Skip to content

👾 Open Computer Use – Open-Source Alternative to Codex Computer Use

fix(dsh): validate compatibility integration

Leo547b4ffb8ed7
diff --git a/README.md b/README.md
index a074fc8..d9dff90 100644
--- a/README.md
+++ b/README.md
@@ -125,7 +125,8 @@ open-computer-use install-gemini-mcp --scope user
# Install into opencode by writing to ~/.config/opencode/opencode.json (or the active config file)
open-computer-use install-opencode-mcp
-# Install into DeepSeek Harness: writes a profile patch, the turn-boundary hook, and the skill
+# Install through DeepSeek Harness's generic MCP compatibility path:
+# verifies the server, then writes a profile patch, turn-boundary hook, and skill
open-computer-use install-dsh-mcp
./scripts/install-dsh-mcp.sh --profile web --no-hook
diff --git a/docs/histories/2026-09/20260914-1850-dsh-host-integration.md b/docs/histories/2026-09/20260914-1850-dsh-host-integration.md
index 72c71e0..10cdcfc 100644
--- a/docs/histories/2026-09/20260914-1850-dsh-host-integration.md
+++ b/docs/histories/2026-09/20260914-1850-dsh-host-integration.md
@@ -5,10 +5,9 @@
* **Base Model**: `deepseek-flash`
* **Runtime**: DeepSeek Harness Web GUI
-### 📥 User Query
-> 你要复用的话,那我 fork 的那个仓库有 dsh 插件吗?如果其他人想在我 fork 仓库基础上在 dsh 使用是否也具备我当前同等能力,不能把复用简单化懂吗,最终是要在每台 mac 电脑上,同样适用 dsh 服务都一样的能力。
+### 变更原因
-(背景:本轮之前,DSH 侧的能力是在一台机器上手工拼出来的——自己写 `cordis.patch.yml` 片段、自己写 `~/.dsh/ocu-hooks.json`、自己把 skill 拷进 `~/.dsh/skills`。仓库里没有任何 DSH 集成,别人 clone 之后拿到的是零。)
+把已有的本机 DSH 配置收敛为仓库可复用的安装入口,并确保新机器能够获得一致、可验证且不会静默覆盖用户文件的集成。
### 🛠 Changes Overview
**Scope:** `scripts/`(宿主安装器)、`scripts/npm/`(npm 包命令表与打包)、`skills/open-computer-use/references/`、`README.md`、`scripts/ci.sh`。
@@ -22,11 +21,14 @@
- **文档**:`skills/open-computer-use/references/installation.md` 增加 DSH 章节;`README.md` 宿主命令列表补齐。
- **验证能力**:新增 `scripts/tests/install-dsh-mcp.test.sh` 并接入 `scripts/ci.sh`。
- **非破坏性 skill 安装**:目标目录已存在且与 checkout 不一致时只警告不覆盖,`--force-skill` 才替换并留时间戳备份。理由:本机就存在一份比仓库更详细的中文运维版技能,直接覆盖等于静默毁掉用户自己的内容。
+- **安装前完成 MCP 握手**:执行 `initialize` 与 `tools/list`,校验 server identity 和非空、合法的工具目录;不锁死工具数量,避免 OCU 演进时安装器误拒绝兼容版本,目标错误时也不会写 profile。
+- **失败策略收紧**:显式安装的 MCP 行使用 `failOnStartupError: true`,避免 DSH 启动成功但用户请求的桌面工具实际缺席。
+- **明确兼容层定位**:该安装器通过通用 `dsh-mcp-client` 接入,不冒充 DSH 的 first-class computer-use provider,也不会占用其 provider slot。
### 🧠 Design Intent (Why)
- **钩子必须和 MCP 一起装**:OCU 的软件光标只在 turn 边界隐藏,触发源是 MCP 通知 `notifications/turn-ended`(`packages/OpenComputerUseKit/Sources/OpenComputerUseKit/MCPServer.swift` → `SoftwareCursorOverlay.reset()`;设计取舍见 `SoftwareCursorOverlay.swift:425-429`——进程内没有 inactivity timer,因为一轮里模型思考数分钟是常态)。而 `dsh-mcp-client` 从不发送该通知,任何会话或子代理调过一次动作后光标会永久留在屏幕上。只写 MCP 配置的安装器会把这个缺陷一起交付给用户。
- **用 marker 块而不是解析 YAML**:helper 是零依赖的(只用 `node:fs`/`node:path`),而 profile patch 是用户也会手改的 YAML。一对注释 marker 圈定托管区间、整块替换,既不需要 YAML 依赖,也不会破坏用户自己的行。
-- **`--command` 必须是绝对路径**:DSH 的 mcp-client 直接 spawn 可执行文件(不经过 shell),PATH 上的裸命令名对它无效;安装器按 `--command` → `$OPEN_COMPUTER_USE_COMMAND` → 常见 app 安装位置 → npm 全局布局 → PATH shim 的顺序探测,全失败时给出可执行的修复指引。
+- **`--command` 固定为绝对路径**:DSH 的 mcp-client 可以通过 PATH 找命令,但 GUI / 后台启动未必继承安装时的 PATH;安装器因此把显式路径限制为绝对路径,并把自动发现的 PATH shim 固化为绝对路径。
- **把 skill 打进 npm 包**:否则 npm 安装路径下找不到 skill 源,"同等能力"就只在源码 checkout 场景成立。
### 📁 Files Modified
@@ -39,13 +41,15 @@
- `README.md`
### ✅ Verification
-- `scripts/tests/install-dsh-mcp.test.sh`:9 项断言全部通过(保留用户行 + 两条托管行、钩子命令带引号、skill 落位、重复执行字节不变、`--no-hook`/`--no-skill` 生效、手写重复行被拒、已有 skill 不被覆盖、`--force-skill` 替换并留备份)。
+- `scripts/tests/install-dsh-mcp.test.sh`:覆盖 MCP 握手、工具目录、失败前不写配置、显式命令不回退、绝对路径、同 id / 同 `serverName` 冲突、用户行保留、钩子命令、skill 落位、幂等、`--no-hook` / `--no-skill`、非破坏更新与备份。
+- 生成的 patch 通过当前 DSH profile loader;真实 `open-computer-use 0.1.54` 完成 MCP 握手并发现 9 个工具。
- `bash -n` / `node --check`:新增与改动的脚本通过。
- 产物 YAML 经独立解析器校验:顶层 2 个条目,`insert` 中 id 为 `["mcp-open-computer-use", "ocu-turn-ended-hook"]`。
- 与真机对照:在相同的目录结构下安装后,产物与当前手工维护的 DSH 配置等价。
### ⚠️ 未覆盖 / 风险
-- 未在全新 Mac(无历史 DSH profile、无既有 OCU 安装)上端到端跑过;命令探测只在本机覆盖了 app 包路径与显式 `--command`。
+- 未在全新 Mac 的发布版 DSH Web UI 上完成模型驱动的桌面动作 E2E;仓库验证覆盖 profile 解析、MCP 握手与工具发现。
- Windows / Linux 未覆盖:钩子命令与 `~/Applications` 探测都是 macOS 取向。
- 安装器不负责构建或安装 app 本身:只注册已存在的可执行文件,找不到时失败并提示(`npm install -g open-computer-use` 或源码 `make app`)。
- `--no-hook` 会把光标粘屏问题留给用户,帮助文本已明确说明。
+- DSH 已提供一等 computer-use provider 注册模型;本安装器仍是通用 MCP 兼容路径,不负责跨仓库实现 OCU 专属 DSH provider。
diff --git a/docs/releases/feature-release-notes.md b/docs/releases/feature-release-notes.md
index f57aff0..a337710 100644
--- a/docs/releases/feature-release-notes.md
+++ b/docs/releases/feature-release-notes.md
@@ -4,6 +4,7 @@
| 日期 | 功能域 | 用户价值 | 变更摘要 |
| --- | --- | --- | --- |
+| 2026-09-17 | DeepSeek Harness 集成 | DSH 用户可以用一条命令安装 Open Computer Use,并在写入配置前发现错误的可执行文件或不兼容的 MCP server。 | 新增 DSH MCP 兼容安装器、turn-boundary 光标清理 hook 和非破坏性 skill 安装;安装前校验 server identity 与非空工具目录但不锁死工具数量,显式安装在 MCP 启动失败时 fail loud,并明确该路径不注册 DSH 的 first-class computer-use provider。 |
| 2026-09-10 | macOS 拖拽修复 | 显式开启全局指针路径后,窗口移动、文本拖选与 Finder 拖放可收到启动真实拖拽所需的事件;默认路径的限制也会明确呈现。 | 发布 `0.3.5`:补齐拖拽位移、手势事件编号与 HID 投递时序,增加投递路径说明;同步升级 Go MCP SDK 到 `v1.4.1`。 |
| 2026-09-08 | drag 投递路径可见性 | 在默认安全配置下调用 `drag` 做窗口移动、文本拖选或 Finder 拖放时,结果会明确说明事件只投递给目标进程、为何没有效果,以及需要设置哪个环境变量,不再表现为“成功但无效果”。 | `drag` 结果新增一条 `Drag delivered via app_post` / `Drag delivered via global pointer path` 文本项;tool description 补充默认路径限制与 `OPEN_COMPUTER_USE_ALLOW_GLOBAL_POINTER_FALLBACKS=1` 说明;skill 文档新增 Drag Delivery 章节;默认行为与安全门本身不变。 |
| 2026-09-08 | macOS 应用定位与 secondary action | 按名称定位应用时减少误选后台 helper,执行 secondary action 时避免动作错配。 | 发布 `0.3.4`:优先匹配普通应用;支持 Safari custom action 短名称,并修复过滤后的动作映射和名称冲突。 |
diff --git a/scripts/install-config-helper.mjs b/scripts/install-config-helper.mjs
index db1e59f..c30614b 100644
--- a/scripts/install-config-helper.mjs
+++ b/scripts/install-config-helper.mjs
@@ -1,5 +1,6 @@
#!/usr/bin/env node
+import { spawn } from "node:child_process";
import { cpSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
import path from "node:path";
@@ -15,6 +16,7 @@ function usage() {
node ./scripts/install-config-helper.mjs gemini-mcp <config-path> <server-name> <command-name>
node ./scripts/install-config-helper.mjs opencode-mcp <primary-config-path> <secondary-config-path> <server-name> <command-name>
node ./scripts/install-config-helper.mjs dsh-mcp <profile-patch-path> <hooks-path> <command-path> <with-turn-ended-hook>
+ node ./scripts/install-config-helper.mjs probe-stdio-mcp <command-path> [<arg> ...]
node ./scripts/install-config-helper.mjs codex-plugin-version <plugin-manifest-path>
node ./scripts/install-config-helper.mjs codex-plugin-config <config-path> <repo-root> <marketplace-name> <plugin-name>
node ./scripts/install-config-helper.mjs copy-into-dir <target-dir> <source-path> [<source-path> ...]
@@ -534,7 +536,7 @@ function renderDshPatchBlock(commandPath, hooksPath, withHook) {
" args:",
" - mcp",
" toolCallTimeoutMs: 300000",
- " failOnStartupError: false",
+ " failOnStartupError: true",
];
if (withHook) {
@@ -600,10 +602,121 @@ function findUnmanagedDshRows(existingText, ids) {
conflicts.push({ id, line: index + 1 });
}
}
+ if (/^serverName:\s*(?:ocu|"ocu"|'ocu')\s*(?:#.*)?$/.test(line.trim())) {
+ conflicts.push({ id: "serverName: ocu", line: index + 1 });
+ }
});
return conflicts;
}
+/** Verify the selected executable is an Open Computer Use MCP server. */
+async function probeStdioMcp(commandPath, args) {
+ if (!path.isAbsolute(commandPath)) {
+ fail(`MCP command must be an absolute path: ${commandPath}`);
+ }
+ if (!existsSync(commandPath)) {
+ fail(`MCP command does not exist: ${commandPath}`);
+ }
+
+ const child = spawn(commandPath, args, { stdio: ["pipe", "pipe", "pipe"] });
+ let stdout = "";
+ let stderr = "";
+ let settled = false;
+ let nextID = 1;
+ const pending = new Map();
+
+ const cleanup = () => {
+ if (!child.killed) child.kill("SIGTERM");
+ };
+ const rejectPending = (error) => {
+ for (const { reject } of pending.values()) reject(error);
+ pending.clear();
+ };
+ child.stderr.on("data", (chunk) => {
+ if (stderr.length < 4096) stderr += chunk.toString();
+ });
+ child.stdout.on("data", (chunk) => {
+ stdout += chunk.toString();
+ while (stdout.includes("\n")) {
+ const newline = stdout.indexOf("\n");
+ const line = stdout.slice(0, newline).trim();
+ stdout = stdout.slice(newline + 1);
+ if (line.length === 0) continue;
+ let message;
+ try {
+ message = JSON.parse(line);
+ } catch {
+ rejectPending(new Error(`MCP server wrote non-JSON stdout: ${line.slice(0, 200)}`));
+ continue;
+ }
+ const request = pending.get(message.id);
+ if (request) {
+ pending.delete(message.id);
+ request.resolve(message);
+ }
+ }
+ });
+
+ const exited = new Promise((_, reject) => {
+ child.once("error", reject);
+ child.once("exit", (code, signal) => {
+ if (!settled) {
+ reject(new Error(`MCP server exited before discovery (code=${code ?? "null"}, signal=${signal ?? "none"})${stderr.trim() ? `: ${stderr.trim()}` : ""}`));
+ }
+ });
+ });
+ const request = (method, params = {}) => {
+ const id = nextID++;
+ return new Promise((resolve, reject) => {
+ pending.set(id, { resolve, reject });
+ child.stdin.write(`${JSON.stringify({ jsonrpc: "2.0", id, method, params })}\n`, (error) => {
+ if (!error) return;
+ pending.delete(id);
+ reject(error);
+ });
+ });
+ };
+ const timeout = new Promise((_, reject) => {
+ setTimeout(() => reject(new Error("MCP discovery timed out after 10 seconds")), 10_000).unref();
+ });
+
+ try {
+ const verify = async () => {
+ const initialized = await request("initialize", {
+ protocolVersion: "2025-03-26",
+ capabilities: {},
+ clientInfo: { name: "open-computer-use-installer", version: "1" },
+ });
+ if (initialized.error) throw new Error(`MCP initialize failed: ${JSON.stringify(initialized.error)}`);
+ if (initialized.result?.serverInfo?.name !== "open-computer-use") {
+ throw new Error(`unexpected MCP server identity: ${JSON.stringify(initialized.result?.serverInfo?.name)}`);
+ }
+ child.stdin.write(`${JSON.stringify({ jsonrpc: "2.0", method: "notifications/initialized", params: {} })}\n`);
+ const listed = await request("tools/list");
+ if (listed.error) throw new Error(`MCP tools/list failed: ${JSON.stringify(listed.error)}`);
+ const tools = listed.result?.tools;
+ if (!Array.isArray(tools)) throw new Error("MCP tools/list did not return a tools array");
+ if (tools.length === 0) throw new Error("MCP tools/list returned an empty tool catalog");
+ const names = tools.map((tool) => tool?.name);
+ if (names.some((name) => typeof name !== "string" || name.trim().length === 0)) {
+ throw new Error("MCP tools/list returned a tool without a valid name");
+ }
+ if (new Set(names).size !== names.length) {
+ throw new Error("MCP tools/list returned duplicate tool names");
+ }
+ return names;
+ };
+ const names = await Promise.race([verify(), timeout, exited]);
+ settled = true;
+ process.stdout.write(`Verified Open Computer Use MCP server (${names.length} tools): ${commandPath}\n`);
+ } catch (error) {
+ settled = true;
+ throw new Error(`Could not verify Open Computer Use MCP server at ${commandPath}: ${error.message}`);
+ } finally {
+ cleanup();
+ }
+}
+
/**
* Install the stdio MCP server into one DSH profile patch, and optionally the
* turn-boundary hook that keeps the software cursor from sticking on screen.
@@ -647,7 +760,7 @@ function installDshMcp(patchPath, hooksPath, commandPath, withHookValue) {
}
}
-function main(argv) {
+async function main(argv) {
const [command, ...args] = argv;
switch (command) {
case "claude-mcp":
@@ -685,6 +798,13 @@ function main(argv) {
}
installDshMcp(...args);
return;
+ case "probe-stdio-mcp":
+ if (args.length < 1) {
+ usage();
+ process.exit(1);
+ }
+ await probeStdioMcp(args[0], args.slice(1));
+ return;
case "codex-plugin-version":
if (args.length !== 1) {
usage();
@@ -712,4 +832,8 @@ function main(argv) {
}
}
-main(process.argv.slice(2));
+try {
+ await main(process.argv.slice(2));
+} catch (error) {
+ fail(error instanceof Error ? error.message : String(error));
+}
diff --git a/scripts/install-dsh-mcp.sh b/scripts/install-dsh-mcp.sh
index 26674c4..2b2f647 100755
--- a/scripts/install-dsh-mcp.sh
+++ b/scripts/install-dsh-mcp.sh
@@ -22,6 +22,9 @@ Install the open-computer-use stdio MCP server into a DeepSeek Harness (DSH)
profile, and register the turn-boundary hook that keeps the software cursor from
sticking on screen.
+This is a compatibility integration through DSH's generic MCP client. It does
+not register a first-class DSH computer-use provider.
+
The managed block in the profile patch is delimited by markers and replaced in
place, so re-running updates it and leaves the rest of the file untouched.
@@ -103,15 +106,32 @@ if ! command -v node >/dev/null 2>&1; then
exit 1
fi
-# DSH spawns this path directly (no shell), so it must be an executable file.
+# Keep a stable absolute path in the profile. DSH can resolve PATH commands, but
+# GUI and background launches do not necessarily inherit the installer's PATH.
resolve_command() {
local -a candidates=()
+ local explicit_command=""
+ local explicit_source=""
if [[ -n "${command_override}" ]]; then
- candidates+=("${command_override}")
+ explicit_command="${command_override}"
+ explicit_source="--command"
+ elif [[ -n "${OPEN_COMPUTER_USE_COMMAND:-}" ]]; then
+ explicit_command="${OPEN_COMPUTER_USE_COMMAND}"
+ explicit_source="OPEN_COMPUTER_USE_COMMAND"
fi
- if [[ -n "${OPEN_COMPUTER_USE_COMMAND:-}" ]]; then
- candidates+=("${OPEN_COMPUTER_USE_COMMAND}")
+
+ if [[ -n "${explicit_command}" ]]; then
+ if [[ "${explicit_command}" != /* ]]; then
+ echo "${explicit_source} must be an absolute executable path: ${explicit_command}" >&2
+ return 2
+ fi
+ if [[ ! -f "${explicit_command}" || ! -x "${explicit_command}" ]]; then
+ echo "${explicit_source} is not an executable file: ${explicit_command}" >&2
+ return 2
+ fi
+ printf '%s\n' "${explicit_command}"
+ return 0
fi
candidates+=(
@@ -140,7 +160,7 @@ resolve_command() {
local candidate=""
for candidate in "${candidates[@]}"; do
- if [[ -x "${candidate}" ]]; then
+ if [[ "${candidate}" == /* && -f "${candidate}" && -x "${candidate}" ]]; then
printf '%s\n' "${candidate}"
return 0
fi
@@ -150,7 +170,14 @@ resolve_command() {
}
command_path=""
-if ! command_path="$(resolve_command)"; then
+set +e
+command_path="$(resolve_command)"
+resolve_status=$?
+set -e
+if [[ "${resolve_status}" -ne 0 ]]; then
+ if [[ "${resolve_status}" -eq 2 ]]; then
+ exit 1
+ fi
cat >&2 <<'EOF'
Could not find an Open Computer Use executable to register.
@@ -166,6 +193,9 @@ EOF
exit 1
fi
+# Fail before changing profile files if the executable is not an OCU MCP server.
+node "${config_helper}" probe-stdio-mcp "${command_path}" mcp
+
profile_dir="${dsh_home}/profiles/${profile_name}"
patch_path="${profile_dir}/cordis.patch.yml"
hooks_path="${dsh_home}/ocu-hooks.json"
@@ -179,40 +209,52 @@ if [[ "${with_hook}" -eq 0 ]]; then
fi
skill_target="${dsh_home}/skills/open-computer-use"
+skill_summary="not installed (--no-skill)"
if [[ "${with_skill}" -eq 1 ]]; then
if [[ ! -d "${skill_source}" ]]; then
echo "Skill source not found at ${skill_source}; skipping the skill copy." >&2
+ skill_summary="not installed (source missing)"
elif [[ ! -e "${skill_target}" ]]; then
node "${config_helper}" copy-into-dir "${dsh_home}/skills" "${skill_source}"
+ skill_summary="installed at ${skill_target}"
elif diff -rq "${skill_source}" "${skill_target}" >/dev/null 2>&1; then
echo "Skill already current at ${skill_target}"
+ skill_summary="already current at ${skill_target}"
elif [[ "${force_skill}" -eq 1 ]]; then
skill_backup="${skill_target}.bak-$(date +%Y%m%d-%H%M%S)"
mv "${skill_target}" "${skill_backup}"
echo "Existing skill moved to ${skill_backup}" >&2
node "${config_helper}" copy-into-dir "${dsh_home}/skills" "${skill_source}"
+ skill_summary="replaced at ${skill_target} (backup: ${skill_backup})"
else
cat >&2 <<EOF
Skill at ${skill_target} differs from this checkout; leaving it untouched so a
local copy is never overwritten silently. Re-run with --force-skill to replace it
(a timestamped backup is kept).
EOF
+ skill_summary="left existing copy untouched at ${skill_target}"
fi
fi
+cursor_summary="not installed (--no-hook)"
+if [[ "${with_hook}" -eq 1 ]]; then
+ cursor_summary="hidden automatically at each turn boundary via ${hooks_path}"
+fi
+
cat <<EOF
Installed into DSH profile "${profile_name}".
- tools mcp__ocu__list_apps / get_app_state / click / perform_secondary_action
- scroll / drag / type_text / press_key / set_value / select_text
- cursor hidden automatically at each turn boundary via ${hooks_path}
- skill ${dsh_home}/skills/open-computer-use (visible in every new conversation)
+ tools mcp__ocu__* (discovered from the installed Open Computer Use server)
+ cursor ${cursor_summary}
+ skill ${skill_summary}
-DSH reloads this profile when the patch file changes, so a running instance picks
-the server up without a restart. On macOS, grant Accessibility and Screen
-Recording to the app bundle once; verify with:
+This installs Open Computer Use through DSH's generic MCP compatibility path; it
+does not reserve DSH's first-class computer-use provider slot. DSH reloads the
+web profile when the patch changes. Other profiles may require a restart. On
+macOS, grant Accessibility and Screen Recording to the app bundle once; verify
+with:
"${command_path}" doctor
EOF
diff --git a/scripts/tests/fixtures/open-computer-use-mcp.mjs b/scripts/tests/fixtures/open-computer-use-mcp.mjs
new file mode 100644
index 0000000..0263416
--- /dev/null
+++ b/scripts/tests/fixtures/open-computer-use-mcp.mjs
@@ -0,0 +1,41 @@
+#!/usr/bin/env node
+
+import readline from "node:readline";
+
+const serverName = process.env.OCU_TEST_SERVER_NAME ?? "open-computer-use";
+
+const defaultToolNames = [
+ "click",
+ "drag",
+ "get_app_state",
+ "list_apps",
+ "perform_secondary_action",
+ "press_key",
+ "scroll",
+ "set_value",
+ "type_text",
+];
+const toolNames = process.env.OCU_TEST_TOOL_NAMES?.split(",") ?? defaultToolNames;
+const tools = toolNames.map((name) => ({ name, inputSchema: { type: "object" } }));
+
+const lines = readline.createInterface({ input: process.stdin });
+lines.on("line", (line) => {
+ const request = JSON.parse(line);
+ if (request.id === undefined) return;
+
+ let result;
+ if (request.method === "initialize") {
+ result = {
+ protocolVersion: "2025-03-26",
+ capabilities: { tools: { listChanged: false } },
+ serverInfo: { name: serverName, version: "test" },
+ };
+ } else if (request.method === "tools/list") {
+ result = { tools };
+ } else {
+ process.stdout.write(`${JSON.stringify({ jsonrpc: "2.0", id: request.id, error: { code: -32601, message: "Method not found" } })}\n`);
+ return;
+ }
+
+ process.stdout.write(`${JSON.stringify({ jsonrpc: "2.0", id: request.id, result })}\n`);
+});
diff --git a/scripts/tests/install-dsh-mcp.test.sh b/scripts/tests/install-dsh-mcp.test.sh
index 886d475..dae909e 100755
--- a/scripts/tests/install-dsh-mcp.test.sh
+++ b/scripts/tests/install-dsh-mcp.test.sh
@@ -24,9 +24,10 @@ pass() {
echo "ok - $1"
}
+fixture="${repo_root}/scripts/tests/fixtures/open-computer-use-mcp.mjs"
fake_command="${work_dir}/Open Computer Use (Dev).app/Contents/MacOS/OpenComputerUse"
mkdir -p "$(dirname "${fake_command}")"
-printf '#!/bin/sh\nexit 0\n' > "${fake_command}"
+cp "${fixture}" "${fake_command}"
chmod +x "${fake_command}"
dsh_home="${work_dir}/dsh"
@@ -34,7 +35,7 @@ profile_dir="${dsh_home}/profiles/web"
mkdir -p "${profile_dir}"
printf -- "- id: web-runtime\n config:\n trustedHosts:\n - 1.2.3.4\n" > "${profile_dir}/cordis.patch.yml"
-"${installer}" --dsh-home "${dsh_home}" --command "${fake_command}" >/dev/null
+install_output="$("${installer}" --dsh-home "${dsh_home}" --command "${fake_command}")"
patch="${profile_dir}/cordis.patch.yml"
hooks="${dsh_home}/ocu-hooks.json"
@@ -45,6 +46,18 @@ grep -q "id: web-runtime" "${patch}" || fail "the installer dropped the user's e
grep -q "trustedHosts" "${patch}" || fail "the installer dropped the user's existing config"
pass "patch keeps the user's rows and adds both managed rows"
+grep -q "failOnStartupError: true" "${patch}" || fail "MCP startup failures are not fatal"
+grep -q "Verified Open Computer Use MCP server (9 tools)" <<<"${install_output}" || fail "installer did not probe the MCP server"
+if grep -q "select_text" <<<"${install_output}"; then
+ fail "installer advertised a tool that the verified server did not expose"
+fi
+pass "installer verifies MCP discovery and reports the discovered namespace"
+
+future_home="${work_dir}/dsh-future-tool-surface"
+OCU_TEST_TOOL_NAMES=js,js_reset "${installer}" --dsh-home "${future_home}" --command "${fake_command}" --no-hook --no-skill >/dev/null
+grep -q "id: mcp-open-computer-use" "${future_home}/profiles/web/cordis.patch.yml" || fail "installer rejected a valid changed OCU tool surface"
+pass "installer accepts OCU tool-surface evolution without pinning a tool count"
+
grep -q "${fake_command}" "${patch}" || fail "patch does not reference the installed command"
grep -q "${fake_command}" "${hooks}" || fail "hook config does not reference the installed command"
node -e 'const fs = require("node:fs");
@@ -64,7 +77,7 @@ before="$(cksum < "${patch}")"
pass "re-running is idempotent"
no_hook_home="${work_dir}/dsh-no-hook"
-"${installer}" --dsh-home "${no_hook_home}" --command "${fake_command}" --no-hook --no-skill >/dev/null
+no_hook_output="$("${installer}" --dsh-home "${no_hook_home}" --command "${fake_command}" --no-hook --no-skill)"
if grep -q "id: ocu-turn-ended-hook" "${no_hook_home}/profiles/web/cordis.patch.yml"; then
fail "--no-hook still wrote the hook row"
fi
@@ -74,6 +87,8 @@ fi
if [[ -d "${no_hook_home}/skills" ]]; then
fail "--no-skill still copied the skill"
fi
+grep -q "cursor not installed (--no-hook)" <<<"${no_hook_output}" || fail "summary claimed the skipped hook was installed"
+grep -q "skill not installed (--no-skill)" <<<"${no_hook_output}" || fail "summary claimed the skipped skill was installed"
pass "--no-hook and --no-skill are honoured"
conflict_home="${work_dir}/dsh-conflict"
@@ -88,6 +103,37 @@ if [[ -f "${conflict_home}/ocu-hooks.json" ]]; then
fi
pass "a hand-written duplicate row is refused instead of duplicated"
+server_name_home="${work_dir}/dsh-server-name-conflict"
+server_name_profile="${server_name_home}/profiles/web"
+mkdir -p "${server_name_profile}"
+printf -- "- insert:\n - id: another-mcp-row\n name: '@deepseek-ai/dsh-mcp-client'\n config:\n serverName: ocu\n" > "${server_name_profile}/cordis.patch.yml"
+if "${installer}" --dsh-home "${server_name_home}" --command "${fake_command}" >/dev/null 2>&1; then
+ fail "installer accepted a duplicate ocu serverName under a different row id"
+fi
+pass "an existing ocu serverName is refused even under a different row id"
+
+invalid_home="${work_dir}/dsh-invalid-server"
+if OCU_TEST_SERVER_NAME=not-open-computer-use "${installer}" --dsh-home "${invalid_home}" --command "${fake_command}" >/dev/null 2>&1; then
+ fail "installer accepted an executable that is not an Open Computer Use MCP server"
+fi
+[[ ! -e "${invalid_home}/profiles/web/cordis.patch.yml" ]] || fail "failed MCP verification modified the profile"
+pass "a non-OCU executable fails before profile files are changed"
+
+missing_home="${work_dir}/dsh-missing-command"
+missing_command="${work_dir}/missing/OpenComputerUse"
+if "${installer}" --dsh-home "${missing_home}" --command "${missing_command}" >/dev/null 2>&1; then
+ fail "installer fell back to auto-detection after an invalid explicit command"
+fi
+[[ ! -e "${missing_home}/profiles/web/cordis.patch.yml" ]] || fail "missing command rejection modified the profile"
+pass "an invalid explicit command fails instead of falling back to another install"
+
+relative_home="${work_dir}/dsh-relative-command"
+if "${installer}" --dsh-home "${relative_home}" --command open-computer-use >/dev/null 2>&1; then
+ fail "installer accepted a relative command override"
+fi
+[[ ! -e "${relative_home}/profiles/web/cordis.patch.yml" ]] || fail "relative command rejection modified the profile"
+pass "an explicit relative command is rejected before profile files are changed"
+
printf 'local edit\n' >> "${dsh_home}/skills/open-computer-use/SKILL.md"
"${installer}" --dsh-home "${dsh_home}" --command "${fake_command}" >/dev/null 2>&1
grep -q "local edit" "${dsh_home}/skills/open-computer-use/SKILL.md" || fail "an existing skill was overwritten without --force-skill"
diff --git a/skills/open-computer-use/references/installation.md b/skills/open-computer-use/references/installation.md
index eef2dba..5801b14 100644
--- a/skills/open-computer-use/references/installation.md
+++ b/skills/open-computer-use/references/installation.md
@@ -84,7 +84,18 @@ ocu install-dsh-mcp
DSH profiles are composed from patch layers, so the installer writes a delimited
block into `<dsh-home>/profiles/<profile>/cordis.patch.yml` (default profile
`web`, default home `~/.dsh`). The block is replaced in place on every run, so
-re-running is idempotent and the rest of the file is untouched.
+re-running is idempotent and the rest of the file is untouched. Before writing,
+the installer performs an MCP `initialize` plus `tools/list` exchange and
+requires the Open Computer Use server identity and a non-empty, valid tool
+catalog. It deliberately does not pin a tool count, so compatible OCU releases
+can add or reshape tools. An unrelated or broken executable therefore fails
+without changing the profile.
+
+This is a compatibility integration through DSH's generic MCP client. It does
+not register a first-class DSH computer-use provider or reserve DSH's exclusive
+computer-use provider slot. Do not enable another desktop provider in the same
+profile unless you deliberately want both independent tool sets to operate the
+same desktop.
It also installs two things a DSH host needs beyond the MCP entry:
@@ -106,10 +117,13 @@ It also installs two things a DSH host needs beyond the MCP entry:
backup.
Options: `--profile <name>`, `--dsh-home <dir>`, `--command <path>`, `--no-hook`,
-`--no-skill`, `--force-skill`. DSH spawns the registered command directly rather
-than through a shell, so `--command` must be an absolute path to an executable;
-when it is omitted the installer probes the usual install locations and the npm
-global layout, and fails with guidance if it finds nothing.
+`--no-skill`, `--force-skill`. `--command` must be an absolute executable path.
+DSH can resolve a bare PATH command, but an absolute path remains stable when a
+GUI or background launch receives a different PATH. When the option is omitted,
+the installer resolves the current PATH shim and common app/npm locations to an
+absolute path, then fails with guidance if it finds nothing. Explicit DSH
+installation treats MCP startup failure as a profile activation error rather
+than silently starting without the requested tools.
For any other MCP client, add a stdio server manually: