@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.
- package/dist/cloud/api.d.ts +3 -0
- package/dist/cloud/controller.d.ts +3 -0
- package/dist/cloud/index.js +17 -17
- package/dist/extensions/plugin/plugin-config-loader.d.ts +9 -10
- package/dist/extensions/plugin/plugin-contributions.d.ts +3 -3
- package/dist/extensions/plugin/plugin-registry.d.ts +26 -57
- package/dist/extensions/plugin/plugin-sandbox.d.ts +8 -5
- package/dist/extensions/plugin-sandbox-bootstrap.js +3 -3
- package/dist/extensions/tools/definitions.d.ts +1 -1
- package/dist/extensions/tools/types.d.ts +3 -2
- package/dist/hub/daemon/entry.d.ts +0 -8
- package/dist/hub/daemon/entry.js +225 -226
- package/dist/hub/daemon/index.d.ts +24 -0
- package/dist/hub/discovery/index.d.ts +8 -1
- package/dist/hub/index.js +212 -212
- package/dist/hub/runtime-host/hub-runtime-host.d.ts +3 -0
- package/dist/index.js +229 -229
- package/dist/remote/remote-environments.d.ts +1 -0
- package/dist/services/telemetry/index.js +1 -1
- package/package.json +8 -12
- package/dist/remote/remote-helper-entry.d.ts +0 -1
- package/dist/remote/remote-helper-entry.js +0 -5
- package/dist/remote/remote-helper.d.ts +0 -29
- package/dist/remote/remote-helper.js +0 -4
|
@@ -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"
|
|
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
|
-
*
|
|
43
|
-
*
|
|
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
|
|
58
|
-
*
|
|
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
|
-
*
|
|
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
|
-
/**
|
|
74
|
+
/** Worker mode: the registry to load through. Defaults to the process-wide one. */
|
|
76
75
|
registry?: PluginRegistry;
|
|
77
|
-
/**
|
|
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
|
|
40
|
-
*
|
|
41
|
-
*
|
|
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 {
|
|
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
|
|
91
|
-
*
|
|
92
|
-
* setup, hook, tool, command, rule, and message-builder
|
|
93
|
-
* a timeout and error capture, and the result is
|
|
94
|
-
* failures are visible instead of silently dropping
|
|
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-
|
|
109
|
-
* started afterwards use the new
|
|
110
|
-
* they set up, which stays callable unless
|
|
111
|
-
* is then turned off for every session,
|
|
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
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
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
|
-
|
|
105
|
+
preload(input: Pick<PluginSessionLoadInput, "pluginPaths" | "disabledPluginPaths" | "discoveryFailures" | "exportName" | "importTimeoutMs">): Promise<PluginStatusRecord[]>;
|
|
120
106
|
/**
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
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
|
|
119
|
+
private refreshEntry;
|
|
141
120
|
private startWorkerCopy;
|
|
142
|
-
/** Re-validates a
|
|
143
|
-
private
|
|
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
|
|
177
|
-
*
|
|
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
|
-
*
|
|
112
|
-
*
|
|
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
|
|
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[];
|