@cline/core 0.0.93 → 0.0.94

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -29,18 +29,18 @@ export declare function resolveAgentPluginPathsWithDiagnostics(options?: Resolve
29
29
  export declare function resolveAgentPluginPaths(options?: ResolveAgentPluginPathsOptions): string[];
30
30
  export declare function resolvePluginSkillDirectoriesFromPaths(pluginPaths: ReadonlyArray<string>): string[];
31
31
  export declare function resolveAgentPluginSkillDirectories(options?: ResolveAgentPluginPathsOptions): string[];
32
- export type PluginExecutionMode = "sandbox" | "worker" | "in_process";
32
+ export type PluginExecutionMode = "sandbox" | "worker";
33
33
  export declare const CLINE_PLUGIN_MODE_ENV = "CLINE_PLUGIN_MODE";
34
34
  /**
35
35
  * Where plugins run (`CLINE_PLUGIN_MODE`, or `mode`):
36
36
  * - `worker` (default): each plugin runs in its own worker thread per
37
37
  * session, inside the host runtime. A plugin crash, `process.exit()`, or
38
38
  * hung loop ends only its worker, and no `node`/`bun` is needed on PATH.
39
- * - `in_process`: plugins are imported into the host process.
40
39
  * - `sandbox`: the previous per-session `node`/`bun` subprocess.
41
40
  *
42
- * Builds that do not ship the sandbox bootstrap (a host bundle without it)
43
- * cannot start workers and fall back to `in_process`.
41
+ * Plugin code never runs on a host's main thread. Both modes need the
42
+ * sandbox bootstrap; a build that ships none fails every plugin load with
43
+ * `PluginBootstrapMissingError` rather than importing plugins into the host.
44
44
  */
45
45
  export declare function resolvePluginExecutionMode(mode?: PluginExecutionMode): PluginExecutionMode;
46
46
  export interface ResolveAndLoadAgentPluginsOptions extends ResolveAgentPluginPathsOptions, PluginTargeting {
@@ -54,9 +54,8 @@ export interface ResolveAndLoadAgentPluginsOptions extends ResolveAgentPluginPat
54
54
  payload?: unknown;
55
55
  }) => void;
56
56
  /**
57
- * Structured workspace and git metadata. Forwarded to sandboxed plugins
58
- * via PluginSetupCtx.workspaceInfo and made available to in-process plugins
59
- * in the extension context.
57
+ * Structured workspace and git metadata, forwarded to plugins via
58
+ * PluginSetupCtx.workspaceInfo.
60
59
  */
61
60
  workspaceInfo?: WorkspaceInfo;
62
61
  session?: PluginSetupContext["session"];
@@ -67,14 +66,14 @@ export interface ResolveAndLoadAgentPluginsOptions extends ResolveAgentPluginPat
67
66
  telemetry?: PluginSetupContext["telemetry"];
68
67
  /**
69
68
  * Per-session plugin selection (`"*"` default plus per-plugin overrides).
70
- * In-process only; the sandbox loads every discovered plugin.
69
+ * Worker mode only; the subprocess sandbox loads every discovered plugin.
71
70
  */
72
71
  policy?: PluginPolicies;
73
72
  /** How a failing plugin hook affects the run. Defaults to `"ignore"`. */
74
73
  hookErrorMode?: PluginHookErrorMode;
75
- /** In-process registry. Defaults to the process-wide registry. */
74
+ /** Worker mode: the registry to load through. Defaults to the process-wide one. */
76
75
  registry?: PluginRegistry;
77
- /** In-process only: a plugin this session uses became degraded or failed. */
76
+ /** Worker mode only: a plugin this session uses became degraded or failed. */
78
77
  onIssue?: (issue: SessionPluginIssue) => void;
79
78
  }
80
79
  export declare function resolveAndLoadAgentPlugins(options?: ResolveAndLoadAgentPluginsOptions): Promise<{
@@ -36,8 +36,8 @@ export interface CollectPluginContributionsResult {
36
36
  /**
37
37
  * Runs each plugin's `setup` with a collecting API, for settings surfaces
38
38
  * that list what plugins contribute without starting a session. Plugins load
39
- * the same way sessions load them: through the shared registry (in workers
40
- * by default, or in-process), so failures are recorded there like any
41
- * other, or through the subprocess sandbox when `CLINE_PLUGIN_MODE=sandbox`.
39
+ * the same way sessions load them: through the shared registry's workers, so
40
+ * failures are recorded there like any other, or through the subprocess
41
+ * sandbox when `CLINE_PLUGIN_MODE=sandbox`.
42
42
  */
43
43
  export declare function collectPluginContributions(input: CollectPluginContributionsInput): Promise<CollectPluginContributionsResult>;
@@ -1,6 +1,6 @@
1
1
  import type { AgentExtension, BasicLogger, PluginPolicies, PluginSetupContext, PluginStatusRecord, SessionPluginIssue } from "@cline/shared";
2
2
  import type { PluginInitializationFailure, PluginInitializationWarning } from "./plugin-load-report";
3
- import { type PluginTargeting } from "./plugin-targeting";
3
+ import type { PluginTargeting } from "./plugin-targeting";
4
4
  export declare const DEFAULT_PLUGIN_IMPORT_TIMEOUT_MS = 4000;
5
5
  export declare const DEFAULT_PLUGIN_SETUP_TIMEOUT_MS = 4000;
6
6
  export declare const DEFAULT_PLUGIN_HOOK_TIMEOUT_MS = 3000;
@@ -22,17 +22,8 @@ export interface PluginRegistryOptions {
22
22
  toolTimeoutMs?: number;
23
23
  failureThreshold?: number;
24
24
  }
25
- /**
26
- * Where a session's plugin copies run. `in_process` imports them into the
27
- * host. `worker` runs each plugin in its own worker thread per session: the
28
- * host never loads plugin code, and a crash, `process.exit()`, or hung loop
29
- * ends only that worker.
30
- */
31
- export type PluginIsolation = "in_process" | "worker";
32
25
  export interface PluginSessionLoadInput extends PluginTargeting {
33
26
  sessionId?: string;
34
- /** Defaults to `in_process`. */
35
- isolation?: PluginIsolation;
36
27
  /** Resolved, enabled plugin module paths, in load order. */
37
28
  pluginPaths: ReadonlyArray<string>;
38
29
  /** Plugin paths turned off in settings; reported as `disabled`. */
@@ -78,20 +69,14 @@ export interface PluginSessionLoadResult {
78
69
  export type PluginStatusListener = (status: PluginStatusRecord) => void;
79
70
  /** The name a plugin is known by before its module is imported. */
80
71
  export declare function derivePluginNameFromPath(pluginPath: string): string;
81
- /**
82
- * Plugins written for the subprocess sandbox emit events through
83
- * `globalThis.__clinePluginHost.emitEvent`. In-process, route those calls to
84
- * the session whose hook or tool is running (async context follows timers and
85
- * promises the call started), else to the session that last called a plugin.
86
- */
87
- export declare function installPluginHostShim(): void;
88
72
  /**
89
73
  * Tracks plugins for the whole process and hands each session a guarded copy
90
- * of the plugins it enabled. Each session gets its own import of the module,
91
- * matching the per-session sandbox plugins were written for. Every import,
92
- * setup, hook, tool, command, rule, and message-builder call is wrapped with
93
- * a timeout and error capture, and the result is recorded per plugin so
94
- * failures are visible instead of silently dropping the plugin's tools.
74
+ * of the plugins it enabled. Each copy runs in its own worker thread, so
75
+ * module state is per session and plugin code never runs on the host's main
76
+ * thread. Every import, setup, hook, tool, command, rule, and message-builder
77
+ * call is wrapped with a timeout and error capture, and the result is
78
+ * recorded per plugin so failures are visible instead of silently dropping
79
+ * the plugin's tools.
95
80
  */
96
81
  export declare class PluginRegistry {
97
82
  private readonly entries;
@@ -105,42 +90,36 @@ export declare class PluginRegistry {
105
90
  list(): PluginStatusRecord[];
106
91
  get(nameOrPath: string): PluginStatusRecord[];
107
92
  /**
108
- * Re-imports the matching plugins and resets their status. Sessions
109
- * started afterwards use the new module; running sessions keep the copy
110
- * they set up, which stays callable unless the re-import fails (the plugin
111
- * is then turned off for every session, failing closed).
93
+ * Re-validates the matching plugins' current code in throwaway workers and
94
+ * resets their status. Sessions started afterwards use the new code;
95
+ * running sessions keep the copy they set up, which stays callable unless
96
+ * the re-import fails (the plugin is then turned off for every session,
97
+ * failing closed).
112
98
  */
113
99
  reload(nameOrPath: string): Promise<PluginStatusRecord[]>;
114
100
  /**
115
- * Finds the plugin whose module root appears in `error`'s stack and turns
116
- * it off for every session. Used by the Hub daemon so a stray plugin error
117
- * does not take the process down.
101
+ * Loads each plugin in a throwaway worker without attaching it to a
102
+ * session, so the Hub can discover plugins at startup and report status
103
+ * (including import errors) before any session exists.
118
104
  */
119
- attributeUncaughtError(error: unknown, label?: string): PluginStatusRecord | undefined;
105
+ preload(input: Pick<PluginSessionLoadInput, "pluginPaths" | "disabledPluginPaths" | "discoveryFailures" | "exportName" | "importTimeoutMs">): Promise<PluginStatusRecord[]>;
120
106
  /**
121
- * Imports plugins without attaching them to a session, so the Hub can
122
- * discover them at startup and report status before any session exists.
123
- * The imported copy is kept for the first session to claim.
107
+ * Each plugin loads in its own worker for this session, and the copy
108
+ * handed to the session is a proxy whose calls go to that worker. The host
109
+ * never imports plugin code. Every setup, hook, tool, command, rule, and
110
+ * message-builder call is wrapped with a timeout and error capture, and
111
+ * the result is recorded per plugin.
124
112
  */
125
- preload(input: Pick<PluginSessionLoadInput, "pluginPaths" | "disabledPluginPaths" | "discoveryFailures" | "exportName" | "importTimeoutMs" | "isolation">): Promise<PluginStatusRecord[]>;
126
113
  loadForSession(input: PluginSessionLoadInput): Promise<PluginSessionLoadResult>;
127
- /**
128
- * Worker isolation: each plugin loads in its own worker for this session,
129
- * and the copy handed to the session is a proxy whose calls go to that
130
- * worker. The copy goes through the same wrapping as an in-process one, so
131
- * status, timeouts, failure counting, policy, and notices are unchanged.
132
- * What differs is where the code runs: the host never imports it.
133
- */
134
- private loadIsolatedForSession;
135
114
  /**
136
115
  * Every worker imports the module fresh, so new code needs no host
137
116
  * re-import. A source change (or re-enabling) still starts a new import
138
117
  * id: the plugin gets a clean slate, and copies of the old code go stale.
139
118
  */
140
- private refreshIsolatedEntry;
119
+ private refreshEntry;
141
120
  private startWorkerCopy;
142
- /** Re-validates a worker plugin's current code in a throwaway worker. */
143
- private reloadIsolated;
121
+ /** Re-validates a plugin's current code in a throwaway worker. */
122
+ private reloadEntry;
144
123
  private staleIssue;
145
124
  /**
146
125
  * Records discovery failures and settings-disabled plugins. Settings-
@@ -153,16 +132,6 @@ export declare class PluginRegistry {
153
132
  private resolveTimeouts;
154
133
  private match;
155
134
  private ensureEntry;
156
- private ensureLoaded;
157
- /** Imports one copy of the module in its own call scope. */
158
- private importCopy;
159
- /**
160
- * Hands a session its own copy of the plugin module. Plugins written for
161
- * the per-session sandbox keep state at module level (one plugin object
162
- * per import), so sharing one copy across sessions would break them.
163
- */
164
- private claimInstance;
165
- private importEntry;
166
135
  private wrapForSession;
167
136
  private runSetup;
168
137
  private wrapHooks;
@@ -173,8 +142,8 @@ export declare class PluginRegistry {
173
142
  /** A failing builder leaves the message unchanged. */
174
143
  private wrapMessageBuilder;
175
144
  /**
176
- * Runs one plugin call in its session scope with a timeout, records the
177
- * outcome against the plugin, and rethrows failures.
145
+ * Runs one plugin call with a timeout, records the outcome against the
146
+ * plugin, and rethrows failures.
178
147
  */
179
148
  private guardedCall;
180
149
  /**
@@ -106,13 +106,16 @@ export declare function selectBootstrapCandidate(options: {
106
106
  file: string;
107
107
  } | {
108
108
  sourcePath: string;
109
- };
109
+ } | undefined;
110
110
  /**
111
- * Whether this build can start the sandbox bootstrap: the compiled file ships
112
- * beside it, or its TypeScript source exists (running from source). Bundles
113
- * that ship neither cannot isolate plugins.
111
+ * @internal Test hook: behave as a host that ships no bootstrap. Tests run
112
+ * from source, where the `.ts` bootstrap always resolves.
114
113
  */
115
- export declare function isPluginSandboxBootstrapAvailable(): boolean;
114
+ export declare function setPluginBootstrapUnavailableForTests(unavailable: boolean): void;
115
+ /** This build ships no `plugin-sandbox-bootstrap.js`, so no plugin can run. */
116
+ export declare class PluginBootstrapMissingError extends Error {
117
+ constructor();
118
+ }
116
119
  export declare function loadSandboxedPlugins(options: PluginSandboxOptions): Promise<{
117
120
  extensions: AgentConfig["extensions"];
118
121
  pluginPaths: string[];