dsh-plugin-lcu: Leveraging the ChatGPT Desktop App Runtime for Local Control

Introduction

In the DeepSeek Harness (DSH) ecosystem, implementing local desktop or browser automation typically requires an additional runtime environment. The dsh-plugin-lcu plugin leverages the Computer-Use API (cua) runtime built into the ChatGPT desktop application. It communicates with this runtime via the MCP protocol to drive the desktop and Chrome browser. It eliminates the need for installing additional Python interpreters or standalone runtime wrappers, directly reusing the local capabilities provided by the ChatGPT desktop application.

Features

This plugin adds three core tools to the DSH Agent:

  • js: Runs a JavaScript snippet using the cua API. The first call returns API documentation; subsequent calls after selecting an application or tab return the initial UI state.
  • js_reset: Discards the current persistent JavaScript session and starts a new runtime instance.
  • computer_use_stop: Manages applications held by the session. Without arguments, it lists current applications; passing an application Bundle ID releases that application. This clears the runtime’s “computer use active” flag without ending the entire session.

Installation

  1. Install the Plugin
    Install the plugin into the specified DSH profile. Once installed, the plugin is active within the profile but does not automatically start any processes.
    dsh plugin --profile <profile> add dsh-plugin-lcu
For profiles managed by the desktop application, please install via the in-app plugin manager (Settings -> Plugins) to avoid CLI conflicts.
  1. Generate Presets
    DSH Agent presets do not support inheritance; config.plugins is the complete list of plugins. Therefore, enabling this plugin requires manually generating the heavy preset that includes it.
    git clone https://github.com/ckanner/dsh-preset-generator
    node dsh-preset-generator/src/gen-presets.mjs --profile ~/.dsh/profiles/<profile>
This operation writes the `heavy` preset into the profile's `cordis.patch.yml`. The `heavy` mode sets the tool display method to `native`, ensuring the `js` tool is directly callable.
  1. Configure Allowlist
    Edit the profile’s configuration file (or cordis.patch.yml) and declare the allowed preset IDs in the dsh-plugin-lcu configuration section.
    - id: lcu
      name: 'dsh-plugin-lcu'
      config:
        presets:
          - heavy
  1. Restart Harness
    Plugin code and configuration changes do not support hot-reloading; the DSH Harness must be restarted for them to take effect.

Configuration

The following items can be configured in cordis.patch.yml:

  • app: Specifies the path to the application providing the runtime. Defaults to /Applications/ChatGPT.app.
  • chrome: Whether to enable browser surface features. Defaults to false.
  • allowedOrigins: A list of pre-approved website origins. When configured, the runtime skips authorization prompts when accessing these origins.

Enabling Chrome features requires installing the official ChatGPT Chrome extension.

Usage Examples

Once heavy mode is enabled, the Agent can perform the following operations:

  • Get System State: Use the js tool to run await cua.getState(); to view currently running applications and tabs.
  • Screenshot: Have the Agent capture a Finder window and read its resolution.
  • Browser Operations: Open Safari, navigate to example.com, and read the page title.
  • List Tabs: Query all current Chrome tabs.

Environment & Limitations

The following prerequisites must be met to use this plugin:

  • Operating System: Only supports macOS on Apple Silicon. The launcher needs to parse macOS application bundles, and the lifecycle wrapper is a macOS service.
  • Application Requirement: The ChatGPT desktop application must be installed at /Applications/ChatGPT.app.
  • Node Version: The locally installed Node.js version must be ^22.19.0 or >=24.0.0.
  • Runtime Source: The runtime comes from the local ChatGPT application and does not involve downloading, rewriting, or requiring additional Codex or ChatGPT authentication flows.

Summary

dsh-plugin-lcu provides a lightweight local control solution that simplifies the environment setup process by reusing the native capabilities of the ChatGPT desktop application. Combined with DSH’s plugin-based architecture, developers can directly invoke system APIs via JavaScript without introducing complex dependencies.

More details and source code: GitHub - ckanner/dsh-plugin-lcu

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye