@cline/core 0.0.66 → 0.0.67
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/ClineCore.d.ts +12 -0
- package/dist/extensions/context/compaction-shared.d.ts +3 -0
- package/dist/extensions/context/compaction.d.ts +8 -1
- package/dist/extensions/mcp/index.d.ts +3 -2
- package/dist/extensions/mcp/timeout.d.ts +2 -0
- package/dist/extensions/mcp/types.d.ts +9 -0
- package/dist/extensions/plugin/plugin-sandbox.d.ts +7 -0
- package/dist/extensions/plugin-sandbox-bootstrap.js +1 -1
- package/dist/extensions/tools/definitions.d.ts +1 -1
- package/dist/extensions/tools/executors/index.d.ts +1 -1
- package/dist/extensions/tools/index.d.ts +1 -1
- package/dist/extensions/tools/schemas.d.ts +45 -45
- package/dist/extensions/tools/types.d.ts +8 -1
- package/dist/hooks/checkpoint-hooks.d.ts +1 -7
- package/dist/hooks/hook-file-hooks.d.ts +3 -2
- package/dist/hub/daemon/entry.js +184 -184
- package/dist/hub/index.js +181 -181
- package/dist/index.d.ts +5 -4
- package/dist/index.js +180 -180
- package/dist/runtime/host/local/agent-event-bridge.d.ts +10 -1
- package/dist/runtime/host/local-runtime-host.d.ts +1 -0
- package/dist/runtime/host/runtime-host.d.ts +10 -0
- package/dist/services/llms/provider-settings.d.ts +4 -0
- package/dist/services/providers/local-provider-registry.d.ts +0 -3
- package/dist/services/telemetry/TelemetryService.d.ts +6 -0
- package/dist/services/telemetry/distinct-id.d.ts +1 -0
- package/dist/services/telemetry/index.d.ts +1 -1
- package/dist/services/telemetry/index.js +1 -1
- package/dist/session/checkpoint-restore.d.ts +14 -1
- package/dist/session/session-versioning-service.d.ts +3 -1
- package/dist/session/user-run-messages.d.ts +20 -0
- package/package.json +4 -4
- package/dist/services/telemetry/tool-context.d.ts +0 -3
package/dist/ClineCore.d.ts
CHANGED
|
@@ -243,6 +243,18 @@ export declare class ClineCore {
|
|
|
243
243
|
* ```
|
|
244
244
|
*/
|
|
245
245
|
readMessages: RuntimeHost["readSessionMessages"];
|
|
246
|
+
/**
|
|
247
|
+
* Reads message history for a session, preferring the live in-memory
|
|
248
|
+
* conversation when the session is still resident in this host.
|
|
249
|
+
*
|
|
250
|
+
* The persisted transcript only catches up at assistant-message/turn
|
|
251
|
+
* boundaries, so `readMessages` can miss an in-flight (or just-aborted)
|
|
252
|
+
* turn. Use this when the current conversation matters — e.g. seeding a
|
|
253
|
+
* replacement session during a plan/act mode switch. Falls back to the
|
|
254
|
+
* persisted transcript when the session is not resident or the host does
|
|
255
|
+
* not track live sessions.
|
|
256
|
+
*/
|
|
257
|
+
readLiveMessages: RuntimeHost["readSessionMessages"];
|
|
246
258
|
restore(input: RestoreInput): Promise<RestoreResult>;
|
|
247
259
|
compareCheckpoint(input: CompareCheckpointInput): Promise<CompareCheckpointResult>;
|
|
248
260
|
/**
|
|
@@ -20,6 +20,8 @@ export interface FileOperationSummary {
|
|
|
20
20
|
}
|
|
21
21
|
export interface CompactionSummaryMetadata {
|
|
22
22
|
kind: "compaction_summary";
|
|
23
|
+
displayRole: "system";
|
|
24
|
+
userRunSpan: number;
|
|
23
25
|
summary: string;
|
|
24
26
|
details: FileOperationSummary;
|
|
25
27
|
tokensBefore: number;
|
|
@@ -86,4 +88,5 @@ export declare function buildSummaryMessage(options: {
|
|
|
86
88
|
summary: string;
|
|
87
89
|
fileOps: FileOperationSummary;
|
|
88
90
|
tokensBefore: number;
|
|
91
|
+
userRunSpan: number;
|
|
89
92
|
}): MessageWithMetadata;
|
|
@@ -40,5 +40,12 @@ export declare function createContextCompactionPrepareTurn(config: Pick<CoreSess
|
|
|
40
40
|
export declare function createCompactionStateAwarePrepareTurn(input: {
|
|
41
41
|
compact?: ContextPipelinePrepareTurn;
|
|
42
42
|
getState?: () => SessionCompactionState | undefined;
|
|
43
|
-
|
|
43
|
+
/**
|
|
44
|
+
* Persist a freshly-computed compaction state. `sourceMessages` are the
|
|
45
|
+
* exact canonical messages the state's source-prefix hash was computed
|
|
46
|
+
* over; hosts must validate projection against these rather than a
|
|
47
|
+
* separately derived transcript, which can legally differ mid-turn and
|
|
48
|
+
* spuriously reject the write.
|
|
49
|
+
*/
|
|
50
|
+
saveState?: (state: SessionCompactionState, sourceMessages: CoreCompactionContext["messages"]) => void | Promise<void>;
|
|
44
51
|
}): ContextPipelinePrepareTurn;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export type { DefaultMcpServerClientFactoryOptions } from "./client";
|
|
2
2
|
export { createDefaultMcpServerClientFactory } from "./client";
|
|
3
|
-
export type { LoadMcpSettingsOptions, McpSettingsLockOptions, McpSettingsMutator,
|
|
4
|
-
export { getMcpServerOAuthState, hasMcpSettingsFile, listMcpServerOAuthStatuses, loadMcpSettingsFile, registerMcpServersFromSettingsFile, resolveDefaultMcpSettingsPath, resolveMcpServerRegistrations, setMcpServerDisabled, updateMcpServerOAuthState, updateMcpServerOAuthStateAsync, updateMcpSettingsFile, updateMcpSettingsFileSync,
|
|
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";
|
|
5
5
|
export { InMemoryMcpManager } from "./manager";
|
|
6
6
|
export type { AuthorizeMcpServerOAuthOptions, AuthorizeMcpServerOAuthResult, CreateMcpOAuthProviderContextOptions, McpOAuthProviderContext, } from "./oauth";
|
|
7
7
|
export { authorizeMcpServerOAuth } from "./oauth";
|
|
@@ -9,5 +9,6 @@ export type { PluginMcpServerResolution } from "./plugin-server-registration";
|
|
|
9
9
|
export { normalizePluginMcpServerRegistration, resolvePluginMcpServerRegistrations, } from "./plugin-server-registration";
|
|
10
10
|
export type { CreateDisabledMcpToolPoliciesOptions, CreateDisabledMcpToolPolicyOptions, } from "./policies";
|
|
11
11
|
export { createDisabledMcpToolPolicies, createDisabledMcpToolPolicy, } from "./policies";
|
|
12
|
+
export { augmentMcpTimeoutError } from "./timeout";
|
|
12
13
|
export { createMcpTools } from "./tools";
|
|
13
14
|
export type { CreateMcpToolsOptions, McpConnectionStatus, McpManager, McpManagerOptions, McpServerClient, McpServerClientFactory, McpServerOAuthState, McpServerOAuthStatus, McpServerRegistration, McpServerSnapshot, McpServerTransportConfig, McpSseTransportConfig, McpStdioTransportConfig, McpStreamableHttpTransportConfig, McpToolCallRequest, McpToolCallResult, McpToolDescriptor, McpToolNameTransform, McpToolProvider, } from "./types";
|
|
@@ -59,6 +59,15 @@ export interface McpServerRegistration {
|
|
|
59
59
|
name: string;
|
|
60
60
|
transport: McpServerTransportConfig;
|
|
61
61
|
disabled?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Per-server request timeout in seconds, from the `timeout` field in
|
|
64
|
+
* cline_mcp_settings.json. Undefined means the shared default for ordinary
|
|
65
|
+
* requests; the stdio client preserves its fast compatibility probe for
|
|
66
|
+
* initialize until a finite timeout is explicitly configured. Registrations are
|
|
67
|
+
* resolved when the runtime is built, so changes take effect on the next
|
|
68
|
+
* session.
|
|
69
|
+
*/
|
|
70
|
+
timeoutSeconds?: number;
|
|
62
71
|
metadata?: Record<string, unknown>;
|
|
63
72
|
oauth?: McpServerOAuthState;
|
|
64
73
|
}
|
|
@@ -35,6 +35,13 @@ export interface PluginSandboxOptions extends PluginTargeting {
|
|
|
35
35
|
user?: SandboxedPluginSetupContext["user"];
|
|
36
36
|
/** Enables a logger bridge that forwards sandbox log calls to the host. */
|
|
37
37
|
logger?: SandboxedPluginSetupContext["logger"];
|
|
38
|
+
/**
|
|
39
|
+
* Enables the telemetry bridge (`ctx.telemetry`) for sandboxed plugins.
|
|
40
|
+
* Set only when the host has a live telemetry service to route
|
|
41
|
+
* `plugin_telemetry` events into, so plugin feature-detection of
|
|
42
|
+
* `ctx.telemetry` means "someone is listening" in both execution modes.
|
|
43
|
+
*/
|
|
44
|
+
telemetryAvailable?: boolean;
|
|
38
45
|
}
|
|
39
46
|
export declare function loadSandboxedPlugins(options: PluginSandboxOptions): Promise<{
|
|
40
47
|
extensions: AgentConfig["extensions"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRequire as GG}from"node:module";var QG=GG(import.meta.url);import{normalizePluginManifest as IG}from"@cline/shared";import{existsSync as _,readFileSync as C}from"node:fs";import{builtinModules as UG,createRequire as y}from"node:module";import{dirname as M,extname as I,isAbsolute as XG,resolve as K}from"node:path";import{fileURLToPath as P}from"node:url";import{PLUGIN_FILE_EXTENSIONS as YG}from"@cline/shared";var m=M(P(import.meta.url)),ZG=y(import.meta.url),$G=K(m,"..","..","..","..",".."),S=WG($G),qG=["@cline/sdk","@cline/agents","@cline/core","@cline/core/hub","@cline/core/hub/daemon-entry","@cline/core/telemetry","@cline/llms","@cline/llms/browser","@cline/shared","@cline/shared/automation","@cline/shared/browser","@cline/shared/storage","@cline/shared/db","@cline/shared/types"],b=new Set(UG.flatMap((G)=>[G,G.replace(/^node:/,"")])),j=new Set(YG),KG=["development","node","import","require","default"];function WG(G){let Q={},U={"@cline/sdk":K(G,"packages/sdk/src/index.ts"),"@cline/agents":K(G,"packages/agents/src/index.ts"),"@cline/core":K(G,"packages/core/src/index.ts"),"@cline/llms":K(G,"packages/llms/src/index.ts"),"@cline/shared":K(G,"packages/shared/src/index.ts"),"@cline/shared/storage":K(G,"packages/shared/src/storage/index.ts"),"@cline/shared/db":K(G,"packages/shared/src/db/index.ts")};for(let[Y,Z]of Object.entries(U))if(_(Z))Q[Y]=Z;for(let Y of["agents","core","llms","shared"]){let Z=K(G,"packages",Y),$=K(Z,"package.json");if(!_($))continue;try{let X=JSON.parse(C($,"utf8"));if(typeof X.name!=="string"||!X.exports)continue;if(typeof X.exports==="string"){let q=K(Z,X.exports);if(_(q))Q[X.name]=q;continue}if(typeof X.exports!=="object")continue;for(let[q,w]of Object.entries(X.exports)){let A=_G(Z,w);if(!A)continue;let L=q==="."?X.name:`${X.name}/${q.replace(/^\.\//,"")}`;Q[L]=A}}catch{}}return Q}function _G(G,Q){let U=R(Q);if(!U)return null;let Y=h(G,U);for(let Z of Y)if(_(Z))return Z;return null}function R(G,Q=new Set){if(typeof G==="string")return G;if(!G||typeof G!=="object")return null;if(Q.has(G))return null;Q.add(G);let U=G;for(let Y of KG){let Z=R(U[Y],Q);if(Z)return Z}return null}function h(G,Q){let U=Q.replace(/^\.\//,""),Y=[K(G,Q)];if(U.startsWith("dist/")){let Z=U.replace(/^dist\//,"src/").replace(/\.(mjs|cjs|js)$/,"");return[K(G,`${Z}.ts`),K(G,`${Z}.tsx`),K(G,`${Z}.mts`),K(G,`${Z}.cts`),...Y]}return Y}function LG(G){return Object.fromEntries(Object.entries(G).sort(([Q],[U])=>U.length-Q.length))}function H(G){return!(G.startsWith(".")||G.startsWith("/")||G.startsWith("file:")||G.startsWith("data:")||G.startsWith("http:")||G.startsWith("https:"))}function J(G){if(G.startsWith("@")){let[Q,U]=G.split("/",3);return U?`${Q}/${U}`:G}return G.split("/",1)[0]??G}function wG(G){let Q=J(G);if(G===Q)return".";return`.${G.slice(Q.length)}`}function d(G){return J(G).startsWith("@cline/")}function V(G,Q){let U=J(Q),Y=M(G);while(!0){let Z=K(Y,"node_modules",U);if(_(Z)||_(K(Z,"package.json")))return!0;let $=K(Y,"..");if($===Y)return!1;Y=$}}function f(G){return T(G)!==null}function T(G){try{return ZG.resolve(G)}catch{}return AG(G)}function AG(G){let Q=J(G),U=u(Q);if(!U)return null;let Y=K(U,"package.json");try{let Z=JSON.parse(C(Y,"utf8")),$=wG(G),X=$==="."&&typeof Z.exports==="string"?Z.exports:Z.exports&&typeof Z.exports==="object"&&Object.hasOwn(Z.exports,$)?Z.exports[$]:void 0,q=R(X)??($==="."&&typeof Z.main==="string"?Z.main:null);if(!q)return null;let w=K(U,q),A=[w,...h(U,q).filter((L)=>L!==w)];for(let L of A)if(_(L))return L;return null}catch{return null}}function zG(){let G=[m],Q=process.env.CLINE_WRAPPER_PATH?.trim();if(Q)G.push(M(M(Q)));let U=process.execPath?.trim();if(U)G.push(M(U));return[...new Set(G.map((Y)=>K(Y)))]}function MG(G,Q){let U=G;while(!0){let Y=K(U,"package.json");if(_(Y))try{if(JSON.parse(C(Y,"utf8")).name===Q)return U}catch{}let Z=K(U,"node_modules",Q,"package.json");if(_(Z))return M(Z);let $=K(U,"..");if($===U)return null;U=$}}function u(G){for(let Q of zG()){let U=MG(Q,G);if(U)return U}return null}function FG(G){let U=M(G);for(let Y=0;Y<4;Y++){let Z=K(U,"package.json");if(_(Z))try{let X=JSON.parse(C(Z,"utf8"));return X!=null&&typeof X==="object"&&"cline"in X}catch{return!1}let $=K(U,"..");if($===U)return!1;U=$}return!1}function c(G,Q){let U=Q.startsWith("file:")?P(Q):XG(Q)?Q:K(M(G),Q);if(_(U)&&j.has(I(U)))return U;for(let Y of j){let Z=`${U}${Y}`;if(_(Z))return Z}for(let Y of j){let Z=K(U,`index${Y}`);if(_(Z))return Z}return null}function l(G){let Q=new Set,U=[/\bimport\s+(?:type\s+)?[^"'`]*?\bfrom\s*["'`]([^"'`]+)["'`]/g,/\bexport\s+[^"'`]*?\bfrom\s*["'`]([^"'`]+)["'`]/g,/\bimport\s*\(\s*["'`]([^"'`]+)["'`]\s*\)/g,/\brequire\s*\(\s*["'`]([^"'`]+)["'`]\s*\)/g];for(let Y of U)for(let Z of G.matchAll(Y)){let $=Z[1];if($)Q.add($)}return[...Q]}function JG(G){return I(G)!==".ts"}function g(G,Q,U=new Set){if(U.has(G)||!_(G))return;if(U.add(G),!j.has(I(G)))return;let Y=C(G,"utf8"),Z=JG(G);for(let $ of l(Y)){if($.startsWith("node:")||b.has($))continue;if(H($)){if(!Z)continue;if(Object.hasOwn(S,$)||Object.hasOwn(S,J($))||V(G,$)||d($)&&f($)||Q&&f($))continue;throw Error(`Cannot find module '${J($)}'`)}let X=c(G,$);if(X)g(X,Q,U)}}function n(G,Q=new Set,U=new Set){if(Q.has(G)||!_(G))return U;if(Q.add(G),!j.has(I(G)))return U;let Y=C(G,"utf8");for(let Z of l(Y)){if(U.add(Z),H(Z))continue;let $=c(G,Z);if($)n($,Q,U)}return U}function CG(G,Q){let U=y(G),Y={},Z=n(G),$=new Set(qG);for(let[X,q]of Object.entries(S)){try{U.resolve(X);continue}catch{}Y[X]=q}for(let X of Z)if(H(X)&&(d(X)||Q))$.add(X);for(let X of $){if(Object.hasOwn(Y,X)||V(G,X))continue;let q=T(X);if(q)Y[X]=q}if(!Q)return Y;for(let X of Z){if(!H(X)||Object.hasOwn(Y,X)||V(G,X)||X.startsWith("node:")||b.has(X))continue;let q=T(X);if(q)Y[X]=q}return Y}function OG(G){let Q=I(G);return Q===".ts"||Q===".tsx"||Q===".mts"||Q===".cts"}var F;function jG(){if(F!==void 0)return F;let G=u("jiti");if(!G)return F=null,null;let Q=K(G,"dist","babel.cjs");if(!_(Q))return F=null,null;try{let Y=y(Q)(Q);F=typeof Y==="function"?Y:null}catch{F=null}return F}async function o(G,Q={}){let U=!FG(G);g(G,U);let Y=CG(G,U),Z=LG(Y),$=await import("jiti"),X=typeof $==="function"?$:typeof $.default==="function"?$.default:void 0;if(!X)throw Error("Unable to load jiti");let q=Object.entries(Z).filter(([,W])=>OG(W)).map(([W])=>W),w=jG(),A=w?(W)=>w({...W,interopDefault:!0}):void 0;return await X(G,{alias:Z,cache:Q.useCache,requireCache:Q.useCache,esmResolve:!0,interopDefault:!1,nativeModules:[...b],transformModules:q,tryNative:!1,...A?{transform:A}:{}}).import(G,{})}function p(G,Q){if(!G)return!0;if(G.providerIds?.length){if(!Q?.providerId||!G.providerIds.includes(Q.providerId))return!1}if(G.modelIds?.length){if(!Q?.modelId||!G.modelIds.includes(Q.modelId))return!1}return!0}function z(G){return typeof G==="object"&&G!==null}function s(G){return Array.isArray(G)&&G.every((Q)=>typeof Q==="string")}function BG(G,Q){if(!z(G))throw Error(`Invalid plugin module: ${Q}`);if(typeof G.name!=="string"||!G.name)throw Error(`Invalid plugin name: ${Q}`);if(!z(G.manifest))throw Error(`Invalid plugin manifest: ${Q}`);if(Object.hasOwn(G.manifest,"providerIds")&&!s(G.manifest.providerIds))throw Error(`Invalid plugin manifest.providerIds: ${Q}`);if(Object.hasOwn(G.manifest,"modelIds")&&!s(G.manifest.modelIds))throw Error(`Invalid plugin manifest.modelIds: ${Q}`)}function DG(G){if(!z(G))throw Error("Plugin setup context must be an object");if(G.session!==void 0&&!z(G.session))throw Error("Plugin setup context session must be an object");if(G.client!==void 0&&!z(G.client))throw Error("Plugin setup context client must be an object");if(G.user!==void 0&&!z(G.user))throw Error("Plugin setup context user must be an object");if(G.workspaceInfo!==void 0&&!z(G.workspaceInfo))throw Error("Plugin setup context workspaceInfo must be an object");if(G.automation!==void 0&&!z(G.automation))throw Error("Plugin setup context automation must be an object");if(G.automation!==void 0&&typeof G.automation.ingestEvent!=="function")throw Error("Plugin setup context automation.ingestEvent must be a function");if(G.logger!==void 0&&!z(G.logger))throw Error("Plugin setup context logger must be an object")}var t=0,N=new Map,v=new Map;function HG(G){let Q=G instanceof Error?G.message:String(G),U=G instanceof Error?G.stack:void 0;return{message:Q,stack:U}}function k(G,Q,U,Y){if(!process.send)return;process.send({type:"response",id:G,ok:Q,result:U,error:Y})}function x(G,Q){if(!process.send)return;process.send({type:"event",name:G,payload:Q})}globalThis.__clinePluginHost={emitEvent:x};globalThis.__clineSessionEnv={cwd:void 0,workspaceInfo:void 0};function i(G){if(!G||typeof G!=="object")return{};return G}function NG(G){if(!G||typeof G!=="object")return;let Q={...G};if(Q.error instanceof Error)Q.error={name:Q.error.name,message:Q.error.message,stack:Q.error.stack};return Q}function EG(G){let Q=(U,Y,Z)=>{x("plugin_log",{level:U,pluginName:G,message:Y,metadata:NG(Z)})};return{debug:(U,Y)=>Q("debug",U,Y),log:(U,Y)=>Q("log",U,Y),error:(U,Y)=>Q("error",U,Y)}}function O(G,Q){let U=`${G}:${Q}`,Y=(v.get(U)??0)+1;return v.set(U,Y),`${G}_${Q}_${Y}`}function SG(G){let Q=typeof G.eventType==="string"?G.eventType.trim():"",U=typeof G.source==="string"?G.source.trim():"";if(!Q)throw Error("Automation event type contribution requires eventType");if(!U)throw Error("Automation event type contribution requires source");return{...G,eventType:Q,source:U,examples:G.examples?[...G.examples]:void 0,metadata:G.metadata?i(G.metadata):void 0}}function B(G){let Q=N.get(G);if(!Q)throw Error(`Unknown sandbox plugin id: ${G}`);return Q}async function VG(G){let Q;try{let U=await o(G.pluginPath);if(Q=U.default??U[G.exportName],BG(Q,G.pluginPath),Q.manifest=IG(Q.manifest),!p(Q.manifest,G.targeting))return{type:"skipped"};let Y={tools:[],commands:[],rules:[],messageBuilders:[],providers:[],automationEventTypes:[],mcpServers:[],shortcuts:[],flags:[]},Z={tools:new Map,commands:new Map,rules:new Map,messageBuilders:new Map},$={registerTool:(X)=>{let q=O(G.pluginId,"tool");Z.tools.set(q,X.execute),Y.tools.push({id:q,name:X.name,description:X.description,inputSchema:X.inputSchema,timeoutMs:X.timeoutMs,retryable:X.retryable})},registerCommand:(X)=>{let q=O(G.pluginId,"command");if(typeof X.handler==="function")Z.commands.set(q,X.handler);Y.commands.push({id:q,name:X.name,description:X.description})},registerRule:(X)=>{let q=O(G.pluginId,"rule");if(typeof X.content==="function"){Z.rules.set(q,X.content),Y.rules.push({id:q,ruleId:X.id,source:X.source,hasContentHandler:!0});return}Y.rules.push({id:q,ruleId:X.id,content:X.content,source:X.source})},registerMessageBuilder:(X)=>{let q=O(G.pluginId,"builder");Z.messageBuilders.set(q,X.build),Y.messageBuilders.push({id:q,name:X.name})},registerProvider:(X)=>{Y.providers.push({id:O(G.pluginId,"provider"),name:X.name,description:X.description,metadata:i(X.metadata)})},registerAutomationEventType:(X)=>{Y.automationEventTypes.push({id:O(G.pluginId,"automation_event"),...SG(X)})},registerMcpServer:(X)=>{Y.mcpServers.push(X)}};if(typeof Q.setup==="function")try{let X={...G.setupCtxBase,...G.loggerEnabled?{logger:EG(Q.name)}:{},...Q.manifest.capabilities.includes("automationEvents")?{automation:{ingestEvent:(q)=>{x("automation_event",q)}}}:{}};DG(X),await Q.setup($,X)}catch(X){return{type:"failure",failure:{pluginPath:G.pluginPath,pluginName:Q.name,phase:"setup",message:X instanceof Error?X.message:String(X),stack:X instanceof Error?X.stack:void 0}}}return{type:"loaded",state:{plugin:Q,handlers:Z},descriptor:{pluginId:G.pluginId,pluginPath:G.pluginPath,name:Q.name,manifest:Q.manifest,hooks:Q.hooks?Object.entries(Q.hooks).filter(([,X])=>typeof X==="function").map(([X])=>X):void 0,contributions:Y}}}catch(U){return{type:"failure",failure:{pluginPath:G.pluginPath,pluginName:Q?.name,phase:"load",message:U instanceof Error?U.message:String(U),stack:U instanceof Error?U.stack:void 0}}}}async function TG(G){if(N.clear(),t=0,v.clear(),G.cwd)try{process.chdir(G.cwd)}catch{}let Q=globalThis.__clineSessionEnv;if(Q)Q.cwd=G.cwd,Q.workspaceInfo=G.workspaceInfo;let U=[],Y=[],Z=[],$=G.exportName||"plugin",X=new Map,q={providerId:G.providerId,modelId:G.modelId},w={session:G.session,client:G.client,user:G.user,workspaceInfo:G.workspaceInfo},A=await Promise.all((G.pluginPaths||[]).map((L)=>{let W=`plugin_${++t}`;return VG({pluginPath:L,pluginId:W,exportName:$,targeting:q,setupCtxBase:w,loggerEnabled:G.loggerEnabled})}));for(let L of A){if(L.type==="skipped")continue;if(L.type==="failure"){Y.push(L.failure);continue}let{descriptor:W,state:r}=L,E=X.get(W.name);if(E!==void 0){let D=U[E];if(!D)X.delete(W.name);else{Z.push({type:"duplicate_plugin_override",pluginName:W.name,pluginPath:W.pluginPath,overriddenPluginPath:D.pluginPath,message:`Plugin "${W.name}" from ${W.pluginPath} overrides ${D.pluginPath}`}),N.delete(D.pluginId),U.splice(E,1),X.clear();for(let[a,e]of U.entries())X.set(e.name,a)}}N.set(W.pluginId,r),X.set(W.name,U.length),U.push(W)}return{plugins:U,failures:Y,warnings:Z}}async function yG(G){let U=B(G.pluginId).plugin.hooks?.[G.hookName];if(typeof U!=="function")return;return await U(G.payload)}async function bG(G){let U=B(G.pluginId).handlers.tools.get(G.contributionId);if(typeof U!=="function")throw Error("Unknown sandbox tool contribution");return await U(G.input,G.context)}async function RG(G){let U=B(G.pluginId).handlers.commands.get(G.contributionId);if(typeof U!=="function")return"";return await U(G.input)}async function kG(G){let U=B(G.pluginId).handlers.messageBuilders.get(G.contributionId);if(typeof U!=="function")return[];return await U(G.messages)}async function vG(G){let U=B(G.pluginId).handlers.rules.get(G.contributionId);if(typeof U!=="function")return"";return await U()}var xG={initialize:TG,invokeHook:yG,executeTool:bG,executeCommand:RG,buildMessages:kG,resolveRuleContent:vG};process.on("message",async(G)=>{if(!G||G.type!=="call")return;let Q=xG[G.method];if(!Q){k(G.id,!1,void 0,{message:`Unknown method: ${String(G.method)}`});return}try{let U=await Q(G.args||{});k(G.id,!0,U)}catch(U){k(G.id,!1,void 0,HG(U))}});
|
|
1
|
+
import{createRequire as QG}from"node:module";var UG=QG(import.meta.url);import{normalizePluginManifest as BG}from"@cline/shared";import{existsSync as _,readFileSync as C}from"node:fs";import{builtinModules as XG,createRequire as R}from"node:module";import{dirname as J,extname as I,isAbsolute as YG,resolve as q}from"node:path";import{fileURLToPath as h}from"node:url";import{PLUGIN_FILE_EXTENSIONS as ZG}from"@cline/shared";var m=J(h(import.meta.url)),$G=R(import.meta.url),KG=q(m,"..","..","..","..",".."),T=_G(KG),qG=["@cline/sdk","@cline/agents","@cline/core","@cline/core/hub","@cline/core/hub/daemon-entry","@cline/core/telemetry","@cline/llms","@cline/llms/browser","@cline/shared","@cline/shared/automation","@cline/shared/browser","@cline/shared/storage","@cline/shared/db","@cline/shared/types"],k=new Set(XG.flatMap((G)=>[G,G.replace(/^node:/,"")])),j=new Set(ZG),WG=["development","node","import","require","default"];function _G(G){let Q={},U={"@cline/sdk":q(G,"packages/sdk/src/index.ts"),"@cline/agents":q(G,"packages/agents/src/index.ts"),"@cline/core":q(G,"packages/core/src/index.ts"),"@cline/llms":q(G,"packages/llms/src/index.ts"),"@cline/shared":q(G,"packages/shared/src/index.ts"),"@cline/shared/storage":q(G,"packages/shared/src/storage/index.ts"),"@cline/shared/db":q(G,"packages/shared/src/db/index.ts")};for(let[Y,Z]of Object.entries(U))if(_(Z))Q[Y]=Z;for(let Y of["agents","core","llms","shared"]){let Z=q(G,"packages",Y),$=q(Z,"package.json");if(!_($))continue;try{let X=JSON.parse(C($,"utf8"));if(typeof X.name!=="string"||!X.exports)continue;if(typeof X.exports==="string"){let K=q(Z,X.exports);if(_(K))Q[X.name]=K;continue}if(typeof X.exports!=="object")continue;for(let[K,A]of Object.entries(X.exports)){let L=wG(Z,A);if(!L)continue;let w=K==="."?X.name:`${X.name}/${K.replace(/^\.\//,"")}`;Q[w]=L}}catch{}}return Q}function wG(G,Q){let U=v(Q);if(!U)return null;let Y=d(G,U);for(let Z of Y)if(_(Z))return Z;return null}function v(G,Q=new Set){if(typeof G==="string")return G;if(!G||typeof G!=="object")return null;if(Q.has(G))return null;Q.add(G);let U=G;for(let Y of WG){let Z=v(U[Y],Q);if(Z)return Z}return null}function d(G,Q){let U=Q.replace(/^\.\//,""),Y=[q(G,Q)];if(U.startsWith("dist/")){let Z=U.replace(/^dist\//,"src/").replace(/\.(mjs|cjs|js)$/,"");return[q(G,`${Z}.ts`),q(G,`${Z}.tsx`),q(G,`${Z}.mts`),q(G,`${Z}.cts`),...Y]}return Y}function AG(G){return Object.fromEntries(Object.entries(G).sort(([Q],[U])=>U.length-Q.length))}function H(G){return!(G.startsWith(".")||G.startsWith("/")||G.startsWith("file:")||G.startsWith("data:")||G.startsWith("http:")||G.startsWith("https:"))}function M(G){if(G.startsWith("@")){let[Q,U]=G.split("/",3);return U?`${Q}/${U}`:G}return G.split("/",1)[0]??G}function LG(G){let Q=M(G);if(G===Q)return".";return`.${G.slice(Q.length)}`}function u(G){return M(G).startsWith("@cline/")}function y(G,Q){let U=M(Q),Y=J(G);while(!0){let Z=q(Y,"node_modules",U);if(_(Z)||_(q(Z,"package.json")))return!0;let $=q(Y,"..");if($===Y)return!1;Y=$}}function P(G){return b(G)!==null}function b(G){try{return $G.resolve(G)}catch{}return FG(G)}function FG(G){let Q=M(G),U=c(Q);if(!U)return null;let Y=q(U,"package.json");try{let Z=JSON.parse(C(Y,"utf8")),$=LG(G),X=$==="."&&typeof Z.exports==="string"?Z.exports:Z.exports&&typeof Z.exports==="object"&&Object.hasOwn(Z.exports,$)?Z.exports[$]:void 0,K=v(X)??($==="."&&typeof Z.main==="string"?Z.main:null);if(!K)return null;let A=q(U,K),L=[A,...d(U,K).filter((w)=>w!==A)];for(let w of L)if(_(w))return w;return null}catch{return null}}function JG(){let G=[m],Q=process.env.CLINE_WRAPPER_PATH?.trim();if(Q)G.push(J(J(Q)));let U=process.execPath?.trim();if(U)G.push(J(U));return[...new Set(G.map((Y)=>q(Y)))]}function zG(G,Q){let U=G;while(!0){let Y=q(U,"package.json");if(_(Y))try{if(JSON.parse(C(Y,"utf8")).name===Q)return U}catch{}let Z=q(U,"node_modules",Q,"package.json");if(_(Z))return J(Z);let $=q(U,"..");if($===U)return null;U=$}}function c(G){for(let Q of JG()){let U=zG(Q,G);if(U)return U}return null}function MG(G){let U=J(G);for(let Y=0;Y<4;Y++){let Z=q(U,"package.json");if(_(Z))try{let X=JSON.parse(C(Z,"utf8"));return X!=null&&typeof X==="object"&&"cline"in X}catch{return!1}let $=q(U,"..");if($===U)return!1;U=$}return!1}function l(G,Q){let U=Q.startsWith("file:")?h(Q):YG(Q)?Q:q(J(G),Q);if(_(U)&&j.has(I(U)))return U;for(let Y of j){let Z=`${U}${Y}`;if(_(Z))return Z}for(let Y of j){let Z=q(U,`index${Y}`);if(_(Z))return Z}return null}function g(G){let Q=new Set,U=[/\bimport\s+(?:type\s+)?[^"'`]*?\bfrom\s*["'`]([^"'`]+)["'`]/g,/\bexport\s+[^"'`]*?\bfrom\s*["'`]([^"'`]+)["'`]/g,/\bimport\s*\(\s*["'`]([^"'`]+)["'`]\s*\)/g,/\brequire\s*\(\s*["'`]([^"'`]+)["'`]\s*\)/g];for(let Y of U)for(let Z of G.matchAll(Y)){let $=Z[1];if($)Q.add($)}return[...Q]}function CG(G){return I(G)!==".ts"}function n(G,Q,U=new Set){if(U.has(G)||!_(G))return;if(U.add(G),!j.has(I(G)))return;let Y=C(G,"utf8"),Z=CG(G);for(let $ of g(Y)){if($.startsWith("node:")||k.has($))continue;if(H($)){if(!Z)continue;if(Object.hasOwn(T,$)||Object.hasOwn(T,M($))||y(G,$)||u($)&&P($)||Q&&P($))continue;throw Error(`Cannot find module '${M($)}'`)}let X=l(G,$);if(X)n(X,Q,U)}}function o(G,Q=new Set,U=new Set){if(Q.has(G)||!_(G))return U;if(Q.add(G),!j.has(I(G)))return U;let Y=C(G,"utf8");for(let Z of g(Y)){if(U.add(Z),H(Z))continue;let $=l(G,Z);if($)o($,Q,U)}return U}function OG(G,Q){let U=R(G),Y={},Z=o(G),$=new Set(qG);for(let[X,K]of Object.entries(T)){try{U.resolve(X);continue}catch{}Y[X]=K}for(let X of Z)if(H(X)&&(u(X)||Q))$.add(X);for(let X of $){if(Object.hasOwn(Y,X)||y(G,X))continue;let K=b(X);if(K)Y[X]=K}if(!Q)return Y;for(let X of Z){if(!H(X)||Object.hasOwn(Y,X)||y(G,X)||X.startsWith("node:")||k.has(X))continue;let K=b(X);if(K)Y[X]=K}return Y}function jG(G){let Q=I(G);return Q===".ts"||Q===".tsx"||Q===".mts"||Q===".cts"}var z;function IG(){if(z!==void 0)return z;let G=c("jiti");if(!G)return z=null,null;let Q=q(G,"dist","babel.cjs");if(!_(Q))return z=null,null;try{let Y=R(Q)(Q);z=typeof Y==="function"?Y:null}catch{z=null}return z}async function p(G,Q={}){let U=!MG(G);n(G,U);let Y=OG(G,U),Z=AG(Y),$=await import("jiti"),X=typeof $==="function"?$:typeof $.default==="function"?$.default:void 0;if(!X)throw Error("Unable to load jiti");let K=Object.entries(Z).filter(([,W])=>jG(W)).map(([W])=>W),A=IG(),L=A?(W)=>A({...W,interopDefault:!0}):void 0;return await X(G,{alias:Z,cache:Q.useCache,requireCache:Q.useCache,esmResolve:!0,interopDefault:!1,nativeModules:[...k],transformModules:K,tryNative:!1,...L?{transform:L}:{}}).import(G,{})}function s(G,Q){if(!G)return!0;if(G.providerIds?.length){if(!Q?.providerId||!G.providerIds.includes(Q.providerId))return!1}if(G.modelIds?.length){if(!Q?.modelId||!G.modelIds.includes(Q.modelId))return!1}return!0}function F(G){return typeof G==="object"&&G!==null}function t(G){return Array.isArray(G)&&G.every((Q)=>typeof Q==="string")}function DG(G,Q){if(!F(G))throw Error(`Invalid plugin module: ${Q}`);if(typeof G.name!=="string"||!G.name)throw Error(`Invalid plugin name: ${Q}`);if(!F(G.manifest))throw Error(`Invalid plugin manifest: ${Q}`);if(Object.hasOwn(G.manifest,"providerIds")&&!t(G.manifest.providerIds))throw Error(`Invalid plugin manifest.providerIds: ${Q}`);if(Object.hasOwn(G.manifest,"modelIds")&&!t(G.manifest.modelIds))throw Error(`Invalid plugin manifest.modelIds: ${Q}`)}function HG(G){if(!F(G))throw Error("Plugin setup context must be an object");if(G.session!==void 0&&!F(G.session))throw Error("Plugin setup context session must be an object");if(G.client!==void 0&&!F(G.client))throw Error("Plugin setup context client must be an object");if(G.user!==void 0&&!F(G.user))throw Error("Plugin setup context user must be an object");if(G.workspaceInfo!==void 0&&!F(G.workspaceInfo))throw Error("Plugin setup context workspaceInfo must be an object");if(G.automation!==void 0&&!F(G.automation))throw Error("Plugin setup context automation must be an object");if(G.automation!==void 0&&typeof G.automation.ingestEvent!=="function")throw Error("Plugin setup context automation.ingestEvent must be a function");if(G.logger!==void 0&&!F(G.logger))throw Error("Plugin setup context logger must be an object")}var i=0,N=new Map,f=new Map;function NG(G){let Q=G instanceof Error?G.message:String(G),U=G instanceof Error?G.stack:void 0;return{message:Q,stack:U}}function x(G,Q,U,Y){if(!process.send)return;process.send({type:"response",id:G,ok:Q,result:U,error:Y})}function E(G,Q){if(!process.send)return;process.send({type:"event",name:G,payload:Q})}globalThis.__clinePluginHost={emitEvent:E};globalThis.__clineSessionEnv={cwd:void 0,workspaceInfo:void 0};function r(G){if(!G||typeof G!=="object")return{};return G}function S(G){if(!G||typeof G!=="object")return;let Q={...G};if(Q.error instanceof Error)Q.error={name:Q.error.name,message:Q.error.message,stack:Q.error.stack};return Q}function SG(G){let Q=(U,Y,Z)=>{E("plugin_log",{level:U,pluginName:G,message:Y,metadata:S(Z)})};return{debug:(U,Y)=>Q("debug",U,Y),log:(U,Y)=>Q("log",U,Y),error:(U,Y)=>Q("error",U,Y)}}function EG(G){let Q=(Z)=>{E("plugin_telemetry",{pluginName:G,...Z})},U=(Z)=>($,X,K,A,L)=>{Q({kind:"metric",metric:Z,name:$,value:X,attributes:S(K),description:A,required:L})},Y=()=>{};return{capture:(Z)=>{Q({kind:"event",event:Z?.event,properties:S(Z?.properties)})},captureRequired:(Z,$)=>{Q({kind:"event",event:Z,properties:S($),required:!0})},recordCounter:U("counter"),recordHistogram:U("histogram"),recordGauge:U("gauge"),isEnabled:()=>!0,setDistinctId:Y,setMetadata:Y,updateMetadata:Y,setCommonProperties:Y,updateCommonProperties:Y,flush:async()=>{},dispose:async()=>{}}}function O(G,Q){let U=`${G}:${Q}`,Y=(f.get(U)??0)+1;return f.set(U,Y),`${G}_${Q}_${Y}`}function VG(G){let Q=typeof G.eventType==="string"?G.eventType.trim():"",U=typeof G.source==="string"?G.source.trim():"";if(!Q)throw Error("Automation event type contribution requires eventType");if(!U)throw Error("Automation event type contribution requires source");return{...G,eventType:Q,source:U,examples:G.examples?[...G.examples]:void 0,metadata:G.metadata?r(G.metadata):void 0}}function B(G){let Q=N.get(G);if(!Q)throw Error(`Unknown sandbox plugin id: ${G}`);return Q}async function TG(G){let Q;try{let U=await p(G.pluginPath);if(Q=U.default??U[G.exportName],DG(Q,G.pluginPath),Q.manifest=BG(Q.manifest),!s(Q.manifest,G.targeting))return{type:"skipped"};let Y={tools:[],commands:[],rules:[],messageBuilders:[],providers:[],automationEventTypes:[],mcpServers:[],shortcuts:[],flags:[]},Z={tools:new Map,commands:new Map,rules:new Map,messageBuilders:new Map},$={registerTool:(X)=>{let K=O(G.pluginId,"tool");Z.tools.set(K,X.execute),Y.tools.push({id:K,name:X.name,description:X.description,inputSchema:X.inputSchema,timeoutMs:X.timeoutMs,retryable:X.retryable})},registerCommand:(X)=>{let K=O(G.pluginId,"command");if(typeof X.handler==="function")Z.commands.set(K,X.handler);Y.commands.push({id:K,name:X.name,description:X.description})},registerRule:(X)=>{let K=O(G.pluginId,"rule");if(typeof X.content==="function"){Z.rules.set(K,X.content),Y.rules.push({id:K,ruleId:X.id,source:X.source,hasContentHandler:!0});return}Y.rules.push({id:K,ruleId:X.id,content:X.content,source:X.source})},registerMessageBuilder:(X)=>{let K=O(G.pluginId,"builder");Z.messageBuilders.set(K,X.build),Y.messageBuilders.push({id:K,name:X.name})},registerProvider:(X)=>{Y.providers.push({id:O(G.pluginId,"provider"),name:X.name,description:X.description,metadata:r(X.metadata)})},registerAutomationEventType:(X)=>{Y.automationEventTypes.push({id:O(G.pluginId,"automation_event"),...VG(X)})},registerMcpServer:(X)=>{Y.mcpServers.push(X)}};if(typeof Q.setup==="function")try{let X={...G.setupCtxBase,...G.telemetryEnabled?{telemetry:EG(Q.name)}:{},...G.loggerEnabled?{logger:SG(Q.name)}:{},...Q.manifest.capabilities.includes("automationEvents")?{automation:{ingestEvent:(K)=>{E("automation_event",K)}}}:{}};HG(X),await Q.setup($,X)}catch(X){return{type:"failure",failure:{pluginPath:G.pluginPath,pluginName:Q.name,phase:"setup",message:X instanceof Error?X.message:String(X),stack:X instanceof Error?X.stack:void 0}}}return{type:"loaded",state:{plugin:Q,handlers:Z},descriptor:{pluginId:G.pluginId,pluginPath:G.pluginPath,name:Q.name,manifest:Q.manifest,hooks:Q.hooks?Object.entries(Q.hooks).filter(([,X])=>typeof X==="function").map(([X])=>X):void 0,contributions:Y}}}catch(U){return{type:"failure",failure:{pluginPath:G.pluginPath,pluginName:Q?.name,phase:"load",message:U instanceof Error?U.message:String(U),stack:U instanceof Error?U.stack:void 0}}}}async function yG(G){if(N.clear(),i=0,f.clear(),G.cwd)try{process.chdir(G.cwd)}catch{}let Q=globalThis.__clineSessionEnv;if(Q)Q.cwd=G.cwd,Q.workspaceInfo=G.workspaceInfo;let U=[],Y=[],Z=[],$=G.exportName||"plugin",X=new Map,K={providerId:G.providerId,modelId:G.modelId},A={session:G.session,client:G.client,user:G.user,workspaceInfo:G.workspaceInfo},L=await Promise.all((G.pluginPaths||[]).map((w)=>{let W=`plugin_${++i}`;return TG({pluginPath:w,pluginId:W,exportName:$,targeting:K,setupCtxBase:A,loggerEnabled:G.loggerEnabled,telemetryEnabled:G.telemetryEnabled})}));for(let w of L){if(w.type==="skipped")continue;if(w.type==="failure"){Y.push(w.failure);continue}let{descriptor:W,state:a}=w,V=X.get(W.name);if(V!==void 0){let D=U[V];if(!D)X.delete(W.name);else{Z.push({type:"duplicate_plugin_override",pluginName:W.name,pluginPath:W.pluginPath,overriddenPluginPath:D.pluginPath,message:`Plugin "${W.name}" from ${W.pluginPath} overrides ${D.pluginPath}`}),N.delete(D.pluginId),U.splice(V,1),X.clear();for(let[e,GG]of U.entries())X.set(GG.name,e)}}N.set(W.pluginId,a),X.set(W.name,U.length),U.push(W)}return{plugins:U,failures:Y,warnings:Z}}async function bG(G){let U=B(G.pluginId).plugin.hooks?.[G.hookName];if(typeof U!=="function")return;return await U(G.payload)}async function RG(G){let U=B(G.pluginId).handlers.tools.get(G.contributionId);if(typeof U!=="function")throw Error("Unknown sandbox tool contribution");return await U(G.input,G.context)}async function kG(G){let U=B(G.pluginId).handlers.commands.get(G.contributionId);if(typeof U!=="function")return"";return await U(G.input)}async function vG(G){let U=B(G.pluginId).handlers.messageBuilders.get(G.contributionId);if(typeof U!=="function")return[];return await U(G.messages)}async function xG(G){let U=B(G.pluginId).handlers.rules.get(G.contributionId);if(typeof U!=="function")return"";return await U()}var fG={initialize:yG,invokeHook:bG,executeTool:RG,executeCommand:kG,buildMessages:vG,resolveRuleContent:xG};process.on("message",async(G)=>{if(!G||G.type!=="call")return;let Q=fG[G.method];if(!Q){x(G.id,!1,void 0,{message:`Unknown method: ${String(G.method)}`});return}try{let U=await Q(G.args||{});x(G.id,!0,U)}catch(U){x(G.id,!1,void 0,NG(U))}});
|
|
@@ -40,7 +40,7 @@ export declare function buildRunCommandsDescription(shellKind: ShellKind, isWind
|
|
|
40
40
|
* names the new shell. The provider must return the shell the executor will
|
|
41
41
|
* use for tool calls issued by that next request.
|
|
42
42
|
*/
|
|
43
|
-
export declare function createShellTool(executor: ShellExecutor, config?: Pick<DefaultToolsConfig, "cwd" | "bashTimeoutMs"> & {
|
|
43
|
+
export declare function createShellTool(executor: ShellExecutor, config?: Pick<DefaultToolsConfig, "cwd" | "bashTimeoutMs" | "telemetry"> & {
|
|
44
44
|
shell?: string | (() => string);
|
|
45
45
|
}): AgentTool<unknown, ToolOperationResult[]>;
|
|
46
46
|
/**
|
|
@@ -13,7 +13,7 @@ import { type FileReadExecutorOptions } from "./file-read";
|
|
|
13
13
|
import { type SearchExecutorOptions } from "./search";
|
|
14
14
|
import { type WebFetchExecutorOptions } from "./web-fetch";
|
|
15
15
|
export { type ApplyPatchExecutorOptions, computePatchChanges, createApplyPatchExecutor, type PatchFileChange, } from "./apply-patch";
|
|
16
|
-
export { PatchActionType } from "./apply-patch-parser";
|
|
16
|
+
export { PATCH_MARKERS, PatchActionType } from "./apply-patch-parser";
|
|
17
17
|
export { CommandExitError, createShellExecutor, type ShellExecutorOptions, } from "./bash";
|
|
18
18
|
export { createEditorExecutor, type EditorExecutorOptions } from "./editor";
|
|
19
19
|
export { createFileReadExecutor, type FileReadExecutorOptions, } from "./file-read";
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
export { validateWithZod, zodToJsonSchema } from "@cline/shared";
|
|
7
7
|
export { ALL_DEFAULT_TOOL_NAMES, DefaultToolNames } from "./constants";
|
|
8
8
|
export { createApplyPatchTool, createAskQuestionTool, createDefaultTools, createEditorTool, createReadFilesTool, createSearchTool, createShellTool, createSkillsTool, createSubmitAndExitTool, createWebFetchTool, } from "./definitions";
|
|
9
|
-
export { type ApplyPatchExecutorOptions, CommandExitError, computePatchChanges, createApplyPatchExecutor, createDefaultExecutors, createDefaultShellExecutor, createEditorExecutor, createFileReadExecutor, createSearchExecutor, createShellExecutor, createWebFetchExecutor, type DefaultExecutorsOptions, type EditorExecutorOptions, type FileReadExecutorOptions, PatchActionType, type PatchFileChange, type SearchExecutorOptions, type ShellExecutorOptions, type WebFetchExecutorOptions, } from "./executors/index";
|
|
9
|
+
export { type ApplyPatchExecutorOptions, CommandExitError, computePatchChanges, createApplyPatchExecutor, createDefaultExecutors, createDefaultShellExecutor, createEditorExecutor, createFileReadExecutor, createSearchExecutor, createShellExecutor, createWebFetchExecutor, type DefaultExecutorsOptions, type EditorExecutorOptions, type FileReadExecutorOptions, PATCH_MARKERS, PatchActionType, type PatchFileChange, type SearchExecutorOptions, type ShellExecutorOptions, type WebFetchExecutorOptions, } from "./executors/index";
|
|
10
10
|
export { MAX_COMMAND_OUTPUT_CHARS, truncateCommandOutput, } from "./executors/output-limits";
|
|
11
11
|
export { DEFAULT_MODEL_TOOL_ROUTING_RULES, resolveToolRoutingConfig, type ToolRoutingRule, } from "./model-tool-routing";
|
|
12
12
|
export { createDefaultToolsWithPreset, createToolPoliciesWithPreset, resolveToolPresetName, type ToolPolicyPresetName, type ToolPresetName, ToolPresets, } from "./presets";
|
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
export declare const INPUT_ARG_CHAR_LIMIT = 6000;
|
|
9
9
|
export declare const ReadFileLineRangeSchema: z.ZodObject<{
|
|
10
|
-
start_line: z.ZodOptional<z.ZodNullable<z.
|
|
11
|
-
end_line: z.ZodOptional<z.ZodNullable<z.
|
|
10
|
+
start_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
11
|
+
end_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
12
12
|
}, z.core.$strip>;
|
|
13
13
|
export declare const ReadFileRequestSchema: z.ZodObject<{
|
|
14
14
|
path: z.ZodString;
|
|
15
|
-
start_line: z.ZodOptional<z.ZodNullable<z.
|
|
16
|
-
end_line: z.ZodOptional<z.ZodNullable<z.
|
|
15
|
+
start_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
16
|
+
end_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
17
17
|
}, z.core.$strip>;
|
|
18
18
|
/**
|
|
19
19
|
* Schema for read_files tool input
|
|
@@ -21,8 +21,8 @@ export declare const ReadFileRequestSchema: z.ZodObject<{
|
|
|
21
21
|
export declare const ReadFilesInputSchema: z.ZodObject<{
|
|
22
22
|
files: z.ZodArray<z.ZodObject<{
|
|
23
23
|
path: z.ZodString;
|
|
24
|
-
start_line: z.ZodOptional<z.ZodNullable<z.
|
|
25
|
-
end_line: z.ZodOptional<z.ZodNullable<z.
|
|
24
|
+
start_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
25
|
+
end_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
26
26
|
}, z.core.$strip>>;
|
|
27
27
|
}, z.core.$strip>;
|
|
28
28
|
/**
|
|
@@ -31,16 +31,16 @@ export declare const ReadFilesInputSchema: z.ZodObject<{
|
|
|
31
31
|
export declare const ReadFilesInputUnionSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
32
32
|
files: z.ZodArray<z.ZodObject<{
|
|
33
33
|
path: z.ZodString;
|
|
34
|
-
start_line: z.ZodOptional<z.ZodNullable<z.
|
|
35
|
-
end_line: z.ZodOptional<z.ZodNullable<z.
|
|
34
|
+
start_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
35
|
+
end_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
36
36
|
}, z.core.$strip>>;
|
|
37
37
|
}, z.core.$strip>, z.ZodUnion<readonly [z.ZodObject<{
|
|
38
38
|
path: z.ZodString;
|
|
39
|
-
start_line: z.ZodOptional<z.ZodNullable<z.
|
|
40
|
-
end_line: z.ZodOptional<z.ZodNullable<z.
|
|
39
|
+
start_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
40
|
+
end_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
41
41
|
}, z.core.$strip>, z.ZodPipe<z.ZodObject<{
|
|
42
|
-
start_line: z.ZodOptional<z.ZodNullable<z.
|
|
43
|
-
end_line: z.ZodOptional<z.ZodNullable<z.
|
|
42
|
+
start_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
43
|
+
end_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
44
44
|
file_path: z.ZodString;
|
|
45
45
|
}, z.core.$strip>, z.ZodTransform<{
|
|
46
46
|
start_line?: number | null | undefined;
|
|
@@ -51,8 +51,8 @@ export declare const ReadFilesInputUnionSchema: z.ZodUnion<readonly [z.ZodObject
|
|
|
51
51
|
start_line?: number | null | undefined;
|
|
52
52
|
end_line?: number | null | undefined;
|
|
53
53
|
}>>, z.ZodPipe<z.ZodObject<{
|
|
54
|
-
start_line: z.ZodOptional<z.ZodNullable<z.
|
|
55
|
-
end_line: z.ZodOptional<z.ZodNullable<z.
|
|
54
|
+
start_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
55
|
+
end_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
56
56
|
filePath: z.ZodString;
|
|
57
57
|
}, z.core.$strip>, z.ZodTransform<{
|
|
58
58
|
start_line?: number | null | undefined;
|
|
@@ -64,11 +64,11 @@ export declare const ReadFilesInputUnionSchema: z.ZodUnion<readonly [z.ZodObject
|
|
|
64
64
|
end_line?: number | null | undefined;
|
|
65
65
|
}>>]>, z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
66
66
|
path: z.ZodString;
|
|
67
|
-
start_line: z.ZodOptional<z.ZodNullable<z.
|
|
68
|
-
end_line: z.ZodOptional<z.ZodNullable<z.
|
|
67
|
+
start_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
68
|
+
end_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
69
69
|
}, z.core.$strip>, z.ZodPipe<z.ZodObject<{
|
|
70
|
-
start_line: z.ZodOptional<z.ZodNullable<z.
|
|
71
|
-
end_line: z.ZodOptional<z.ZodNullable<z.
|
|
70
|
+
start_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
71
|
+
end_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
72
72
|
file_path: z.ZodString;
|
|
73
73
|
}, z.core.$strip>, z.ZodTransform<{
|
|
74
74
|
start_line?: number | null | undefined;
|
|
@@ -79,8 +79,8 @@ export declare const ReadFilesInputUnionSchema: z.ZodUnion<readonly [z.ZodObject
|
|
|
79
79
|
start_line?: number | null | undefined;
|
|
80
80
|
end_line?: number | null | undefined;
|
|
81
81
|
}>>, z.ZodPipe<z.ZodObject<{
|
|
82
|
-
start_line: z.ZodOptional<z.ZodNullable<z.
|
|
83
|
-
end_line: z.ZodOptional<z.ZodNullable<z.
|
|
82
|
+
start_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
83
|
+
end_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
84
84
|
filePath: z.ZodString;
|
|
85
85
|
}, z.core.$strip>, z.ZodTransform<{
|
|
86
86
|
start_line?: number | null | undefined;
|
|
@@ -93,11 +93,11 @@ export declare const ReadFilesInputUnionSchema: z.ZodUnion<readonly [z.ZodObject
|
|
|
93
93
|
}>>]>>, z.ZodArray<z.ZodString>, z.ZodString, z.ZodObject<{
|
|
94
94
|
files: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
95
95
|
path: z.ZodString;
|
|
96
|
-
start_line: z.ZodOptional<z.ZodNullable<z.
|
|
97
|
-
end_line: z.ZodOptional<z.ZodNullable<z.
|
|
96
|
+
start_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
97
|
+
end_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
98
98
|
}, z.core.$strip>, z.ZodPipe<z.ZodObject<{
|
|
99
|
-
start_line: z.ZodOptional<z.ZodNullable<z.
|
|
100
|
-
end_line: z.ZodOptional<z.ZodNullable<z.
|
|
99
|
+
start_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
100
|
+
end_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
101
101
|
file_path: z.ZodString;
|
|
102
102
|
}, z.core.$strip>, z.ZodTransform<{
|
|
103
103
|
start_line?: number | null | undefined;
|
|
@@ -108,8 +108,8 @@ export declare const ReadFilesInputUnionSchema: z.ZodUnion<readonly [z.ZodObject
|
|
|
108
108
|
start_line?: number | null | undefined;
|
|
109
109
|
end_line?: number | null | undefined;
|
|
110
110
|
}>>, z.ZodPipe<z.ZodObject<{
|
|
111
|
-
start_line: z.ZodOptional<z.ZodNullable<z.
|
|
112
|
-
end_line: z.ZodOptional<z.ZodNullable<z.
|
|
111
|
+
start_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
112
|
+
end_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
113
113
|
filePath: z.ZodString;
|
|
114
114
|
}, z.core.$strip>, z.ZodTransform<{
|
|
115
115
|
start_line?: number | null | undefined;
|
|
@@ -123,11 +123,11 @@ export declare const ReadFilesInputUnionSchema: z.ZodUnion<readonly [z.ZodObject
|
|
|
123
123
|
}, z.core.$strip>, z.ZodObject<{
|
|
124
124
|
files: z.ZodUnion<readonly [z.ZodObject<{
|
|
125
125
|
path: z.ZodString;
|
|
126
|
-
start_line: z.ZodOptional<z.ZodNullable<z.
|
|
127
|
-
end_line: z.ZodOptional<z.ZodNullable<z.
|
|
126
|
+
start_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
127
|
+
end_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
128
128
|
}, z.core.$strip>, z.ZodPipe<z.ZodObject<{
|
|
129
|
-
start_line: z.ZodOptional<z.ZodNullable<z.
|
|
130
|
-
end_line: z.ZodOptional<z.ZodNullable<z.
|
|
129
|
+
start_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
130
|
+
end_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
131
131
|
file_path: z.ZodString;
|
|
132
132
|
}, z.core.$strip>, z.ZodTransform<{
|
|
133
133
|
start_line?: number | null | undefined;
|
|
@@ -138,8 +138,8 @@ export declare const ReadFilesInputUnionSchema: z.ZodUnion<readonly [z.ZodObject
|
|
|
138
138
|
start_line?: number | null | undefined;
|
|
139
139
|
end_line?: number | null | undefined;
|
|
140
140
|
}>>, z.ZodPipe<z.ZodObject<{
|
|
141
|
-
start_line: z.ZodOptional<z.ZodNullable<z.
|
|
142
|
-
end_line: z.ZodOptional<z.ZodNullable<z.
|
|
141
|
+
start_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
142
|
+
end_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
143
143
|
filePath: z.ZodString;
|
|
144
144
|
}, z.core.$strip>, z.ZodTransform<{
|
|
145
145
|
start_line?: number | null | undefined;
|
|
@@ -159,11 +159,11 @@ export declare const ReadFilesInputUnionSchema: z.ZodUnion<readonly [z.ZodObject
|
|
|
159
159
|
}, z.core.$strip>, z.ZodObject<{
|
|
160
160
|
paths: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
161
161
|
path: z.ZodString;
|
|
162
|
-
start_line: z.ZodOptional<z.ZodNullable<z.
|
|
163
|
-
end_line: z.ZodOptional<z.ZodNullable<z.
|
|
162
|
+
start_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
163
|
+
end_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
164
164
|
}, z.core.$strip>, z.ZodPipe<z.ZodObject<{
|
|
165
|
-
start_line: z.ZodOptional<z.ZodNullable<z.
|
|
166
|
-
end_line: z.ZodOptional<z.ZodNullable<z.
|
|
165
|
+
start_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
166
|
+
end_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
167
167
|
file_path: z.ZodString;
|
|
168
168
|
}, z.core.$strip>, z.ZodTransform<{
|
|
169
169
|
start_line?: number | null | undefined;
|
|
@@ -174,8 +174,8 @@ export declare const ReadFilesInputUnionSchema: z.ZodUnion<readonly [z.ZodObject
|
|
|
174
174
|
start_line?: number | null | undefined;
|
|
175
175
|
end_line?: number | null | undefined;
|
|
176
176
|
}>>, z.ZodPipe<z.ZodObject<{
|
|
177
|
-
start_line: z.ZodOptional<z.ZodNullable<z.
|
|
178
|
-
end_line: z.ZodOptional<z.ZodNullable<z.
|
|
177
|
+
start_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
178
|
+
end_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
179
179
|
filePath: z.ZodString;
|
|
180
180
|
}, z.core.$strip>, z.ZodTransform<{
|
|
181
181
|
start_line?: number | null | undefined;
|
|
@@ -189,11 +189,11 @@ export declare const ReadFilesInputUnionSchema: z.ZodUnion<readonly [z.ZodObject
|
|
|
189
189
|
}, z.core.$strip>, z.ZodObject<{
|
|
190
190
|
paths: z.ZodUnion<readonly [z.ZodObject<{
|
|
191
191
|
path: z.ZodString;
|
|
192
|
-
start_line: z.ZodOptional<z.ZodNullable<z.
|
|
193
|
-
end_line: z.ZodOptional<z.ZodNullable<z.
|
|
192
|
+
start_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
193
|
+
end_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
194
194
|
}, z.core.$strip>, z.ZodPipe<z.ZodObject<{
|
|
195
|
-
start_line: z.ZodOptional<z.ZodNullable<z.
|
|
196
|
-
end_line: z.ZodOptional<z.ZodNullable<z.
|
|
195
|
+
start_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
196
|
+
end_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
197
197
|
file_path: z.ZodString;
|
|
198
198
|
}, z.core.$strip>, z.ZodTransform<{
|
|
199
199
|
start_line?: number | null | undefined;
|
|
@@ -204,8 +204,8 @@ export declare const ReadFilesInputUnionSchema: z.ZodUnion<readonly [z.ZodObject
|
|
|
204
204
|
start_line?: number | null | undefined;
|
|
205
205
|
end_line?: number | null | undefined;
|
|
206
206
|
}>>, z.ZodPipe<z.ZodObject<{
|
|
207
|
-
start_line: z.ZodOptional<z.ZodNullable<z.
|
|
208
|
-
end_line: z.ZodOptional<z.ZodNullable<z.
|
|
207
|
+
start_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
208
|
+
end_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
209
209
|
filePath: z.ZodString;
|
|
210
210
|
}, z.core.$strip>, z.ZodTransform<{
|
|
211
211
|
start_line?: number | null | undefined;
|
|
@@ -293,7 +293,7 @@ export declare const EditFileInputSchema: z.ZodObject<{
|
|
|
293
293
|
path: z.ZodString;
|
|
294
294
|
old_text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
295
295
|
new_text: z.ZodString;
|
|
296
|
-
insert_line: z.ZodOptional<z.ZodNullable<z.
|
|
296
|
+
insert_line: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
297
297
|
}, z.core.$strip>;
|
|
298
298
|
/**
|
|
299
299
|
* Schema for apply_patch tool input
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Type definitions for executors, configuration, and results.
|
|
5
5
|
*/
|
|
6
|
-
import type { AgentToolContext, ImageContent, TextContent } from "@cline/shared";
|
|
6
|
+
import type { AgentToolContext, ImageContent, ITelemetryService, TextContent } from "@cline/shared";
|
|
7
7
|
import type { ApplyPatchInput, EditFileInput, ReadFileRequest, StructuredCommandInput } from "./schemas";
|
|
8
8
|
/**
|
|
9
9
|
* Result from a single tool operation
|
|
@@ -152,6 +152,13 @@ export type DefaultToolName = "read_files" | "search_codebase" | "run_commands"
|
|
|
152
152
|
* Configuration for enabling/disabling default tools
|
|
153
153
|
*/
|
|
154
154
|
export interface DefaultToolsConfig {
|
|
155
|
+
/**
|
|
156
|
+
* Host telemetry service, injected at tool construction time. Tools that
|
|
157
|
+
* emit operational telemetry (e.g. run_commands timeouts) close over this
|
|
158
|
+
* service. It is a live host object and must never travel on the per-call
|
|
159
|
+
* AgentToolContext, which crosses process boundaries over JSON IPC.
|
|
160
|
+
*/
|
|
161
|
+
telemetry?: ITelemetryService;
|
|
155
162
|
/**
|
|
156
163
|
* Enable the read_files tool
|
|
157
164
|
* @default true
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AgentHooks, BasicLogger } from "@cline/shared";
|
|
2
|
+
export declare function isCheckpointStashMessage(message: string): boolean;
|
|
2
3
|
export interface CheckpointEntry {
|
|
3
4
|
ref: string;
|
|
4
5
|
createdAt: number;
|
|
@@ -25,13 +26,6 @@ type CreateCheckpointHooksOptions = {
|
|
|
25
26
|
sessionId: string;
|
|
26
27
|
runCount: number;
|
|
27
28
|
}) => Promise<CheckpointEntry | undefined> | CheckpointEntry | undefined;
|
|
28
|
-
/**
|
|
29
|
-
* Starting value for the internal run counter. Use this when a session
|
|
30
|
-
* is created with initial messages (e.g. after a checkpoint restore) so
|
|
31
|
-
* that new checkpoint entries get runCount values that don't collide
|
|
32
|
-
* with entries carried over from the source session.
|
|
33
|
-
*/
|
|
34
|
-
initialRunCount?: number;
|
|
35
29
|
};
|
|
36
30
|
/**
|
|
37
31
|
* Deletes all private git refs under refs/cline/checkpoints/{sessionId}/ that
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import type { AgentExtension, AgentHooks } from "@cline/shared";
|
|
2
|
-
import { type BasicLogger, type WorkspaceInfo } from "@cline/shared";
|
|
1
|
+
import type { AgentExtension, AgentHooks, BasicLogger, WorkspaceInfo } from "@cline/shared";
|
|
3
2
|
type HookRuntimeOptions = {
|
|
4
3
|
cwd: string;
|
|
5
4
|
workspacePath: string;
|
|
6
5
|
rootSessionId?: string;
|
|
7
6
|
logger?: BasicLogger;
|
|
8
7
|
toolCallTimeoutMs?: number;
|
|
8
|
+
/** Keep asynchronous hooks attached until exit. Intended for deterministic tests. */
|
|
9
|
+
detachAsyncHooks?: boolean;
|
|
9
10
|
/** Structured git + path metadata forwarded into every hook payload. */
|
|
10
11
|
workspaceInfo?: WorkspaceInfo;
|
|
11
12
|
};
|