fix(cli): keep the npm install's on-disk plugin bootstrap

An npm install sets CLINE_WRAPPER_PATH and ships the SDK and its other
packages beside the binary, and standalone plugins rely on that host lookup
(for example importing yaml without node_modules of their own). Only
standalone binaries, which have none of that on disk, switch to the embedded
worker.
This commit is contained in:
Saoud Rizwan
2026-10-14 06:21:01 +00:00
parent 3e78cad580
commit 8d09157569
+7 -4
View File
@@ -24,12 +24,15 @@ import { writeErr } from "./utils/output";
declare const CLINE_PLUGIN_WORKER_PATH: string | undefined;
// Compiled executables run plugins in their embedded worker, which serves the
// SDK from this build. Override any bootstrap a parent process configured: the
// Hub daemon and SSH remotes run this binary with no plugin files beside it.
// The subprocess sandbox spawns a separate runtime that cannot read it.
// Standalone compiled executables (the desktop's Hub, SSH remotes) have no
// plugin files beside them, so plugins run in the embedded worker, which serves
// the SDK from this build; override any bootstrap a parent configured. An npm
// install (CLINE_WRAPPER_PATH) keeps its on-disk bootstrap, whose host lookup
// also gives standalone plugins the install's other packages. The subprocess
// sandbox spawns a separate runtime that cannot read the embedded worker.
if (
typeof CLINE_PLUGIN_WORKER_PATH === "string" &&
!process.env.CLINE_WRAPPER_PATH &&
process.env.CLINE_PLUGIN_MODE !== "sandbox"
) {
process.env.CLINE_PLUGIN_BOOTSTRAP_PATH = CLINE_PLUGIN_WORKER_PATH;