@clinebot/core 0.0.0

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 (200) hide show
  1. package/README.md +88 -0
  2. package/dist/account/cline-account-service.d.ts +34 -0
  3. package/dist/account/index.d.ts +3 -0
  4. package/dist/account/rpc.d.ts +38 -0
  5. package/dist/account/types.d.ts +74 -0
  6. package/dist/agents/agent-config-loader.d.ts +18 -0
  7. package/dist/agents/agent-config-parser.d.ts +25 -0
  8. package/dist/agents/hooks-config-loader.d.ts +23 -0
  9. package/dist/agents/index.d.ts +11 -0
  10. package/dist/agents/plugin-config-loader.d.ts +22 -0
  11. package/dist/agents/plugin-loader.d.ts +9 -0
  12. package/dist/agents/plugin-sandbox.d.ts +12 -0
  13. package/dist/agents/unified-config-file-watcher.d.ts +77 -0
  14. package/dist/agents/user-instruction-config-loader.d.ts +63 -0
  15. package/dist/auth/client.d.ts +11 -0
  16. package/dist/auth/cline.d.ts +41 -0
  17. package/dist/auth/codex.d.ts +39 -0
  18. package/dist/auth/oca.d.ts +22 -0
  19. package/dist/auth/server.d.ts +22 -0
  20. package/dist/auth/types.d.ts +72 -0
  21. package/dist/auth/utils.d.ts +32 -0
  22. package/dist/chat/chat-schema.d.ts +145 -0
  23. package/dist/default-tools/constants.d.ts +23 -0
  24. package/dist/default-tools/definitions.d.ts +96 -0
  25. package/dist/default-tools/executors/apply-patch-parser.d.ts +68 -0
  26. package/dist/default-tools/executors/apply-patch.d.ts +26 -0
  27. package/dist/default-tools/executors/bash.d.ts +49 -0
  28. package/dist/default-tools/executors/editor.d.ts +31 -0
  29. package/dist/default-tools/executors/file-read.d.ts +40 -0
  30. package/dist/default-tools/executors/index.d.ts +44 -0
  31. package/dist/default-tools/executors/search.d.ts +50 -0
  32. package/dist/default-tools/executors/web-fetch.d.ts +58 -0
  33. package/dist/default-tools/index.d.ts +57 -0
  34. package/dist/default-tools/presets.d.ts +124 -0
  35. package/dist/default-tools/schemas.d.ts +121 -0
  36. package/dist/default-tools/types.d.ts +237 -0
  37. package/dist/index.d.ts +23 -0
  38. package/dist/index.js +220 -0
  39. package/dist/input/file-indexer.d.ts +5 -0
  40. package/dist/input/index.d.ts +4 -0
  41. package/dist/input/mention-enricher.d.ts +12 -0
  42. package/dist/mcp/config-loader.d.ts +15 -0
  43. package/dist/mcp/index.d.ts +4 -0
  44. package/dist/mcp/manager.d.ts +24 -0
  45. package/dist/mcp/types.d.ts +66 -0
  46. package/dist/runtime/hook-file-hooks.d.ts +18 -0
  47. package/dist/runtime/rules.d.ts +5 -0
  48. package/dist/runtime/runtime-builder.d.ts +5 -0
  49. package/dist/runtime/sandbox/subprocess-sandbox.d.ts +19 -0
  50. package/dist/runtime/session-runtime.d.ts +36 -0
  51. package/dist/runtime/tool-approval.d.ts +9 -0
  52. package/dist/runtime/workflows.d.ts +13 -0
  53. package/dist/server/index.d.ts +47 -0
  54. package/dist/server/index.js +641 -0
  55. package/dist/session/default-session-manager.d.ts +77 -0
  56. package/dist/session/rpc-session-service.d.ts +12 -0
  57. package/dist/session/runtime-oauth-token-manager.d.ts +28 -0
  58. package/dist/session/session-artifacts.d.ts +19 -0
  59. package/dist/session/session-graph.d.ts +15 -0
  60. package/dist/session/session-host.d.ts +21 -0
  61. package/dist/session/session-manager.d.ts +50 -0
  62. package/dist/session/session-manifest.d.ts +30 -0
  63. package/dist/session/session-service.d.ts +113 -0
  64. package/dist/session/sqlite-rpc-session-backend.d.ts +30 -0
  65. package/dist/session/unified-session-persistence-service.d.ts +93 -0
  66. package/dist/session/workspace-manager.d.ts +28 -0
  67. package/dist/session/workspace-manifest.d.ts +25 -0
  68. package/dist/storage/provider-settings-legacy-migration.d.ts +13 -0
  69. package/dist/storage/provider-settings-manager.d.ts +20 -0
  70. package/dist/storage/sqlite-session-store.d.ts +29 -0
  71. package/dist/storage/sqlite-team-store.d.ts +31 -0
  72. package/dist/storage/team-store.d.ts +2 -0
  73. package/dist/team/index.d.ts +1 -0
  74. package/dist/team/projections.d.ts +8 -0
  75. package/dist/types/common.d.ts +10 -0
  76. package/dist/types/config.d.ts +37 -0
  77. package/dist/types/events.d.ts +54 -0
  78. package/dist/types/provider-settings.d.ts +20 -0
  79. package/dist/types/sessions.d.ts +9 -0
  80. package/dist/types/storage.d.ts +37 -0
  81. package/dist/types/workspace.d.ts +7 -0
  82. package/dist/types.d.ts +26 -0
  83. package/package.json +63 -0
  84. package/src/account/cline-account-service.test.ts +101 -0
  85. package/src/account/cline-account-service.ts +267 -0
  86. package/src/account/index.ts +20 -0
  87. package/src/account/rpc.test.ts +62 -0
  88. package/src/account/rpc.ts +172 -0
  89. package/src/account/types.ts +80 -0
  90. package/src/agents/agent-config-loader.test.ts +234 -0
  91. package/src/agents/agent-config-loader.ts +107 -0
  92. package/src/agents/agent-config-parser.ts +191 -0
  93. package/src/agents/hooks-config-loader.ts +97 -0
  94. package/src/agents/index.ts +84 -0
  95. package/src/agents/plugin-config-loader.test.ts +91 -0
  96. package/src/agents/plugin-config-loader.ts +160 -0
  97. package/src/agents/plugin-loader.test.ts +102 -0
  98. package/src/agents/plugin-loader.ts +105 -0
  99. package/src/agents/plugin-sandbox.test.ts +120 -0
  100. package/src/agents/plugin-sandbox.ts +471 -0
  101. package/src/agents/unified-config-file-watcher.test.ts +196 -0
  102. package/src/agents/unified-config-file-watcher.ts +483 -0
  103. package/src/agents/user-instruction-config-loader.test.ts +158 -0
  104. package/src/agents/user-instruction-config-loader.ts +438 -0
  105. package/src/auth/client.test.ts +40 -0
  106. package/src/auth/client.ts +25 -0
  107. package/src/auth/cline.test.ts +130 -0
  108. package/src/auth/cline.ts +414 -0
  109. package/src/auth/codex.test.ts +170 -0
  110. package/src/auth/codex.ts +466 -0
  111. package/src/auth/oca.test.ts +215 -0
  112. package/src/auth/oca.ts +546 -0
  113. package/src/auth/server.ts +216 -0
  114. package/src/auth/types.ts +78 -0
  115. package/src/auth/utils.test.ts +128 -0
  116. package/src/auth/utils.ts +247 -0
  117. package/src/chat/chat-schema.ts +82 -0
  118. package/src/default-tools/constants.ts +35 -0
  119. package/src/default-tools/definitions.test.ts +233 -0
  120. package/src/default-tools/definitions.ts +632 -0
  121. package/src/default-tools/executors/apply-patch-parser.ts +520 -0
  122. package/src/default-tools/executors/apply-patch.ts +359 -0
  123. package/src/default-tools/executors/bash.ts +205 -0
  124. package/src/default-tools/executors/editor.ts +231 -0
  125. package/src/default-tools/executors/file-read.test.ts +25 -0
  126. package/src/default-tools/executors/file-read.ts +94 -0
  127. package/src/default-tools/executors/index.ts +75 -0
  128. package/src/default-tools/executors/search.ts +278 -0
  129. package/src/default-tools/executors/web-fetch.ts +259 -0
  130. package/src/default-tools/index.ts +161 -0
  131. package/src/default-tools/presets.test.ts +63 -0
  132. package/src/default-tools/presets.ts +168 -0
  133. package/src/default-tools/schemas.ts +228 -0
  134. package/src/default-tools/types.ts +324 -0
  135. package/src/index.ts +119 -0
  136. package/src/input/file-indexer.d.ts +11 -0
  137. package/src/input/file-indexer.test.ts +87 -0
  138. package/src/input/file-indexer.ts +280 -0
  139. package/src/input/index.ts +7 -0
  140. package/src/input/mention-enricher.test.ts +82 -0
  141. package/src/input/mention-enricher.ts +119 -0
  142. package/src/mcp/config-loader.test.ts +238 -0
  143. package/src/mcp/config-loader.ts +219 -0
  144. package/src/mcp/index.ts +26 -0
  145. package/src/mcp/manager.test.ts +106 -0
  146. package/src/mcp/manager.ts +262 -0
  147. package/src/mcp/types.ts +88 -0
  148. package/src/runtime/hook-file-hooks.test.ts +106 -0
  149. package/src/runtime/hook-file-hooks.ts +736 -0
  150. package/src/runtime/index.ts +27 -0
  151. package/src/runtime/rules.ts +34 -0
  152. package/src/runtime/runtime-builder.team-persistence.test.ts +203 -0
  153. package/src/runtime/runtime-builder.test.ts +215 -0
  154. package/src/runtime/runtime-builder.ts +515 -0
  155. package/src/runtime/runtime-parity.test.ts +132 -0
  156. package/src/runtime/sandbox/subprocess-sandbox.ts +207 -0
  157. package/src/runtime/session-runtime.ts +44 -0
  158. package/src/runtime/tool-approval.ts +104 -0
  159. package/src/runtime/workflows.test.ts +119 -0
  160. package/src/runtime/workflows.ts +54 -0
  161. package/src/server/index.ts +282 -0
  162. package/src/session/default-session-manager.e2e.test.ts +354 -0
  163. package/src/session/default-session-manager.test.ts +816 -0
  164. package/src/session/default-session-manager.ts +1286 -0
  165. package/src/session/index.ts +37 -0
  166. package/src/session/rpc-session-service.ts +189 -0
  167. package/src/session/runtime-oauth-token-manager.test.ts +137 -0
  168. package/src/session/runtime-oauth-token-manager.ts +265 -0
  169. package/src/session/session-artifacts.ts +106 -0
  170. package/src/session/session-graph.ts +90 -0
  171. package/src/session/session-host.ts +190 -0
  172. package/src/session/session-manager.ts +56 -0
  173. package/src/session/session-manifest.ts +29 -0
  174. package/src/session/session-service.team-persistence.test.ts +48 -0
  175. package/src/session/session-service.ts +610 -0
  176. package/src/session/sqlite-rpc-session-backend.ts +303 -0
  177. package/src/session/unified-session-persistence-service.ts +781 -0
  178. package/src/session/workspace-manager.ts +98 -0
  179. package/src/session/workspace-manifest.ts +100 -0
  180. package/src/storage/artifact-store.ts +1 -0
  181. package/src/storage/index.ts +11 -0
  182. package/src/storage/provider-settings-legacy-migration.test.ts +175 -0
  183. package/src/storage/provider-settings-legacy-migration.ts +637 -0
  184. package/src/storage/provider-settings-manager.test.ts +111 -0
  185. package/src/storage/provider-settings-manager.ts +129 -0
  186. package/src/storage/session-store.ts +1 -0
  187. package/src/storage/sqlite-session-store.ts +270 -0
  188. package/src/storage/sqlite-team-store.ts +443 -0
  189. package/src/storage/team-store.ts +5 -0
  190. package/src/team/index.ts +4 -0
  191. package/src/team/projections.ts +285 -0
  192. package/src/types/common.ts +14 -0
  193. package/src/types/config.ts +64 -0
  194. package/src/types/events.ts +46 -0
  195. package/src/types/index.ts +24 -0
  196. package/src/types/provider-settings.ts +43 -0
  197. package/src/types/sessions.ts +16 -0
  198. package/src/types/storage.ts +64 -0
  199. package/src/types/workspace.ts +7 -0
  200. package/src/types.ts +127 -0
@@ -0,0 +1,228 @@
1
+ /**
2
+ * Zod Schemas for Default Tool Inputs
3
+ *
4
+ * These schemas define the input structure for each default tool
5
+ * and are used for both validation and JSON Schema generation.
6
+ */
7
+
8
+ import { z } from "zod";
9
+
10
+ /**
11
+ * Schema for read tool input
12
+ */
13
+ const AbsolutePath = z
14
+ .string()
15
+ .describe("The absolute file path of a text file to read content from");
16
+
17
+ /**
18
+ * Schema for read_files tool input
19
+ */
20
+ export const ReadFilesInputSchema = z.object({
21
+ file_paths: z.array(AbsolutePath).describe("Array of absolute file paths"),
22
+ });
23
+ export const ReadFilesInputUnionSchema = z.union([
24
+ ReadFilesInputSchema,
25
+ z.array(z.string()),
26
+ z.string(),
27
+ ]);
28
+
29
+ /**
30
+ * Schema for search_codebase tool input
31
+ */
32
+ export const SearchCodebaseInputSchema = z.object({
33
+ queries: z
34
+ .array(z.string())
35
+ .describe("Array of regex search queries to execute"),
36
+ });
37
+
38
+ const CommandInputSchema = z.string();
39
+ /**
40
+ * Schema for run_commands tool input
41
+ */
42
+ export const RunCommandsInputSchema = z.object({
43
+ commands: z
44
+ .array(CommandInputSchema)
45
+ .describe("Array of shell commands to execute"),
46
+ });
47
+ export const RunCommandsInputUnionSchema = z.union([
48
+ RunCommandsInputSchema,
49
+ z.array(CommandInputSchema),
50
+ CommandInputSchema,
51
+ ]);
52
+
53
+ /**
54
+ * Schema for a single web fetch request
55
+ */
56
+ export const WebFetchRequestSchema = z.object({
57
+ url: z.url().describe("The URL to fetch"),
58
+ prompt: z.string().min(2).describe("Analysis prompt for the fetched content"),
59
+ });
60
+
61
+ /**
62
+ * Schema for fetch_web_content tool input
63
+ */
64
+ export const FetchWebContentInputSchema = z.object({
65
+ requests: z
66
+ .array(WebFetchRequestSchema)
67
+ .describe("Array of web fetch requests"),
68
+ });
69
+
70
+ /**
71
+ * Schema for editor tool input
72
+ */
73
+ export const EditFileInputSchema = z
74
+ .object({
75
+ command: z
76
+ .enum(["create", "str_replace", "insert"])
77
+ .describe(
78
+ "Editor command to execute: create, str_replace, insert, or undo_edit",
79
+ ),
80
+ path: z.string().min(1).describe("Absolute file path"),
81
+ file_text: z
82
+ .string()
83
+ .optional()
84
+ .describe("Full file content used with create"),
85
+ old_str: z
86
+ .string()
87
+ .optional()
88
+ .describe("Exact text to replace (must match exactly once)"),
89
+ new_str: z.string().optional().describe("Replacement or inserted text"),
90
+ insert_line: z
91
+ .number()
92
+ .int()
93
+ .optional()
94
+ .describe("Zero-based line index for insert"),
95
+ })
96
+ .superRefine((value, ctx) => {
97
+ switch (value.command) {
98
+ case "create":
99
+ if (value.file_text === undefined) {
100
+ ctx.addIssue({
101
+ code: z.ZodIssueCode.custom,
102
+ path: ["file_text"],
103
+ message: "file_text is required for command=create",
104
+ });
105
+ }
106
+ break;
107
+ case "str_replace":
108
+ if (value.old_str === undefined) {
109
+ ctx.addIssue({
110
+ code: z.ZodIssueCode.custom,
111
+ path: ["old_str"],
112
+ message: "old_str is required for command=str_replace",
113
+ });
114
+ }
115
+ break;
116
+ case "insert":
117
+ if (value.insert_line === undefined) {
118
+ ctx.addIssue({
119
+ code: z.ZodIssueCode.custom,
120
+ path: ["insert_line"],
121
+ message: "insert_line is required for command=insert",
122
+ });
123
+ }
124
+ if (value.new_str === undefined) {
125
+ ctx.addIssue({
126
+ code: z.ZodIssueCode.custom,
127
+ path: ["new_str"],
128
+ message: "new_str is required for command=insert",
129
+ });
130
+ }
131
+ break;
132
+ }
133
+ });
134
+
135
+ /**
136
+ * Schema for apply_patch tool input
137
+ */
138
+ export const ApplyPatchInputSchema = z.object({
139
+ input: z
140
+ .string()
141
+ .min(1)
142
+ .describe("The apply_patch text payload, including patch instructions"),
143
+ });
144
+ export const ApplyPatchInputUnionSchema = z.union([
145
+ ApplyPatchInputSchema,
146
+ z.string(),
147
+ ]);
148
+
149
+ /**
150
+ * Schema for skills tool input
151
+ */
152
+ export const SkillsInputSchema = z.object({
153
+ skill: z
154
+ .string()
155
+ .min(1)
156
+ .describe(
157
+ 'The skill name. E.g., "commit", "review-pr", "pdf", or "ms-office-suite:pdf"',
158
+ ),
159
+ args: z.string().optional().describe("Optional arguments for the skill"),
160
+ });
161
+
162
+ /**
163
+ * Schema for ask_followup_question tool input
164
+ */
165
+ export const AskQuestionInputSchema = z.object({
166
+ question: z
167
+ .string()
168
+ .min(1)
169
+ .describe(
170
+ 'The single question to ask the user. E.g. "How can I help you?"',
171
+ ),
172
+ options: z
173
+ .array(z.string().min(1))
174
+ .min(2)
175
+ .max(5)
176
+ .describe(
177
+ "Array of 2-5 user-selectable answer options for the single question",
178
+ ),
179
+ });
180
+
181
+ // =============================================================================
182
+ // Type Definitions (derived from Zod schemas)
183
+ // =============================================================================
184
+
185
+ /**
186
+ * Input for the read_files tool
187
+ */
188
+ export type ReadFilesInput = z.infer<typeof ReadFilesInputSchema>;
189
+
190
+ /**
191
+ * Input for the search_codebase tool
192
+ */
193
+ export type SearchCodebaseInput = z.infer<typeof SearchCodebaseInputSchema>;
194
+
195
+ /**
196
+ * Input for the run_commands tool
197
+ */
198
+ export type RunCommandsInput = z.infer<typeof RunCommandsInputSchema>;
199
+
200
+ /**
201
+ * Web fetch request parameters
202
+ */
203
+ export type WebFetchRequest = z.infer<typeof WebFetchRequestSchema>;
204
+
205
+ /**
206
+ * Input for the fetch_web_content tool
207
+ */
208
+ export type FetchWebContentInput = z.infer<typeof FetchWebContentInputSchema>;
209
+
210
+ /**
211
+ * Input for the editor tool
212
+ */
213
+ export type EditFileInput = z.infer<typeof EditFileInputSchema>;
214
+
215
+ /**
216
+ * Input for the apply_patch tool
217
+ */
218
+ export type ApplyPatchInput = z.infer<typeof ApplyPatchInputSchema>;
219
+
220
+ /**
221
+ * Input for the skills tool
222
+ */
223
+ export type SkillsInput = z.infer<typeof SkillsInputSchema>;
224
+
225
+ /**
226
+ * Input for the ask_followup_question tool
227
+ */
228
+ export type AskQuestionInput = z.infer<typeof AskQuestionInputSchema>;
@@ -0,0 +1,324 @@
1
+ /**
2
+ * Types for Default Tools
3
+ *
4
+ * Type definitions for executors, configuration, and results.
5
+ */
6
+
7
+ import type { ToolContext } from "@clinebot/agents";
8
+ import type { ApplyPatchInput, EditFileInput } from "./schemas";
9
+
10
+ // =============================================================================
11
+ // Tool Result Types
12
+ // =============================================================================
13
+
14
+ /**
15
+ * Result from a single tool operation
16
+ */
17
+ export interface ToolOperationResult {
18
+ /** The query/input that was executed */
19
+ query: string;
20
+ /** The result content (if successful) */
21
+ result: string;
22
+ /** Error message (if failed) */
23
+ error?: string;
24
+ /** Whether the operation succeeded */
25
+ success: boolean;
26
+ /** Duration in MS */
27
+ duration?: number;
28
+ }
29
+
30
+ // =============================================================================
31
+ // Executor Interfaces
32
+ // =============================================================================
33
+
34
+ /**
35
+ * Executor for reading files
36
+ *
37
+ * @param filePath - Absolute path to the file to read
38
+ * @param context - Tool execution context
39
+ * @returns The file content as a string
40
+ */
41
+ export type FileReadExecutor = (
42
+ filePath: string,
43
+ context: ToolContext,
44
+ ) => Promise<string>;
45
+
46
+ /**
47
+ * Executor for searching the codebase
48
+ *
49
+ * @param query - Regex pattern to search for
50
+ * @param cwd - Current working directory for the search
51
+ * @param context - Tool execution context
52
+ * @returns Search results as a formatted string
53
+ */
54
+ export type SearchExecutor = (
55
+ query: string,
56
+ cwd: string,
57
+ context: ToolContext,
58
+ ) => Promise<string>;
59
+
60
+ /**
61
+ * Executor for running shell commands
62
+ *
63
+ * @param command - Shell command to execute
64
+ * @param cwd - Current working directory for execution
65
+ * @param context - Tool execution context
66
+ * @returns Command output (stdout)
67
+ */
68
+ export type BashExecutor = (
69
+ command: string,
70
+ cwd: string,
71
+ context: ToolContext,
72
+ ) => Promise<string>;
73
+
74
+ /**
75
+ * Executor for fetching web content
76
+ *
77
+ * @param url - URL to fetch
78
+ * @param prompt - Analysis prompt for the content
79
+ * @param context - Tool execution context
80
+ * @returns Analyzed/extracted content
81
+ */
82
+ export type WebFetchExecutor = (
83
+ url: string,
84
+ prompt: string,
85
+ context: ToolContext,
86
+ ) => Promise<string>;
87
+
88
+ /**
89
+ * Executor for editing files
90
+ *
91
+ * @param input - Editor command input
92
+ * @param cwd - Current working directory for filesystem operations
93
+ * @param context - Tool execution context
94
+ * @returns A formatted operation result string
95
+ */
96
+ export type EditorExecutor = (
97
+ input: EditFileInput,
98
+ cwd: string,
99
+ context: ToolContext,
100
+ ) => Promise<string>;
101
+
102
+ /**
103
+ * Executor for apply_patch operations
104
+ *
105
+ * @param input - apply_patch command payload
106
+ * @param cwd - Current working directory for filesystem operations
107
+ * @param context - Tool execution context
108
+ * @returns A formatted operation result string
109
+ */
110
+ export type ApplyPatchExecutor = (
111
+ input: ApplyPatchInput,
112
+ cwd: string,
113
+ context: ToolContext,
114
+ ) => Promise<string>;
115
+
116
+ /**
117
+ * Executor for invoking configured skills
118
+ *
119
+ * @param skill - Skill name to invoke
120
+ * @param args - Optional arguments for the skill
121
+ * @param context - Tool execution context
122
+ * @returns Skill loading/invocation result
123
+ */
124
+ export type SkillsExecutor = (
125
+ skill: string,
126
+ args: string | undefined,
127
+ context: ToolContext,
128
+ ) => Promise<string>;
129
+
130
+ /**
131
+ * Executor for asking a single follow-up question with selectable options
132
+ *
133
+ * @param question - Single clarifying question for the user
134
+ * @param options - 2-5 selectable answer options
135
+ * @param context - Tool execution context
136
+ * @returns Executor-specific result payload
137
+ */
138
+ export type AskQuestionExecutor = (
139
+ question: string,
140
+ options: string[],
141
+ context: ToolContext,
142
+ ) => Promise<string>;
143
+
144
+ /**
145
+ * Skill metadata exposed by SkillsExecutor for clients/UI
146
+ */
147
+ export interface SkillsExecutorSkillMetadata {
148
+ /** Normalized skill id (usually lowercased name) */
149
+ id: string;
150
+ /** Display name for the skill */
151
+ name: string;
152
+ /** Optional short description */
153
+ description?: string;
154
+ /** True when configured but intentionally disabled */
155
+ disabled: boolean;
156
+ }
157
+
158
+ /**
159
+ * A callable executor that can also expose configured skill metadata.
160
+ */
161
+ export interface SkillsExecutorWithMetadata {
162
+ (
163
+ skill: string,
164
+ args: string | undefined,
165
+ context: ToolContext,
166
+ ): Promise<string>;
167
+ configuredSkills?: SkillsExecutorSkillMetadata[];
168
+ }
169
+
170
+ /**
171
+ * Collection of all tool executors
172
+ */
173
+ export interface ToolExecutors {
174
+ /** File reading implementation */
175
+ readFile?: FileReadExecutor;
176
+ /** Codebase search implementation */
177
+ search?: SearchExecutor;
178
+ /** Shell command execution implementation */
179
+ bash?: BashExecutor;
180
+ /** Web content fetching implementation */
181
+ webFetch?: WebFetchExecutor;
182
+ /** Filesystem editor implementation */
183
+ editor?: EditorExecutor;
184
+ /** Apply patch implementation */
185
+ applyPatch?: ApplyPatchExecutor;
186
+ /** Skill invocation implementation */
187
+ skills?: SkillsExecutorWithMetadata;
188
+ /** Follow-up question implementation */
189
+ askQuestion?: AskQuestionExecutor;
190
+ }
191
+
192
+ // =============================================================================
193
+ // Tool Configuration
194
+ // =============================================================================
195
+
196
+ /**
197
+ * Names of available default tools
198
+ */
199
+ export type DefaultToolName =
200
+ | "read_files"
201
+ | "search_codebase"
202
+ | "run_commands"
203
+ | "fetch_web_content"
204
+ | "apply_patch"
205
+ | "editor"
206
+ | "skills"
207
+ | "ask_question";
208
+
209
+ /**
210
+ * Configuration for enabling/disabling default tools
211
+ */
212
+ export interface DefaultToolsConfig {
213
+ /**
214
+ * Enable the read_files tool
215
+ * @default true
216
+ */
217
+ enableReadFiles?: boolean;
218
+
219
+ /**
220
+ * Enable the search_codebase tool
221
+ * @default true
222
+ */
223
+ enableSearch?: boolean;
224
+
225
+ /**
226
+ * Enable the run_commands tool
227
+ * @default true
228
+ */
229
+ enableBash?: boolean;
230
+
231
+ /**
232
+ * Enable the fetch_web_content tool
233
+ * @default true
234
+ */
235
+ enableWebFetch?: boolean;
236
+
237
+ /**
238
+ * Enable the apply_patch tool
239
+ * @default true
240
+ */
241
+ enableApplyPatch?: boolean;
242
+
243
+ /**
244
+ * Enable the editor tool
245
+ * @default true
246
+ */
247
+ enableEditor?: boolean;
248
+
249
+ /**
250
+ * Enable the skills tool
251
+ * @default true
252
+ */
253
+ enableSkills?: boolean;
254
+
255
+ /**
256
+ * Enable the ask_followup_question tool
257
+ * @default true
258
+ */
259
+ enableAskQuestion?: boolean;
260
+
261
+ /**
262
+ * Current working directory for tools that need it
263
+ */
264
+ cwd?: string;
265
+
266
+ /**
267
+ * Timeout for file read operations in milliseconds
268
+ * @default 10000
269
+ */
270
+ fileReadTimeoutMs?: number;
271
+
272
+ /**
273
+ * Timeout for bash command execution in milliseconds
274
+ * @default 30000
275
+ */
276
+ bashTimeoutMs?: number;
277
+
278
+ /**
279
+ * Timeout for web fetch operations in milliseconds
280
+ * @default 30000
281
+ */
282
+ webFetchTimeoutMs?: number;
283
+
284
+ /**
285
+ * Timeout for search operations in milliseconds
286
+ * @default 30000
287
+ */
288
+ searchTimeoutMs?: number;
289
+
290
+ /**
291
+ * Timeout for apply_patch operations in milliseconds
292
+ * @default 30000
293
+ */
294
+ applyPatchTimeoutMs?: number;
295
+
296
+ /**
297
+ * Timeout for editor operations in milliseconds
298
+ * @default 30000
299
+ */
300
+ editorTimeoutMs?: number;
301
+
302
+ /**
303
+ * Timeout for skills operations in milliseconds
304
+ * @default 15000
305
+ */
306
+ skillsTimeoutMs?: number;
307
+
308
+ /**
309
+ * Timeout for ask_followup_question operations in milliseconds
310
+ * @default 15000
311
+ */
312
+ askQuestionTimeoutMs?: number;
313
+ }
314
+
315
+ /**
316
+ * Options for creating default tools
317
+ */
318
+ export interface CreateDefaultToolsOptions extends DefaultToolsConfig {
319
+ /**
320
+ * Executor implementations for the tools
321
+ * Only tools with provided executors will be available
322
+ */
323
+ executors: ToolExecutors;
324
+ }
package/src/index.ts ADDED
@@ -0,0 +1,119 @@
1
+ /**
2
+ * @clinebot/core
3
+ *
4
+ * Runtime-agnostic core contracts and shared state utilities.
5
+ */
6
+
7
+ export {
8
+ type ClineAccountBalance,
9
+ type ClineAccountOperations,
10
+ type ClineAccountOrganization,
11
+ type ClineAccountOrganizationBalance,
12
+ type ClineAccountOrganizationUsageTransaction,
13
+ type ClineAccountPaymentTransaction,
14
+ ClineAccountService,
15
+ type ClineAccountServiceOptions,
16
+ type ClineAccountUsageTransaction,
17
+ type ClineAccountUser,
18
+ executeRpcClineAccountAction,
19
+ isRpcClineAccountActionRequest,
20
+ RpcClineAccountService,
21
+ type RpcProviderActionExecutor,
22
+ } from "./account";
23
+ export type {
24
+ ChatMessage,
25
+ ChatSessionConfig,
26
+ ChatSessionStatus,
27
+ ChatSummary,
28
+ ChatViewState,
29
+ } from "./chat/chat-schema";
30
+ export {
31
+ ChatMessageRoleSchema,
32
+ ChatMessageSchema,
33
+ ChatSessionConfigSchema,
34
+ ChatSessionStatusSchema,
35
+ ChatSummarySchema,
36
+ ChatViewStateSchema,
37
+ } from "./chat/chat-schema";
38
+ export {
39
+ ALL_DEFAULT_TOOL_NAMES,
40
+ type AskQuestionExecutor,
41
+ type CreateBuiltinToolsOptions,
42
+ type CreateDefaultToolsOptions,
43
+ createBuiltinTools,
44
+ createDefaultExecutors,
45
+ createDefaultTools,
46
+ createDefaultToolsWithPreset,
47
+ createToolPoliciesWithPreset,
48
+ type DefaultExecutorsOptions,
49
+ type DefaultToolName,
50
+ DefaultToolNames,
51
+ type DefaultToolsConfig,
52
+ type ToolExecutors,
53
+ type ToolPolicyPresetName,
54
+ type ToolPresetName,
55
+ ToolPresets,
56
+ } from "./default-tools";
57
+ export {
58
+ hasMcpSettingsFile,
59
+ InMemoryMcpManager,
60
+ type LoadMcpSettingsOptions,
61
+ loadMcpSettingsFile,
62
+ type McpConnectionStatus,
63
+ type McpManager,
64
+ type McpManagerOptions,
65
+ type McpServerClient,
66
+ type McpServerClientFactory,
67
+ type McpServerRegistration,
68
+ type McpServerSnapshot,
69
+ type McpServerTransportConfig,
70
+ type McpSettingsFile,
71
+ type McpSseTransportConfig,
72
+ type McpStdioTransportConfig,
73
+ type McpStreamableHttpTransportConfig,
74
+ type RegisterMcpServersFromSettingsOptions,
75
+ registerMcpServersFromSettingsFile,
76
+ resolveDefaultMcpSettingsPath,
77
+ resolveMcpServerRegistrations,
78
+ } from "./mcp";
79
+
80
+ export { ProviderSettingsManager } from "./storage/provider-settings-manager";
81
+ export {
82
+ SqliteTeamStore,
83
+ type SqliteTeamStoreOptions,
84
+ } from "./storage/team-store";
85
+ export {
86
+ buildTeamProgressSummary,
87
+ toTeamProgressLifecycleEvent,
88
+ } from "./team";
89
+
90
+ // Compatibility barrel (legacy imports).
91
+ export type { RuntimeEnvironment, SessionEvent, StoredMessages } from "./types";
92
+ export type { SessionStatus } from "./types/common";
93
+ export { SESSION_STATUSES, SessionSource } from "./types/common";
94
+ export type {
95
+ CoreAgentMode,
96
+ CoreModelConfig,
97
+ CoreRuntimeFeatures,
98
+ CoreSessionConfig,
99
+ } from "./types/config";
100
+ export type {
101
+ CoreSessionEvent,
102
+ SessionChunkEvent,
103
+ SessionEndedEvent,
104
+ SessionTeamProgressEvent,
105
+ SessionToolEvent,
106
+ } from "./types/events";
107
+ export type {
108
+ ProviderTokenSource,
109
+ StoredProviderSettings,
110
+ StoredProviderSettingsEntry,
111
+ } from "./types/provider-settings";
112
+ export {
113
+ emptyStoredProviderSettings,
114
+ StoredProviderSettingsEntrySchema,
115
+ StoredProviderSettingsSchema,
116
+ } from "./types/provider-settings";
117
+ export type { SessionRecord, SessionRef } from "./types/sessions";
118
+ export type { ArtifactStore, SessionStore, TeamStore } from "./types/storage";
119
+ export type { WorkspaceInfo } from "./types/workspace";
@@ -0,0 +1,11 @@
1
+ export interface FastFileIndexOptions {
2
+ ttlMs?: number;
3
+ }
4
+ export declare function getFileIndex(
5
+ cwd: string,
6
+ options?: FastFileIndexOptions,
7
+ ): Promise<Set<string>>;
8
+ export declare function prewarmFileIndex(
9
+ cwd: string,
10
+ options?: FastFileIndexOptions,
11
+ ): Promise<void>;