Computer use CLI for AI agents
Rust accessibilityaccessibility-apiai-agentsautomationclicomputer-usecomputer-use-agentcomputer-use-agentsdesktop-automationmacosmcprust
fix: complete secure three-platform release installation (#315)
Lahfirb6420fac8506
diff --git a/Cargo.lock b/Cargo.lockindex 85c67eff3..6096476f7 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -19,7 +19,7 @@ checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"[[package]]name = "agent-desktop"-version = "0.11.0"+version = "0.11.1"dependencies = ["agent-desktop-core","agent-desktop-linux",@@ -38,7 +38,7 @@ dependencies = [[[package]]name = "agent-desktop-core"-version = "0.11.0"+version = "0.11.1"dependencies = ["base64","libc",@@ -52,7 +52,7 @@ dependencies = [[[package]]name = "agent-desktop-ffi"-version = "0.11.0"+version = "0.11.1"dependencies = ["agent-desktop-core","agent-desktop-linux",@@ -68,7 +68,7 @@ dependencies = [[[package]]name = "agent-desktop-linux"-version = "0.11.0"+version = "0.11.1"dependencies = ["agent-desktop-core","async-io",@@ -85,7 +85,7 @@ dependencies = [[[package]]name = "agent-desktop-macos"-version = "0.11.0"+version = "0.11.1"dependencies = ["accessibility-sys","agent-desktop-core",@@ -104,7 +104,7 @@ dependencies = [[[package]]name = "agent-desktop-windows"-version = "0.11.0"+version = "0.11.1"dependencies = ["agent-desktop-core","serde_json",diff --git a/Cargo.toml b/Cargo.tomlindex 06612d968..acd5d4a62 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -7,7 +7,7 @@ resolver = "2"edition = "2024"rust-version = "1.89"license = "Apache-2.0"-version = "0.11.0"+version = "0.11.1"[workspace.dependencies]clap = { version = "4.6", features = ["derive"] }diff --git a/npm/bin/agent-desktop b/npm/bin/agent-desktopindex 98157d88e..27f4befb8 100755--- a/npm/bin/agent-desktop+++ b/npm/bin/agent-desktop@@ -1,10 +1,10 @@#!/usr/bin/env nodeconst { spawn } = require('child_process');-const { existsSync, accessSync, chmodSync, constants } = require('fs');+const { existsSync, accessSync, chmodSync, lstatSync, constants } = require('fs');const { isAbsolute, join } = require('path');const { platform, arch } = require('os');-const { MACOS_HELPER_NAME, releasedKeys, resolve } = require('../lib/platform');+const { LINUX_HELPER_NAME, MACOS_HELPER_NAME, releasedKeys, resolve } = require('../lib/platform');const binDir = __dirname;const MACOS_HELPER_PATH_ENV = 'AGENT_DESKTOP_MACOS_HELPER_PATH';@@ -51,6 +51,26 @@ function main() {}}+ if (platform() === 'linux') {+ try {+ const directory = lstatSync(binDir);+ if (!directory.isDirectory()) throw new Error('Package bin path must be a directory');+ if (directory.mode & 0o022) chmodSync(binDir, directory.mode & 0o755);+ const plainHelper = join(binDir, LINUX_HELPER_NAME);+ const linuxHelper = existsSync(plainHelper)+ ? plainHelper : join(binDir, `${LINUX_HELPER_NAME}-linux-${arch()}`);+ if (existsSync(linuxHelper)) {+ const helper = lstatSync(linuxHelper);+ if (!helper.isFile()) throw new Error('Linux helper must be a regular file');+ const mode = (helper.mode & 0o755) | 0o100;+ if ((helper.mode & 0o777) !== mode) chmodSync(linuxHelper, mode);+ }+ } catch (err) {+ console.error(`Error: Cannot secure Linux package permissions: ${err.message}`);+ process.exit(1);+ }+ }+let helperPath;if (platform() === 'darwin') {const override = process.env[MACOS_HELPER_PATH_ENV];diff --git a/npm/package.json b/npm/package.jsonindex e5711499d..f4b05bb42 100644--- a/npm/package.json+++ b/npm/package.json@@ -1,6 +1,6 @@{"name": "agent-desktop",- "version": "0.11.0",+ "version": "0.11.1","description": "Reliable computer use for AI agents — observe and operate desktop apps via native accessibility trees","license": "Apache-2.0","repository": {diff --git a/npm/scripts/postinstall.js b/npm/scripts/postinstall.jsindex 24141761f..8d4b82f51 100644--- a/npm/scripts/postinstall.js+++ b/npm/scripts/postinstall.js@@ -277,6 +277,11 @@ function main() {mkdirSync(binDir, { recursive: true });}+ if (platform() === 'linux') {+ const mode = lstatSync(binDir).mode;+ if (mode & 0o022) chmodSync(binDir, mode & 0o755);+ }+if (process.env.AGENT_DESKTOP_BINARY_PATH) {const customPath = process.env.AGENT_DESKTOP_BINARY_PATH;try {diff --git a/scripts/checkout-release-source.sh b/scripts/checkout-release-source.shindex ed45afe44..21aeecc6c 100644--- a/scripts/checkout-release-source.sh+++ b/scripts/checkout-release-source.sh@@ -4,8 +4,8 @@ if [[ ! "${RELEASE_SOURCE_SHA:-}" =~ ^[0-9a-f]{40}$ ]] || [[ ! "${RELEASE_WORKFLecho "Release source and workflow must be full commit SHAs" >&2exit 1fi-if ! git merge-base --is-ancestor "$RELEASE_SOURCE_SHA" "$RELEASE_WORKFLOW_SHA"; then+if ! git -c safe.directory="$PWD" merge-base --is-ancestor "$RELEASE_SOURCE_SHA" "$RELEASE_WORKFLOW_SHA"; thenecho "Release source must belong to the triggering main history" >&2exit 1fi-git checkout --detach "$RELEASE_SOURCE_SHA"+git -c safe.directory="$PWD" checkout --detach "$RELEASE_SOURCE_SHA"diff --git a/skills/agent-desktop-ffi/SKILL.md b/skills/agent-desktop-ffi/SKILL.mdindex 4fb0667b9..21640c496 100644--- a/skills/agent-desktop-ffi/SKILL.md+++ b/skills/agent-desktop-ffi/SKILL.md@@ -1,6 +1,6 @@---name: agent-desktop-ffi-version: 0.11.0+version: 0.11.1tags: ffi, c-bindings, cdylib, python, swift, node, go, rust-ffirequirements:- agent-desktop-ffidiff --git a/skills/agent-desktop-linux/SKILL.md b/skills/agent-desktop-linux/SKILL.mdindex 27affd2a9..48d8047e9 100644--- a/skills/agent-desktop-linux/SKILL.md+++ b/skills/agent-desktop-linux/SKILL.md@@ -1,6 +1,6 @@---name: agent-desktop-linux-version: 0.11.0+version: 0.11.1tags: linux-automation, accessibility, at-spi, x11, wayland, ai-agent, gui-automation, clirequirements:- agent-desktopdiff --git a/skills/agent-desktop-macos/SKILL.md b/skills/agent-desktop-macos/SKILL.mdindex 7de0935e6..0856654c0 100644--- a/skills/agent-desktop-macos/SKILL.md+++ b/skills/agent-desktop-macos/SKILL.md@@ -1,6 +1,6 @@---name: agent-desktop-macos-version: 0.11.0+version: 0.11.1tags: macos-automation, accessibility, ax, tcc, ai-agent, gui-automation, clirequirements:- agent-desktopdiff --git a/skills/agent-desktop-windows/SKILL.md b/skills/agent-desktop-windows/SKILL.mdindex e0d4ec0ff..5033df7dc 100644--- a/skills/agent-desktop-windows/SKILL.md+++ b/skills/agent-desktop-windows/SKILL.md@@ -1,6 +1,6 @@---name: agent-desktop-windows-version: 0.11.0+version: 0.11.1tags: windows-automation, accessibility, uia, ai-agent, gui-automation, clirequirements:- agent-desktopdiff --git a/skills/agent-desktop/SKILL.md b/skills/agent-desktop/SKILL.mdindex d201608c4..80caa26ca 100644--- a/skills/agent-desktop/SKILL.md+++ b/skills/agent-desktop/SKILL.md@@ -1,6 +1,6 @@---name: agent-desktop-version: 0.11.0+version: 0.11.1tags: computer-use, desktop-automation, accessibility, ai-agent, gui-automation, clirequirements:- agent-desktopdiff --git a/tests/npm/bundled.test.js b/tests/npm/bundled.test.jsindex 30a9c5855..9b427b49c 100644--- a/tests/npm/bundled.test.js+++ b/tests/npm/bundled.test.js@@ -1,7 +1,7 @@const assert = require('node:assert/strict');const { execFileSync } = require('node:child_process');const { createHash } = require('node:crypto');-const { cpSync, mkdirSync, mkdtempSync, realpathSync, readFileSync, writeFileSync } = require('node:fs');+const { cpSync, mkdirSync, mkdtempSync, realpathSync, readFileSync, writeFileSync, chmodSync, statSync, renameSync, symlinkSync } = require('node:fs');const { tmpdir } = require('node:os');const { join, resolve } = require('node:path');const { test } = require('node:test');@@ -67,3 +67,40 @@ test('release packaging rejects a modified archive before installing its executa[join(root, 'scripts/prepare-npm-binaries.js'), archives], { stdio: 'pipe' }),(error) => error.stderr.toString().includes('Checksum mismatch'));});++test('blocked-script Linux launch removes write access without broadening private helpers', {+ skip: process.platform === 'win32',+}, () => {+ for (const mode of [0o775, 0o700]) {+ const { root, archives } = fixture();+ execFileSync(process.execPath, [join(root, 'scripts/prepare-npm-binaries.js'), archives]);+ const bin = join(root, 'npm/bin');+ const helper = join(bin, 'agent-desktop-linux-clipboard-owner-linux-x64');+ chmodSync(bin, mode);+ chmodSync(helper, mode);+ const stub = join(root, 'os-stub.js');+ writeFileSync(stub, "const os = require('os'); os.platform = () => 'linux'; os.arch = () => 'x64';");+ execFileSync(process.execPath, ['-r', stub, join(bin, 'agent-desktop'), 'version']);+ assert.equal(statSync(bin).mode & 0o777, mode & 0o755);+ assert.equal(statSync(helper).mode & 0o777, mode & 0o755);+ }+});++test('Linux permission repair refuses helper symlinks without changing their target', {+ skip: process.platform === 'win32',+}, () => {+ const { root, archives } = fixture();+ execFileSync(process.execPath, [join(root, 'scripts/prepare-npm-binaries.js'), archives]);+ const bin = join(root, 'npm/bin');+ const helper = join(bin, 'agent-desktop-linux-clipboard-owner-linux-x64');+ const outside = join(root, 'outside-helper');+ renameSync(helper, outside);+ chmodSync(outside, 0o775);+ symlinkSync(outside, helper);+ const stub = join(root, 'os-stub.js');+ writeFileSync(stub, "const os = require('os'); os.platform = () => 'linux'; os.arch = () => 'x64';");+ assert.throws(() => execFileSync(process.execPath,+ ['-r', stub, join(bin, 'agent-desktop'), 'version'], { stdio: 'pipe' }),+ (error) => error.stderr.toString().includes('Linux helper must be a regular file'));+ assert.equal(statSync(outside).mode & 0o777, 0o775);+});diff --git a/tests/release/prepare.test.js b/tests/release/prepare.test.jsindex 45f626428..c7ade0e13 100644--- a/tests/release/prepare.test.js+++ b/tests/release/prepare.test.js@@ -66,10 +66,16 @@ test('release checkout accepts only commits in the triggering history', { skip:git('commit', '-qm', 'test: create unrelated history');const unrelated = git('rev-parse', 'HEAD');git('checkout', '--detach', workflow);- for (const source of [unrelated, 'main; exit 0', ancestor]) {+ for (const scenario of [+ { source: unrelated }, { source: 'main; exit 0' }, { source: ancestor },+ { source: ancestor, differentOwner: '1' },+ ]) {+ git('checkout', '--detach', workflow);+ const { source, differentOwner } = scenario;const result = spawnSync('bash', [resolve(__dirname, '../../scripts/checkout-release-source.sh')], {cwd: root, encoding: 'utf8',- env: { ...process.env, RELEASE_SOURCE_SHA: source, RELEASE_WORKFLOW_SHA: workflow },+ env: { ...process.env, RELEASE_SOURCE_SHA: source, RELEASE_WORKFLOW_SHA: workflow,+ GIT_TEST_ASSUME_DIFFERENT_OWNER: differentOwner },});assert.equal(result.status, source === ancestor ? 0 : 1, result.stderr);assert.equal(git('rev-parse', 'HEAD'), source === ancestor ? ancestor : workflow);