👾 Open Computer Use – Open-Source Alternative to Codex Computer Use
Swift accessibilityai-agentai-agentsclaude-codecodexcodex-computer-usecomputer-usecomputer-use-agentcross-platformcuadesktop-automationgemini-cligui-automationmacosmcpmodel-context-protocolopen-computer-useopen-computer-use-mcpopenai-codexopencode
feat(dsh): 补齐 DeepSeek Harness 宿主集成
陈伟记865207854897
diff --git a/README.md b/README.mdindex e71c48f..a074fc8 100644--- a/README.md+++ b/README.md@@ -125,6 +125,10 @@ 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+open-computer-use install-dsh-mcp+./scripts/install-dsh-mcp.sh --profile web --no-hook+# Call a single Computer Use tool and print the MCP-style JSON resultopen-computer-use call list_appsocu call list_appsdiff --git a/docs/histories/2026-09/20260914-1850-dsh-host-integration.md b/docs/histories/2026-09/20260914-1850-dsh-host-integration.mdnew file mode 100644index 0000000..506a74b--- /dev/null+++ b/docs/histories/2026-09/20260914-1850-dsh-host-integration.md@@ -0,0 +1,50 @@+## [2026-09-14 18:50] | Task: 为 DeepSeek Harness 补齐宿主集成++### 🤖 Execution Context+* **Agent ID**: `session-66aa166d-ee60-437e-a52e-940a311c8c76` (DSH)+* **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 之后拿到的是零。)++### 🛠 Changes Overview+**Scope:** `scripts/`(宿主安装器)、`scripts/npm/`(npm 包命令表与打包)、`skills/open-computer-use/references/`、`README.md`、`scripts/ci.sh`。++**Key Actions:**+- **新增 DSH 宿主安装器**:`scripts/install-dsh-mcp.sh`(`--profile` / `--dsh-home` / `--command` / `--no-hook` / `--no-skill`),与既有 `install-{claude,codex,gemini,opencode}-mcp.sh` 同一形状。+- **`install-config-helper.mjs` 新增 `dsh-mcp` 子命令**:往 `<dsh-home>/profiles/<profile>/cordis.patch.yml` 写入由 marker 包裹的托管块(MCP 行 + turn 边界钩子行),并写 `<dsh-home>/ocu-hooks.json`。块按 marker 原位替换而非合并,因此可重复执行且不动用户自己的行。+- **turn 边界钩子随 MCP 一起安装**:用 `@deepseek-ai/dsh-hooks-codex` 把 `Stop`(= `agent/turn-stopping`)映射到 `open-computer-use turn-ended`。这是 DSH 区别于其它宿主的必需项,理由见下。+- **skill 安装到 `<dsh-home>/skills`**:DSH 把该目录当作用户级 skill 根扫描,所有新会话可见。+- **npm 侧对齐**:`scripts/npm/build-packages.mjs` 增加 `install-dsh-mcp` 命令、帮助文本、`help install-dsh-mcp` 分支、打包清单与拷贝逻辑(含把 `skills/open-computer-use` 打进包里,否则 npm 用户没有 skill 可用)。+- **文档**:`skills/open-computer-use/references/installation.md` 增加 DSH 章节;`README.md` 宿主命令列表补齐。+- **验证能力**:新增 `scripts/tests/install-dsh-mcp.test.sh` 并接入 `scripts/ci.sh`。++### 🧠 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 的顺序探测,全失败时给出可执行的修复指引。+- **把 skill 打进 npm 包**:否则 npm 安装路径下找不到 skill 源,"同等能力"就只在源码 checkout 场景成立。++### 📁 Files Modified+- `scripts/install-dsh-mcp.sh`(新增)+- `scripts/install-config-helper.mjs`+- `scripts/npm/build-packages.mjs`+- `scripts/tests/install-dsh-mcp.test.sh`(新增)+- `scripts/ci.sh`+- `skills/open-computer-use/references/installation.md`+- `README.md`++### ✅ Verification+- `scripts/tests/install-dsh-mcp.test.sh`:5 项断言全部通过(保留用户行 + 两条托管行、钩子命令带引号、skill 落位、重复执行字节不变、`--no-hook`/`--no-skill` 生效)。+- `bash -n` / `node --check`:新增与改动的脚本通过。+- 产物 YAML 经独立解析器校验:顶层 2 个条目,`insert` 中 id 为 `["mcp-open-computer-use", "ocu-turn-ended-hook"]`。+- 与真机对照:在相同的目录结构下安装后,产物与当前手工维护的 DSH 配置等价。++### ⚠️ 未覆盖 / 风险+- 未在全新 Mac(无历史 DSH profile、无既有 OCU 安装)上端到端跑过;命令探测只在本机覆盖了 app 包路径与显式 `--command`。+- Windows / Linux 未覆盖:钩子命令与 `~/Applications` 探测都是 macOS 取向。+- 安装器不负责构建或安装 app 本身:只注册已存在的可执行文件,找不到时失败并提示(`npm install -g open-computer-use` 或源码 `make app`)。+- `--no-hook` 会把光标粘屏问题留给用户,帮助文本已明确说明。diff --git a/scripts/ci.sh b/scripts/ci.shindex 870c125..ff3e1d2 100755--- a/scripts/ci.sh+++ b/scripts/ci.sh@@ -7,6 +7,7 @@ repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)""${repo_root}/scripts/check-docs.sh""${repo_root}/scripts/check-repo-hygiene.sh""${repo_root}/scripts/check-action-pinning.sh"+"${repo_root}/scripts/tests/install-dsh-mcp.test.sh"while IFS= read -r file; dobash -n "$file"diff --git a/scripts/install-config-helper.mjs b/scripts/install-config-helper.mjsindex b5b8d95..db1e59f 100644--- a/scripts/install-config-helper.mjs+++ b/scripts/install-config-helper.mjs@@ -14,6 +14,7 @@ function usage() {node ./scripts/install-config-helper.mjs codex-mcp <config-path> <server-name> <command-name>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 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> ...]@@ -475,6 +476,177 @@ function copyIntoDir(targetDir, sourcePaths) {}}+/**+ * Markers around the block this installer owns inside a DSH profile patch. The+ * patch is a plain YAML array the user also edits by hand, so the block is+ * delimited and replaced wholesale instead of being merged key by key.+ */+const DSH_PATCH_BEGIN_MARKER = "# >>> open-computer-use (managed by install-dsh-mcp.sh)";+const DSH_PATCH_END_MARKER = "# <<< open-computer-use";++/** Quote a value as a double-quoted YAML scalar (paths routinely contain spaces and parentheses). */+function quoteYamlString(value) {+ return `"${String(value).replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`;+}++/** Quote a value for the shell line a DSH hook runs. */+function quoteShellWord(value) {+ return `"${String(value).replaceAll("\\", "\\\\").replaceAll('"', '\\"').replaceAll("$", "\\$").replaceAll("`", "\\`")}"`;+}++/**+ * Render the DSH hook config that clears the Open Computer Use software cursor.+ * The cursor is only hidden at a turn boundary (the MCP `notifications/turn-ended`+ * notification), which dsh-mcp-client never sends, so without this hook the cursor+ * stays on screen after the first action of any session or subagent.+ */+function renderDshHookConfig(commandPath) {+ return {+ hooks: {+ Stop: [+ {+ hooks: [+ {+ type: "command",+ command: `${quoteShellWord(commandPath)} turn-ended`,+ timeout: 5,+ },+ ],+ },+ ],+ },+ };+}++/** Render the managed block appended to a DSH profile patch. */+function renderDshPatchBlock(commandPath, hooksPath, withHook) {+ const lines = [+ DSH_PATCH_BEGIN_MARKER,+ "# Replaced in place on every run; edits inside the block are overwritten.",+ "# For the hook rationale see skills/open-computer-use/references/installation.md.",+ "- insert:",+ " - id: mcp-open-computer-use",+ " name: '@deepseek-ai/dsh-mcp-client'",+ " config:",+ " serverName: ocu",+ " transport: stdio",+ ` command: ${quoteYamlString(commandPath)}`,+ " args:",+ " - mcp",+ " toolCallTimeoutMs: 300000",+ " failOnStartupError: false",+ ];++ if (withHook) {+ lines.push(+ " # OCU hides its software cursor only at a turn boundary, and dsh-mcp-client",+ " # never sends that notification; this row maps Stop onto the OCU CLI.",+ " - id: ocu-turn-ended-hook",+ " name: '@deepseek-ai/dsh-hooks-codex'",+ " config:",+ ` configPath: ${quoteYamlString(hooksPath)}`,+ " defaultTimeoutMs: 5000",+ );+ }++ lines.push(DSH_PATCH_END_MARKER);+ return lines;+}++/** Replace the managed block in place, or append it when the patch has none yet. */+function applyDshPatchBlock(existingText, blockLines, patchPath) {+ const normalized = normalizeNewlines(existingText);+ const lines = normalized.length > 0 ? normalized.split("\n") : [];+ const beginIndex = lines.findIndex((line) => line.trim() === DSH_PATCH_BEGIN_MARKER);+ const endIndex = lines.findIndex((line) => line.trim() === DSH_PATCH_END_MARKER);++ if ((beginIndex === -1) !== (endIndex === -1) || (beginIndex !== -1 && endIndex < beginIndex)) {+ fail(`Refusing to edit ${patchPath}: found only one of the two managed markers. Delete the stale marker line and re-run.`);+ }++ let nextLines;+ if (beginIndex === -1) {+ nextLines = trimTrailingBlankLines([...lines]);+ if (nextLines.length > 0) {+ nextLines.push("");+ }+ nextLines.push(...blockLines);+ } else {+ nextLines = [...lines.slice(0, beginIndex), ...blockLines, ...lines.slice(endIndex + 1)];+ }++ const text = trimTrailingBlankLines(nextLines).join("\n");+ return text.length > 0 ? `${text}\n` : "";+}++/**+ * Find rows this installer would own that already exist outside the managed+ * block. They usually come from a hand-written registration; keeping both would+ * register the MCP server twice, and dsh-mcp-client rejects a duplicate+ * serverName.+ */+function findUnmanagedDshRows(existingText, ids) {+ const lines = normalizeNewlines(existingText).split("\n");+ const beginIndex = lines.findIndex((line) => line.trim() === DSH_PATCH_BEGIN_MARKER);+ const endIndex = lines.findIndex((line) => line.trim() === DSH_PATCH_END_MARKER);+ const outside = beginIndex !== -1 && endIndex > beginIndex+ ? [...lines.slice(0, beginIndex), ...lines.slice(endIndex + 1)]+ : lines;++ const conflicts = [];+ outside.forEach((line, index) => {+ for (const id of ids) {+ if (line.trim() === `- id: ${id}`) {+ conflicts.push({ id, line: index + 1 });+ }+ }+ });+ return conflicts;+}++/**+ * 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.+ */+function installDshMcp(patchPath, hooksPath, commandPath, withHookValue) {+ const withHook = withHookValue !== "0" && withHookValue !== "false";++ if (!existsSync(commandPath)) {+ fail(`MCP command does not exist: ${commandPath}`);+ }++ const existing = readTextIfExists(patchPath);+ const managedIds = withHook+ ? ["mcp-open-computer-use", "ocu-turn-ended-hook"]+ : ["mcp-open-computer-use"];+ const conflicts = findUnmanagedDshRows(existing, managedIds);+ if (conflicts.length > 0) {+ const found = conflicts.map((entry) => `"${entry.id}" (line ${entry.line})`).join(", ");+ fail(+ `Refusing to edit ${patchPath}: it already declares ${found} outside the managed block.\n` ++ "Remove the hand-written row(s) and re-run: two rows for the same id register the MCP " ++ "server twice, and dsh-mcp-client rejects a duplicate serverName.",+ );+ }++ if (withHook) {+ writeJSONConfig(hooksPath, renderDshHookConfig(commandPath));+ }++ const nextText = applyDshPatchBlock(existing, renderDshPatchBlock(commandPath, hooksPath, withHook), patchPath);++ if (nextText !== existing) {+ ensureParentDir(patchPath);+ writeFileSync(patchPath, nextText, "utf8");+ }++ process.stdout.write(`MCP server "ocu" -> ${commandPath}\n`);+ process.stdout.write(`DSH profile patch: ${patchPath} (${existing === nextText ? "already current" : "updated"})\n`);+ if (withHook) {+ process.stdout.write(`Turn-boundary hook config: ${hooksPath}\n`);+ }+}+function main(argv) {const [command, ...args] = argv;switch (command) {@@ -506,6 +678,13 @@ function main(argv) {}installOpencodeMcp(...args);return;+ case "dsh-mcp":+ if (args.length !== 4) {+ usage();+ process.exit(1);+ }+ installDshMcp(...args);+ return;case "codex-plugin-version":if (args.length !== 1) {usage();diff --git a/scripts/install-dsh-mcp.sh b/scripts/install-dsh-mcp.shnew file mode 100755index 0000000..53084ce--- /dev/null+++ b/scripts/install-dsh-mcp.sh@@ -0,0 +1,196 @@+#!/usr/bin/env bash++set -euo pipefail++script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"+repo_root="$(cd "${script_dir}/.." && pwd)"+config_helper="${script_dir}/install-config-helper.mjs"+skill_source="${repo_root}/skills/open-computer-use"++dsh_home="${DSH_HOME:-${HOME}/.dsh}"+profile_name="web"+command_override=""+with_hook=1+with_skill=1++usage() {+ cat <<'EOF'+Usage: ./scripts/install-dsh-mcp.sh [options]++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.++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.++Options:+ --profile <name> DSH profile to patch (default: web)+ --dsh-home <dir> Harness home (default: $DSH_HOME or ~/.dsh)+ --command <path> Executable DSH spawns for the MCP server (default: auto-detect)+ --no-hook Do not write the turn-boundary hook config or its patch row+ --no-skill Do not copy the skill into <dsh-home>/skills+ -h, --help Show this help.++Environment:+ DSH_HOME Harness home; same meaning as --dsh-home+ OPEN_COMPUTER_USE_COMMAND Same meaning as --command++Why the hook is part of this installer:+ Open Computer Use hides its software cursor only at a turn boundary, signalled+ by the MCP notifications/turn-ended notification. dsh-mcp-client never sends+ that notification, so without the hook the cursor stays on screen after the+ first action of any session or subagent. The hook maps DSH's Stop point onto+ the Open Computer Use CLI. Use --no-hook only if you do not want the cursor.+EOF+}++while [[ $# -gt 0 ]]; do+ case "$1" in+ --profile)+ if [[ $# -lt 2 || -z "${2:-}" ]]; then+ echo "--profile requires a value" >&2+ exit 1+ fi+ profile_name="$2"+ shift 2+ ;;+ --dsh-home)+ if [[ $# -lt 2 || -z "${2:-}" ]]; then+ echo "--dsh-home requires a value" >&2+ exit 1+ fi+ dsh_home="$2"+ shift 2+ ;;+ --command)+ if [[ $# -lt 2 || -z "${2:-}" ]]; then+ echo "--command requires a value" >&2+ exit 1+ fi+ command_override="$2"+ shift 2+ ;;+ --no-hook)+ with_hook=0+ shift+ ;;+ --no-skill)+ with_skill=0+ shift+ ;;+ -h|--help)+ usage+ exit 0+ ;;+ *)+ echo "Unknown argument: $1" >&2+ usage >&2+ exit 1+ ;;+ esac+done++if ! command -v node >/dev/null 2>&1; then+ echo "node is required to update the DSH profile patch" >&2+ exit 1+fi++# DSH spawns this path directly (no shell), so it must be an executable file.+resolve_command() {+ local -a candidates=()++ if [[ -n "${command_override}" ]]; then+ candidates+=("${command_override}")+ fi+ if [[ -n "${OPEN_COMPUTER_USE_COMMAND:-}" ]]; then+ candidates+=("${OPEN_COMPUTER_USE_COMMAND}")+ fi++ candidates+=(+ "${HOME}/Applications/Open Computer Use (Dev).app/Contents/MacOS/OpenComputerUse"+ "${HOME}/Applications/Open Computer Use.app/Contents/MacOS/OpenComputerUse"+ "/Applications/Open Computer Use (Dev).app/Contents/MacOS/OpenComputerUse"+ "/Applications/Open Computer Use.app/Contents/MacOS/OpenComputerUse"+ )++ local npm_root=""+ if command -v npm >/dev/null 2>&1; then+ npm_root="$(npm root -g 2>/dev/null || true)"+ if [[ -n "${npm_root}" ]]; then+ candidates+=(+ "${npm_root}/open-computer-use/dist/Open Computer Use.app/Contents/MacOS/OpenComputerUse"+ "${npm_root}/open-computer-use/dist/Open Computer Use (Dev).app/Contents/MacOS/OpenComputerUse"+ )+ fi+ fi++ local shim=""+ shim="$(command -v open-computer-use 2>/dev/null || true)"+ if [[ -n "${shim}" ]]; then+ candidates+=("${shim}")+ fi++ local candidate=""+ for candidate in "${candidates[@]}"; do+ if [[ -x "${candidate}" ]]; then+ printf '%s\n' "${candidate}"+ return 0+ fi+ done++ return 1+}++command_path=""+if ! command_path="$(resolve_command)"; then+ cat >&2 <<'EOF'+Could not find an Open Computer Use executable to register.++Pass one explicitly, or make one available first:+ --command "/path/to/Open Computer Use.app/Contents/MacOS/OpenComputerUse"+ npm install -g open-computer-use+ make app # from a source checkout, then install the built bundle++A DSH profile spawns the executable directly, so the path must exist and be+executable; a bare command name resolved through PATH is not enough unless it is+an absolute path.+EOF+ exit 1+fi++profile_dir="${dsh_home}/profiles/${profile_name}"+patch_path="${profile_dir}/cordis.patch.yml"+hooks_path="${dsh_home}/ocu-hooks.json"++mkdir -p "${profile_dir}"++node "${config_helper}" dsh-mcp "${patch_path}" "${hooks_path}" "${command_path}" "${with_hook}"++if [[ "${with_hook}" -eq 0 ]]; then+ echo "Turn-boundary hook skipped (--no-hook); the software cursor can stay on screen between turns." >&2+fi++if [[ "${with_skill}" -eq 1 ]]; then+ if [[ -d "${skill_source}" ]]; then+ node "${config_helper}" copy-into-dir "${dsh_home}/skills" "${skill_source}"+ else+ echo "Skill source not found at ${skill_source}; skipping the skill copy." >&2+ fi+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)++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:++ "${command_path}" doctor+EOFdiff --git a/scripts/npm/build-packages.mjs b/scripts/npm/build-packages.mjsindex 64ff43b..99dbc4c 100644--- a/scripts/npm/build-packages.mjs+++ b/scripts/npm/build-packages.mjs@@ -227,6 +227,7 @@ const installCommands = new Map([["install-gemini-mcp", "install-gemini-mcp.sh"],["install-codex-mcp", "install-codex-mcp.sh"],["install-opencode-mcp", "install-opencode-mcp.sh"],+ ["install-dsh-mcp", "install-dsh-mcp.sh"],["install-codex-plugin", "install-codex-plugin.sh"],]);@@ -249,6 +250,7 @@ Commands:install-gemini-mcp Install the MCP server into Gemini CLI config.install-codex-mcp Install the MCP server into ~/.codex/config.toml.install-opencode-mcp Install the MCP server into ~/.config/opencode.+ install-dsh-mcp Install the MCP server into a DeepSeek Harness profile.install-codex-plugin Install this npm package into the local Codex plugin cache.help [command] Show general or command-specific help.version Print the CLI version.@@ -339,6 +341,11 @@ if (command === "-h" || command === "--help" || (command === "help" && args.lengprocess.exit(0);}+if (command === "help" && args[1] === "install-dsh-mcp") {+ printInstallHelp("install-dsh-mcp.sh", "open-computer-use install-dsh-mcp [--profile <name>] [--command <path>] [--no-hook] [--no-skill]");+ process.exit(0);+}+if (command === "help" && args[1] === "install-codex-plugin") {printInstallHelp("install-codex-plugin.sh", "open-computer-use install-codex-plugin");process.exit(0);@@ -536,8 +543,10 @@ function renderMetaPackageJson(packageName, version) {"scripts/install-config-helper.mjs","scripts/install-codex-mcp.sh","scripts/install-opencode-mcp.sh",+ "scripts/install-dsh-mcp.sh","scripts/install-codex-plugin.sh","scripts/postinstall.mjs",+ "skills/open-computer-use/","README.md","LICENSE",],@@ -550,13 +559,16 @@ function copyInstallerScripts(packageRoot) {cpSync(path.join(repoRoot, "scripts", "install-config-helper.mjs"), path.join(packageRoot, "scripts", "install-config-helper.mjs"));cpSync(path.join(repoRoot, "scripts", "install-codex-mcp.sh"), path.join(packageRoot, "scripts", "install-codex-mcp.sh"));cpSync(path.join(repoRoot, "scripts", "install-opencode-mcp.sh"), path.join(packageRoot, "scripts", "install-opencode-mcp.sh"));+ cpSync(path.join(repoRoot, "scripts", "install-dsh-mcp.sh"), path.join(packageRoot, "scripts", "install-dsh-mcp.sh"));cpSync(path.join(repoRoot, "scripts", "install-codex-plugin.sh"), path.join(packageRoot, "scripts", "install-codex-plugin.sh"));+ cpSync(path.join(repoRoot, "skills", "open-computer-use"), path.join(packageRoot, "skills", "open-computer-use"), { recursive: true });for (const scriptName of ["install-claude-mcp.sh","install-gemini-mcp.sh","install-codex-mcp.sh","install-opencode-mcp.sh",+ "install-dsh-mcp.sh","install-codex-plugin.sh",]) {chmodSync(path.join(packageRoot, "scripts", scriptName), 0o755);diff --git a/scripts/tests/install-dsh-mcp.test.sh b/scripts/tests/install-dsh-mcp.test.shnew file mode 100755index 0000000..cce3811--- /dev/null+++ b/scripts/tests/install-dsh-mcp.test.sh@@ -0,0 +1,91 @@+#!/usr/bin/env bash+#+# Behavioural test for scripts/install-dsh-mcp.sh: it must register a runnable+# MCP command, add the turn-boundary hook, leave the user's own patch rows alone,+# stay idempotent, and honour --no-hook / --no-skill.++set -euo pipefail++repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"+installer="${repo_root}/scripts/install-dsh-mcp.sh"++work_dir="$(mktemp -d)"+cleanup() {+ rm -rf "${work_dir}"+}+trap cleanup EXIT++fail() {+ echo "FAIL: $1" >&2+ exit 1+}++pass() {+ echo "ok - $1"+}++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}"+chmod +x "${fake_command}"++dsh_home="${work_dir}/dsh"+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++patch="${profile_dir}/cordis.patch.yml"+hooks="${dsh_home}/ocu-hooks.json"++grep -q "id: mcp-open-computer-use" "${patch}" || fail "patch is missing the MCP row"+grep -q "id: ocu-turn-ended-hook" "${patch}" || fail "patch is missing the turn-boundary hook row"+grep -q "id: web-runtime" "${patch}" || fail "the installer dropped the user's existing rows"+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 "${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");+const data = JSON.parse(fs.readFileSync(process.argv[1], "utf8"));+const command = data.hooks.Stop[0].hooks[0].command;+if (!command.includes("turn-ended")) process.exit(1);+if (!command.trimStart().startsWith(String.fromCharCode(34))) process.exit(1);' "${hooks}" || fail "hook config is not the expected quoted Stop command"+pass "hook config runs turn-ended with a quoted command path"++[[ -f "${dsh_home}/skills/open-computer-use/SKILL.md" ]] || fail "skill was not copied into the DSH skill root"+pass "skill is installed into the DSH skill root"++before="$(cksum < "${patch}")"+"${installer}" --dsh-home "${dsh_home}" --command "${fake_command}" >/dev/null+[[ "$(cksum < "${patch}")" == "${before}" ]] || fail "re-running changed the patch"+[[ "$(grep -c 'managed by install-dsh-mcp.sh' "${patch}")" == "1" ]] || fail "re-running duplicated the managed block"+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+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+if [[ -f "${no_hook_home}/ocu-hooks.json" ]]; then+ fail "--no-hook still wrote the hook config"+fi+if [[ -d "${no_hook_home}/skills" ]]; then+ fail "--no-skill still copied the skill"+fi+pass "--no-hook and --no-skill are honoured"++conflict_home="${work_dir}/dsh-conflict"+conflict_profile="${conflict_home}/profiles/web"+mkdir -p "${conflict_profile}"+printf -- "- insert:\n - id: mcp-open-computer-use\n name: '@deepseek-ai/dsh-mcp-client'\n" > "${conflict_profile}/cordis.patch.yml"+if "${installer}" --dsh-home "${conflict_home}" --command "${fake_command}" >/dev/null 2>&1; then+ fail "installer accepted a hand-written row it would duplicate"+fi+if [[ -f "${conflict_home}/ocu-hooks.json" ]]; then+ fail "installer wrote hook config before refusing the conflicting patch"+fi+pass "a hand-written duplicate row is refused instead of duplicated"++echo "install-dsh-mcp tests passed"diff --git a/skills/open-computer-use/references/installation.md b/skills/open-computer-use/references/installation.mdindex 88d45f2..c76f220 100644--- a/skills/open-computer-use/references/installation.md+++ b/skills/open-computer-use/references/installation.md@@ -71,6 +71,39 @@ Codex App can also use the plugin installer:open-computer-use install-codex-plugin```+Install into DeepSeek Harness (DSH):++```sh+open-computer-use install-dsh-mcp+ocu install-dsh-mcp++# from a source checkout+./scripts/install-dsh-mcp.sh+```++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.++It also installs two things a DSH host needs beyond the MCP entry:++- **The turn-boundary hook.** Open Computer Use hides its software cursor only at+ a turn boundary, signalled by the MCP `notifications/turn-ended` notification.+ `dsh-mcp-client` never sends that notification, so without the hook the cursor+ stays on screen after the first action of any session or subagent. The+ installer writes `<dsh-home>/ocu-hooks.json` and maps DSH's Stop point onto+ `open-computer-use turn-ended`. Pass `--no-hook` to skip both.+- **The skill.** Copied to `<dsh-home>/skills/open-computer-use`, which DSH scans+ as a user-level skill root, so every new conversation can see it. Pass+ `--no-skill` to skip.++Options: `--profile <name>`, `--dsh-home <dir>`, `--command <path>`, `--no-hook`,+`--no-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.+For any other MCP client, add a stdio server manually:```json