@clinebot/core 0.0.20 → 0.0.21

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 (356) hide show
  1. package/dist/account/cline-account-service.d.ts +3 -2
  2. package/dist/account/cline-account-service.d.ts.map +1 -0
  3. package/dist/account/index.d.ts +1 -0
  4. package/dist/account/index.d.ts.map +1 -0
  5. package/dist/account/rpc.d.ts +1 -0
  6. package/dist/account/rpc.d.ts.map +1 -0
  7. package/dist/account/types.d.ts +1 -0
  8. package/dist/account/types.d.ts.map +1 -0
  9. package/dist/agents/agent-config-loader.d.ts +1 -0
  10. package/dist/agents/agent-config-loader.d.ts.map +1 -0
  11. package/dist/agents/agent-config-parser.d.ts +1 -0
  12. package/dist/agents/agent-config-parser.d.ts.map +1 -0
  13. package/dist/agents/hooks-config-loader.d.ts +1 -0
  14. package/dist/agents/hooks-config-loader.d.ts.map +1 -0
  15. package/dist/agents/index.d.ts +1 -0
  16. package/dist/agents/index.d.ts.map +1 -0
  17. package/dist/agents/plugin-config-loader.d.ts +1 -0
  18. package/dist/agents/plugin-config-loader.d.ts.map +1 -0
  19. package/dist/agents/plugin-loader.d.ts +1 -0
  20. package/dist/agents/plugin-loader.d.ts.map +1 -0
  21. package/dist/agents/plugin-sandbox.d.ts +1 -0
  22. package/dist/agents/plugin-sandbox.d.ts.map +1 -0
  23. package/dist/agents/unified-config-file-watcher.d.ts +1 -0
  24. package/dist/agents/unified-config-file-watcher.d.ts.map +1 -0
  25. package/dist/agents/user-instruction-config-loader.d.ts +1 -0
  26. package/dist/agents/user-instruction-config-loader.d.ts.map +1 -0
  27. package/dist/auth/client.d.ts +1 -0
  28. package/dist/auth/client.d.ts.map +1 -0
  29. package/dist/auth/cline.d.ts +1 -0
  30. package/dist/auth/cline.d.ts.map +1 -0
  31. package/dist/auth/codex.d.ts +1 -0
  32. package/dist/auth/codex.d.ts.map +1 -0
  33. package/dist/auth/oca.d.ts +1 -0
  34. package/dist/auth/oca.d.ts.map +1 -0
  35. package/dist/auth/server.d.ts +1 -0
  36. package/dist/auth/server.d.ts.map +1 -0
  37. package/dist/auth/types.d.ts +1 -0
  38. package/dist/auth/types.d.ts.map +1 -0
  39. package/dist/auth/utils.d.ts +1 -0
  40. package/dist/auth/utils.d.ts.map +1 -0
  41. package/dist/chat/chat-schema.d.ts +13 -12
  42. package/dist/chat/chat-schema.d.ts.map +1 -0
  43. package/dist/index.d.ts +3 -1
  44. package/dist/index.d.ts.map +1 -0
  45. package/dist/index.node.d.ts +2 -0
  46. package/dist/index.node.d.ts.map +1 -0
  47. package/dist/index.node.js +303 -302
  48. package/dist/input/file-indexer.d.ts +1 -0
  49. package/dist/input/file-indexer.d.ts.map +1 -0
  50. package/dist/input/index.d.ts +1 -0
  51. package/dist/input/index.d.ts.map +1 -0
  52. package/dist/input/mention-enricher.d.ts +1 -0
  53. package/dist/input/mention-enricher.d.ts.map +1 -0
  54. package/dist/mcp/config-loader.d.ts +1 -0
  55. package/dist/mcp/config-loader.d.ts.map +1 -0
  56. package/dist/mcp/index.d.ts +1 -0
  57. package/dist/mcp/index.d.ts.map +1 -0
  58. package/dist/mcp/manager.d.ts +1 -0
  59. package/dist/mcp/manager.d.ts.map +1 -0
  60. package/dist/mcp/types.d.ts +1 -0
  61. package/dist/mcp/types.d.ts.map +1 -0
  62. package/dist/providers/local-provider-registry.d.ts +36 -0
  63. package/dist/providers/local-provider-registry.d.ts.map +1 -0
  64. package/dist/providers/local-provider-service.d.ts +2 -1
  65. package/dist/providers/local-provider-service.d.ts.map +1 -0
  66. package/dist/runtime/commands.d.ts +1 -0
  67. package/dist/runtime/commands.d.ts.map +1 -0
  68. package/dist/runtime/hook-file-hooks.d.ts +1 -0
  69. package/dist/runtime/hook-file-hooks.d.ts.map +1 -0
  70. package/dist/runtime/rules.d.ts +1 -0
  71. package/dist/runtime/rules.d.ts.map +1 -0
  72. package/dist/runtime/runtime-builder.d.ts +1 -0
  73. package/dist/runtime/runtime-builder.d.ts.map +1 -0
  74. package/dist/runtime/sandbox/subprocess-sandbox.d.ts +1 -0
  75. package/dist/runtime/sandbox/subprocess-sandbox.d.ts.map +1 -0
  76. package/dist/runtime/session-runtime.d.ts +2 -0
  77. package/dist/runtime/session-runtime.d.ts.map +1 -0
  78. package/dist/runtime/skills.d.ts +1 -0
  79. package/dist/runtime/skills.d.ts.map +1 -0
  80. package/dist/runtime/tool-approval.d.ts +1 -0
  81. package/dist/runtime/tool-approval.d.ts.map +1 -0
  82. package/dist/runtime/workflows.d.ts +1 -0
  83. package/dist/runtime/workflows.d.ts.map +1 -0
  84. package/dist/session/default-session-manager.d.ts +4 -0
  85. package/dist/session/default-session-manager.d.ts.map +1 -0
  86. package/dist/session/file-session-service.d.ts +1 -0
  87. package/dist/session/file-session-service.d.ts.map +1 -0
  88. package/dist/session/rpc-session-service.d.ts +1 -0
  89. package/dist/session/rpc-session-service.d.ts.map +1 -0
  90. package/dist/session/rpc-spawn-lease.d.ts +1 -0
  91. package/dist/session/rpc-spawn-lease.d.ts.map +1 -0
  92. package/dist/session/runtime-oauth-token-manager.d.ts +1 -0
  93. package/dist/session/runtime-oauth-token-manager.d.ts.map +1 -0
  94. package/dist/session/session-agent-events.d.ts +20 -1
  95. package/dist/session/session-agent-events.d.ts.map +1 -0
  96. package/dist/session/session-artifacts.d.ts +1 -0
  97. package/dist/session/session-artifacts.d.ts.map +1 -0
  98. package/dist/session/session-config-builder.d.ts +1 -0
  99. package/dist/session/session-config-builder.d.ts.map +1 -0
  100. package/dist/session/session-graph.d.ts +1 -0
  101. package/dist/session/session-graph.d.ts.map +1 -0
  102. package/dist/session/session-host.d.ts +1 -0
  103. package/dist/session/session-host.d.ts.map +1 -0
  104. package/dist/session/session-manager.d.ts +1 -0
  105. package/dist/session/session-manager.d.ts.map +1 -0
  106. package/dist/session/session-manifest.d.ts +2 -1
  107. package/dist/session/session-manifest.d.ts.map +1 -0
  108. package/dist/session/session-service.d.ts +1 -0
  109. package/dist/session/session-service.d.ts.map +1 -0
  110. package/dist/session/session-team-coordination.d.ts +1 -0
  111. package/dist/session/session-team-coordination.d.ts.map +1 -0
  112. package/dist/session/session-telemetry.d.ts +3 -1
  113. package/dist/session/session-telemetry.d.ts.map +1 -0
  114. package/dist/session/sqlite-rpc-session-backend.d.ts +1 -0
  115. package/dist/session/sqlite-rpc-session-backend.d.ts.map +1 -0
  116. package/dist/session/unified-session-persistence-service.d.ts +1 -0
  117. package/dist/session/unified-session-persistence-service.d.ts.map +1 -0
  118. package/dist/session/utils/helpers.d.ts +1 -0
  119. package/dist/session/utils/helpers.d.ts.map +1 -0
  120. package/dist/session/utils/types.d.ts +1 -0
  121. package/dist/session/utils/types.d.ts.map +1 -0
  122. package/dist/session/utils/usage.d.ts +1 -0
  123. package/dist/session/utils/usage.d.ts.map +1 -0
  124. package/dist/session/workspace-manager.d.ts +1 -0
  125. package/dist/session/workspace-manager.d.ts.map +1 -0
  126. package/dist/session/workspace-manifest.d.ts +1 -0
  127. package/dist/session/workspace-manifest.d.ts.map +1 -0
  128. package/dist/storage/file-team-store.d.ts +1 -0
  129. package/dist/storage/file-team-store.d.ts.map +1 -0
  130. package/dist/storage/provider-settings-legacy-migration.d.ts +1 -0
  131. package/dist/storage/provider-settings-legacy-migration.d.ts.map +1 -0
  132. package/dist/storage/provider-settings-manager.d.ts +1 -0
  133. package/dist/storage/provider-settings-manager.d.ts.map +1 -0
  134. package/dist/storage/sqlite-session-store.d.ts +1 -0
  135. package/dist/storage/sqlite-session-store.d.ts.map +1 -0
  136. package/dist/storage/sqlite-team-store.d.ts +1 -0
  137. package/dist/storage/sqlite-team-store.d.ts.map +1 -0
  138. package/dist/storage/team-store.d.ts +1 -0
  139. package/dist/storage/team-store.d.ts.map +1 -0
  140. package/dist/team/index.d.ts +1 -0
  141. package/dist/team/index.d.ts.map +1 -0
  142. package/dist/team/projections.d.ts +1 -0
  143. package/dist/team/projections.d.ts.map +1 -0
  144. package/dist/telemetry/ITelemetryAdapter.d.ts +1 -0
  145. package/dist/telemetry/ITelemetryAdapter.d.ts.map +1 -0
  146. package/dist/telemetry/LoggerTelemetryAdapter.d.ts +1 -0
  147. package/dist/telemetry/LoggerTelemetryAdapter.d.ts.map +1 -0
  148. package/dist/telemetry/OpenTelemetryAdapter.d.ts +1 -0
  149. package/dist/telemetry/OpenTelemetryAdapter.d.ts.map +1 -0
  150. package/dist/telemetry/OpenTelemetryProvider.d.ts +1 -0
  151. package/dist/telemetry/OpenTelemetryProvider.d.ts.map +1 -0
  152. package/dist/telemetry/TelemetryService.d.ts +1 -0
  153. package/dist/telemetry/TelemetryService.d.ts.map +1 -0
  154. package/dist/telemetry/core-events.d.ts +55 -22
  155. package/dist/telemetry/core-events.d.ts.map +1 -0
  156. package/dist/telemetry/opentelemetry.d.ts +1 -0
  157. package/dist/telemetry/opentelemetry.d.ts.map +1 -0
  158. package/dist/tools/constants.d.ts +1 -0
  159. package/dist/tools/constants.d.ts.map +1 -0
  160. package/dist/tools/definitions.d.ts +8 -1
  161. package/dist/tools/definitions.d.ts.map +1 -0
  162. package/dist/tools/executors/apply-patch-parser.d.ts +1 -0
  163. package/dist/tools/executors/apply-patch-parser.d.ts.map +1 -0
  164. package/dist/tools/executors/apply-patch.d.ts +1 -0
  165. package/dist/tools/executors/apply-patch.d.ts.map +1 -0
  166. package/dist/tools/executors/bash.d.ts +2 -1
  167. package/dist/tools/executors/bash.d.ts.map +1 -0
  168. package/dist/tools/executors/editor.d.ts +1 -0
  169. package/dist/tools/executors/editor.d.ts.map +1 -0
  170. package/dist/tools/executors/file-read.d.ts +1 -0
  171. package/dist/tools/executors/file-read.d.ts.map +1 -0
  172. package/dist/tools/executors/index.d.ts +14 -7
  173. package/dist/tools/executors/index.d.ts.map +1 -0
  174. package/dist/tools/executors/search.d.ts +1 -0
  175. package/dist/tools/executors/search.d.ts.map +1 -0
  176. package/dist/tools/executors/web-fetch.d.ts +1 -0
  177. package/dist/tools/executors/web-fetch.d.ts.map +1 -0
  178. package/dist/tools/helpers.d.ts +15 -0
  179. package/dist/tools/helpers.d.ts.map +1 -0
  180. package/dist/tools/index.d.ts +2 -1
  181. package/dist/tools/index.d.ts.map +1 -0
  182. package/dist/tools/model-tool-routing.d.ts +1 -0
  183. package/dist/tools/model-tool-routing.d.ts.map +1 -0
  184. package/dist/tools/presets.d.ts +1 -0
  185. package/dist/tools/presets.d.ts.map +1 -0
  186. package/dist/tools/schemas.d.ts +41 -0
  187. package/dist/tools/schemas.d.ts.map +1 -0
  188. package/dist/tools/types.d.ts +3 -2
  189. package/dist/tools/types.d.ts.map +1 -0
  190. package/dist/types/common.d.ts +1 -0
  191. package/dist/types/common.d.ts.map +1 -0
  192. package/dist/types/config.d.ts +1 -0
  193. package/dist/types/config.d.ts.map +1 -0
  194. package/dist/types/events.d.ts +1 -0
  195. package/dist/types/events.d.ts.map +1 -0
  196. package/dist/types/provider-settings.d.ts +1 -0
  197. package/dist/types/provider-settings.d.ts.map +1 -0
  198. package/dist/types/sessions.d.ts +1 -0
  199. package/dist/types/sessions.d.ts.map +1 -0
  200. package/dist/types/storage.d.ts +1 -0
  201. package/dist/types/storage.d.ts.map +1 -0
  202. package/dist/types/workspace.d.ts +1 -0
  203. package/dist/types/workspace.d.ts.map +1 -0
  204. package/dist/types.d.ts +1 -0
  205. package/dist/types.d.ts.map +1 -0
  206. package/package.json +6 -4
  207. package/src/account/cline-account-service.test.ts +0 -101
  208. package/src/account/cline-account-service.ts +0 -287
  209. package/src/account/index.ts +0 -22
  210. package/src/account/rpc.test.ts +0 -62
  211. package/src/account/rpc.ts +0 -172
  212. package/src/account/types.ts +0 -98
  213. package/src/agents/agent-config-loader.test.ts +0 -236
  214. package/src/agents/agent-config-loader.ts +0 -108
  215. package/src/agents/agent-config-parser.ts +0 -198
  216. package/src/agents/hooks-config-loader.test.ts +0 -20
  217. package/src/agents/hooks-config-loader.ts +0 -118
  218. package/src/agents/index.ts +0 -85
  219. package/src/agents/plugin-config-loader.test.ts +0 -140
  220. package/src/agents/plugin-config-loader.ts +0 -97
  221. package/src/agents/plugin-loader.test.ts +0 -228
  222. package/src/agents/plugin-loader.ts +0 -172
  223. package/src/agents/plugin-sandbox-bootstrap.ts +0 -445
  224. package/src/agents/plugin-sandbox.test.ts +0 -317
  225. package/src/agents/plugin-sandbox.ts +0 -341
  226. package/src/agents/unified-config-file-watcher.test.ts +0 -196
  227. package/src/agents/unified-config-file-watcher.ts +0 -483
  228. package/src/agents/user-instruction-config-loader.test.ts +0 -158
  229. package/src/agents/user-instruction-config-loader.ts +0 -438
  230. package/src/auth/client.test.ts +0 -40
  231. package/src/auth/client.ts +0 -25
  232. package/src/auth/cline.test.ts +0 -130
  233. package/src/auth/cline.ts +0 -420
  234. package/src/auth/codex.test.ts +0 -170
  235. package/src/auth/codex.ts +0 -491
  236. package/src/auth/oca.test.ts +0 -215
  237. package/src/auth/oca.ts +0 -573
  238. package/src/auth/server.ts +0 -216
  239. package/src/auth/types.ts +0 -81
  240. package/src/auth/utils.test.ts +0 -128
  241. package/src/auth/utils.ts +0 -247
  242. package/src/chat/chat-schema.ts +0 -82
  243. package/src/index.node.ts +0 -285
  244. package/src/index.ts +0 -211
  245. package/src/input/file-indexer.d.ts +0 -11
  246. package/src/input/file-indexer.test.ts +0 -127
  247. package/src/input/file-indexer.ts +0 -327
  248. package/src/input/index.ts +0 -7
  249. package/src/input/mention-enricher.test.ts +0 -85
  250. package/src/input/mention-enricher.ts +0 -122
  251. package/src/mcp/config-loader.test.ts +0 -238
  252. package/src/mcp/config-loader.ts +0 -219
  253. package/src/mcp/index.ts +0 -26
  254. package/src/mcp/manager.test.ts +0 -106
  255. package/src/mcp/manager.ts +0 -262
  256. package/src/mcp/types.ts +0 -88
  257. package/src/providers/local-provider-service.ts +0 -608
  258. package/src/runtime/commands.test.ts +0 -98
  259. package/src/runtime/commands.ts +0 -83
  260. package/src/runtime/hook-file-hooks.test.ts +0 -237
  261. package/src/runtime/hook-file-hooks.ts +0 -859
  262. package/src/runtime/index.ts +0 -37
  263. package/src/runtime/rules.ts +0 -34
  264. package/src/runtime/runtime-builder.team-persistence.test.ts +0 -202
  265. package/src/runtime/runtime-builder.test.ts +0 -371
  266. package/src/runtime/runtime-builder.ts +0 -589
  267. package/src/runtime/runtime-parity.test.ts +0 -143
  268. package/src/runtime/sandbox/subprocess-sandbox.ts +0 -231
  269. package/src/runtime/session-runtime.ts +0 -46
  270. package/src/runtime/skills.ts +0 -44
  271. package/src/runtime/tool-approval.ts +0 -104
  272. package/src/runtime/workflows.test.ts +0 -119
  273. package/src/runtime/workflows.ts +0 -45
  274. package/src/session/default-session-manager.e2e.test.ts +0 -384
  275. package/src/session/default-session-manager.test.ts +0 -1741
  276. package/src/session/default-session-manager.ts +0 -1233
  277. package/src/session/file-session-service.ts +0 -280
  278. package/src/session/index.ts +0 -42
  279. package/src/session/rpc-session-service.ts +0 -107
  280. package/src/session/rpc-spawn-lease.test.ts +0 -49
  281. package/src/session/rpc-spawn-lease.ts +0 -122
  282. package/src/session/runtime-oauth-token-manager.test.ts +0 -137
  283. package/src/session/runtime-oauth-token-manager.ts +0 -272
  284. package/src/session/session-agent-events.ts +0 -159
  285. package/src/session/session-artifacts.ts +0 -106
  286. package/src/session/session-config-builder.ts +0 -113
  287. package/src/session/session-graph.ts +0 -92
  288. package/src/session/session-host.test.ts +0 -29
  289. package/src/session/session-host.ts +0 -242
  290. package/src/session/session-manager.ts +0 -69
  291. package/src/session/session-manifest.ts +0 -29
  292. package/src/session/session-service.team-persistence.test.ts +0 -48
  293. package/src/session/session-service.ts +0 -673
  294. package/src/session/session-team-coordination.ts +0 -229
  295. package/src/session/session-telemetry.ts +0 -95
  296. package/src/session/sqlite-rpc-session-backend.ts +0 -303
  297. package/src/session/unified-session-persistence-service.test.ts +0 -85
  298. package/src/session/unified-session-persistence-service.ts +0 -996
  299. package/src/session/utils/helpers.ts +0 -139
  300. package/src/session/utils/types.ts +0 -57
  301. package/src/session/utils/usage.ts +0 -32
  302. package/src/session/workspace-manager.ts +0 -98
  303. package/src/session/workspace-manifest.ts +0 -100
  304. package/src/storage/artifact-store.ts +0 -1
  305. package/src/storage/file-team-store.ts +0 -257
  306. package/src/storage/index.ts +0 -11
  307. package/src/storage/provider-settings-legacy-migration.test.ts +0 -307
  308. package/src/storage/provider-settings-legacy-migration.ts +0 -689
  309. package/src/storage/provider-settings-manager.test.ts +0 -145
  310. package/src/storage/provider-settings-manager.ts +0 -150
  311. package/src/storage/session-store.ts +0 -1
  312. package/src/storage/sqlite-session-store.ts +0 -275
  313. package/src/storage/sqlite-team-store.ts +0 -454
  314. package/src/storage/team-store.ts +0 -40
  315. package/src/team/index.ts +0 -4
  316. package/src/team/projections.ts +0 -285
  317. package/src/telemetry/ITelemetryAdapter.ts +0 -94
  318. package/src/telemetry/LoggerTelemetryAdapter.test.ts +0 -42
  319. package/src/telemetry/LoggerTelemetryAdapter.ts +0 -114
  320. package/src/telemetry/OpenTelemetryAdapter.test.ts +0 -157
  321. package/src/telemetry/OpenTelemetryAdapter.ts +0 -348
  322. package/src/telemetry/OpenTelemetryProvider.test.ts +0 -113
  323. package/src/telemetry/OpenTelemetryProvider.ts +0 -322
  324. package/src/telemetry/TelemetryService.test.ts +0 -134
  325. package/src/telemetry/TelemetryService.ts +0 -141
  326. package/src/telemetry/core-events.ts +0 -344
  327. package/src/telemetry/opentelemetry.ts +0 -20
  328. package/src/tools/constants.ts +0 -35
  329. package/src/tools/definitions.test.ts +0 -658
  330. package/src/tools/definitions.ts +0 -726
  331. package/src/tools/executors/apply-patch-parser.ts +0 -520
  332. package/src/tools/executors/apply-patch.ts +0 -359
  333. package/src/tools/executors/bash.ts +0 -205
  334. package/src/tools/executors/editor.test.ts +0 -35
  335. package/src/tools/executors/editor.ts +0 -219
  336. package/src/tools/executors/file-read.test.ts +0 -49
  337. package/src/tools/executors/file-read.ts +0 -110
  338. package/src/tools/executors/index.ts +0 -75
  339. package/src/tools/executors/search.ts +0 -278
  340. package/src/tools/executors/web-fetch.ts +0 -259
  341. package/src/tools/index.ts +0 -168
  342. package/src/tools/model-tool-routing.test.ts +0 -86
  343. package/src/tools/model-tool-routing.ts +0 -132
  344. package/src/tools/presets.test.ts +0 -62
  345. package/src/tools/presets.ts +0 -168
  346. package/src/tools/schemas.ts +0 -284
  347. package/src/tools/types.ts +0 -328
  348. package/src/types/common.ts +0 -14
  349. package/src/types/config.ts +0 -84
  350. package/src/types/events.ts +0 -74
  351. package/src/types/index.ts +0 -24
  352. package/src/types/provider-settings.ts +0 -43
  353. package/src/types/sessions.ts +0 -16
  354. package/src/types/storage.ts +0 -64
  355. package/src/types/workspace.ts +0 -7
  356. package/src/types.ts +0 -128
@@ -1,278 +0,0 @@
1
- /**
2
- * Search Executor
3
- *
4
- * Built-in implementation for searching the codebase using regex.
5
- */
6
-
7
- import * as fs from "node:fs/promises";
8
- import * as path from "node:path";
9
- import type { ToolContext } from "@clinebot/agents";
10
- import { getFileIndex } from "../../input";
11
- import type { SearchExecutor } from "../types.js";
12
-
13
- /**
14
- * Options for the search executor
15
- */
16
- export interface SearchExecutorOptions {
17
- /**
18
- * File extensions to include in search (without dot)
19
- * @default common code extensions
20
- */
21
- includeExtensions?: string[];
22
-
23
- /**
24
- * Directories to exclude from search
25
- * @default ["node_modules", ".git", "dist", "build", ".next", "coverage"]
26
- */
27
- excludeDirs?: string[];
28
-
29
- /**
30
- * Maximum number of results to return
31
- * @default 100
32
- */
33
- maxResults?: number;
34
-
35
- /**
36
- * Number of context lines before and after match
37
- * @default 2
38
- */
39
- contextLines?: number;
40
-
41
- /**
42
- * Maximum depth to traverse
43
- * @default 20
44
- */
45
- maxDepth?: number;
46
- }
47
-
48
- const DEFAULT_INCLUDE_EXTENSIONS = [
49
- "ts",
50
- "tsx",
51
- "js",
52
- "jsx",
53
- "mjs",
54
- "cjs",
55
- "json",
56
- "md",
57
- "mdx",
58
- "txt",
59
- "yaml",
60
- "yml",
61
- "toml",
62
- "py",
63
- "rb",
64
- "go",
65
- "rs",
66
- "java",
67
- "kt",
68
- "swift",
69
- "c",
70
- "cpp",
71
- "h",
72
- "hpp",
73
- "css",
74
- "scss",
75
- "less",
76
- "html",
77
- "vue",
78
- "svelte",
79
- "sql",
80
- "sh",
81
- "bash",
82
- "zsh",
83
- "fish",
84
- "ps1",
85
- "env",
86
- "gitignore",
87
- "dockerignore",
88
- "editorconfig",
89
- ];
90
-
91
- const DEFAULT_EXCLUDE_DIRS = [
92
- "node_modules",
93
- ".git",
94
- "dist",
95
- "build",
96
- ".next",
97
- "coverage",
98
- "__pycache__",
99
- ".venv",
100
- "venv",
101
- ".cache",
102
- ".turbo",
103
- ".output",
104
- "out",
105
- "target",
106
- "bin",
107
- "obj",
108
- ];
109
-
110
- /**
111
- * Search result for a single file match
112
- */
113
- interface SearchMatch {
114
- file: string;
115
- line: number;
116
- column: number;
117
- match: string;
118
- context: string[];
119
- }
120
-
121
- function shouldIncludeFile(
122
- relativePath: string,
123
- excludeDirs: Set<string>,
124
- includeExtensions: Set<string>,
125
- maxDepth: number,
126
- ): boolean {
127
- const segments = relativePath.split("/");
128
- const fileName = segments[segments.length - 1] ?? "";
129
- const directoryDepth = segments.length - 1;
130
-
131
- if (directoryDepth > maxDepth) {
132
- return false;
133
- }
134
-
135
- for (let i = 0; i < segments.length - 1; i++) {
136
- if (excludeDirs.has(segments[i] ?? "")) {
137
- return false;
138
- }
139
- }
140
-
141
- const ext = path.posix.extname(fileName).slice(1).toLowerCase();
142
- return includeExtensions.has(ext) || (!ext && !fileName.startsWith("."));
143
- }
144
-
145
- /**
146
- * Create a search executor using regex pattern matching
147
- *
148
- * @example
149
- * ```typescript
150
- * const search = createSearchExecutor({
151
- * maxResults: 50,
152
- * contextLines: 3,
153
- * })
154
- *
155
- * const results = await search("function\\s+handleClick", "/path/to/project", context)
156
- * ```
157
- */
158
- export function createSearchExecutor(
159
- options: SearchExecutorOptions = {},
160
- ): SearchExecutor {
161
- const {
162
- includeExtensions = DEFAULT_INCLUDE_EXTENSIONS,
163
- excludeDirs = DEFAULT_EXCLUDE_DIRS,
164
- maxResults = 100,
165
- contextLines = 2,
166
- maxDepth = 20,
167
- } = options;
168
- const excludeDirsSet = new Set(excludeDirs);
169
- const includeExtensionsSet = new Set(
170
- includeExtensions.map((extension) => extension.toLowerCase()),
171
- );
172
-
173
- return async (
174
- query: string,
175
- cwd: string,
176
- _context: ToolContext,
177
- ): Promise<string> => {
178
- // Compile regex
179
- let regex: RegExp;
180
- try {
181
- regex = new RegExp(query, "gim");
182
- } catch (error) {
183
- throw new Error(
184
- `Invalid regex pattern: ${query}. ${error instanceof Error ? error.message : ""}`,
185
- );
186
- }
187
-
188
- const matches: SearchMatch[] = [];
189
- let totalFilesSearched = 0;
190
-
191
- const fileList = await getFileIndex(cwd);
192
-
193
- // Search files from the fast index.
194
- for (const relativePath of fileList) {
195
- if (
196
- !shouldIncludeFile(
197
- relativePath,
198
- excludeDirsSet,
199
- includeExtensionsSet,
200
- maxDepth,
201
- )
202
- ) {
203
- continue;
204
- }
205
-
206
- if (matches.length >= maxResults) break;
207
-
208
- totalFilesSearched++;
209
- const filePath = path.join(cwd, relativePath);
210
-
211
- try {
212
- const content = await fs.readFile(filePath, "utf-8");
213
- const lines = content.split("\n");
214
-
215
- for (let lineIdx = 0; lineIdx < lines.length; lineIdx++) {
216
- const line = lines[lineIdx];
217
- regex.lastIndex = 0; // Reset regex state
218
-
219
- let match: RegExpExecArray | null;
220
- while ((match = regex.exec(line)) !== null) {
221
- if (matches.length >= maxResults) break;
222
-
223
- // Get context lines
224
- const contextStart = Math.max(0, lineIdx - contextLines);
225
- const contextEnd = Math.min(
226
- lines.length - 1,
227
- lineIdx + contextLines,
228
- );
229
- const contextLinesArr: string[] = [];
230
-
231
- for (let i = contextStart; i <= contextEnd; i++) {
232
- const prefix = i === lineIdx ? ">" : " ";
233
- contextLinesArr.push(`${prefix} ${i + 1}: ${lines[i]}`);
234
- }
235
-
236
- matches.push({
237
- file: relativePath,
238
- line: lineIdx + 1,
239
- column: match.index + 1,
240
- match: match[0],
241
- context: contextLinesArr,
242
- });
243
-
244
- // Prevent infinite loop on zero-length matches
245
- if (match.index === regex.lastIndex) {
246
- regex.lastIndex++;
247
- }
248
- }
249
- }
250
- } catch {}
251
- }
252
-
253
- // Format results
254
- if (matches.length === 0) {
255
- return `No results found for pattern: ${query}\nSearched ${totalFilesSearched} files.`;
256
- }
257
-
258
- const resultLines: string[] = [
259
- `Found ${matches.length} result${matches.length === 1 ? "" : "s"} for pattern: ${query}`,
260
- `Searched ${totalFilesSearched} files.`,
261
- "",
262
- ];
263
-
264
- for (const match of matches) {
265
- resultLines.push(`${match.file}:${match.line}:${match.column}`);
266
- resultLines.push(...match.context);
267
- resultLines.push("");
268
- }
269
-
270
- if (matches.length >= maxResults) {
271
- resultLines.push(
272
- `(Showing first ${maxResults} results. Refine your search for more specific results.)`,
273
- );
274
- }
275
-
276
- return resultLines.join("\n");
277
- };
278
- }
@@ -1,259 +0,0 @@
1
- /**
2
- * Web Fetch Executor
3
- *
4
- * Built-in implementation for fetching web content using native fetch.
5
- */
6
-
7
- import type { ToolContext } from "@clinebot/agents";
8
- import type { WebFetchExecutor } from "../types.js";
9
-
10
- /**
11
- * Options for the web fetch executor
12
- */
13
- export interface WebFetchExecutorOptions {
14
- /**
15
- * Timeout for fetch requests in milliseconds
16
- * @default 30000 (30 seconds)
17
- */
18
- timeoutMs?: number;
19
-
20
- /**
21
- * Maximum response size in bytes
22
- * @default 5_000_000 (5MB)
23
- */
24
- maxResponseBytes?: number;
25
-
26
- /**
27
- * User agent string
28
- * @default "Mozilla/5.0 (compatible; AgentBot/1.0)"
29
- */
30
- userAgent?: string;
31
-
32
- /**
33
- * Additional headers
34
- */
35
- headers?: Record<string, string>;
36
-
37
- /**
38
- * Whether to follow redirects
39
- * @default true
40
- */
41
- followRedirects?: boolean;
42
-
43
- /**
44
- * Maximum number of redirects to follow
45
- * @default 5
46
- */
47
- maxRedirects?: number;
48
- }
49
-
50
- /**
51
- * Extract text content from HTML
52
- * Simple implementation - strips tags and normalizes whitespace
53
- */
54
- function htmlToText(html: string): string {
55
- return (
56
- html
57
- // Remove script and style elements
58
- .replace(/<script[^>]*>[\s\S]*?<\/script>/gi, "")
59
- .replace(/<style[^>]*>[\s\S]*?<\/style>/gi, "")
60
- // Remove HTML comments
61
- .replace(/<!--[\s\S]*?-->/g, "")
62
- // Replace block elements with newlines
63
- .replace(/<(p|div|br|hr|h[1-6]|li|tr)[^>]*>/gi, "\n")
64
- // Remove all remaining tags
65
- .replace(/<[^>]+>/g, " ")
66
- // Decode HTML entities
67
- .replace(/&nbsp;/g, " ")
68
- .replace(/&amp;/g, "&")
69
- .replace(/&lt;/g, "<")
70
- .replace(/&gt;/g, ">")
71
- .replace(/&quot;/g, '"')
72
- .replace(/&#(\d+);/g, (_, n) => String.fromCharCode(parseInt(n, 10)))
73
- // Normalize whitespace
74
- .replace(/\s+/g, " ")
75
- .replace(/\n\s+/g, "\n")
76
- .replace(/\n{3,}/g, "\n\n")
77
- .trim()
78
- );
79
- }
80
-
81
- /**
82
- * Create a web fetch executor using native fetch
83
- *
84
- * @example
85
- * ```typescript
86
- * const webFetch = createWebFetchExecutor({
87
- * timeoutMs: 15000,
88
- * maxResponseBytes: 2_000_000,
89
- * })
90
- *
91
- * const content = await webFetch(
92
- * "https://docs.example.com/api",
93
- * "Extract the authentication section",
94
- * context
95
- * )
96
- * ```
97
- */
98
- export function createWebFetchExecutor(
99
- options: WebFetchExecutorOptions = {},
100
- ): WebFetchExecutor {
101
- const {
102
- timeoutMs = 30000,
103
- maxResponseBytes = 5_000_000,
104
- userAgent = "Mozilla/5.0 (compatible; AgentBot/1.0)",
105
- headers = {},
106
- followRedirects = true,
107
- // maxRedirects is available in options but native fetch handles it automatically
108
- } = options;
109
-
110
- return async (
111
- url: string,
112
- prompt: string,
113
- context: ToolContext,
114
- ): Promise<string> => {
115
- // Validate URL
116
- let parsedUrl: URL;
117
- try {
118
- parsedUrl = new URL(url);
119
- } catch {
120
- throw new Error(`Invalid URL: ${url}`);
121
- }
122
-
123
- // Only allow http and https
124
- if (!["http:", "https:"].includes(parsedUrl.protocol)) {
125
- throw new Error(
126
- `Invalid protocol: ${parsedUrl.protocol}. Only http and https are supported.`,
127
- );
128
- }
129
-
130
- // Create abort controller for timeout
131
- const controller = new AbortController();
132
- const timeout = setTimeout(() => controller.abort(), timeoutMs);
133
- let contextAbortHandler: (() => void) | undefined;
134
-
135
- // Combine with context abort signal
136
- if (context.abortSignal) {
137
- contextAbortHandler = () => controller.abort();
138
- context.abortSignal.addEventListener("abort", contextAbortHandler);
139
- }
140
-
141
- try {
142
- const response = await fetch(url, {
143
- method: "GET",
144
- headers: {
145
- "User-Agent": userAgent,
146
- Accept:
147
- "text/html,application/xhtml+xml,application/xml;q=0.9,text/plain;q=0.8,*/*;q=0.7",
148
- "Accept-Language": "en-US,en;q=0.9",
149
- ...headers,
150
- },
151
- redirect: followRedirects ? "follow" : "manual",
152
- signal: controller.signal,
153
- });
154
-
155
- clearTimeout(timeout);
156
-
157
- // Check for redirect limit (if we're checking manually)
158
- if (!followRedirects && response.status >= 300 && response.status < 400) {
159
- const location = response.headers.get("location");
160
- return `Redirect to: ${location}`;
161
- }
162
-
163
- // Check response status
164
- if (!response.ok) {
165
- throw new Error(`HTTP ${response.status}: ${response.statusText}`);
166
- }
167
-
168
- // Get content type
169
- const contentType = response.headers.get("content-type") || "";
170
-
171
- // Read response body with size limit
172
- const reader = response.body?.getReader();
173
- if (!reader) {
174
- throw new Error("Failed to read response body");
175
- }
176
-
177
- const chunks: Uint8Array[] = [];
178
- let totalSize = 0;
179
-
180
- while (true) {
181
- const { done, value } = await reader.read();
182
- if (done) break;
183
-
184
- totalSize += value.length;
185
- if (totalSize > maxResponseBytes) {
186
- reader.cancel();
187
- throw new Error(
188
- `Response too large: exceeded ${maxResponseBytes} bytes`,
189
- );
190
- }
191
-
192
- chunks.push(value);
193
- }
194
-
195
- // Combine chunks
196
- const buffer = new Uint8Array(totalSize);
197
- let offset = 0;
198
- for (const chunk of chunks) {
199
- buffer.set(chunk, offset);
200
- offset += chunk.length;
201
- }
202
-
203
- // Decode as text
204
- const text = new TextDecoder("utf-8").decode(buffer);
205
-
206
- // Process content based on type
207
- let content: string;
208
- if (
209
- contentType.includes("text/html") ||
210
- contentType.includes("application/xhtml")
211
- ) {
212
- content = htmlToText(text);
213
- } else if (contentType.includes("application/json")) {
214
- try {
215
- const json = JSON.parse(text);
216
- content = JSON.stringify(json, null, 2);
217
- } catch {
218
- content = text;
219
- }
220
- } else {
221
- content = text;
222
- }
223
-
224
- // Format output with metadata
225
- const outputLines = [
226
- `URL: ${url}`,
227
- `Content-Type: ${contentType}`,
228
- `Size: ${totalSize} bytes`,
229
- ``,
230
- `--- Content ---`,
231
- content.slice(0, 50000), // Limit content size for output
232
- ];
233
-
234
- if (content.length > 50000) {
235
- outputLines.push(
236
- `\n[Content truncated: showing first 50000 of ${content.length} characters]`,
237
- );
238
- }
239
-
240
- outputLines.push(``, `--- Analysis Request ---`, `Prompt: ${prompt}`);
241
-
242
- return outputLines.join("\n");
243
- } catch (error) {
244
- clearTimeout(timeout);
245
-
246
- if (error instanceof Error) {
247
- if (error.name === "AbortError") {
248
- throw new Error(`Request timed out after ${timeoutMs}ms`);
249
- }
250
- throw error;
251
- }
252
- throw new Error(`Fetch failed: ${String(error)}`);
253
- } finally {
254
- if (context.abortSignal && contextAbortHandler) {
255
- context.abortSignal.removeEventListener("abort", contextAbortHandler);
256
- }
257
- }
258
- };
259
- }
@@ -1,168 +0,0 @@
1
- /**
2
- * Default Tools
3
- *
4
- * This module provides a set of configurable default tools for agents.
5
- */
6
-
7
- // Zod Utilities
8
- export { validateWithZod, zodToJsonSchema } from "@clinebot/shared";
9
- // Constants
10
- export { ALL_DEFAULT_TOOL_NAMES, DefaultToolNames } from "./constants.js";
11
- // Tool Definitions
12
- export {
13
- createApplyPatchTool,
14
- createAskQuestionTool,
15
- createBashTool,
16
- createDefaultTools,
17
- createEditorTool,
18
- createReadFilesTool,
19
- createSearchTool,
20
- createSkillsTool,
21
- createWebFetchTool,
22
- } from "./definitions.js";
23
- // Built-in Executors
24
- export {
25
- type ApplyPatchExecutorOptions,
26
- type BashExecutorOptions,
27
- createApplyPatchExecutor,
28
- createBashExecutor,
29
- createDefaultExecutors,
30
- createEditorExecutor,
31
- createFileReadExecutor,
32
- createSearchExecutor,
33
- createWebFetchExecutor,
34
- type DefaultExecutorsOptions,
35
- type EditorExecutorOptions,
36
- type FileReadExecutorOptions,
37
- type SearchExecutorOptions,
38
- type WebFetchExecutorOptions,
39
- } from "./executors/index.js";
40
- export {
41
- DEFAULT_MODEL_TOOL_ROUTING_RULES,
42
- resolveToolRoutingConfig,
43
- type ToolRoutingRule,
44
- } from "./model-tool-routing.js";
45
- // Presets
46
- export {
47
- createDefaultToolsWithPreset,
48
- createToolPoliciesWithPreset,
49
- type ToolPolicyPresetName,
50
- type ToolPresetName,
51
- ToolPresets,
52
- } from "./presets.js";
53
- // Schemas
54
- export {
55
- type ApplyPatchInput,
56
- ApplyPatchInputSchema,
57
- type AskQuestionInput,
58
- AskQuestionInputSchema,
59
- type EditFileInput,
60
- EditFileInputSchema,
61
- type FetchWebContentInput,
62
- FetchWebContentInputSchema,
63
- type ReadFileRequest,
64
- ReadFileRequestSchema,
65
- type ReadFilesInput,
66
- ReadFilesInputSchema,
67
- type RunCommandsInput,
68
- RunCommandsInputSchema,
69
- type SearchCodebaseInput,
70
- SearchCodebaseInputSchema,
71
- type SkillsInput,
72
- SkillsInputSchema,
73
- type WebFetchRequest,
74
- WebFetchRequestSchema,
75
- } from "./schemas.js";
76
- // Types
77
- export type {
78
- ApplyPatchExecutor,
79
- AskQuestionExecutor,
80
- BashExecutor,
81
- CreateDefaultToolsOptions,
82
- DefaultToolName,
83
- DefaultToolsConfig,
84
- EditorExecutor,
85
- FileReadExecutor,
86
- SearchExecutor,
87
- SkillsExecutor,
88
- SkillsExecutorSkillMetadata,
89
- SkillsExecutorWithMetadata,
90
- ToolExecutors,
91
- ToolOperationResult,
92
- WebFetchExecutor,
93
- } from "./types.js";
94
-
95
- // =============================================================================
96
- // Convenience: Create Tools with Built-in Executors
97
- // =============================================================================
98
-
99
- import type { Tool } from "@clinebot/agents";
100
- import { createDefaultTools } from "./definitions.js";
101
- import {
102
- createDefaultExecutors,
103
- type DefaultExecutorsOptions,
104
- } from "./executors/index.js";
105
- import type { CreateDefaultToolsOptions, ToolExecutors } from "./types.js";
106
-
107
- /**
108
- * Options for creating default tools with built-in executors
109
- */
110
- export interface CreateBuiltinToolsOptions
111
- extends Omit<CreateDefaultToolsOptions, "executors"> {
112
- /**
113
- * Configuration for the built-in executors
114
- */
115
- executorOptions?: DefaultExecutorsOptions;
116
- /**
117
- * Optional executor overrides/additions for tools without built-ins
118
- */
119
- executors?: Partial<ToolExecutors>;
120
- }
121
-
122
- /**
123
- * Create default tools with built-in Node.js executors
124
- *
125
- * This is a convenience function that creates the default tools with
126
- * working implementations using Node.js built-in modules.
127
- *
128
- * @example
129
- * ```typescript
130
- * import { Agent } from "@clinebot/agents"
131
- * import { createBuiltinTools } from "@clinebot/core/node"
132
- *
133
- * const tools = createBuiltinTools({
134
- * cwd: "/path/to/project",
135
- * enableBash: true,
136
- * enableWebFetch: false, // Disable web fetching
137
- * executorOptions: {
138
- * bash: { timeoutMs: 60000 },
139
- * },
140
- * })
141
- *
142
- * const agent = new Agent({
143
- * providerId: "anthropic",
144
- * modelId: "claude-sonnet-4-20250514",
145
- * systemPrompt: "You are a coding assistant.",
146
- * tools,
147
- * })
148
- * ```
149
- */
150
- export function createBuiltinTools(
151
- options: CreateBuiltinToolsOptions = {},
152
- ): Tool[] {
153
- const {
154
- executorOptions = {},
155
- executors: executorOverrides,
156
- ...toolsConfig
157
- } = options;
158
-
159
- const executors = {
160
- ...createDefaultExecutors(executorOptions),
161
- ...(executorOverrides ?? {}),
162
- };
163
-
164
- return createDefaultTools({
165
- ...toolsConfig,
166
- executors,
167
- });
168
- }