@deepseek-ai/dsh-cua-mcp 0.0.0-stage → 0.2.3-alpha.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 DeepSeek
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.
@@ -0,0 +1,58 @@
1
+ # Bilingual-pair consistency record for README.md (docs/i18n/README.md): per heading
2
+ # section, a hash of its English and Chinese blocks outside code blocks and generated regions.
3
+ # After editing either side, bring the other along and re-record with:
4
+ # pnpm run verify-translation-pairing --write packages/experimental/cua-mcp/README.md
5
+ /:
6
+ en: 837f60ce18bd6470
7
+ zh: cb329560601b38a4
8
+ /deepseek-ai-dsh-cua-mcp:
9
+ en: c0bca87ff2983e2e
10
+ zh: da83dd66b8feafab
11
+ /deepseek-ai-dsh-cua-mcp/summary:
12
+ en: bc050868d6516402
13
+ zh: b87be90c2ad7fe19
14
+ /deepseek-ai-dsh-cua-mcp/table-of-contents:
15
+ en: dcb583a860af8206
16
+ zh: 0a0d02b6e7e4e0b6
17
+ /deepseek-ai-dsh-cua-mcp/use-this-package:
18
+ en: bbff250eba0f1b89
19
+ zh: 0a618f05cc88ee2b
20
+ /deepseek-ai-dsh-cua-mcp/use-this-package/start-the-server:
21
+ en: ce44d68f2ede2c0f
22
+ zh: 1d7bbd8a9aabc7f5
23
+ /deepseek-ai-dsh-cua-mcp/use-this-package/connect-a-client:
24
+ en: 67ead744db140e08
25
+ zh: eac0c52840b65922
26
+ /deepseek-ai-dsh-cua-mcp/use-this-package/what-you-get:
27
+ en: 44044e39f455e46f
28
+ zh: 657393ce56a7a3b5
29
+ /deepseek-ai-dsh-cua-mcp/configuration:
30
+ en: 3fc42ffbb107d5ac
31
+ zh: 1fda41e53d3b4c9f
32
+ /deepseek-ai-dsh-cua-mcp/understand-the-implementation:
33
+ en: 7e685c1041391819
34
+ zh: 5a80112fd5f3d82f
35
+ /deepseek-ai-dsh-cua-mcp/further-exploration:
36
+ en: 5b8bd3e71ebbb316
37
+ zh: f1c8b9ae63ce3aac
38
+ /deepseek-ai-dsh-cua-mcp/model-experience:
39
+ en: 215e7ba838619b7b
40
+ zh: a311da3843709f90
41
+ /deepseek-ai-dsh-cua-mcp/model-experience/external-harness-model:
42
+ en: 75ba5b40dac5fdbc
43
+ zh: 690d784248b15542
44
+ /deepseek-ai-dsh-cua-mcp/model-experience/external-harness-model/what-the-model-sees:
45
+ en: b4b85192e7287a64
46
+ zh: 82457adbaa7c2454
47
+ /deepseek-ai-dsh-cua-mcp/model-experience/external-harness-model/token-effect:
48
+ en: a1e565f3662c01d9
49
+ zh: 26467072decb772b
50
+ /deepseek-ai-dsh-cua-mcp/model-experience/external-harness-model/kv-cache-effect:
51
+ en: 0b0c63281111993b
52
+ zh: 45716a56b5a5ad12
53
+ /deepseek-ai-dsh-cua-mcp/known-limitations-and-deferred-work:
54
+ en: b1ce029c37a771af
55
+ zh: 42390a45e6c440e4
56
+ /deepseek-ai-dsh-cua-mcp/known-limitations-and-deferred-work/dev-note:
57
+ en: e67f633dc6fe7773
58
+ zh: 8ec3e73528ddb1a6
package/README.md CHANGED
@@ -1,3 +1,190 @@
1
- # Temporary Holding Version
1
+ ---
2
+ description: "Serve Computer Use to Codex, Claude Code, and other MCP clients from the cua-mcp profile over stdio."
3
+ kind: "package-bundle"
4
+ ---
2
5
 
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.
6
+ # @deepseek-ai/dsh-cua-mcp
7
+
8
+ English | [中文](README.zh.md)
9
+
10
+ ## Summary
11
+
12
+ This experimental bundle composes the standalone `cua-mcp` profile, an MCP stdio server for Computer Use. Every DSH installation ships it; a profile manifest that selects this bundle alone lets `dsh --profile cua-mcp` serve `cua_get_api_reference`, `cua_run_code`, and `cua_reset` to one MCP client. The profile is this bundle alone: no model adapter, prompt-side tool, or telemetry row loads. One connection owns one Agent whose programs keep application and window objects in memory between calls. Consent for application and pointer access is granted without a human or forwarded to the client as an elicitation; the connected harness owns the model.
13
+
14
+ ## Table of Contents
15
+
16
+ - [Use this package](#use-this-package)
17
+ - [Configuration](#configuration)
18
+ - [Understand the implementation](#understand-the-implementation)
19
+ - [Further Exploration](#further-exploration)
20
+ - [Model Experience](#model-experience)
21
+ - [Known Limitations and Deferred Work](#known-limitations-and-deferred-work)
22
+ - [Dev Note](#dev-note)
23
+
24
+ -----
25
+
26
+ <a id="use-this-package"></a>
27
+ ## Use this package
28
+
29
+ ### Start the server
30
+
31
+ The bundle is a runtime dependency of the `dsh` installation, so a profile that selects it as its only layer loads it from the installation; no pnpm, registry, or network access is involved. Create the profile once under the Harness home (`$DSH_HOME`, by default `~/.dsh`); `dsh --profile cua-mcp` is then the stdio command, and a source checkout runs it through `pnpm dsh` after `pnpm run build`. Do not add the bundle to a profile that already composes `dsh-base`, such as the one `dsh plugin --profile cua-mcp add` creates: both compositions declare the same row ids, which is also why the Web plugin page hides this bundle while the Host inventory still reports it as optional.
32
+
33
+ ```sh
34
+ mkdir -p "${DSH_HOME:-$HOME/.dsh}/profiles/cua-mcp"
35
+ printf '%s\n' '{ "name": "dsh-profile-cua-mcp", "private": true, "dependencies": {}, "dsh": { "profile": { "bundles": ["@deepseek-ai/dsh-cua-mcp"] } } }' > "${DSH_HOME:-$HOME/.dsh}/profiles/cua-mcp/package.json"
36
+ ```
37
+
38
+ The Python runtime wheel ships the same installation: write the same manifest under the home the harness passes as `DSH_HOME`, then use its executable as the stdio command:
39
+
40
+ ```python
41
+ from deepseek_harness_runtime import resolve_bundled_launch_args
42
+
43
+ command = [*resolve_bundled_launch_args(), "--profile", "cua-mcp"] # the MCP stdio command
44
+ ```
45
+
46
+ ### Connect a client
47
+
48
+ `dsh --profile cua-mcp` is the stdio command, and `--help` prints its own help. A client entry names the installation's `dsh` executable by absolute path, passes `--profile cua-mcp`, sets `DSH_HOME` when the server should use a Harness home other than the default, `DSH_CUA_CONSENT` for the consent mode, and `DSH_CUA_WORKSPACE` when programs should work in a directory other than the default workspace; from a source checkout the command is `node` with `<checkout>/apps/cli/lib/bin.js` as its first argument, after `pnpm run build`. For Codex, add to `~/.codex/config.toml`:
49
+
50
+ ```toml
51
+ [mcp_servers.dsh_cua]
52
+ command = "/absolute/path/to/dsh"
53
+ args = ["--profile", "cua-mcp"]
54
+ env = { DSH_HOME = "/absolute/path/to/dsh-home", DSH_CUA_CONSENT = "elicit" }
55
+ required = true
56
+ startup_timeout_sec = 120
57
+ tool_timeout_sec = 600
58
+ enabled_tools = ["cua_get_api_reference", "cua_run_code", "cua_reset"]
59
+ omit_tools_from = ["code_mode", "deferred"]
60
+
61
+ [mcp_servers.dsh_cua.tools.cua_run_code]
62
+ output_token_limit = 25000
63
+ ```
64
+
65
+ `required = true` makes Codex wait for the server before its first model request and end the session when the server does not start; without it Codex waits `mcp_optional_startup_grace_ms`, one second by default, and the first request can go out without the three tools. `startup_timeout_sec = 120` bounds that wait and covers first-run helper preparation, `tool_timeout_sec = 600` matches the default program maximum, `enabled_tools` with `omit_tools_from` exposes the three tools directly instead of through tool search, and `output_token_limit` raises the `cua_run_code` output budget to 25,000 tokens.
66
+
67
+ `codex exec` runs with the approval policy `never`, under which Codex refuses `cua_run_code`, the one tool this server annotates as destructive and open-world, with `MCP tool call requires approval, but approval policy is never` (observed on codex-cli 0.153.2). An unattended run therefore adds `approval_mode = "approve"` to the `cua_run_code` table and sets `DSH_CUA_CONSENT = "allow"`.
68
+
69
+ For Claude Code, register the same entry with a ten-minute tool timeout:
70
+
71
+ ```sh
72
+ claude mcp add-json dsh_cua '{"type":"stdio","command":"/absolute/path/to/dsh","args":["--profile","cua-mcp"],"env":{"DSH_HOME":"/absolute/path/to/dsh-home","DSH_CUA_CONSENT":"elicit"},"timeout":600000,"alwaysLoad":true}'
73
+ ```
74
+
75
+ Other clients take the same `command`, `args`, and `env` under `mcpServers`. The Claude Code, `dsh-mcp-client`, and Codex entries were exercised against a real macOS desktop, Codex through `codex exec` on codex-cli 0.153.2 and 0.166.0-alpha.5.1 with `DSH_CUA_CONSENT=allow`; no client has driven a Windows desktop through this profile. Codex's interactive approval prompts and its elicitation forwarding were not exercised here; per the Codex configuration reference as of 2026-11-11, Codex forwards elicitations only with `approval_policy.granular.mcp_elicitations = true`. DSH's own `dsh-mcp-client` declares no elicitation capability, and Claude Code 2.1 print mode declines elicitations, so unattended runs through those clients need `DSH_CUA_CONSENT=allow`.
76
+
77
+ A client that allows tools by name must allow all three: without `cua_get_api_reference` its model has no `cua` API reference. Give the server a Harness home that no profile with uncompressed Session logs shares: this profile writes zstd-compressed logs under `sessions`, and a profile that sets `compression: none`, such as `sdk-minimal`, fails Session queries on a directory that holds them.
78
+
79
+ On macOS the profile prepares the signed Computer Use helper on first start and needs Accessibility and Screen Recording permissions for it; the [macOS provider](../cua-macos/README.md) owns that setup. This profile has no permission page, so grant both in System Settings → Privacy & Security by adding the helper application: a source checkout prepares `DSH Computer Use Dev.app` under the macOS provider package's `native/.build/prepared/<arch>/<build>/` directory, where `current.json` names the selected build; an installed package ships `DSH Computer Use.app`. Until both are granted, `await cua.getCapabilities()` reports the missing flags and application operations fail; a locked desktop fails them with `SESSION_LOCKED`.
80
+
81
+ On native Windows the profile mounts the [Windows provider](../cua-windows/README.md), which owns helper setup: a source checkout builds the helper with the .NET 10 SDK on PATH, and an npm installation ships none. For such an installation, name the helper with `helperPath` on the `cua-mcp-provider-windows` row in the profile's `cordis.patch.yml`: the absolute path of `dsh-cua-windows.exe`, from the extracted standalone ZIP on x64 or a matching build on ARM64. A patch replaces the row's whole config, so restate the bundle's fields:
82
+
83
+ ```yaml
84
+ - id: cua-mcp-provider-windows
85
+ config:
86
+ agentPreset: ptc
87
+ screenshotTarget:
88
+ longEdge: 2048
89
+ maxBytes: 2097152
90
+ helperPath: 'C:\absolute\path\to\dsh-cua-windows.exe'
91
+ ```
92
+
93
+ That provider does not launch applications and offers no `Always allow` grant: open the application before a program selects it, and under `elicit` every connection asks for consent again. The profile does not mount it under WSL.
94
+
95
+ On other Hosts the profile starts without a provider: the listing carries `cua_get_api_reference` and `cua_reset`, each of which returns an error naming the missing provider, and a `cua_run_code` call fails as `unknown tool`. A provider row that fails to activate, such as the Windows row without a helper, leaves the same listing, and the launcher names the failure on stderr.
96
+
97
+ ### What you get
98
+
99
+ `cua_get_api_reference` returns the `cua` API reference: the guidance the provider registers for the connection's Agent, with every method signature and operating rule, which a DSH model receives in its system prompt. It takes no arguments, runs no program, and touches neither the desktop nor the program environment, so it also answers while a program is running. The server instructions ask the model to call it at the start of every conversation, and its description asks for another call when the reference has left the model's context or a program fails on an unknown `cua` method.
100
+
101
+ `cua_run_code` is the Agent's DSH registration served as an MCP tool: every `tools/list` reads its name, description, and parameter schema from the tool registry, so the provider's definition is the only source, `description` is required as that definition declares, and `timeoutMs` bounds one program. The projection omits the registration's sandbox-escalation fields, `sandbox_permissions` and `justification`, and a call naming them is refused before execution; every other argument passes to the DSH tool executor unchanged, which validates them and answers unknown names, so an invalid call returns DSH's error result. The program runs as TypeScript REPL statements against the global `cua` object in the provider's retained Node environment. The result carries what the program passes to `inspect(...)`: text as text blocks and each inspected screenshot as an inline image in the exact version the program observed, so pixel coordinates in the text match the image; a program that inspects nothing returns a completion notice. The tool description carries the execution rules. Programs start in the workspace and run one at a time per connection in arrival order; a cancelled call cancels its program. A failed call returns DSH's failure message with `isError` set and without DSH's `Error:` prefix.
102
+
103
+ `cua_reset` discards the program environment and nothing else. The program process ends, so its variables, imports, and application and window objects are gone; a `cua_run_code` program that is still running is cancelled, and the reset answers after that program has. The connection's Agent stays with its native connection and its consent decisions: an application granted for the session is not asked again, a refused one stays refused, and saved grants and the helper's system permissions are untouched. The next program starts a fresh process with a new `cua` object and selects applications again with `cua.getApp`; a program that arrives during a reset runs after it. A reset whose process cleanup fails returns an error, and programs fail until a later `cua_reset` succeeds. Use it after an unusable environment, or to keep retained state out of the next task.
104
+
105
+ The connection's Agent is created in the workspace before the stdio transport opens, so the first listing already carries its registration, and disposed when the client closes stdin, which also exits the process. The workspace is `DSH_CUA_WORKSPACE`, or `cua-mcp/workspace` under the Harness home when the variable is unset; the profile creates it, programs start there, and it is the directory the default `workspace-write` sandbox lets them write, whatever directory the client launched the server from. Application consent follows the [CUA consent rules](../cua/README.md) for that Agent: `DSH_CUA_CONSENT=allow` grants each request for the session without a human, and the default `elicit` forwards the request to the client as a form elicitation whose answers are the CUA labels; a declined form records a denial for the session, and a client without elicitation receives an error that names the `allow` mode.
106
+
107
+ -----
108
+
109
+ <a id="configuration"></a>
110
+ ## Configuration
111
+
112
+ Configure the `cua-mcp` row in the profile's `cordis.patch.yml`; the bundle patch maps `DSH_CUA_CONSENT` and `DSH_CUA_WORKSPACE` onto it.
113
+
114
+ | Field | Default | Meaning |
115
+ |---|---|---|
116
+ | `consent` | `elicit` | `allow` grants application and pointer consent for this session without a human; `elicit` forwards each request to the MCP client. |
117
+ | `workspace` | `cua-mcp/workspace` under the Harness home | Absolute directory the connection's Agent works in. Programs start there and it is their `workspace-write` root. Startup creates it when missing; a relative path or a directory that cannot be created is reported on stderr and ends the process with exit code 1. |
118
+
119
+ The patch also mounts the Host's native provider, row `cua-mcp-provider` on macOS and row `cua-mcp-provider-windows` on native Windows, with `screenshotTarget: { longEdge: 2048, maxBytes: 2097152 }` because no model route selects a request image here, and `agentPreset: ptc` with an empty `cua-mcp` preset so the connection's Agent receives `cua_run_code` and no other model-facing rows. Override those rows by id in the profile patch; an override replaces the row's whole config, so restate the fields it keeps. The `sandbox-policy` row's `workspaceRoot` resolves the same directory as `workspace`; a program's root is its Agent's working directory, so that field covers only calls without a Session.
120
+
121
+ -----
122
+
123
+ <a id="understand-the-implementation"></a>
124
+ ## Understand the implementation
125
+
126
+ <details>
127
+ <summary>Implementation internals — click to expand</summary>
128
+
129
+ The [patch](cordis.patch.yml) composes the whole profile over the empty root: sessions with JSONL persistence and projections, attachments, storage for application grants, the subprocess, sandbox, approval, and filesystem seams program processes run under, tools with the native executor, the system prompt, user questions, the llm hub without an adapter, the Agent registry with the agent-loop factory, the preset registry with the empty default preset, the `computer-use` registry, one native provider row per Host, macOS on Darwin and Windows on native Windows, and this frontend. A profile manifest that lists this bundle alone selects the composition; the launcher loads it from the installation without a template. The frontend parses the invocation with `parseCmdline`, binds stdin EOF to the launcher's bounded shutdown, and after the launcher commits readiness creates the workspace and connects the official MCP server to a stdio transport. `cua-mcp` is not a required startup entry: the launcher reports an inactive row on stderr instead of stopping the profile.
130
+
131
+ [`server.ts`](src/server.ts) serves the three tools through the protocol server's low-level `tools/list` and `tools/call` handlers: the listing projects the Agent's `cua_run_code` registration, checked against the protocol's tool type, between the two tools that file defines. The connection's Agent mounts the registry's default preset and records the workspace as its working directory, which the sandbox policy resolves as the `workspace-write` root of its programs. `cua_get_api_reference` reads the provider's prompt section for that Agent through `ctx.systemPrompt.assemble` and keeps no state. A `cua_run_code` call runs through `ctx.tools.execute` inside `ctx.agents.withInitiator` with the Agent and the request signal and no model step, so the Session log carries nested `tool/ptc-dispatch` events but no root `tool/call`; [`projection.ts`](src/projection.ts) renders the result and its deferred screenshot contexts, reading each image through `ctx.cuaPrograms.screenshotRequestTarget`. `cua_reset` cancels the Agent's running program with `agent.cancel`, calls `ctx.cuaPrograms.release`, with which the provider's program runtime releases the environment of that state owner, and answers once the Agent is idle; one release runs at a time, and program calls wait for it because the runtime rejects a program while the previous process is exiting. [`consent.ts`](src/consent.ts) is the `user-questions/request` answerer for that Agent. A `cua_run_code` call runs as the Agent's maintenance activity, so an Agent disposed while a call is in flight cancels the call and waits for it and its nested calls to settle before it releases its native connection and closes its Session.
132
+
133
+ </details>
134
+
135
+ -----
136
+
137
+ <a id="further-exploration"></a>
138
+ ## Further Exploration
139
+
140
+ - [Shared CUA package](../cua/README.md) — the object API, consent rules, and `cua_run_code`.
141
+ - [macOS provider](../cua-macos/README.md) — helper preparation, permissions, and platform guidance.
142
+ - [Windows provider](../cua-windows/README.md) — helper setup, interaction rules, and platform limits.
143
+ - [Computer use](../../../docs/subsystems/computer-use.md) and [MCP](../../../docs/subsystems/mcp.md) — subsystem references.
144
+ - [Profile composition](../../boot/app-boot/README.md) — bundle layers and patch lifetimes.
145
+ - [Decision record](../../../.agents/notes/implemented/architecture/2026-11-09-computer-use-mcp-server.md) — why the server runs inside a profile and owns one Agent per connection.
146
+
147
+ -----
148
+
149
+ <a id="model-experience"></a>
150
+ ## Model Experience
151
+
152
+ ### External harness model
153
+
154
+ #### What the model sees
155
+
156
+ The connected harness's model sees `cua_get_api_reference`, the Agent's `cua_run_code` definition, `cua_reset`, and the server instructions from `tools/list` and `initialize`. The `cua` API reference the provider registered enters its context as the result of a `cua_get_api_reference` call, which the instructions request at the start of every conversation; `cua_run_code` results carry only program output and inspected screenshots. No DSH model request exists in this profile.
157
+
158
+ #### Token effect
159
+
160
+ The tool description carries the registration's execution rules, about 3,200 characters; a `cua_get_api_reference` result is the API reference, about 13,000 characters with the current macOS provider, about 3,300 tokens by the repository's four-character estimate, spent once per call. Screenshots are inline images at the provider's `screenshotTarget` size. Clients cap tool output; the documented Codex configuration raises the `cua_run_code` budget to 25,000 tokens. Clients also cap tool descriptions and server instructions: Claude Code 2.1.309 forwards the first 4,096 characters of either and appends `… [truncated]`; DSH's `dsh-mcp-client` forwards a 20,000-character description intact. The registration's description and the instructions, about 600 characters, fit that budget; the reference does not and travels as a tool result.
161
+
162
+ #### KV Cache effect
163
+
164
+ The tool catalog and instructions are stable for one installation. The reference text changes only with the installed CUA packages and enters a conversation as an ordinary tool result.
165
+
166
+ ## Known Limitations and Deferred Work
167
+
168
+ <a id="known-limitations-and-deferred-work"></a>
169
+
170
+ - Successful programs retain held keys and mouse buttons across calls and report them in a system reminder. Program failure, a received cancellation of an active cua_run_code request, reset and connection closure release owned input. If a call sends down and returns, and the client pauses while its model is thinking, this server receives no cancellation: that input can remain pressed until explicit up or later cleanup.
171
+ - macOS and native Windows Hosts have a provider. Other Hosts, WSL included, list `cua_get_api_reference` and `cua_reset`, which both name the missing provider; a `cua_run_code` call fails as `unknown tool`.
172
+ - On Windows the [provider's limits](../cua-windows/README.md#known-limitations-and-deferred-work) apply through MCP: it does not launch applications, grants no `Always allow`, and an npm installation needs `helperPath`.
173
+ - Elicitation uses the 2025 MCP request model; a client that negotiates the 2026-07-28 revision receives an error for consent requests and should use `DSH_CUA_CONSENT=allow`.
174
+ - Program sandbox escalation and the raw `cua` tool are not exposed; `DSH_PERMISSION_MODE` selects the launch-time file sandbox of program processes, and the workspace is its `workspace-write` root.
175
+ - The `cua` API reference reaches a model only when it calls `cua_get_api_reference`. The server cannot observe a new conversation on an existing connection or a compacted context, so the instructions and the tool description carry that request; a client that withholds the tool leaves its model with the execution rules alone.
176
+ - The server does not bound result text. A program that inspects a large value returns all of it, up to the program runtime's 64 MiB output limit, and only the client's own output limit protects its context.
177
+ - The registration's description still carries the PTC sandbox-escalation guidance ("A sandbox escalation approves this complete program …"); a program that follows it is refused before execution and told that `DSH_PERMISSION_MODE` selects the sandbox.
178
+ - A provider description longer than 4,096 characters reaches Claude Code 2.1.309 models cut; the projection does not shorten it.
179
+ - Root tool calls are not Session events; the connected harness's transcript is the record of calls and results.
180
+ - The patch lists the profile's dependency closure explicitly; a new service injection in the CUA or PTC packages leaves the provider row inactive, reported on stderr, and `cua_run_code` out of the listing until the patch adds the row.
181
+
182
+ <a id="dev-note"></a>
183
+ ### Dev Note
184
+
185
+ <details>
186
+ <summary>Working context for maintainers — click to expand</summary>
187
+
188
+ None.
189
+
190
+ </details>
package/README.zh.md ADDED
@@ -0,0 +1,190 @@
1
+ ---
2
+ description: "通过 cua-mcp profile 以 stdio 向 Codex、Claude Code 等 MCP 客户端提供 Computer Use。"
3
+ kind: "package-bundle"
4
+ ---
5
+
6
+ # @deepseek-ai/dsh-cua-mcp
7
+
8
+ [English](README.md) | 中文
9
+
10
+ ## 概述
11
+
12
+ 这个实验性组合包独立组成 `cua-mcp` profile,即 Computer Use 的 MCP stdio 服务器。每个 DSH 安装都自带它;只选本组合包的 profile manifest 就能让 `dsh --profile cua-mcp` 向一个 MCP 客户端提供 `cua_get_api_reference`、`cua_run_code` 与 `cua_reset`。该 profile 只由本组合包构成:不加载任何模型适配器、提示侧工具或遥测行。一个连接拥有一个 Agent,其程序在多次调用之间于内存中保留应用与窗口对象。应用与指针访问的授权可无人值守放行,或作为 elicitation 转发给客户端;模型归接入的 harness 所有。
13
+
14
+ ## 目录
15
+
16
+ - [使用本包](#use-this-package)
17
+ - [配置](#configuration)
18
+ - [理解实现](#understand-the-implementation)
19
+ - [进一步探索](#further-exploration)
20
+ - [模型体验](#model-experience)
21
+ - [已知限制与延后工作](#known-limitations-and-deferred-work)
22
+ - [开发备注](#dev-note)
23
+
24
+ -----
25
+
26
+ <a id="use-this-package"></a>
27
+ ## 使用本包
28
+
29
+ ### 启动服务器
30
+
31
+ 组合包是 `dsh` 安装的运行时依赖,因此只选它这一层的 profile 直接从安装中加载它;不涉及 pnpm、registry 或网络。在 Harness home(`$DSH_HOME`,默认 `~/.dsh`)下创建一次 profile,之后 `dsh --profile cua-mcp` 就是 stdio 命令,源码检出在 `pnpm run build` 之后通过 `pnpm dsh` 运行它。不要把组合包加进已经组合了 `dsh-base` 的 profile(例如 `dsh plugin --profile cua-mcp add` 创建的那种):两套组合声明同样的行 id,Web 插件页也因此隐藏本组合包,而 Host 清单仍把它报告为可选组合包。
32
+
33
+ ```sh
34
+ mkdir -p "${DSH_HOME:-$HOME/.dsh}/profiles/cua-mcp"
35
+ printf '%s\n' '{ "name": "dsh-profile-cua-mcp", "private": true, "dependencies": {}, "dsh": { "profile": { "bundles": ["@deepseek-ai/dsh-cua-mcp"] } } }' > "${DSH_HOME:-$HOME/.dsh}/profiles/cua-mcp/package.json"
36
+ ```
37
+
38
+ Python runtime wheel 自带同一份安装:在 harness 以 `DSH_HOME` 传入的 home 下写入同样的 manifest,然后把它的可执行程序用作 stdio 命令:
39
+
40
+ ```python
41
+ from deepseek_harness_runtime import resolve_bundled_launch_args
42
+
43
+ command = [*resolve_bundled_launch_args(), "--profile", "cua-mcp"] # the MCP stdio command
44
+ ```
45
+
46
+ ### 接入客户端
47
+
48
+ `dsh --profile cua-mcp` 就是 stdio 命令,`--help` 打印它自己的帮助。客户端配置项以绝对路径指向安装的 `dsh` 可执行程序,传入 `--profile cua-mcp`,在服务器应使用非默认 Harness home 时设置 `DSH_HOME`,用 `DSH_CUA_CONSENT` 设置授权模式,并在程序应工作于默认工作区之外的目录时设置 `DSH_CUA_WORKSPACE`;源码检出在 `pnpm run build` 之后以 `node` 为命令、`<checkout>/apps/cli/lib/bin.js` 为首个参数。Codex 在 `~/.codex/config.toml` 中加入:
49
+
50
+ ```toml
51
+ [mcp_servers.dsh_cua]
52
+ command = "/absolute/path/to/dsh"
53
+ args = ["--profile", "cua-mcp"]
54
+ env = { DSH_HOME = "/absolute/path/to/dsh-home", DSH_CUA_CONSENT = "elicit" }
55
+ required = true
56
+ startup_timeout_sec = 120
57
+ tool_timeout_sec = 600
58
+ enabled_tools = ["cua_get_api_reference", "cua_run_code", "cua_reset"]
59
+ omit_tools_from = ["code_mode", "deferred"]
60
+
61
+ [mcp_servers.dsh_cua.tools.cua_run_code]
62
+ output_token_limit = 25000
63
+ ```
64
+
65
+ `required = true` 让 Codex 在首个模型请求之前等待服务器就绪,并在服务器无法启动时结束会话;不设置时 Codex 只等待 `mcp_optional_startup_grace_ms`(默认一秒),首个请求可能不带这三个工具。`startup_timeout_sec = 120` 限定这段等待并留给首次 helper 准备,`tool_timeout_sec = 600` 对齐默认程序上限,`enabled_tools` 配合 `omit_tools_from` 让三个工具直接暴露而不进入工具搜索,`output_token_limit` 把 `cua_run_code` 的输出预算提高到 25,000 token。
66
+
67
+ `codex exec` 以审批策略 `never` 运行,此时 Codex 会拒绝 `cua_run_code`(本服务器唯一标注为 destructive 与 open-world 的工具),错误为 `MCP tool call requires approval, but approval policy is never`(在 codex-cli 0.153.2 上观察到)。因此无人值守运行要在 `cua_run_code` 表中加入 `approval_mode = "approve"`,并设置 `DSH_CUA_CONSENT = "allow"`。
68
+
69
+ Claude Code 以十分钟工具超时注册同一配置项:
70
+
71
+ ```sh
72
+ claude mcp add-json dsh_cua '{"type":"stdio","command":"/absolute/path/to/dsh","args":["--profile","cua-mcp"],"env":{"DSH_HOME":"/absolute/path/to/dsh-home","DSH_CUA_CONSENT":"elicit"},"timeout":600000,"alwaysLoad":true}'
73
+ ```
74
+
75
+ 其他客户端在 `mcpServers` 下使用同样的 `command`、`args` 与 `env`。Claude Code、`dsh-mcp-client` 与 Codex 三条配置都经真实 macOS 桌面验证,其中 Codex 是在 codex-cli 0.153.2 与 0.166.0-alpha.5.1 上通过 `codex exec` 并以 `DSH_CUA_CONSENT=allow` 验证的;没有客户端经本 profile 操作过 Windows 桌面。Codex 的交互式审批提示及其 elicitation 转发未在此实测;按 Codex 配置参考,截至 2026-11-11,Codex 只有在 `approval_policy.granular.mcp_elicitations = true` 时才转发 elicitation。DSH 自己的 `dsh-mcp-client` 未声明 elicitation 能力,Claude Code 2.1 的 print 模式会拒绝 elicitation,因此经这两类客户端的无人值守运行需要 `DSH_CUA_CONSENT=allow`。
76
+
77
+ 按名称放行工具的客户端必须放行全部三个:缺少 `cua_get_api_reference` 时,它的模型拿不到 `cua` API 参考。服务器使用的 Harness home 不要与采用未压缩 Session 日志的 profile 共用:本 profile 在 `sessions` 下写入 zstd 压缩的日志,设置了 `compression: none` 的 profile(例如 `sdk-minimal`)在含有这些日志的目录上查询 Session 会失败。
78
+
79
+ 在 macOS 上,profile 首次启动时准备已签名的 Computer Use helper,并需要为其授予辅助功能与屏幕录制权限;[macOS 提供方](../cua-macos/README.zh.md)负责这部分设置。本 profile 没有权限页面,因此要在「系统设置 → 隐私与安全性」中添加 helper 应用来授予这两项权限:源码检出在 macOS 提供方包的 `native/.build/prepared/<arch>/<build>/` 目录下准备 `DSH Computer Use Dev.app`,其中 `current.json` 记录当前选中的构建;已安装的包附带 `DSH Computer Use.app`。两项权限都授予之前,`await cua.getCapabilities()` 会报告缺失的标志,应用操作会失败;桌面处于锁定状态时这些操作以 `SESSION_LOCKED` 失败。
80
+
81
+ 在原生 Windows 上,profile 挂载 [Windows 提供方](../cua-windows/README.zh.md),helper 的准备由它负责:源码检出用 PATH 上的 .NET 10 SDK 构建 helper;npm 安装不附带 helper。此时要在 profile 的 `cordis.patch.yml` 中用 `cua-mcp-provider-windows` 行的 `helperPath` 指明 helper:即 `dsh-cua-windows.exe` 的绝对路径,x64 取自解压后的独立 ZIP,ARM64 取自对应架构的构建。patch 会替换该行的整个 config,因此要重述组合包的字段:
82
+
83
+ ```yaml
84
+ - id: cua-mcp-provider-windows
85
+ config:
86
+ agentPreset: ptc
87
+ screenshotTarget:
88
+ longEdge: 2048
89
+ maxBytes: 2097152
90
+ helperPath: 'C:\absolute\path\to\dsh-cua-windows.exe'
91
+ ```
92
+
93
+ 该提供方不启动应用,也不提供 `Always allow` 授权:程序选中应用之前要先打开它,在 `elicit` 模式下每个连接都会重新询问授权。profile 不在 WSL 下挂载它。
94
+
95
+ 在其他 Host 上 profile 没有提供方也能启动:列表有 `cua_get_api_reference` 与 `cua_reset`,二者都返回指出缺少提供方的错误,调用 `cua_run_code` 以 `unknown tool` 失败。提供方行无法激活时(例如 Windows 行缺少 helper)列表相同,启动器会在 stderr 上指出失败原因。
96
+
97
+ ### 你会得到什么
98
+
99
+ `cua_get_api_reference` 返回 `cua` API 参考:提供方为连接的 Agent 注册的指引,包含每个方法的签名与操作规则,也就是 DSH 模型在系统提示中收到的那段文本。它不带参数,不运行程序,也不触碰桌面和程序环境,因此程序运行期间同样可以应答。服务器说明要求模型在每次对话开始时调用它;它的描述要求在参考已不在模型上下文中、或程序因未知的 `cua` 方法失败时再调用一次。
100
+
101
+ `cua_run_code` 就是该 Agent 的 DSH 注册项以 MCP 工具的形式提供:每次 `tools/list` 都从工具注册表读取它的名称、描述和参数 schema,因此提供方的定义是唯一来源,`description` 按该定义必填,`timeoutMs` 限制单个程序。投影省略注册项中的沙箱提权字段 `sandbox_permissions` 与 `justification`,指定它们的调用在执行前被拒绝;其余参数原样交给 DSH 工具执行器,由它校验参数并回答未知名称,因此非法调用返回 DSH 的错误结果。程序作为 TypeScript REPL 语句在提供方保留的 Node 环境中对全局 `cua` 对象运行。结果携带程序传给 `inspect(...)` 的内容:文本成为文本块,每张被 inspect 的截图成为内联图片,且图片正是程序观察到的那一版,因此文本中的像素坐标与图片一致;没有 inspect 任何值的程序返回一条完成提示。执行规则在工具描述里。程序在工作区中启动,同一连接的程序按到达顺序逐个运行;取消调用会取消其程序。失败的调用返回 DSH 的失败信息并设置 `isError`,不带 DSH 的 `Error:` 前缀。
102
+
103
+ `cua_reset` 只丢弃程序环境。程序进程结束,因此其中的变量、导入以及应用和窗口对象都不复存在;仍在运行的 `cua_run_code` 程序被取消,reset 在该程序返回之后才返回。连接的 Agent 连同其本机连接和授权决定都保留:本会话已放行的应用不会再次询问,已拒绝的应用保持拒绝,已保存的授权和 helper 的系统权限不受影响。下一个程序在新进程中启动,拥有新的 `cua` 对象,并通过 `cua.getApp` 重新选择应用;reset 期间到达的程序在它之后运行。进程清理失败的 reset 返回错误,此后程序会失败,直到后续的 `cua_reset` 成功。在环境不可用之后,或不希望保留的状态带入下一个任务时使用它。
104
+
105
+ 连接的 Agent 在 stdio 传输打开之前创建于工作区中,因此首次列表就带有它的注册项;客户端关闭 stdin 时销毁,进程随之退出。工作区是 `DSH_CUA_WORKSPACE`,变量未设置时为 Harness home 下的 `cua-mcp/workspace`;profile 会创建它,程序在其中启动,默认的 `workspace-write` 沙箱允许程序写入的也是这个目录,与客户端从哪个目录启动服务器无关。应用授权按该 Agent 遵循 [CUA 授权规则](../cua/README.zh.md):`DSH_CUA_CONSENT=allow` 在无人值守下为本会话放行每个请求;默认的 `elicit` 把请求作为表单 elicitation 转发给客户端,答案即 CUA 的选项标签;被拒绝的表单为本会话记录一次拒绝,不支持 elicitation 的客户端会收到指明 `allow` 模式的错误。
106
+
107
+ -----
108
+
109
+ <a id="configuration"></a>
110
+ ## 配置
111
+
112
+ 在 profile 的 `cordis.patch.yml` 中配置 `cua-mcp` 行;组合包 patch 把 `DSH_CUA_CONSENT` 与 `DSH_CUA_WORKSPACE` 映射到它。
113
+
114
+ | 字段 | 默认值 | 含义 |
115
+ |---|---|---|
116
+ | `consent` | `elicit` | `allow` 在无人值守下为本会话放行应用与指针授权;`elicit` 把每个请求转发给 MCP 客户端。 |
117
+ | `workspace` | Harness home 下的 `cua-mcp/workspace` | 连接的 Agent 工作所在的绝对目录。程序在其中启动,它也是程序的 `workspace-write` 根。启动时在目录不存在时创建它;路径为相对路径或目录无法创建时,在 stderr 报告并以退出码 1 结束。 |
118
+
119
+ patch 还以 `screenshotTarget: { longEdge: 2048, maxBytes: 2097152 }` 挂载该 Host 的原生提供方(macOS 上是 `cua-mcp-provider` 行,原生 Windows 上是 `cua-mcp-provider-windows` 行),因为这里没有模型路由来选择请求图片;并以 `agentPreset: ptc` 搭配空的 `cua-mcp` preset,使连接的 Agent 只获得 `cua_run_code` 而没有其他面向模型的行。可在 profile patch 中按 id 覆盖这些行;覆盖会替换该行的整个 config,因此要重述需要保留的字段。`sandbox-policy` 行的 `workspaceRoot` 与 `workspace` 解析为同一目录;程序的根是其 Agent 的工作目录,因此该字段只作用于没有 Session 的调用。
120
+
121
+ -----
122
+
123
+ <a id="understand-the-implementation"></a>
124
+ ## 理解实现
125
+
126
+ <details>
127
+ <summary>实现细节 — 点击展开</summary>
128
+
129
+ [patch](cordis.patch.yml) 在空根上组成整个 profile:带 JSONL 持久化与投影的会话、附件、保存应用授权的存储、程序进程所依赖的子进程、沙箱、审批与文件系统 seam、带原生执行器的工具、系统提示、用户提问、不挂适配器的 llm hub、带 agent-loop 工厂的 Agent 注册表、带空默认 preset 的 preset 注册表、`computer-use` 注册表、每种 Host 一行的原生提供方(Darwin 上是 macOS,原生 Windows 上是 Windows),以及本前端。只列出本组合包的 profile manifest 选中这套组合;启动器不经模板直接从安装中加载它。前端用 `parseCmdline` 解析调用,把 stdin EOF 绑定到启动器的有界关闭,并在启动器提交就绪后创建工作区、把官方 MCP 服务器连接到 stdio 传输。`cua-mcp` 不是启动必需条目:行无法激活时启动器在 stderr 上报告,而不是停止 profile。
130
+
131
+ [`server.ts`](src/server.ts) 通过协议服务器的低层 `tools/list` 与 `tools/call` handler 提供三个工具:列表把该 Agent 的 `cua_run_code` 注册项按协议的工具类型校验后投影出来,排在该文件定义的两个工具之间。连接的 Agent 挂载注册表的默认 preset,并把工作区记录为自己的工作目录,沙箱策略据此解析其程序的 `workspace-write` 根。`cua_get_api_reference` 通过 `ctx.systemPrompt.assemble` 读取提供方为该 Agent 注册的提示段,不保存任何状态。`cua_run_code` 调用在 `ctx.agents.withInitiator` 内带着 Agent 和请求 signal、不经模型步骤地通过 `ctx.tools.execute` 运行,因此 Session 日志只有嵌套的 `tool/ptc-dispatch` 事件而没有根 `tool/call`;[`projection.ts`](src/projection.ts) 渲染结果及其延后的截图上下文,并通过 `ctx.cuaPrograms.screenshotRequestTarget` 读取每张图片。`cua_reset` 用 `agent.cancel` 取消该 Agent 正在运行的程序,调用 `ctx.cuaPrograms.release`,由提供方的程序运行时释放该 state owner 的环境,并在 Agent 空闲后返回;同一时刻只进行一次释放,程序调用会等待它,因为前一个进程尚在退出时运行时会拒绝程序。[`consent.ts`](src/consent.ts) 是该 Agent 的 `user-questions/request` 应答者。`cua_run_code` 调用作为该 Agent 的维护活动运行,因此 Agent 在调用进行中被销毁时会取消该调用,等它及其嵌套调用结算之后才释放本机连接并关闭 Session。
132
+
133
+ </details>
134
+
135
+ -----
136
+
137
+ <a id="further-exploration"></a>
138
+ ## 进一步探索
139
+
140
+ - [共享 CUA 包](../cua/README.zh.md) — 对象 API、授权规则与 `cua_run_code`。
141
+ - [macOS 提供方](../cua-macos/README.zh.md) — helper 准备、权限与平台指引。
142
+ - [Windows 提供方](../cua-windows/README.zh.md) — helper 设置、交互规则与平台限制。
143
+ - [计算机操作](../../../docs/subsystems/computer-use.zh.md)与 [MCP](../../../docs/subsystems/mcp.zh.md) — 子系统参考。
144
+ - [profile 组合](../../boot/app-boot/README.zh.md) — 组合包层与 patch 生命周期。
145
+ - [决策记录](../../../.agents/notes/implemented/architecture/2026-11-09-computer-use-mcp-server.zh.md) — 服务器为何运行在 profile 内并为每个连接持有一个 Agent。
146
+
147
+ -----
148
+
149
+ <a id="model-experience"></a>
150
+ ## 模型体验
151
+
152
+ ### 外部 harness 的模型
153
+
154
+ #### 模型看到什么
155
+
156
+ 接入 harness 的模型通过 `tools/list` 和 `initialize` 看到 `cua_get_api_reference`、该 Agent 的 `cua_run_code` 定义、`cua_reset` 与服务器说明。提供方注册的 `cua` API 参考作为 `cua_get_api_reference` 调用的结果进入其上下文,服务器说明要求每次对话开始时调用它;`cua_run_code` 的结果只携带程序输出与被 inspect 的截图。该 profile 中不存在 DSH 模型请求。
157
+
158
+ #### Token 影响
159
+
160
+ 工具描述携带注册项的执行规则,约 3,200 个字符;一次 `cua_get_api_reference` 的结果就是 API 参考,使用当前 macOS 提供方时约 13,000 个字符,按仓库四字符/token 估算约 3,300 token,每次调用支付一次。截图是提供方 `screenshotTarget` 尺寸的内联图片。客户端会限制工具输出;文档给出的 Codex 配置把 `cua_run_code` 的预算提高到 25,000 token。客户端同样限制工具描述和服务器说明:Claude Code 2.1.309 对二者都只转发前 4,096 个字符并追加 `… [truncated]`;DSH 的 `dsh-mcp-client` 原样转发 20,000 个字符的描述。注册项的描述和约 600 个字符的服务器说明都在该预算之内;参考超出预算,因此作为工具结果传递。
161
+
162
+ #### KV Cache 影响
163
+
164
+ 工具目录和说明对同一安装保持稳定。参考文本只随已安装的 CUA 包变化,并作为普通的工具结果进入对话。
165
+
166
+ ## 已知限制与延后工作
167
+
168
+ <a id="known-limitations-and-deferred-work"></a>
169
+
170
+ - 成功结束的程序跨调用保持键盘键和鼠标按钮,并通过 system reminder 报告。程序失败、执行中的 cua_run_code 请求收到取消、重置和断连会释放所属输入。如果一次调用发送 down 后返回,客户端随后在模型思考期间暂停,服务端收不到取消:该输入可能持续按住,直到显式 up 或后续清理。
171
+ - macOS 与原生 Windows Host 有提供方。其他 Host(包括 WSL)列出 `cua_get_api_reference` 与 `cua_reset`,二者都指出缺少提供方;调用 `cua_run_code` 以 `unknown tool` 失败。
172
+ - 在 Windows 上,[提供方的限制](../cua-windows/README.zh.md#known-limitations-and-deferred-work)经 MCP 同样适用:它不启动应用,不提供 `Always allow` 授权,npm 安装需要配置 `helperPath`。
173
+ - Elicitation 使用 2025 版 MCP 请求模型;协商到 2026-07-28 修订版的客户端在授权请求时收到错误,应改用 `DSH_CUA_CONSENT=allow`。
174
+ - 不暴露程序沙箱提权和原始 `cua` 工具;`DSH_PERMISSION_MODE` 选择程序进程启动时的文件沙箱,工作区是它的 `workspace-write` 根。
175
+ - `cua` API 参考只有在模型调用 `cua_get_api_reference` 时才到达模型。服务器观察不到既有连接上的新对话,也观察不到上下文压缩,因此由服务器说明和工具描述提出这一要求;不放行该工具的客户端,其模型只有执行规则可用。
176
+ - 服务器不限制结果文本的大小。程序 inspect 一个很大的值时会原样返回全部内容,上限是程序运行时 64 MiB 的输出限制,只有客户端自己的输出上限能保护其上下文。
177
+ - 注册项的描述仍带有 PTC 的沙箱提权说明("A sandbox escalation approves this complete program …");按它请求提权的程序会在执行前被拒绝,并被告知 `DSH_PERMISSION_MODE` 决定沙箱。
178
+ - 提供方描述超过 4,096 个字符时,Claude Code 2.1.309 的模型只看到被截断的部分;投影不会缩短它。
179
+ - 根工具调用不是 Session 事件;接入 harness 的 transcript 才是调用与结果的记录。
180
+ - patch 显式列出该 profile 的依赖闭包;CUA 或 PTC 包新增服务注入时,提供方行无法激活并在 stderr 上报告,列表里没有 `cua_run_code`,直到 patch 补上该行。
181
+
182
+ <a id="dev-note"></a>
183
+ ### 开发备注
184
+
185
+ <details>
186
+ <summary>维护者工作上下文 — 点击展开</summary>
187
+
188
+ 无。
189
+
190
+ </details>
@@ -0,0 +1,145 @@
1
+ # The Computer Use MCP application: a standalone profile composed from this one
2
+ # insert over the empty profile root. No model turn ever runs here, so the
3
+ # composition carries no model adapter, prompt-side tools, telemetry, or
4
+ # session-management rows; stdout belongs exclusively to MCP JSON-RPC, and one
5
+ # stdio connection owns one Agent whose cua_run_code programs retain state until
6
+ # the client disconnects or calls cua_reset.
7
+ #
8
+ # Row ids match dsh-base where the plugin is the same, so a profile or home
9
+ # cordis.patch.yml written for a base-backed profile addresses them unchanged.
10
+
11
+ - insert:
12
+ # Sessions: the connection Agent's Session log (nested tool/ptc-dispatch events
13
+ # and screenshots) and the projections that approval, sandbox policy, and the
14
+ # Agent registry derive from it.
15
+ - id: session
16
+ name: '@deepseek-ai/dsh-session'
17
+
18
+ - id: session-persistence-jsonl
19
+ name: '@deepseek-ai/dsh-session-persistence-jsonl'
20
+ config:
21
+ root: !!js dshHomePath('sessions')
22
+
23
+ - id: session-projection
24
+ name: '@deepseek-ai/dsh-session-projection'
25
+
26
+ - id: attachment-local
27
+ name: '@deepseek-ai/dsh-attachment-local'
28
+
29
+ - id: working-directory
30
+ name: '@deepseek-ai/dsh-working-directory'
31
+
32
+ # Durable KV storage for the provider's application grants.
33
+ - id: storage
34
+ name: '@deepseek-ai/dsh-storage'
35
+
36
+ - id: storage-json
37
+ name: '@deepseek-ai/dsh-storage-json'
38
+ config:
39
+ root: !!js dshHomePath('storages')
40
+
41
+ - id: storage-domain
42
+ name: '@deepseek-ai/dsh-storage-domain'
43
+ config:
44
+ backend: json
45
+
46
+ # Program processes: the dedicated CUA runtime launches under the same
47
+ # file-effect boundary as every shipped CLI mode. A program's workspace-write
48
+ # root is its Agent's working directory, which the cua-mcp row sets to the
49
+ # workspace below; this row's root covers calls without a Session.
50
+ - id: subprocess
51
+ name: '@deepseek-ai/dsh-subprocess-local'
52
+
53
+ - id: sandbox
54
+ name: '@deepseek-ai/dsh-sandbox-local'
55
+
56
+ - id: sandbox-policy
57
+ name: '@deepseek-ai/dsh-sandbox-policy'
58
+ config:
59
+ mode: !!js process.env.DSH_PERMISSION_MODE ?? 'workspace-write'
60
+ workspaceRoot: !!js process.env.DSH_CUA_WORKSPACE ?? dshHomePath('cua-mcp', 'workspace')
61
+
62
+ - id: approval
63
+ name: '@deepseek-ai/dsh-user-approval'
64
+ config:
65
+ policy: !!js "(process.env.DSH_PERMISSION_MODE ?? 'workspace-write') === 'danger-full-access' ? 'never' : 'ask'"
66
+
67
+ - id: fs-sandbox
68
+ name: '@deepseek-ai/dsh-fs-sandbox'
69
+
70
+ # Tool execution and the Agent that owns the connection.
71
+ - id: tools
72
+ name: '@deepseek-ai/dsh-tools'
73
+
74
+ - id: tool-executor-native
75
+ name: '@deepseek-ai/dsh-tool-executor-native'
76
+
77
+ - id: system-prompt
78
+ name: '@deepseek-ai/dsh-system-prompt'
79
+ config:
80
+ personaPrefix: ''
81
+
82
+ - id: user-questions
83
+ name: '@deepseek-ai/dsh-user-questions'
84
+
85
+ # The Agent registry creates the connection Agent through the agent-loop
86
+ # factory; no model adapter is mounted on the llm hub, so no turn can run.
87
+ - id: llm
88
+ name: '@deepseek-ai/dsh-llm'
89
+
90
+ - id: agent
91
+ name: '@deepseek-ai/dsh-agent'
92
+
93
+ - id: agent-loop
94
+ name: '@deepseek-ai/dsh-agent-loop'
95
+ config:
96
+ agents: []
97
+
98
+ # A composed preset selects cua_run_code for the connection's Agent; the
99
+ # empty preset keeps every model-facing row out of this profile.
100
+ - id: cua-mcp-presets
101
+ name: '@deepseek-ai/dsh-agent-preset-registry'
102
+ config:
103
+ default: cua-mcp
104
+
105
+ - id: cua-mcp-preset
106
+ name: '@deepseek-ai/dsh-agent-preset'
107
+ config:
108
+ id: cua-mcp
109
+ plugins: []
110
+
111
+ - id: cua-mcp-computer-use
112
+ name: '@deepseek-ai/dsh-computer-use'
113
+
114
+ # One native provider per Host: macOS, and native Windows (not WSL). Both
115
+ # are optional dependencies that an installation on another platform can
116
+ # lack, so each row is disabled off its own Host.
117
+ # Screenshots target a fixed request image because no model route exists here.
118
+ - id: cua-mcp-provider
119
+ name: '@deepseek-ai/dsh-cua-macos'
120
+ disabled: !!js process.platform !== 'darwin'
121
+ config:
122
+ agentPreset: ptc
123
+ screenshotTarget:
124
+ longEdge: 2048
125
+ maxBytes: 2097152
126
+
127
+ - id: cua-mcp-provider-windows
128
+ name: '@deepseek-ai/dsh-cua-windows'
129
+ disabled: !!js process.platform !== 'win32'
130
+ config:
131
+ agentPreset: ptc
132
+ screenshotTarget:
133
+ longEdge: 2048
134
+ maxBytes: 2097152
135
+
136
+ # DSH_CUA_CONSENT=allow grants application and pointer access without a human;
137
+ # the default forwards each request to the MCP client as an elicitation.
138
+ # DSH_CUA_WORKSPACE is the directory programs start in and may write under
139
+ # workspace-write; the default stays inside the Harness home whatever
140
+ # directory the client started the server in.
141
+ - id: cua-mcp
142
+ name: '@deepseek-ai/dsh-cua-mcp'
143
+ config:
144
+ consent: !!js process.env.DSH_CUA_CONSENT ?? 'elicit'
145
+ workspace: !!js process.env.DSH_CUA_WORKSPACE ?? dshHomePath('cua-mcp', 'workspace')