@cline/core 0.0.38-nightly.1778113663

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.
Files changed (227) hide show
  1. package/README.md +108 -0
  2. package/dist/ClineCore.d.ts +282 -0
  3. package/dist/account/cline-account-service.d.ts +37 -0
  4. package/dist/account/index.d.ts +3 -0
  5. package/dist/account/rpc.d.ts +40 -0
  6. package/dist/account/types.d.ts +98 -0
  7. package/dist/auth/bounded-ttl-cache.d.ts +13 -0
  8. package/dist/auth/client.d.ts +30 -0
  9. package/dist/auth/cline.d.ts +64 -0
  10. package/dist/auth/codex.d.ts +43 -0
  11. package/dist/auth/oca.d.ts +28 -0
  12. package/dist/auth/server.d.ts +54 -0
  13. package/dist/auth/types.d.ts +103 -0
  14. package/dist/auth/utils.d.ts +32 -0
  15. package/dist/cline-core/automation.d.ts +34 -0
  16. package/dist/cline-core/runtime-services.d.ts +5 -0
  17. package/dist/cline-core/start-input.d.ts +10 -0
  18. package/dist/cline-core/telemetry.d.ts +10 -0
  19. package/dist/cline-core/types.d.ts +221 -0
  20. package/dist/cron/events/cron-event-ingress.d.ts +37 -0
  21. package/dist/cron/reports/cron-report-writer.d.ts +40 -0
  22. package/dist/cron/runner/cron-materializer.d.ts +35 -0
  23. package/dist/cron/runner/cron-runner.d.ts +45 -0
  24. package/dist/cron/runner/resource-limiter.d.ts +8 -0
  25. package/dist/cron/schedule/scheduler.d.ts +12 -0
  26. package/dist/cron/service/cron-service.d.ts +56 -0
  27. package/dist/cron/service/schedule-command-service.d.ts +9 -0
  28. package/dist/cron/service/schedule-service.d.ts +98 -0
  29. package/dist/cron/specs/cron-reconciler.d.ts +61 -0
  30. package/dist/cron/specs/cron-spec-parser.d.ts +26 -0
  31. package/dist/cron/specs/cron-watcher.d.ts +22 -0
  32. package/dist/cron/store/cron-schema.d.ts +2 -0
  33. package/dist/cron/store/sqlite-cron-store.d.ts +240 -0
  34. package/dist/extensions/config/index.d.ts +7 -0
  35. package/dist/extensions/config/runtime-commands.d.ts +11 -0
  36. package/dist/extensions/config/skill-frontmatter-toggle.d.ts +11 -0
  37. package/dist/extensions/config/unified-config-file-watcher.d.ts +77 -0
  38. package/dist/extensions/config/user-instruction-config-loader.d.ts +64 -0
  39. package/dist/extensions/config/user-instruction-plugin.d.ts +25 -0
  40. package/dist/extensions/config/user-instruction-service.d.ts +23 -0
  41. package/dist/extensions/context/agentic-compaction.d.ts +12 -0
  42. package/dist/extensions/context/basic-compaction.d.ts +8 -0
  43. package/dist/extensions/context/compaction-shared.d.ts +60 -0
  44. package/dist/extensions/context/compaction.d.ts +24 -0
  45. package/dist/extensions/index.d.ts +5 -0
  46. package/dist/extensions/mcp/client.d.ts +2 -0
  47. package/dist/extensions/mcp/config-loader.d.ts +15 -0
  48. package/dist/extensions/mcp/index.d.ts +8 -0
  49. package/dist/extensions/mcp/manager.d.ts +23 -0
  50. package/dist/extensions/mcp/name-transform.d.ts +2 -0
  51. package/dist/extensions/mcp/policies.d.ts +14 -0
  52. package/dist/extensions/mcp/tools.d.ts +3 -0
  53. package/dist/extensions/mcp/types.d.ts +94 -0
  54. package/dist/extensions/plugin/plugin-config-loader.d.ts +40 -0
  55. package/dist/extensions/plugin/plugin-load-report.d.ts +18 -0
  56. package/dist/extensions/plugin/plugin-loader.d.ts +22 -0
  57. package/dist/extensions/plugin/plugin-module-import.d.ts +4 -0
  58. package/dist/extensions/plugin/plugin-sandbox.d.ts +36 -0
  59. package/dist/extensions/plugin/plugin-targeting.d.ts +6 -0
  60. package/dist/extensions/plugin-sandbox-bootstrap.js +1 -0
  61. package/dist/extensions/tools/constants.d.ts +24 -0
  62. package/dist/extensions/tools/definitions.d.ts +102 -0
  63. package/dist/extensions/tools/executors/apply-patch-parser.d.ts +68 -0
  64. package/dist/extensions/tools/executors/apply-patch.d.ts +28 -0
  65. package/dist/extensions/tools/executors/bash.d.ts +49 -0
  66. package/dist/extensions/tools/executors/editor.d.ts +31 -0
  67. package/dist/extensions/tools/executors/file-read.d.ts +40 -0
  68. package/dist/extensions/tools/executors/index.d.ts +50 -0
  69. package/dist/extensions/tools/executors/search.d.ts +50 -0
  70. package/dist/extensions/tools/executors/web-fetch.d.ts +58 -0
  71. package/dist/extensions/tools/helpers.d.ts +15 -0
  72. package/dist/extensions/tools/index.d.ts +59 -0
  73. package/dist/extensions/tools/model-tool-routing.d.ts +33 -0
  74. package/dist/extensions/tools/presets.d.ts +132 -0
  75. package/dist/extensions/tools/runtime.d.ts +24 -0
  76. package/dist/extensions/tools/schemas.d.ts +241 -0
  77. package/dist/extensions/tools/team/delegated-agent.d.ts +43 -0
  78. package/dist/extensions/tools/team/index.d.ts +2 -0
  79. package/dist/extensions/tools/team/multi-agent.d.ts +230 -0
  80. package/dist/extensions/tools/team/projections.d.ts +8 -0
  81. package/dist/extensions/tools/team/runtime.d.ts +4 -0
  82. package/dist/extensions/tools/team/spawn-agent-tool.d.ts +83 -0
  83. package/dist/extensions/tools/team/subagent-prompts.d.ts +3 -0
  84. package/dist/extensions/tools/team/team-tools.d.ts +35 -0
  85. package/dist/extensions/tools/types.d.ts +254 -0
  86. package/dist/hooks/checkpoint-hooks.d.ts +45 -0
  87. package/dist/hooks/hook-extension.d.ts +2 -0
  88. package/dist/hooks/hook-file-config.d.ts +24 -0
  89. package/dist/hooks/hook-file-hooks.d.ts +21 -0
  90. package/dist/hooks/index.d.ts +5 -0
  91. package/dist/hooks/subprocess-runner.d.ts +21 -0
  92. package/dist/hooks/subprocess.d.ts +68 -0
  93. package/dist/hub/client/connect.d.ts +14 -0
  94. package/dist/hub/client/index.d.ts +88 -0
  95. package/dist/hub/client/session-client.d.ts +118 -0
  96. package/dist/hub/client/ui-client.d.ts +45 -0
  97. package/dist/hub/daemon/entry.d.ts +1 -0
  98. package/dist/hub/daemon/entry.js +720 -0
  99. package/dist/hub/daemon/index.d.ts +8 -0
  100. package/dist/hub/daemon/runtime-handlers.d.ts +12 -0
  101. package/dist/hub/daemon/start-shared-server.d.ts +18 -0
  102. package/dist/hub/discovery/defaults.d.ts +16 -0
  103. package/dist/hub/discovery/index.d.ts +30 -0
  104. package/dist/hub/discovery/workspace.d.ts +3 -0
  105. package/dist/hub/index.d.ts +32 -0
  106. package/dist/hub/index.js +717 -0
  107. package/dist/hub/runtime-host/hub-runtime-host.d.ts +73 -0
  108. package/dist/hub/runtime-host/remote-runtime-host.d.ts +9 -0
  109. package/dist/hub/server/browser-websocket.d.ts +17 -0
  110. package/dist/hub/server/command-transport.d.ts +7 -0
  111. package/dist/hub/server/handlers/approval-handlers.d.ts +17 -0
  112. package/dist/hub/server/handlers/capability-handlers.d.ts +12 -0
  113. package/dist/hub/server/handlers/client-handlers.d.ts +6 -0
  114. package/dist/hub/server/handlers/context.d.ts +56 -0
  115. package/dist/hub/server/handlers/run-handlers.d.ts +5 -0
  116. package/dist/hub/server/handlers/session-event-projector.d.ts +7 -0
  117. package/dist/hub/server/handlers/session-handlers.d.ts +20 -0
  118. package/dist/hub/server/hub-client-contributions.d.ts +19 -0
  119. package/dist/hub/server/hub-notifications.d.ts +7 -0
  120. package/dist/hub/server/hub-schedule-events.d.ts +2 -0
  121. package/dist/hub/server/hub-server-logging.d.ts +2 -0
  122. package/dist/hub/server/hub-server-options.d.ts +55 -0
  123. package/dist/hub/server/hub-server-transport.d.ts +34 -0
  124. package/dist/hub/server/hub-session-records.d.ts +8 -0
  125. package/dist/hub/server/hub-websocket-server.d.ts +6 -0
  126. package/dist/hub/server/index.d.ts +4 -0
  127. package/dist/hub/server/native-transport.d.ts +16 -0
  128. package/dist/index.d.ts +102 -0
  129. package/dist/index.js +715 -0
  130. package/dist/runtime/capabilities/index.d.ts +2 -0
  131. package/dist/runtime/capabilities/normalize-runtime-capabilities.d.ts +2 -0
  132. package/dist/runtime/capabilities/runtime-capabilities.d.ts +6 -0
  133. package/dist/runtime/config/agent-message-codec.d.ts +6 -0
  134. package/dist/runtime/config/agent-runtime-config-builder.d.ts +87 -0
  135. package/dist/runtime/host/history.d.ts +18 -0
  136. package/dist/runtime/host/host.d.ts +7 -0
  137. package/dist/runtime/host/local/agent-event-bridge.d.ts +29 -0
  138. package/dist/runtime/host/local/session-record.d.ts +6 -0
  139. package/dist/runtime/host/local/session-service-invoker.d.ts +4 -0
  140. package/dist/runtime/host/local/spawn-tool.d.ts +15 -0
  141. package/dist/runtime/host/local/user-files.d.ts +1 -0
  142. package/dist/runtime/host/local-runtime-host.d.ts +119 -0
  143. package/dist/runtime/host/runtime-host-support.d.ts +20 -0
  144. package/dist/runtime/host/runtime-host.d.ts +163 -0
  145. package/dist/runtime/orchestration/runtime-builder.d.ts +6 -0
  146. package/dist/runtime/orchestration/runtime-event-adapter.d.ts +101 -0
  147. package/dist/runtime/orchestration/runtime-oauth-token-manager.d.ts +30 -0
  148. package/dist/runtime/orchestration/session-runtime-orchestrator.d.ts +218 -0
  149. package/dist/runtime/orchestration/session-runtime.d.ts +58 -0
  150. package/dist/runtime/orchestration/user-input-builder.d.ts +15 -0
  151. package/dist/runtime/safety/loop-detection.d.ts +58 -0
  152. package/dist/runtime/safety/mistake-tracker.d.ts +68 -0
  153. package/dist/runtime/safety/rules.d.ts +6 -0
  154. package/dist/runtime/tools/subprocess-sandbox.d.ts +43 -0
  155. package/dist/runtime/tools/tool-approval.d.ts +9 -0
  156. package/dist/runtime/turn-queue/pending-prompt-service.d.ts +64 -0
  157. package/dist/services/agent-events.d.ts +33 -0
  158. package/dist/services/config.d.ts +2 -0
  159. package/dist/services/global-settings.d.ts +34 -0
  160. package/dist/services/llms/cline-recommended-models.d.ts +19 -0
  161. package/dist/services/llms/configured-provider-registry.d.ts +27 -0
  162. package/dist/services/llms/handler-factory.d.ts +3 -0
  163. package/dist/services/llms/provider-defaults.d.ts +28 -0
  164. package/dist/services/llms/provider-settings.d.ts +247 -0
  165. package/dist/services/llms/runtime-config.d.ts +3 -0
  166. package/dist/services/llms/runtime-registry.d.ts +19 -0
  167. package/dist/services/llms/runtime-types.d.ts +84 -0
  168. package/dist/services/local-runtime-bootstrap.d.ts +45 -0
  169. package/dist/services/plugin-tools.d.ts +15 -0
  170. package/dist/services/providers/local-provider-registry.d.ts +218 -0
  171. package/dist/services/providers/local-provider-service.d.ts +99 -0
  172. package/dist/services/providers/model-source.d.ts +3 -0
  173. package/dist/services/session-artifacts.d.ts +17 -0
  174. package/dist/services/session-data.d.ts +51 -0
  175. package/dist/services/session-telemetry.d.ts +15 -0
  176. package/dist/services/storage/file-team-store.d.ts +28 -0
  177. package/dist/services/storage/provider-settings-legacy-migration.d.ts +38 -0
  178. package/dist/services/storage/provider-settings-manager.d.ts +23 -0
  179. package/dist/services/storage/sqlite-session-store.d.ts +30 -0
  180. package/dist/services/storage/sqlite-team-store.d.ts +34 -0
  181. package/dist/services/storage/team-store.d.ts +15 -0
  182. package/dist/services/telemetry/ITelemetryAdapter.d.ts +54 -0
  183. package/dist/services/telemetry/OpenTelemetryAdapter.d.ts +43 -0
  184. package/dist/services/telemetry/OpenTelemetryProvider.d.ts +83 -0
  185. package/dist/services/telemetry/TelemetryLoggerSink.d.ts +27 -0
  186. package/dist/services/telemetry/TelemetryService.d.ts +34 -0
  187. package/dist/services/telemetry/core-events.d.ts +198 -0
  188. package/dist/services/telemetry/distinct-id.d.ts +1 -0
  189. package/dist/services/telemetry/index.d.ts +3 -0
  190. package/dist/services/telemetry/index.js +1 -0
  191. package/dist/services/usage.d.ts +18 -0
  192. package/dist/services/workspace/file-indexer.d.ts +5 -0
  193. package/dist/services/workspace/index.d.ts +4 -0
  194. package/dist/services/workspace/mention-enricher.d.ts +13 -0
  195. package/dist/services/workspace/workspace-manager.d.ts +27 -0
  196. package/dist/services/workspace/workspace-manifest.d.ts +31 -0
  197. package/dist/services/workspace/workspace-telemetry.d.ts +18 -0
  198. package/dist/session/checkpoint-restore.d.ts +20 -0
  199. package/dist/session/models/session-graph.d.ts +15 -0
  200. package/dist/session/models/session-manifest.d.ts +29 -0
  201. package/dist/session/models/session-row.d.ts +92 -0
  202. package/dist/session/services/file-session-service.d.ts +8 -0
  203. package/dist/session/services/message-builder.d.ts +66 -0
  204. package/dist/session/services/persistence-service.d.ts +58 -0
  205. package/dist/session/services/session-service.d.ts +13 -0
  206. package/dist/session/session-snapshot.d.ts +57 -0
  207. package/dist/session/session-versioning-service.d.ts +48 -0
  208. package/dist/session/stores/conversation-store.d.ts +29 -0
  209. package/dist/session/stores/session-manifest-store.d.ts +21 -0
  210. package/dist/session/stores/team-persistence-store.d.ts +23 -0
  211. package/dist/session/team/index.d.ts +2 -0
  212. package/dist/session/team/team-child-session-manager.d.ts +35 -0
  213. package/dist/session/team/team-session-coordinator.d.ts +13 -0
  214. package/dist/settings/index.d.ts +2 -0
  215. package/dist/settings/settings-service.d.ts +6 -0
  216. package/dist/settings/types.d.ts +42 -0
  217. package/dist/types/chat-schema.d.ts +161 -0
  218. package/dist/types/common.d.ts +19 -0
  219. package/dist/types/config.d.ts +167 -0
  220. package/dist/types/events.d.ts +89 -0
  221. package/dist/types/provider-settings.d.ts +19 -0
  222. package/dist/types/session.d.ts +116 -0
  223. package/dist/types/sessions.d.ts +28 -0
  224. package/dist/types/storage.d.ts +36 -0
  225. package/dist/types.d.ts +32 -0
  226. package/dist/version.d.ts +1 -0
  227. package/package.json +83 -0
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Constants for Default Tools
3
+ *
4
+ * Tool name constants and utility arrays.
5
+ */
6
+ import type { DefaultToolName } from "./types";
7
+ /**
8
+ * Constants for default tool names
9
+ */
10
+ export declare const DefaultToolNames: {
11
+ readonly READ_FILES: "read_files";
12
+ readonly SEARCH_CODEBASE: "search_codebase";
13
+ readonly RUN_COMMANDS: "run_commands";
14
+ readonly FETCH_WEB_CONTENT: "fetch_web_content";
15
+ readonly APPLY_PATCH: "apply_patch";
16
+ readonly EDITOR: "editor";
17
+ readonly SKILLS: "skills";
18
+ readonly ASK: "ask_question";
19
+ readonly SUBMIT_AND_EXIT: "submit_and_exit";
20
+ };
21
+ /**
22
+ * Array of all default tool names
23
+ */
24
+ export declare const ALL_DEFAULT_TOOL_NAMES: DefaultToolName[];
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Default AgentTool Definitions
3
+ *
4
+ * Factory functions for creating the default tools.
5
+ */
6
+ import { type AgentTool } from "@cline/shared";
7
+ import { type ApplyPatchInput, type AskQuestionInput, type EditFileInput, type FetchWebContentInput, type ReadFilesInput, type RunCommandsInput, type SearchCodebaseInput, type SkillsInput, type StructuredCommandInput, type SubmitInput } from "./schemas";
8
+ import type { ApplyPatchExecutor, AskQuestionExecutor, BashExecutor, CreateDefaultToolsOptions, DefaultToolsConfig, EditorExecutor, FileReadExecutor, SearchExecutor, SkillsExecutorWithMetadata, ToolOperationResult, VerifySubmitExecutor, WebFetchExecutor } from "./types";
9
+ /**
10
+ * Create the read_files tool
11
+ *
12
+ * Reads the content of one or more files from the filesystem.
13
+ */
14
+ export declare function createReadFilesTool(executor: FileReadExecutor, config?: Pick<DefaultToolsConfig, "fileReadTimeoutMs">): AgentTool<ReadFilesInput, ToolOperationResult[]>;
15
+ /**
16
+ * Create the search_codebase tool
17
+ *
18
+ * Performs regex pattern searches across the codebase.
19
+ */
20
+ export declare function createSearchTool(executor: SearchExecutor, config?: Pick<DefaultToolsConfig, "cwd" | "searchTimeoutMs">): AgentTool<SearchCodebaseInput, ToolOperationResult[]>;
21
+ /**
22
+ * Create the run_commands tool
23
+ *
24
+ * Executes shell commands in the project directory.
25
+ */
26
+ export declare function createBashTool(executor: BashExecutor, config?: Pick<DefaultToolsConfig, "cwd" | "bashTimeoutMs">): AgentTool<RunCommandsInput, ToolOperationResult[]>;
27
+ /**
28
+ * Create the run_commands tool
29
+ *
30
+ * Executes shell commands in the project directory.
31
+ */
32
+ export declare function createWindowsShellTool(executor: BashExecutor, config?: Pick<DefaultToolsConfig, "cwd" | "bashTimeoutMs">): AgentTool<StructuredCommandInput, ToolOperationResult[]>;
33
+ /**
34
+ * Create the fetch_web_content tool
35
+ *
36
+ * Fetches content from URLs and analyzes them using provided prompts.
37
+ */
38
+ export declare function createWebFetchTool(executor: WebFetchExecutor, config?: Pick<DefaultToolsConfig, "webFetchTimeoutMs">): AgentTool<FetchWebContentInput, ToolOperationResult[]>;
39
+ /**
40
+ * Create the apply_patch tool
41
+ *
42
+ * Applies the canonical apply_patch format to one or more files.
43
+ */
44
+ export declare function createApplyPatchTool(executor: ApplyPatchExecutor, config?: Pick<DefaultToolsConfig, "cwd" | "applyPatchTimeoutMs">): AgentTool<ApplyPatchInput, ToolOperationResult>;
45
+ /**
46
+ * Create the editor tool
47
+ *
48
+ * Supports controlled filesystem edits with create, replace, and insert commands.
49
+ */
50
+ export declare function createEditorTool(executor: EditorExecutor, config?: Pick<DefaultToolsConfig, "cwd" | "editorTimeoutMs">): AgentTool<EditFileInput, ToolOperationResult>;
51
+ /**
52
+ * Create the skills tool
53
+ *
54
+ * Invokes a configured skill by name and optional arguments.
55
+ */
56
+ export declare function createSkillsTool(executor: SkillsExecutorWithMetadata, config?: Pick<DefaultToolsConfig, "skillsTimeoutMs">): AgentTool<SkillsInput, string>;
57
+ /**
58
+ * Create the ask_question tool
59
+ *
60
+ * Asks the user a single clarifying question with 2-5 selectable options.
61
+ */
62
+ export declare function createAskQuestionTool(executor: AskQuestionExecutor): AgentTool<AskQuestionInput, string>;
63
+ export declare function createSubmitAndExitTool(executor: VerifySubmitExecutor, config?: Pick<DefaultToolsConfig, "submitTimeoutMs">): AgentTool<SubmitInput, string>;
64
+ /**
65
+ * Create a set of default tools for an agent
66
+ *
67
+ * This function creates the default tools based on the provided configuration
68
+ * and executors. Only tools that are enabled AND have an executor provided
69
+ * will be included in the returned array.
70
+ *
71
+ * @example
72
+ * ```typescript
73
+ * import { Agent, createDefaultTools } from "@cline/core"
74
+ * import * as fs from "fs/promises"
75
+ * import { exec } from "child_process"
76
+ *
77
+ * const tools = createDefaultTools({
78
+ * executors: {
79
+ * readFile: async ({ path }) => fs.readFile(path, "utf-8"),
80
+ * bash: async (cmd, cwd) => {
81
+ * return new Promise((resolve, reject) => {
82
+ * exec(cmd, { cwd }, (err, stdout, stderr) => {
83
+ * if (err) reject(new Error(stderr || err.message))
84
+ * else resolve(stdout)
85
+ * })
86
+ * })
87
+ * },
88
+ * },
89
+ * enableReadFiles: true,
90
+ * enableBash: true,
91
+ * enableSearch: false, // Disabled
92
+ * enableWebFetch: false, // Disabled
93
+ * cwd: "/path/to/project",
94
+ * })
95
+ *
96
+ * const agent = new Agent({
97
+ * // ... provider config
98
+ * tools,
99
+ * })
100
+ * ```
101
+ */
102
+ export declare function createDefaultTools(options: CreateDefaultToolsOptions): AgentTool[];
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Apply Patch parser and patch model types.
3
+ *
4
+ * This parser supports the Cline apply_patch format used by the legacy runtime.
5
+ */
6
+ export declare const PATCH_MARKERS: {
7
+ readonly BEGIN: "*** Begin Patch";
8
+ readonly END: "*** End Patch";
9
+ readonly ADD: "*** Add File: ";
10
+ readonly UPDATE: "*** Update File: ";
11
+ readonly DELETE: "*** Delete File: ";
12
+ readonly MOVE: "*** Move to: ";
13
+ readonly SECTION: "@@";
14
+ readonly END_FILE: "*** End of File";
15
+ };
16
+ export declare const BASH_WRAPPERS: readonly ["%%bash", "apply_patch", "EOF", "```"];
17
+ export declare enum PatchActionType {
18
+ ADD = "add",
19
+ DELETE = "delete",
20
+ UPDATE = "update"
21
+ }
22
+ export interface PatchChunk {
23
+ origIndex: number;
24
+ delLines: string[];
25
+ insLines: string[];
26
+ }
27
+ export interface PatchAction {
28
+ type: PatchActionType;
29
+ newFile?: string;
30
+ chunks: PatchChunk[];
31
+ movePath?: string;
32
+ }
33
+ export interface PatchWarning {
34
+ path: string;
35
+ chunkIndex?: number;
36
+ message: string;
37
+ context?: string;
38
+ }
39
+ export interface Patch {
40
+ actions: Record<string, PatchAction>;
41
+ warnings?: PatchWarning[];
42
+ }
43
+ export declare class DiffError extends Error {
44
+ constructor(message: string);
45
+ }
46
+ export declare class PatchParser {
47
+ private readonly lines;
48
+ private readonly currentFiles;
49
+ private patch;
50
+ private index;
51
+ private fuzz;
52
+ private currentPath?;
53
+ constructor(lines: string[], currentFiles: Record<string, string>);
54
+ parse(): {
55
+ patch: Patch;
56
+ fuzz: number;
57
+ };
58
+ private addWarning;
59
+ private skipBeginSentinel;
60
+ private hasMoreLines;
61
+ private isEndMarker;
62
+ private parseNextAction;
63
+ private checkDuplicate;
64
+ private parseUpdate;
65
+ private parseUpdateFile;
66
+ private parseDelete;
67
+ private parseAdd;
68
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Apply Patch Executor
3
+ *
4
+ * Built-in implementation for the documented GPT-5 apply_patch grammar.
5
+ * It accepts the freeform patch body directly and tolerates the legacy shell
6
+ * wrapper form used by older prompts.
7
+ */
8
+ import type { ApplyPatchExecutor } from "../types";
9
+ /**
10
+ * Options for the apply_patch executor
11
+ */
12
+ export interface ApplyPatchExecutorOptions {
13
+ /**
14
+ * File encoding used for read/write operations
15
+ * @default "utf-8"
16
+ */
17
+ encoding?: BufferEncoding;
18
+ /**
19
+ * Restrict relative-path file operations to paths inside cwd.
20
+ * Absolute paths are always accepted as-is.
21
+ * @default true
22
+ */
23
+ restrictToCwd?: boolean;
24
+ }
25
+ /**
26
+ * Create an apply_patch executor using Node.js fs module.
27
+ */
28
+ export declare function createApplyPatchExecutor(options?: ApplyPatchExecutorOptions): ApplyPatchExecutor;
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Bash Executor
3
+ *
4
+ * Built-in implementation for running shell commands using Node.js spawn.
5
+ */
6
+ import type { BashExecutor } from "../types";
7
+ /**
8
+ * Options for the bash executor
9
+ */
10
+ export interface BashExecutorOptions {
11
+ /**
12
+ * Shell to use for execution
13
+ * @default "/bin/bash" on Unix, "powershell" on Windows
14
+ */
15
+ shell?: string;
16
+ /**
17
+ * Timeout for command execution in milliseconds
18
+ * @default 30000 (30 seconds)
19
+ */
20
+ timeoutMs?: number;
21
+ /**
22
+ * Maximum output size in bytes
23
+ * @default 1_000_000 (1MB)
24
+ */
25
+ maxOutputBytes?: number;
26
+ /**
27
+ * Environment variables to add/override
28
+ */
29
+ env?: Record<string, string>;
30
+ /**
31
+ * Whether to combine stdout and stderr
32
+ * @default true
33
+ */
34
+ combineOutput?: boolean;
35
+ }
36
+ /**
37
+ * Create a bash executor using Node.js spawn
38
+ *
39
+ * @example
40
+ * ```typescript
41
+ * const bash = createBashExecutor({
42
+ * timeoutMs: 60000, // 1 minute timeout
43
+ * shell: "/bin/zsh",
44
+ * })
45
+ *
46
+ * const output = await bash("ls -la", "/path/to/project", context)
47
+ * ```
48
+ */
49
+ export declare function createBashExecutor(options?: BashExecutorOptions): BashExecutor;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Editor Executor
3
+ *
4
+ * Built-in implementation for filesystem editing operations.
5
+ */
6
+ import type { EditorExecutor } from "../types";
7
+ /**
8
+ * Options for the editor executor
9
+ */
10
+ export interface EditorExecutorOptions {
11
+ /**
12
+ * File encoding used for read/write operations
13
+ * @default "utf-8"
14
+ */
15
+ encoding?: BufferEncoding;
16
+ /**
17
+ * Restrict relative-path file operations to paths inside cwd.
18
+ * Absolute paths are always accepted as-is.
19
+ * @default true
20
+ */
21
+ restrictToCwd?: boolean;
22
+ /**
23
+ * Maximum number of diff lines in str_replace output
24
+ * @default 200
25
+ */
26
+ maxDiffLines?: number;
27
+ }
28
+ /**
29
+ * Create an editor executor using Node.js fs module
30
+ */
31
+ export declare function createEditorExecutor(options?: EditorExecutorOptions): EditorExecutor;
@@ -0,0 +1,40 @@
1
+ /**
2
+ * File Read Executor
3
+ *
4
+ * Built-in implementation for reading files using Node.js fs module.
5
+ */
6
+ import type { FileReadExecutor } from "../types";
7
+ /**
8
+ * Options for the file read executor
9
+ */
10
+ export interface FileReadExecutorOptions {
11
+ /**
12
+ * Maximum file size to read in bytes
13
+ * @default 10_000_000 (10MB)
14
+ */
15
+ maxFileSizeBytes?: number;
16
+ /**
17
+ * File encoding
18
+ * @default "utf-8"
19
+ */
20
+ encoding?: BufferEncoding;
21
+ /**
22
+ * Whether to include line numbers in output
23
+ * @default false
24
+ */
25
+ includeLineNumbers?: boolean;
26
+ }
27
+ /**
28
+ * Create a file read executor using Node.js fs module
29
+ *
30
+ * @example
31
+ * ```typescript
32
+ * const readFile = createFileReadExecutor({
33
+ * maxFileSizeBytes: 5_000_000, // 5MB limit
34
+ * includeLineNumbers: true,
35
+ * })
36
+ *
37
+ * const content = await readFile({ path: "/path/to/file.ts" }, context)
38
+ * ```
39
+ */
40
+ export declare function createFileReadExecutor(options?: FileReadExecutorOptions): FileReadExecutor;
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Built-in Executor Implementations
3
+ *
4
+ * This module provides ready-to-use implementations of the tool executors
5
+ * using Node.js built-in modules. These can be used directly or as references
6
+ * for custom implementations.
7
+ */
8
+ import type { ToolExecutors } from "../types";
9
+ import { type ApplyPatchExecutorOptions } from "./apply-patch";
10
+ import { type BashExecutorOptions } from "./bash";
11
+ import { type EditorExecutorOptions } from "./editor";
12
+ import { type FileReadExecutorOptions } from "./file-read";
13
+ import { type SearchExecutorOptions } from "./search";
14
+ import { type WebFetchExecutorOptions } from "./web-fetch";
15
+ export { type ApplyPatchExecutorOptions, createApplyPatchExecutor, } from "./apply-patch";
16
+ export { type BashExecutorOptions, createBashExecutor, } from "./bash";
17
+ export { createEditorExecutor, type EditorExecutorOptions } from "./editor";
18
+ export { createFileReadExecutor, type FileReadExecutorOptions, } from "./file-read";
19
+ export { createSearchExecutor, type SearchExecutorOptions } from "./search";
20
+ export { createWebFetchExecutor, type WebFetchExecutorOptions, } from "./web-fetch";
21
+ /**
22
+ * Options for creating default executors
23
+ */
24
+ export interface DefaultExecutorsOptions {
25
+ fileRead?: FileReadExecutorOptions;
26
+ search?: SearchExecutorOptions;
27
+ bash?: BashExecutorOptions;
28
+ webFetch?: WebFetchExecutorOptions;
29
+ applyPatch?: ApplyPatchExecutorOptions;
30
+ editor?: EditorExecutorOptions;
31
+ }
32
+ /**
33
+ * Create all default executors with optional configuration
34
+ *
35
+ * @example
36
+ * ```typescript
37
+ * import { createDefaultTools, createDefaultExecutors } from "@cline/core"
38
+ *
39
+ * const executors = createDefaultExecutors({
40
+ * bash: { timeoutMs: 60000 },
41
+ * search: { maxResults: 50 },
42
+ * })
43
+ *
44
+ * const tools = createDefaultTools({
45
+ * executors,
46
+ * cwd: "/path/to/project",
47
+ * })
48
+ * ```
49
+ */
50
+ export declare function createDefaultExecutors(options?: DefaultExecutorsOptions): ToolExecutors;
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Search Executor
3
+ *
4
+ * Built-in implementation for searching the codebase using ripgrep (if available) or regex.
5
+ */
6
+ import type { SearchExecutor } from "../types";
7
+ /**
8
+ * Options for the search executor
9
+ */
10
+ export interface SearchExecutorOptions {
11
+ /**
12
+ * File extensions to include in search (without dot)
13
+ * @default common code extensions
14
+ */
15
+ includeExtensions?: string[];
16
+ /**
17
+ * Directories to exclude from search
18
+ * @default ["node_modules", ".git", "dist", "build", ".next", "coverage"]
19
+ */
20
+ excludeDirs?: string[];
21
+ /**
22
+ * Maximum number of results to return
23
+ * @default 100
24
+ */
25
+ maxResults?: number;
26
+ /**
27
+ * Number of context lines before and after match
28
+ * @default 2
29
+ */
30
+ contextLines?: number;
31
+ /**
32
+ * Maximum depth to traverse
33
+ * @default 20
34
+ */
35
+ maxDepth?: number;
36
+ }
37
+ /**
38
+ * Create a search executor using regex pattern matching
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * const search = createSearchExecutor({
43
+ * maxResults: 50,
44
+ * contextLines: 3,
45
+ * })
46
+ *
47
+ * const results = await search("function\\s+handleClick", "/path/to/project", context)
48
+ * ```
49
+ */
50
+ export declare function createSearchExecutor(options?: SearchExecutorOptions): SearchExecutor;
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Web Fetch Executor
3
+ *
4
+ * Built-in implementation for fetching web content using native fetch.
5
+ */
6
+ import type { WebFetchExecutor } from "../types";
7
+ /**
8
+ * Options for the web fetch executor
9
+ */
10
+ export interface WebFetchExecutorOptions {
11
+ /**
12
+ * Timeout for fetch requests in milliseconds
13
+ * @default 30000 (30 seconds)
14
+ */
15
+ timeoutMs?: number;
16
+ /**
17
+ * Maximum response size in bytes
18
+ * @default 5_000_000 (5MB)
19
+ */
20
+ maxResponseBytes?: number;
21
+ /**
22
+ * User agent string
23
+ * @default "Mozilla/5.0 (compatible; AgentBot/1.0)"
24
+ */
25
+ userAgent?: string;
26
+ /**
27
+ * Additional headers
28
+ */
29
+ headers?: Record<string, string>;
30
+ /**
31
+ * Whether to follow redirects
32
+ * @default true
33
+ */
34
+ followRedirects?: boolean;
35
+ /**
36
+ * Maximum number of redirects to follow
37
+ * @default 5
38
+ */
39
+ maxRedirects?: number;
40
+ }
41
+ /**
42
+ * Create a web fetch executor using native fetch
43
+ *
44
+ * @example
45
+ * ```typescript
46
+ * const webFetch = createWebFetchExecutor({
47
+ * timeoutMs: 15000,
48
+ * maxResponseBytes: 2_000_000,
49
+ * })
50
+ *
51
+ * const content = await webFetch(
52
+ * "https://docs.example.com/api",
53
+ * "Extract the authentication section",
54
+ * context
55
+ * )
56
+ * ```
57
+ */
58
+ export declare function createWebFetchExecutor(options?: WebFetchExecutorOptions): WebFetchExecutor;
@@ -0,0 +1,15 @@
1
+ import { type EditFileInput, type ReadFileRequest, type StructuredCommandInput } from "./schemas";
2
+ /**
3
+ * Format an error into a string message
4
+ */
5
+ export declare function formatError(error: unknown): string;
6
+ export declare function getEditorSizeError(input: EditFileInput): string | null;
7
+ /**
8
+ * Create a timeout-wrapped promise
9
+ */
10
+ export declare function withTimeout<T>(promise: Promise<T>, ms: number, message: string): Promise<T>;
11
+ export declare function normalizeReadFileRequests(input: unknown): ReadFileRequest[];
12
+ export declare function formatReadFileQuery(request: ReadFileRequest): string;
13
+ export declare function getReadFileRangeError(request: ReadFileRequest): string | null;
14
+ export declare function normalizeRunCommandsInput(input: unknown): Array<string | StructuredCommandInput>;
15
+ export declare function formatRunCommandQuery(command: string | StructuredCommandInput): string;
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Default Tools
3
+ *
4
+ * This module provides a set of configurable default tools for agents.
5
+ */
6
+ export { validateWithZod, zodToJsonSchema } from "@cline/shared";
7
+ export { ALL_DEFAULT_TOOL_NAMES, DefaultToolNames } from "./constants";
8
+ export { createApplyPatchTool, createAskQuestionTool, createBashTool, createDefaultTools, createEditorTool, createReadFilesTool, createSearchTool, createSkillsTool, createSubmitAndExitTool, createWebFetchTool, createWindowsShellTool, } from "./definitions";
9
+ export { type ApplyPatchExecutorOptions, type BashExecutorOptions, createApplyPatchExecutor, createBashExecutor, createDefaultExecutors, createEditorExecutor, createFileReadExecutor, createSearchExecutor, createWebFetchExecutor, type DefaultExecutorsOptions, type EditorExecutorOptions, type FileReadExecutorOptions, type SearchExecutorOptions, type WebFetchExecutorOptions, } from "./executors/index";
10
+ export { DEFAULT_MODEL_TOOL_ROUTING_RULES, resolveToolRoutingConfig, type ToolRoutingRule, } from "./model-tool-routing";
11
+ export { createDefaultToolsWithPreset, createToolPoliciesWithPreset, resolveToolPresetName, type ToolPolicyPresetName, type ToolPresetName, ToolPresets, } from "./presets";
12
+ export { type BuiltinToolAvailabilityContext, getCoreAcpToolNames, getCoreBuiltinToolCatalog, getCoreDefaultEnabledToolIds, getCoreHeadlessToolNames, resolveCoreSelectedToolIds, type ToolCatalogEntry, } from "./runtime";
13
+ export { type ApplyPatchInput, ApplyPatchInputSchema, type AskQuestionInput, AskQuestionInputSchema, type EditFileInput, EditFileInputSchema, type FetchWebContentInput, FetchWebContentInputSchema, type ReadFileRequest, ReadFileRequestSchema, type ReadFilesInput, ReadFilesInputSchema, type RunCommandsInput, RunCommandsInputSchema, type SearchCodebaseInput, SearchCodebaseInputSchema, type SkillsInput, SkillsInputSchema, type SubmitInput, SubmitInputSchema, type WebFetchRequest, WebFetchRequestSchema, } from "./schemas";
14
+ export { TEAM_TOOL_NAMES } from "./team/team-tools";
15
+ export type { ApplyPatchExecutor, AskQuestionExecutor, BashExecutor, CreateDefaultToolsOptions, DefaultToolName, DefaultToolsConfig, EditorExecutor, FileReadExecutor, SearchExecutor, SkillsExecutor, SkillsExecutorSkillMetadata, SkillsExecutorWithMetadata, ToolExecutors, ToolOperationResult, VerifySubmitExecutor, WebFetchExecutor, } from "./types";
16
+ import type { AgentTool } from "@cline/shared";
17
+ import { type DefaultExecutorsOptions } from "./executors/index";
18
+ import type { CreateDefaultToolsOptions, ToolExecutors } from "./types";
19
+ /**
20
+ * Options for creating default tools with built-in executors
21
+ */
22
+ export interface CreateBuiltinToolsOptions extends Omit<CreateDefaultToolsOptions, "executors"> {
23
+ /**
24
+ * Configuration for the built-in executors
25
+ */
26
+ executorOptions?: DefaultExecutorsOptions;
27
+ /**
28
+ * Optional executor overrides/additions for tools without built-ins
29
+ */
30
+ executors?: Partial<ToolExecutors>;
31
+ }
32
+ /**
33
+ * Create default tools with built-in Node.js executors
34
+ *
35
+ * This is a convenience function that creates the default tools with
36
+ * working implementations using Node.js built-in modules.
37
+ *
38
+ * @example
39
+ * ```typescript
40
+ * import { Agent, createBuiltinTools } from "@cline/core"
41
+ *
42
+ * const tools = createBuiltinTools({
43
+ * cwd: "/path/to/project",
44
+ * enableBash: true,
45
+ * enableWebFetch: false, // Disable web fetching
46
+ * executorOptions: {
47
+ * bash: { timeoutMs: 60000 },
48
+ * },
49
+ * })
50
+ *
51
+ * const agent = new Agent({
52
+ * providerId: "anthropic",
53
+ * modelId: "claude-sonnet-4-20250514",
54
+ * systemPrompt: "You are a coding assistant.",
55
+ * tools,
56
+ * })
57
+ * ```
58
+ */
59
+ export declare function createBuiltinTools(options?: CreateBuiltinToolsOptions): AgentTool[];
@@ -0,0 +1,33 @@
1
+ import type { CoreAgentMode } from "../../types/config";
2
+ import type { DefaultToolName, DefaultToolsConfig } from "./types";
3
+ export interface ToolRoutingRule {
4
+ /**
5
+ * Optional rule label for debugging and logs.
6
+ */
7
+ name?: string;
8
+ /**
9
+ * Which mode the rule applies to.
10
+ * @default "any"
11
+ */
12
+ mode?: CoreAgentMode | "any";
13
+ /**
14
+ * Case-insensitive substrings that must match the model ID.
15
+ * When omitted/empty, the rule is not constrained by model ID.
16
+ */
17
+ modelIdIncludes?: string[];
18
+ /**
19
+ * Case-insensitive substrings that must match the provider ID.
20
+ * When omitted/empty, the rule is not constrained by provider ID.
21
+ */
22
+ providerIdIncludes?: string[];
23
+ /**
24
+ * Enable these tools when the rule matches.
25
+ */
26
+ enableTools?: DefaultToolName[];
27
+ /**
28
+ * Disable these tools when the rule matches.
29
+ */
30
+ disableTools?: DefaultToolName[];
31
+ }
32
+ export declare const DEFAULT_MODEL_TOOL_ROUTING_RULES: ToolRoutingRule[];
33
+ export declare function resolveToolRoutingConfig(providerId: string, modelId: string, mode: CoreAgentMode, rules: ToolRoutingRule[] | undefined): Partial<DefaultToolsConfig>;