rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:ckanner/dsh-plugin-lcu
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
English | 中文
Drive the desktop and Chrome from DeepSeek Harness using the computer-use runtime that ships inside the ChatGPT desktop application.
This plugin launches that runtime directly and speaks to it over MCP. It is the whole integration: locating and validating the application, building the environment the runtime expects, the approval bridge, the turn lifecycle, and the macOS service wrapper that performs per-turn cleanup. Nothing else has to be installed — no wrapper project, no second interpreter, no Python.
No Codex or ChatGPT authentication is involved. The runtime comes from your local installation and is never downloaded, rewritten or authenticated.
| Tool | What it does |
|---|---|
lcu_cua |
The PTC bridge to the desktop/browser runtime. cua.getState, cua.getApp, cua.getBrowser, cua.getTab and cua.createBrowserTab return values or handles; handle methods (screenshots, clicks, typing, AX reads) run through the same binding. |
The plugin adds the bridge, not a native js tool. PTC programs initialize it with
connectCua and use the runtime exactly like the old cua object:
var { connectCua } = await import('<profile>/node_modules/dsh-plugin-lcu/lib/bridge.js')
var cua = connectCua((request) => tools.lcu_cua(request), text => console.log(text))
const state = await cua.getState()
const app = await cua.getApp('Finder')
cua.stopApp(app?) lists or releases held applications; cua.reset() clears the
runtime. The old host-only turn_ended / js_add_node_module_dir tools remain
internal and are never shown to the model.
Screenshots are prepared through DSH's attachment store when the active route declares image input. Projection, model delivery, and attachment to a run are separate facts; see the managed media contract.
| OS | macOS on Apple Silicon. The launcher resolves a macOS application bundle and the lifecycle wrapper is a macOS service; other platforms would need both revisited. |
| ChatGPT desktop app | Installed at /Applications/ChatGPT.app (or configured with app). It supplies the runtime, its instructions and the signed helper. |
| DSH | A profile you can install a bundle into. |
There is no Python requirement and no separate runtime to install. The plugin starts the application's
own node and its own entry point.
Installing makes the plugin's one row active in that profile. It opens nothing at load time.
dsh plugin --profile <profile> add dsh-plugin-lcu
For the desktop app's managed profile, the CLI refuses; install it through the app's plugin manager (Settings ▸ Plugins) instead, which runs the same pnpm operation.
DSH agent presets have no inheritance: a preset's config.plugins is its complete plugin list, and
a patch replaces a whole entry rather than merging into it. So a custom preset must restate its base —
and the base ships inside the application and changes when DSH is upgraded.
That restatement is not part of this package. It serves more than one plugin, and the region it writes is also written by DSH's own settings UI, so it lives on its own:
git clone https://github.com/ckanner/dsh-preset-generator
node dsh-preset-generator/src/gen-presets.mjs --profile ~/.dsh/profiles/<profile>
This writes a marked block into that profile's cordis.patch.yml containing two presets:
| Preset | Base | Adds |
|---|---|---|
daily |
the shipped ptc preset |
its delegation provider; LCU when included in the plugin allowlist |
heavy |
the shipped ptc preset |
its delegation provider; LCU when included in the plugin allowlist |
Re-run it after a DSH upgrade so the copies keep up. --daily-only emits just daily, --dry-run
prints without writing, and --out FILE writes somewhere else. The official Codex tool is no longer
a per-preset row: since DSH 0.2.1 the official bundle contributes a global subagent_codex, and
a separate provider registers its own same-named tool per Agent for the generated presets, shadowing
the global one. Two registrations in one scope still collide, so nothing may enable a same-name
tool-subagent row beside that provider.
Both presets use PTC. The plugin's PTC bridge turns the runtime's
cuaobject into atools.lcu_cuabinding, so the model writes onerun_codeprogram instead of nesting ajsstring inside another JavaScript program.
The plugin is one root row with a presets allowlist. Edit the installed cordis.patch.yml
(or the profile patch) to match the preset ids you generated:
- id: lcu
name: 'dsh-plugin-lcu'
config:
presets:
- daily
- heavy
Restart the harness — plugin code and configuration changes are not hot-reloaded. Then start a task in either mode and ask it to do something harmless:
Use the PTC
cuabridge to runawait cua.getState();and tell me which apps are running.
The first time an app is touched, the runtime asks for approval. See below.
On the first attach the plugin resolves the application and writes what it found to the diagnostic log:
app: /Applications/ChatGPT.app version=26.1002.52244 runtime=0.0.29/20261003001300-807782c586fc
attach: launching /Applications/ChatGPT.app/Contents/Resources/cua_node/bin/node [...]
If the application is missing or one of its files is writable by another account, attach is refused with the reason instead, and the session simply runs without the capability.
config:
chrome: true
This turns on the runtime's browser surface. The browser half of the runtime is OpenAI's, and driving a page
happens through the official ChatGPT Chrome extension, which talks to a native messaging host. On a machine
where the ChatGPT desktop application is installed that host is already registered, so nothing further is
needed: enable the extension in the profile you want to drive, and confirm it appears in cua.getState().
Sites stay exact-origin approvals.
Every site the runtime wants to use asks once. To skip the prompt for origins you trust, list exact
origins — the message must round-trip through new URL(...).origin unchanged:
config:
allowedOrigins:
- http://localhost:3000
The diagnostic log names every origin that was asked, which is the easiest way to discover them.
Pick an enabled mode when you start a task. The tools are attached per Agent: a session in any other mode never sees them, and never spawns the runtime.
Typical asks:
Take a screenshot of the Finder window and tell me its resolution.
List my current Chrome tabs.
Open Safari, go to example.com and read the page title.
Schedulers can explicitly mount LCU on a live SDK root or admitted descendant through
dsh-plugin-lcu/managed, with real identity, GUI lease admission, awaited cancellation/cleanup
receipts, and media facts. This does not inherit or impersonate a desktop preset.
See the public API and lifecycle contract.
| Field | Default | Meaning |
|---|---|---|
app |
/Applications/ChatGPT.app |
The application whose runtime provides computer use. |
command |
unset | An explicit executable that replaces the computed launch, for an application the built-in resolution cannot reach. It bypasses the runtime's own environment setup. |
chrome |
false |
Enable the browser surface. |
audio |
false |
Enable the runtime's computer-audio API. |
presets |
["daily", "heavy"] |
Agent preset ids whose sessions get the PTC bridge. |
allowedOrigins |
[] |
Exact HTTP(S) origins answered without asking. Invalid entries are dropped, never widened. |
allowedApps |
[] |
Bundle identifiers computer use may use without asking. The application hosting the agent is refused even when it is listed here. |
sectionOrder |
0 |
Prompt section order for the injected runtime instructions. |
The model cannot approve anything. Every decision is a person's:
allowedOrigins only ever matches an exact
origin; a trailing slash, a path, or different case is a different origin and is asked, not granted.The plugin keeps no permission cache of its own; Always allow is remembered by the runtime, per app.
Every approval belongs to a person, and an unanswered question is a refusal — the runtime does not default to granting. A run with nobody at the keyboard therefore has to have both halves already decided:
config:
allowedApps:
- com.google.Chrome # use this application without asking
allowedOrigins:
- https://example.com # and reach this exact origin without asking
allowedApps is matched against the bundle identifier, case-insensitively. The
application hosting the agent is refused before the list is consulted, so no
entry can authorize it.allowedOrigins matches an exact origin only; a path, a trailing slash or
different case is a different origin and is still asked.The diagnostic log names every application and origin that was asked
(approval: site https://example.com asking (add it to allowedOrigins to skip this)),
which is how to discover the exact values a run needs.
src/app.ts locate and validate the application; build the runtime environment; plan the launch
src/connection.ts the MCP client: handshake, tool discovery, calls, elicitation, lifecycle
src/approval.ts approval-shape recognition and label→value mapping
src/host-guard.ts the anti-self-approval guard
src/tool.ts tool definitions, text projection, durable screenshots
src/index.ts the desktop plugin: preset-driven per-Agent attachment
src/managed.ts public SDK attachment, resource admission, receipts and evidence facts
src/authority.ts shared exact app/origin authorization
src/control.ts the relay that carries the runtime's control API to and from the wrapper
src/session.ts the connection, following the application across an update
src/diag.ts the attach/approval diagnostic log
helper/sky-service.mjs the runtime's Sky service: the turn-ended hook and the control channel
The runtime is launched directly. src/app.ts finds ChatGPT.app, checks that the pieces it needs are
present and not writable by another account, and computes the environment the runtime expects — its own node
and node_repl, its module roots, its trusted code paths, the API surface, the signed helper it launches for
the macOS native pipe. It does not set NODE_REPL_TRUSTED_SERVICES to the application's default: see below.
The turn-ended hook is the one thing the runtime lacks. A turn that never ends is a turn whose
per-application Stop is never released, and the application then refuses every later turn. The runtime exposes
addTurnEndedHandler to its trusted services but installs no handler of its own, so
helper/sky-service.mjs is loaded as the sky trusted service: it forwards every request to the
application's own service unchanged and adds the hook, which asks the application to clean up a finished turn
through the application's own signed client.
That is deliberately less than the obvious implementation. Signalling a supervisor process, which then spawns
the signed client with a turn-ended argument, needs Apple Events — which macOS refuses to grant, and
refuses to even prompt for, when a hardened-runtime harness is the responsible process. That step always times
out. The application's own IPC is the step that performs the cleanup, it needs no Apple Events, and it settles
in tens of milliseconds. There is no supervisor process, and no lifetime socket.
The control channel is a relay, and the plugin serves it. Releasing one application early needs the
runtime's control API, which lives inside the runtime's process. The wrapper connects to a socket the plugin
serves, announces itself as the service, reports the turn contexts it has seen, and answers status and
stop requests there. The relay decides nothing: whether a session and turn are real, and whether an
application is actually held, are questions only the wrapper can answer, because only it has the turn
metadata the runtime keys that state by.
Two details of that channel are not guessable. The wrapper runs inside the runtime's JavaScript sandbox, which
refuses an ordinary socket connection with EPERM — for the per-user temporary directory and /private/tmp
alike — so it connects through the runtime's own nativePipe API instead. And that pipe silently drops a
string write; messages have to be written as buffers, which is easy to mistake for a peer that never
answered.
No MCP SDK dependency. The harness's own MCP bridge declares capabilities: {} and therefore cannot answer
elicitation — which is exactly how the runtime asks for approval — and pulling a second SDK into a profile
plugin would pin a version the host does not own. MCP over stdio is newline-delimited JSON-RPC, so the wire is
owned here. Together with type-only imports of the DSH packages, the plugin has no runtime dependencies at
all.
Tools are registered per Agent, not at mount. The server owns the tool schemas, so they can only be fetched after the handshake. An Agent's connection is opened when the Agent is created or when it commits a preset choice, and everything the plugin contributes is registered into that Agent's own context, so it unwinds on disposal.
Both preset timings are handled. A new task is created with the deployment default and the picker's
choice is applied afterwards, so agent/created alone would see the wrong composition; the registry
re-emits agent-preset/selected, and the plugin reacts to that too.
Lazy by construction. Nothing starts at load time. No enabled session, no runtime process.
Instructions are injected. The server's initialize.instructions becomes a prompt section on the
Agent. It is short by design — the API manual lives in the js tool description and in the first tool
result.
Everything the plugin decides about attaching, launching and approving is appended to:
~/.dsh/lcu-diag.log
It rotates by starting over past 1 MB. LCU_DIAG=0 disables it. This is the first place to look: the
harness has no plugin-log surface a running session can read, and a failing agent/created listener is
otherwise swallowed silently.
| Symptom | Cause and fix |
|---|---|
| Tools never appear in an enabled mode | Check the log for decide … composed=. If the composed preset is not in presets, fix the allowlist. If there is no agent-preset/selected line, the mode was never committed. |
computer use is unavailable (…) at load, or no tools |
The application could not be resolved. The log names the reason and the path; check app. |
no userQuestions service -> cancel (fail closed) |
The approval surface is not mounted in this profile. |
refusing to approve the app hosting this agent |
Working as designed; ask for a different app. |
| The ChatGPT app still shows computer use on an app | Ask for cua.stopApp(), or close the session — the connection owns the runtime process tree and releases it on the way out. |
Chrome tabs never appear with chrome: true |
The official extension is not enabled in that browser profile. Open chrome://extensions, enable it, and confirm it shows up in cua.getState(). |
| An application refuses every turn with "explicitly stopped by the user" | The host application's turn cleanup has not run. Check the log for a turn cleanup failure, and quit and relaunch the ChatGPT application to clear the state. |
node scripts/probe-lcu.mjs starts the runtime with no harness involved and prints the protocol version,
server identity, instructions length and the tool list — useful to separate a plugin problem from a runtime
problem.
helper/sky-service.mjs has three diagnostic switches, all default off, because it runs where the obvious
channels do not work: the runtime's JavaScript sandbox denies file writes, and it captures console output.
DSH_SKY_DEBUG=1 traces the hook, DSH_SKY_REPORT=1 makes the next call fail with the last cleanup outcome,
and DSH_SKY_FORCE_ERROR=1 proves the module loaded at all.
LCU (MIT, Amont Labs) is the project that showed this was possible: Codex computer use, decoupled from the app. It locates the same runtime and exposes it over MCP.
This plugin does that job itself, and no longer installs or invokes LCU. The differences that matter:
scripts/ also ships two tools for the sibling Codex subagent bundle, because the same profile
usually wants both:
update-codex.mjs — keeps the profile's @openai/codex on the newest release that still passes
three gates (handshake, protocol-schema assertions, and a real turn), rolling back automatically when
one fails. The published @deepseek-ai/dsh-subagent-codex pins 0.153.4, which does not serve every
current ChatGPT-account model; this bumps it through a profile-level, scoped pnpm override. See
node scripts/update-codex.mjs --help for --check, --verify-only, --to and --rollback.codex-baseline.json — the last version that passed all three gates.cua.stopApp() — and pressing
Esc on the host application's "using your computer" banner — ask the runtime to stop using one application
for the current turn. The plugin performs the host application's turn-ended cleanup through its own IPC, so
the next turn can use that application again, and cua.stopApp() with no argument reports what is held.
If an application is still refused every turn, that cleanup failed and the log says so. Ordinary use —
screenshots, clicks, typing, browser tabs — is unaffected; the plugin's tool description says so, so a
model does not stop an application on its own initiative.js sandbox cannot write files. Every write fails with EPERM, including in the temporary
directory, so a screenshot cannot be saved from inside js. Images are delivered to the harness as
attachments instead, and each stored image reports its host filesystem path in the tool result;
copying one into the workspace is a one-line bash call (install -m 644 '<path>' <target> — the
store keeps its objects mode 400). The plugin states both in the tool result and in the instructions
it injects.npm install
npm run typecheck # strict, noUncheckedIndexedAccess, exactOptionalPropertyTypes
npm run build # emits lib/
npm test # node --test, no build step
npm run test:packed # consume emitted JS through the actual package exports
The connection and launcher suites talk to the real installed computer-use runtime and skip themselves
when the application is not present, so npm test is meaningful locally and still passes on CI. The
approval, projection, guard and wrapper suites are pure and always run.
Plugin code and configuration are not hot-reloaded by the harness: a running process keeps the module it loaded. Rebuild and restart to see a change.
MIT. Nothing is vendored: the native half is the application's own, and this package has no runtime dependencies. The ChatGPT application and its instructions remain under their own terms and are used from your local installation.
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek-harness。