@cline/core 0.0.71 → 0.0.72

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.
@@ -23,6 +23,8 @@ export interface CronRunReportData {
23
23
  }>;
24
24
  durationMs?: number;
25
25
  error?: string;
26
+ /** Optional context for where in the run lifecycle the error occurred. */
27
+ errorContext?: string;
26
28
  triggerEvent?: CronEventLogRecord;
27
29
  }
28
30
  export interface WriteReportOptions {
@@ -1,4 +1,5 @@
1
1
  import { type BasicLogger, type ChatRunTurnRequest, type ChatStartSessionArtifacts, type ChatStartSessionRequest, type HubScheduleCreateInput, type HubScheduleUpdateInput, type ScheduleExecutionRecord, type ScheduleExecutionStatus, type ScheduleRecord } from "@cline/shared";
2
+ import type { ResolveCronSpecsDirOptions } from "@cline/shared/storage";
2
3
  type HubScheduleTurnResult = {
3
4
  text: string;
4
5
  usage?: {
@@ -48,6 +49,12 @@ export interface HubScheduleServiceOptions {
48
49
  eventPublisher?: (eventType: string, payload: Record<string, unknown>) => void;
49
50
  logger?: BasicLogger;
50
51
  dbPath?: string;
52
+ /**
53
+ * Cron spec source/report location forwarded to the runner. Defaults to
54
+ * the global `~/.cline/cron` directory — tests must override this so run
55
+ * reports land in a temp directory instead of the user's real one.
56
+ */
57
+ specs?: ResolveCronSpecsDirOptions;
51
58
  pollIntervalMs?: number;
52
59
  globalMaxConcurrency?: number;
53
60
  claimLeaseSeconds?: number;
@@ -1,9 +1,25 @@
1
1
  import type { FetchLike } from "@modelcontextprotocol/sdk/shared/transport.js";
2
2
  import type { McpServerClientFactory } from "./types";
3
+ export declare const DEFAULT_MCP_CONNECT_TIMEOUT_MS = 3000;
3
4
  export interface DefaultMcpServerClientFactoryOptions {
4
5
  settingsPath?: string;
5
6
  clientName?: string;
6
7
  clientVersion?: string;
7
8
  fetch?: FetchLike;
8
9
  }
10
+ export interface ProbeMcpServerConnectionOptions extends Omit<DefaultMcpServerClientFactoryOptions, "settingsPath"> {
11
+ serverName: string;
12
+ filePath?: string;
13
+ }
14
+ export interface ProbeMcpServerConnectionResult {
15
+ serverName: string;
16
+ connected: boolean;
17
+ authorizationRequired: boolean;
18
+ error?: string;
19
+ }
9
20
  export declare function createDefaultMcpServerClientFactory(options?: DefaultMcpServerClientFactoryOptions): McpServerClientFactory;
21
+ /**
22
+ * Passively verifies a configured remote MCP endpoint. This may use or refresh
23
+ * existing credentials, but it never starts an interactive OAuth redirect.
24
+ */
25
+ export declare function probeMcpServerConnection(options: ProbeMcpServerConnectionOptions): Promise<ProbeMcpServerConnectionResult>;
@@ -1,11 +1,18 @@
1
1
  import type { BasicLogger } from "@cline/shared";
2
- import type { McpManager, McpServerOAuthState, McpServerOAuthStatus, McpServerRegistration } from "./types";
2
+ import type { McpManager, McpServerOAuthClientConfig, McpServerOAuthState, McpServerOAuthStatus, McpServerRegistration } from "./types";
3
3
  export interface McpSettingsFile {
4
4
  mcpServers: Record<string, Omit<McpServerRegistration, "name">>;
5
5
  }
6
6
  export interface LoadMcpSettingsOptions {
7
7
  filePath?: string;
8
8
  }
9
+ export interface UpdateMcpServerOAuthStateOptions extends LoadMcpSettingsOptions {
10
+ /**
11
+ * When present, only update OAuth state while the server still has this
12
+ * configured client. `null` asserts that dynamic registration is still in use.
13
+ */
14
+ expectedOAuthClient?: McpServerOAuthClientConfig | null;
15
+ }
9
16
  export interface RegisterMcpServersFromSettingsOptions {
10
17
  filePath?: string;
11
18
  }
@@ -24,6 +31,9 @@ export type McpSettingsMutator<T> = (settings: Record<string, unknown>) => T;
24
31
  export declare class McpSettingsUpdateSkippedError extends Error {
25
32
  constructor(message: string);
26
33
  }
34
+ export declare class McpOAuthClientChangedError extends Error {
35
+ constructor(serverName: string);
36
+ }
27
37
  export declare class McpSettingsLockTimeoutError extends Error {
28
38
  constructor(message: string);
29
39
  }
@@ -61,6 +71,14 @@ export declare function loadMcpSettingsFile(options?: LoadMcpSettingsOptions): M
61
71
  export declare function normalizeMcpServerOAuthState(value: McpServerOAuthState | undefined): McpServerOAuthState | undefined;
62
72
  export declare function hasMcpSettingsFile(options?: LoadMcpSettingsOptions): boolean;
63
73
  export declare function resolveMcpServerRegistrations(options?: LoadMcpSettingsOptions): McpServerRegistration[];
74
+ /**
75
+ * Parses one raw MCP settings entry without requiring sibling entries to be
76
+ * valid. Hosts with an editable settings UI can use this to keep healthy and
77
+ * repairable entries visible when a hand-edited sibling is malformed.
78
+ */
79
+ export declare function parseMcpServerRegistration(name: string, value: unknown): McpServerRegistration;
80
+ /** Resolves one configured server without requiring sibling entries to parse. */
81
+ export declare function resolveMcpServerRegistration(serverName: string, options?: LoadMcpSettingsOptions): McpServerRegistration | undefined;
64
82
  export declare function setMcpServerDisabled(options: SetMcpServerDisabledOptions): void;
65
83
  export declare function getMcpServerOAuthState(serverName: string, options?: LoadMcpSettingsOptions): McpServerOAuthState | undefined;
66
84
  /**
@@ -71,12 +89,14 @@ export declare function getMcpServerOAuthState(serverName: string, options?: Loa
71
89
  *
72
90
  * TODO: Delete once all callers migrate to {@link updateMcpServerOAuthStateAsync}.
73
91
  */
74
- export declare function updateMcpServerOAuthState(serverName: string, updater: (current: McpServerOAuthState) => McpServerOAuthState, options?: LoadMcpSettingsOptions): McpServerOAuthState;
92
+ export declare function updateMcpServerOAuthState(serverName: string, updater: (current: McpServerOAuthState) => McpServerOAuthState, options?: UpdateMcpServerOAuthStateOptions): McpServerOAuthState;
75
93
  /**
76
94
  * Scoped read-modify-write of one server's `oauth` block that yields the event
77
95
  * loop while acquiring the lock. The updater is synchronous and pure; it
78
96
  * receives the server's current OAuth state and returns the next state.
79
97
  */
80
- export declare function updateMcpServerOAuthStateAsync(serverName: string, updater: (current: McpServerOAuthState) => McpServerOAuthState, options?: LoadMcpSettingsOptions): Promise<McpServerOAuthState>;
98
+ export declare function updateMcpServerOAuthStateAsync(serverName: string, updater: (current: McpServerOAuthState) => McpServerOAuthState, options?: UpdateMcpServerOAuthStateOptions): Promise<McpServerOAuthState>;
81
99
  export declare function listMcpServerOAuthStatuses(options?: LoadMcpSettingsOptions): McpServerOAuthStatus[];
100
+ /** Calculates OAuth status for one already-parsed registration. */
101
+ export declare function getMcpServerOAuthStatus(registration: McpServerRegistration): McpServerOAuthStatus;
82
102
  export declare function registerMcpServersFromSettingsFile(manager: Pick<McpManager, "registerServer">, options?: RegisterMcpServersFromSettingsOptions): Promise<McpServerRegistration[]>;
@@ -1,7 +1,7 @@
1
- export type { DefaultMcpServerClientFactoryOptions } from "./client";
2
- export { createDefaultMcpServerClientFactory } from "./client";
3
- export type { LoadMcpSettingsOptions, McpSettingsFile, McpSettingsLockOptions, McpSettingsMutator, RegisterMcpServersFromSettingsOptions, SetMcpServerDisabledOptions, } from "./config-loader";
4
- export { getMcpServerOAuthState, hasMcpSettingsFile, listMcpServerOAuthStatuses, loadMcpSettingsFile, McpSettingsLockTimeoutError, McpSettingsMutatorPurityError, McpSettingsUpdateSkippedError, registerMcpServersFromSettingsFile, resolveDefaultMcpSettingsPath, resolveMcpServerRegistrations, setMcpServerDisabled, updateMcpServerOAuthState, updateMcpServerOAuthStateAsync, updateMcpSettingsFile, updateMcpSettingsFileSync, } from "./config-loader";
1
+ export type { DefaultMcpServerClientFactoryOptions, ProbeMcpServerConnectionOptions, ProbeMcpServerConnectionResult, } from "./client";
2
+ export { createDefaultMcpServerClientFactory, DEFAULT_MCP_CONNECT_TIMEOUT_MS, probeMcpServerConnection, } from "./client";
3
+ export type { LoadMcpSettingsOptions, McpSettingsFile, McpSettingsLockOptions, McpSettingsMutator, RegisterMcpServersFromSettingsOptions, SetMcpServerDisabledOptions, UpdateMcpServerOAuthStateOptions, } from "./config-loader";
4
+ export { getMcpServerOAuthState, getMcpServerOAuthStatus, hasMcpSettingsFile, listMcpServerOAuthStatuses, loadMcpSettingsFile, McpOAuthClientChangedError, McpSettingsLockTimeoutError, McpSettingsMutatorPurityError, McpSettingsUpdateSkippedError, parseMcpServerRegistration, registerMcpServersFromSettingsFile, resolveDefaultMcpSettingsPath, resolveMcpServerRegistration, resolveMcpServerRegistrations, setMcpServerDisabled, updateMcpServerOAuthState, updateMcpServerOAuthStateAsync, updateMcpSettingsFile, updateMcpSettingsFileSync, } from "./config-loader";
5
5
  export { InMemoryMcpManager } from "./manager";
6
6
  export type { AuthorizeMcpServerOAuthOptions, AuthorizeMcpServerOAuthResult, CreateMcpOAuthProviderContextOptions, McpOAuthProviderContext, } from "./oauth";
7
7
  export { authorizeMcpServerOAuth } from "./oauth";
@@ -11,4 +11,4 @@ export type { CreateDisabledMcpToolPoliciesOptions, CreateDisabledMcpToolPolicyO
11
11
  export { createDisabledMcpToolPolicies, createDisabledMcpToolPolicy, } from "./policies";
12
12
  export { augmentMcpTimeoutError } from "./timeout";
13
13
  export { createMcpTools } from "./tools";
14
- export type { CreateMcpToolsOptions, McpConnectionStatus, McpManager, McpManagerOptions, McpServerClient, McpServerClientFactory, McpServerOAuthState, McpServerOAuthStatus, McpServerRegistration, McpServerSnapshot, McpServerTransportConfig, McpSseTransportConfig, McpStdioTransportConfig, McpStreamableHttpTransportConfig, McpToolCallRequest, McpToolCallResult, McpToolDescriptor, McpToolNameTransform, McpToolProvider, } from "./types";
14
+ export type { CreateMcpToolsOptions, McpConnectionStatus, McpManager, McpManagerOptions, McpServerClient, McpServerClientFactory, McpServerOAuthClientConfig, McpServerOAuthState, McpServerOAuthStatus, McpServerRegistration, McpServerSnapshot, McpServerTransportConfig, McpSseTransportConfig, McpStdioTransportConfig, McpStreamableHttpTransportConfig, McpToolCallRequest, McpToolCallResult, McpToolDescriptor, McpToolNameTransform, McpToolProvider, } from "./types";
@@ -1,15 +1,17 @@
1
1
  import type { OAuthClientProvider } from "@modelcontextprotocol/sdk/client/auth.js";
2
2
  import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
3
3
  import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
4
+ import type { OAuthClientInformationMixed } from "@modelcontextprotocol/sdk/shared/auth.js";
4
5
  import type { FetchLike } from "@modelcontextprotocol/sdk/shared/transport.js";
5
6
  import { type OAuthServerCloseInfo, type OAuthServerListeningInfo } from "../../auth/server";
6
- import type { McpServerRegistration } from "./types";
7
+ import type { McpServerOAuthClientConfig, McpServerRegistration } from "./types";
7
8
  export type McpSdkAuthCapableTransport = SSEClientTransport | StreamableHTTPClientTransport;
8
9
  export interface CreateMcpOAuthProviderContextOptions {
9
10
  settingsPath?: string;
10
11
  serverName: string;
11
12
  redirectUrl: string;
12
13
  onAuthorizationUrl?: (url: string) => void | Promise<void>;
14
+ clientInformation?: OAuthClientInformationMixed;
13
15
  }
14
16
  export interface McpOAuthProviderContext {
15
17
  provider: OAuthClientProvider;
@@ -17,6 +19,8 @@ export interface McpOAuthProviderContext {
17
19
  getLastOAuthState(): string | undefined;
18
20
  resetInteractiveState(): Promise<void>;
19
21
  markError(errorMessage: string): Promise<void>;
22
+ markConnectionError(errorMessage: string): Promise<void>;
23
+ markAuthorizationRequired(errorMessage: string): Promise<void>;
20
24
  clearError(): Promise<void>;
21
25
  }
22
26
  export interface AuthorizeMcpServerOAuthOptions {
@@ -33,16 +37,26 @@ export interface AuthorizeMcpServerOAuthOptions {
33
37
  successHtml?: string;
34
38
  onServerListening?: (info: OAuthServerListeningInfo) => void | Promise<void>;
35
39
  onServerClose?: (info: OAuthServerCloseInfo) => void | Promise<void>;
40
+ signal?: AbortSignal;
36
41
  }
37
42
  export interface AuthorizeMcpServerOAuthResult {
38
43
  serverName: string;
39
44
  authorized: true;
40
45
  message: string;
41
46
  }
47
+ export declare function createMcpOAuthClientInformation(config: McpServerOAuthClientConfig | undefined): OAuthClientInformationMixed | undefined;
42
48
  export declare function createMcpOAuthProviderContext(options: CreateMcpOAuthProviderContextOptions): McpOAuthProviderContext;
43
49
  export declare function createMcpSdkTransport(input: {
44
50
  registration: McpServerRegistration;
45
51
  oauthProvider?: OAuthClientProvider;
46
52
  fetch?: FetchLike;
47
53
  }): McpSdkAuthCapableTransport;
54
+ /**
55
+ * Recognizes a 401 from a remote MCP server across transports. The streamable
56
+ * HTTP transport (and SSE message POSTs) reject with the typed
57
+ * UnauthorizedError raised at the fetch boundary, but the SSE stream request
58
+ * runs inside EventSource, which consumes the response and reports the HTTP
59
+ * status only through SseError's code.
60
+ */
61
+ export declare function isMcpUnauthorizedError(error: unknown): boolean;
48
62
  export declare function authorizeMcpServerOAuth(options: AuthorizeMcpServerOAuthOptions): Promise<AuthorizeMcpServerOAuthResult>;
@@ -0,0 +1,9 @@
1
+ import type { McpServerTransportConfig, McpStdioTransportConfig, McpStreamableHttpTransportConfig } from "./types";
2
+ /**
3
+ * Recognizes the exact no-option `npx mcp-remote <url>` proxy shape emitted by
4
+ * older marketplace entries. Cline has a native Streamable HTTP transport, so
5
+ * spawning the proxy would duplicate OAuth handling and let the child process
6
+ * open a browser as a side effect of merely enabling the server.
7
+ */
8
+ export declare function resolveMcpRemoteProxyTransport(transport: McpStdioTransportConfig): McpStreamableHttpTransportConfig | undefined;
9
+ export declare function resolveNativeMcpTransport(transport: McpServerTransportConfig): McpServerTransportConfig;
@@ -54,6 +54,11 @@ export interface McpServerOAuthState {
54
54
  redirectUrl?: string;
55
55
  lastError?: string;
56
56
  lastAuthenticatedAt?: number;
57
+ authorizationRequired?: boolean;
58
+ }
59
+ export interface McpServerOAuthClientConfig {
60
+ clientId: string;
61
+ clientSecret?: string;
57
62
  }
58
63
  export interface McpServerRegistration {
59
64
  name: string;
@@ -62,13 +67,14 @@ export interface McpServerRegistration {
62
67
  /**
63
68
  * Per-server request timeout in seconds, from the `timeout` field in
64
69
  * cline_mcp_settings.json. Undefined means the shared default for ordinary
65
- * requests; the stdio client preserves its fast compatibility probe for
70
+ * requests; the stdio client uses its default connect budget for
66
71
  * initialize until a finite timeout is explicitly configured. Registrations are
67
72
  * resolved when the runtime is built, so changes take effect on the next
68
73
  * session.
69
74
  */
70
75
  timeoutSeconds?: number;
71
76
  metadata?: Record<string, unknown>;
77
+ oauthClient?: McpServerOAuthClientConfig;
72
78
  oauth?: McpServerOAuthState;
73
79
  }
74
80
  export interface McpServerSnapshot {
@@ -95,6 +101,7 @@ export interface McpServerOAuthStatus {
95
101
  serverName: string;
96
102
  oauthSupported: boolean;
97
103
  oauthConfigured: boolean;
104
+ authorizationRequired: boolean;
98
105
  lastError?: string;
99
106
  lastAuthenticatedAt?: number;
100
107
  }
@@ -9,6 +9,7 @@ export interface ResolveAgentPluginPathsOptions {
9
9
  pluginPaths?: ReadonlyArray<string>;
10
10
  workspacePath?: string;
11
11
  cwd?: string;
12
+ includeDisabled?: boolean;
12
13
  }
13
14
  export declare function resolveAgentPluginPaths(options?: ResolveAgentPluginPathsOptions): string[];
14
15
  export declare function resolvePluginSkillDirectoriesFromPaths(pluginPaths: ReadonlyArray<string>): string[];
@@ -43,6 +43,30 @@ export interface PluginSandboxOptions extends PluginTargeting {
43
43
  */
44
44
  telemetryAvailable?: boolean;
45
45
  }
46
+ /**
47
+ * Pick the bootstrap the sandbox subprocess should run.
48
+ *
49
+ * Sibling compiled candidates always match the running host build, so they
50
+ * win. When the host runs from source (the `.ts` bootstrap exists next to
51
+ * this module), the sandbox must run that SAME source bootstrap: the
52
+ * wrapper/executable fallbacks locate compiled bootstraps from a separately
53
+ * installed CLI package (e.g. a published version in the package-manager
54
+ * cache), and mixing that code with a source host silently breaks plugin
55
+ * loading because its module resolution points at the other installation's
56
+ * layout. Those fallbacks exist only for compiled hosts
57
+ * (`bun build --compile`) where import.meta points inside the binary and no
58
+ * sibling file exists on real disk.
59
+ */
60
+ export declare function selectBootstrapCandidate(options: {
61
+ siblingCandidates: string[];
62
+ sourceBootstrapPath: string;
63
+ installedCandidates: Array<string | undefined>;
64
+ exists?: (path: string) => boolean;
65
+ }): {
66
+ file: string;
67
+ } | {
68
+ sourcePath: string;
69
+ };
46
70
  export declare function loadSandboxedPlugins(options: PluginSandboxOptions): Promise<{
47
71
  extensions: AgentConfig["extensions"];
48
72
  pluginPaths: string[];
@@ -1,4 +1,5 @@
1
1
  import type { HubClientRecord, HubUINotifyPayload, HubUIShowWindowPayload, SessionRecord } from "@cline/shared";
2
+ import type { CoreSettingsMutationResult, CoreSettingsToggleInput } from "../../settings";
2
3
  export interface HubUIClientOptions {
3
4
  address: string;
4
5
  authToken?: string;
@@ -29,6 +30,7 @@ export declare class HubUIClient {
29
30
  sendShowWindow(payload?: HubUIShowWindowPayload): Promise<void>;
30
31
  listClients(): Promise<HubClientRecord[]>;
31
32
  listSessions(limit?: number): Promise<SessionRecord[]>;
33
+ toggleSetting(input: CoreSettingsToggleInput): Promise<CoreSettingsMutationResult>;
32
34
  /**
33
35
  * Subscribe to UI-relevant hub events.
34
36
  * Returns an unsubscribe function.
@@ -3,3 +3,13 @@
3
3
  * lifecycle handlers are installed.
4
4
  */
5
5
  export declare const hubDaemonReady: Promise<void>;
6
+ /**
7
+ * Abort-family rejections are expected daemon noise, not fatal faults: when a
8
+ * user cancels a turn, in-flight provider streams and fetches can reject on a
9
+ * floating promise after the run has already settled (DOMException
10
+ * "AbortError" from fetch/undici, Node ABORT_ERR, or the runtime's own
11
+ * AgentRuntimeAbortError). Exiting on those kills every resident session in
12
+ * the daemon — the next message from any connected client then lands on
13
+ * `session_not_found` and forces a rebuild from disk.
14
+ */
15
+ export declare function isAbortRejection(reason: unknown): boolean;