@clinebot/core 0.0.35 → 0.0.37

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 (441) hide show
  1. package/README.md +1 -2
  2. package/dist/ClineCore.d.ts +362 -39
  3. package/dist/ClineCore.d.ts.map +1 -1
  4. package/dist/account/cline-account-service.d.ts.map +1 -1
  5. package/dist/account/index.d.ts +1 -1
  6. package/dist/account/index.d.ts.map +1 -1
  7. package/dist/account/rpc.d.ts +6 -6
  8. package/dist/account/rpc.d.ts.map +1 -1
  9. package/dist/cron/cron-event-ingress.d.ts +38 -0
  10. package/dist/cron/cron-event-ingress.d.ts.map +1 -0
  11. package/dist/cron/cron-materializer.d.ts +36 -0
  12. package/dist/cron/cron-materializer.d.ts.map +1 -0
  13. package/dist/cron/cron-reconciler.d.ts +62 -0
  14. package/dist/cron/cron-reconciler.d.ts.map +1 -0
  15. package/dist/cron/cron-report-writer.d.ts +41 -0
  16. package/dist/cron/cron-report-writer.d.ts.map +1 -0
  17. package/dist/cron/cron-runner.d.ts +43 -0
  18. package/dist/cron/cron-runner.d.ts.map +1 -0
  19. package/dist/cron/cron-schema.d.ts +3 -0
  20. package/dist/cron/cron-schema.d.ts.map +1 -0
  21. package/dist/cron/cron-service.d.ts +57 -0
  22. package/dist/cron/cron-service.d.ts.map +1 -0
  23. package/dist/cron/cron-spec-parser.d.ts +27 -0
  24. package/dist/cron/cron-spec-parser.d.ts.map +1 -0
  25. package/dist/cron/cron-watcher.d.ts +23 -0
  26. package/dist/cron/cron-watcher.d.ts.map +1 -0
  27. package/dist/cron/resource-limiter.d.ts +9 -0
  28. package/dist/cron/resource-limiter.d.ts.map +1 -0
  29. package/dist/cron/schedule-command-service.d.ts +10 -0
  30. package/dist/cron/schedule-command-service.d.ts.map +1 -0
  31. package/dist/cron/schedule-service.d.ts +100 -0
  32. package/dist/cron/schedule-service.d.ts.map +1 -0
  33. package/dist/cron/scheduler.d.ts +68 -0
  34. package/dist/cron/scheduler.d.ts.map +1 -0
  35. package/dist/cron/sqlite-cron-store.d.ts +230 -0
  36. package/dist/cron/sqlite-cron-store.d.ts.map +1 -0
  37. package/dist/cron/sqlite-schedule-store.d.ts +52 -0
  38. package/dist/cron/sqlite-schedule-store.d.ts.map +1 -0
  39. package/dist/extensions/config/agent-config-loader.d.ts +4 -3
  40. package/dist/extensions/config/agent-config-loader.d.ts.map +1 -1
  41. package/dist/extensions/config/runtime-commands.d.ts +1 -0
  42. package/dist/extensions/config/runtime-commands.d.ts.map +1 -1
  43. package/dist/extensions/config/user-instruction-config-loader.d.ts +1 -0
  44. package/dist/extensions/config/user-instruction-config-loader.d.ts.map +1 -1
  45. package/dist/extensions/context/agentic-compaction.d.ts +2 -2
  46. package/dist/extensions/context/agentic-compaction.d.ts.map +1 -1
  47. package/dist/extensions/context/compaction-shared.d.ts +5 -4
  48. package/dist/extensions/context/compaction-shared.d.ts.map +1 -1
  49. package/dist/extensions/context/compaction.d.ts.map +1 -1
  50. package/dist/extensions/plugin/plugin-config-loader.d.ts +15 -2
  51. package/dist/extensions/plugin/plugin-config-loader.d.ts.map +1 -1
  52. package/dist/extensions/plugin/plugin-loader.d.ts +13 -7
  53. package/dist/extensions/plugin/plugin-loader.d.ts.map +1 -1
  54. package/dist/extensions/plugin/plugin-module-import.d.ts.map +1 -1
  55. package/dist/extensions/plugin/plugin-sandbox.d.ts +21 -2
  56. package/dist/extensions/plugin/plugin-sandbox.d.ts.map +1 -1
  57. package/dist/extensions/plugin/plugin-targeting.d.ts +7 -0
  58. package/dist/extensions/plugin/plugin-targeting.d.ts.map +1 -0
  59. package/dist/extensions/plugin-sandbox-bootstrap.js +237 -276
  60. package/dist/extensions/tools/constants.d.ts +1 -0
  61. package/dist/extensions/tools/constants.d.ts.map +1 -1
  62. package/dist/extensions/tools/definitions.d.ts +3 -4
  63. package/dist/extensions/tools/definitions.d.ts.map +1 -1
  64. package/dist/extensions/tools/executors/apply-patch.d.ts +3 -1
  65. package/dist/extensions/tools/executors/apply-patch.d.ts.map +1 -1
  66. package/dist/extensions/tools/executors/editor.d.ts.map +1 -1
  67. package/dist/extensions/tools/executors/search.d.ts +1 -1
  68. package/dist/extensions/tools/executors/search.d.ts.map +1 -1
  69. package/dist/extensions/tools/helpers.d.ts +1 -0
  70. package/dist/extensions/tools/helpers.d.ts.map +1 -1
  71. package/dist/extensions/tools/index.d.ts +3 -2
  72. package/dist/extensions/tools/index.d.ts.map +1 -1
  73. package/dist/extensions/tools/presets.d.ts +27 -44
  74. package/dist/extensions/tools/presets.d.ts.map +1 -1
  75. package/dist/extensions/tools/runtime.d.ts +25 -0
  76. package/dist/extensions/tools/runtime.d.ts.map +1 -0
  77. package/dist/extensions/tools/schemas.d.ts +25 -3
  78. package/dist/extensions/tools/schemas.d.ts.map +1 -1
  79. package/dist/extensions/tools/team/delegated-agent.d.ts +2 -2
  80. package/dist/extensions/tools/team/delegated-agent.d.ts.map +1 -1
  81. package/dist/extensions/tools/team/multi-agent.d.ts +7 -3
  82. package/dist/extensions/tools/team/multi-agent.d.ts.map +1 -1
  83. package/dist/extensions/tools/team/team-tools.d.ts +1 -0
  84. package/dist/extensions/tools/team/team-tools.d.ts.map +1 -1
  85. package/dist/extensions/tools/types.d.ts +0 -5
  86. package/dist/extensions/tools/types.d.ts.map +1 -1
  87. package/dist/hooks/hook-bridge.d.ts +118 -0
  88. package/dist/hooks/hook-bridge.d.ts.map +1 -0
  89. package/dist/hooks/hook-file-hooks.d.ts +6 -2
  90. package/dist/hooks/hook-file-hooks.d.ts.map +1 -1
  91. package/dist/hooks/hook-registry.d.ts +16 -0
  92. package/dist/hooks/hook-registry.d.ts.map +1 -0
  93. package/dist/hooks/index.d.ts +0 -1
  94. package/dist/hooks/index.d.ts.map +1 -1
  95. package/dist/hooks/subprocess.d.ts +8 -1
  96. package/dist/hooks/subprocess.d.ts.map +1 -1
  97. package/dist/hub/browser-websocket.d.ts +18 -0
  98. package/dist/hub/browser-websocket.d.ts.map +1 -0
  99. package/dist/hub/client.d.ts +51 -0
  100. package/dist/hub/client.d.ts.map +1 -0
  101. package/dist/hub/connect.d.ts +15 -0
  102. package/dist/hub/connect.d.ts.map +1 -0
  103. package/dist/hub/daemon-entry.d.ts +2 -0
  104. package/dist/hub/daemon-entry.d.ts.map +1 -0
  105. package/dist/hub/daemon-entry.js +1305 -0
  106. package/dist/hub/daemon.d.ts +5 -0
  107. package/dist/hub/daemon.d.ts.map +1 -0
  108. package/dist/hub/defaults.d.ts +17 -0
  109. package/dist/hub/defaults.d.ts.map +1 -0
  110. package/dist/hub/discovery.d.ts +29 -0
  111. package/dist/hub/discovery.d.ts.map +1 -0
  112. package/dist/hub/index.d.ts +15 -0
  113. package/dist/hub/index.d.ts.map +1 -0
  114. package/dist/hub/index.js +1294 -0
  115. package/dist/hub/native-transport.d.ts +17 -0
  116. package/dist/hub/native-transport.d.ts.map +1 -0
  117. package/dist/hub/runtime-handlers.d.ts +11 -0
  118. package/dist/hub/runtime-handlers.d.ts.map +1 -0
  119. package/dist/hub/server.d.ts +104 -0
  120. package/dist/hub/server.d.ts.map +1 -0
  121. package/dist/hub/session-client.d.ts +90 -0
  122. package/dist/hub/session-client.d.ts.map +1 -0
  123. package/dist/hub/start-shared-server.d.ts +19 -0
  124. package/dist/hub/start-shared-server.d.ts.map +1 -0
  125. package/dist/hub/transport.d.ts +8 -0
  126. package/dist/hub/transport.d.ts.map +1 -0
  127. package/dist/hub/ui-client.d.ts +45 -0
  128. package/dist/hub/ui-client.d.ts.map +1 -0
  129. package/dist/hub/workspace.d.ts +4 -0
  130. package/dist/hub/workspace.d.ts.map +1 -0
  131. package/dist/index.d.ts +29 -16
  132. package/dist/index.d.ts.map +1 -1
  133. package/dist/index.js +782 -471
  134. package/dist/llms/cline-recommended-models.d.ts +20 -0
  135. package/dist/llms/cline-recommended-models.d.ts.map +1 -0
  136. package/dist/llms/configured-provider-registry.d.ts +28 -0
  137. package/dist/llms/configured-provider-registry.d.ts.map +1 -0
  138. package/dist/llms/handler-factory.d.ts +16 -0
  139. package/dist/llms/handler-factory.d.ts.map +1 -0
  140. package/dist/llms/provider-defaults.d.ts +27 -0
  141. package/dist/llms/provider-defaults.d.ts.map +1 -0
  142. package/dist/llms/provider-settings.d.ts +245 -0
  143. package/dist/llms/provider-settings.d.ts.map +1 -0
  144. package/dist/llms/runtime-config.d.ts +4 -0
  145. package/dist/llms/runtime-config.d.ts.map +1 -0
  146. package/dist/llms/runtime-registry.d.ts +20 -0
  147. package/dist/llms/runtime-registry.d.ts.map +1 -0
  148. package/dist/llms/runtime-types.d.ts +85 -0
  149. package/dist/llms/runtime-types.d.ts.map +1 -0
  150. package/dist/runtime/agent-config-adapter.d.ts +148 -0
  151. package/dist/runtime/agent-config-adapter.d.ts.map +1 -0
  152. package/dist/runtime/agent-runtime-config-builder.d.ts +96 -0
  153. package/dist/runtime/agent-runtime-config-builder.d.ts.map +1 -0
  154. package/dist/runtime/history.d.ts +6 -0
  155. package/dist/runtime/history.d.ts.map +1 -1
  156. package/dist/runtime/host.d.ts +1 -2
  157. package/dist/runtime/host.d.ts.map +1 -1
  158. package/dist/runtime/loop-detection.d.ts +59 -0
  159. package/dist/runtime/loop-detection.d.ts.map +1 -0
  160. package/dist/runtime/mistake-tracker.d.ts +69 -0
  161. package/dist/runtime/mistake-tracker.d.ts.map +1 -0
  162. package/dist/runtime/rules.d.ts +1 -0
  163. package/dist/runtime/rules.d.ts.map +1 -1
  164. package/dist/runtime/runtime-builder.d.ts.map +1 -1
  165. package/dist/runtime/runtime-event-adapter.d.ts +102 -0
  166. package/dist/runtime/runtime-event-adapter.d.ts.map +1 -0
  167. package/dist/runtime/runtime-host.d.ts +49 -26
  168. package/dist/runtime/runtime-host.d.ts.map +1 -1
  169. package/dist/runtime/runtime-oauth-token-manager.d.ts.map +1 -1
  170. package/dist/runtime/session-runtime-orchestrator.d.ts +261 -0
  171. package/dist/runtime/session-runtime-orchestrator.d.ts.map +1 -0
  172. package/dist/runtime/session-runtime.d.ts +16 -21
  173. package/dist/runtime/session-runtime.d.ts.map +1 -1
  174. package/dist/runtime/user-input-builder.d.ts +24 -0
  175. package/dist/runtime/user-input-builder.d.ts.map +1 -0
  176. package/dist/services/global-settings.d.ts +12 -0
  177. package/dist/services/global-settings.d.ts.map +1 -0
  178. package/dist/services/index.js +28 -0
  179. package/dist/services/local-runtime-bootstrap.d.ts +9 -3
  180. package/dist/services/local-runtime-bootstrap.d.ts.map +1 -1
  181. package/dist/services/plugin-tools.d.ts +16 -0
  182. package/dist/services/plugin-tools.d.ts.map +1 -0
  183. package/dist/services/providers/local-provider-registry.d.ts +199 -23
  184. package/dist/services/providers/local-provider-registry.d.ts.map +1 -1
  185. package/dist/services/providers/local-provider-service.d.ts +15 -13
  186. package/dist/services/providers/local-provider-service.d.ts.map +1 -1
  187. package/dist/services/session-data.d.ts +1 -1
  188. package/dist/services/session-data.d.ts.map +1 -1
  189. package/dist/services/session-telemetry.d.ts +7 -2
  190. package/dist/services/session-telemetry.d.ts.map +1 -1
  191. package/dist/services/storage/file-team-store.d.ts.map +1 -1
  192. package/dist/services/storage/provider-settings-legacy-migration.d.ts +1 -1
  193. package/dist/services/storage/provider-settings-legacy-migration.d.ts.map +1 -1
  194. package/dist/services/storage/provider-settings-manager.d.ts +1 -0
  195. package/dist/services/storage/provider-settings-manager.d.ts.map +1 -1
  196. package/dist/services/storage/sqlite-team-store.d.ts.map +1 -1
  197. package/dist/services/workspace-manifest.d.ts +11 -0
  198. package/dist/services/workspace-manifest.d.ts.map +1 -1
  199. package/dist/session/conversation-store.d.ts +30 -0
  200. package/dist/session/conversation-store.d.ts.map +1 -0
  201. package/dist/session/message-builder.d.ts +65 -0
  202. package/dist/session/message-builder.d.ts.map +1 -0
  203. package/dist/session/persistence-service.d.ts +11 -23
  204. package/dist/session/persistence-service.d.ts.map +1 -1
  205. package/dist/session/session-manifest-store.d.ts +22 -0
  206. package/dist/session/session-manifest-store.d.ts.map +1 -0
  207. package/dist/session/session-manifest.d.ts +1 -1
  208. package/dist/session/session-row.d.ts +93 -0
  209. package/dist/session/session-row.d.ts.map +1 -0
  210. package/dist/session/session-service.d.ts +2 -102
  211. package/dist/session/session-service.d.ts.map +1 -1
  212. package/dist/session/subagent-session-manager.d.ts +36 -0
  213. package/dist/session/subagent-session-manager.d.ts.map +1 -0
  214. package/dist/session/team-persistence-store.d.ts +24 -0
  215. package/dist/session/team-persistence-store.d.ts.map +1 -0
  216. package/dist/transports/hub.d.ts +58 -0
  217. package/dist/transports/hub.d.ts.map +1 -0
  218. package/dist/transports/local.d.ts +23 -9
  219. package/dist/transports/local.d.ts.map +1 -1
  220. package/dist/transports/remote.d.ts +10 -0
  221. package/dist/transports/remote.d.ts.map +1 -0
  222. package/dist/transports/runtime-host-support.d.ts +3 -2
  223. package/dist/transports/runtime-host-support.d.ts.map +1 -1
  224. package/dist/types/chat-schema.d.ts +15 -17
  225. package/dist/types/chat-schema.d.ts.map +1 -1
  226. package/dist/types/config.d.ts +17 -7
  227. package/dist/types/config.d.ts.map +1 -1
  228. package/dist/types/events.d.ts +7 -6
  229. package/dist/types/events.d.ts.map +1 -1
  230. package/dist/types/provider-settings.d.ts +4 -5
  231. package/dist/types/provider-settings.d.ts.map +1 -1
  232. package/dist/types/session.d.ts +7 -3
  233. package/dist/types/session.d.ts.map +1 -1
  234. package/dist/types.d.ts +11 -4
  235. package/dist/types.d.ts.map +1 -1
  236. package/package.json +20 -6
  237. package/src/ClineCore.ts +757 -44
  238. package/src/account/cline-account-service.ts +44 -6
  239. package/src/account/index.ts +3 -3
  240. package/src/account/rpc.ts +12 -12
  241. package/src/cron/cron-event-ingress.ts +357 -0
  242. package/src/cron/cron-materializer.ts +97 -0
  243. package/src/cron/cron-reconciler.ts +241 -0
  244. package/src/cron/cron-report-writer.ts +153 -0
  245. package/src/cron/cron-runner.ts +495 -0
  246. package/src/cron/cron-schema.ts +127 -0
  247. package/src/cron/cron-service.ts +163 -0
  248. package/src/cron/cron-spec-parser.ts +489 -0
  249. package/src/cron/cron-watcher.ts +102 -0
  250. package/src/cron/index.ts +15 -0
  251. package/src/cron/resource-limiter.ts +46 -0
  252. package/src/cron/schedule-command-service.ts +193 -0
  253. package/src/cron/schedule-service.ts +703 -0
  254. package/src/cron/scheduler.ts +772 -0
  255. package/src/cron/sqlite-cron-store.ts +1286 -0
  256. package/src/cron/sqlite-schedule-store.ts +708 -0
  257. package/src/extensions/config/agent-config-loader.ts +17 -7
  258. package/src/extensions/config/runtime-commands.ts +6 -0
  259. package/src/extensions/config/user-instruction-config-loader.ts +1 -0
  260. package/src/extensions/context/agentic-compaction.ts +3 -3
  261. package/src/extensions/context/basic-compaction.ts +2 -2
  262. package/src/extensions/context/compaction-shared.ts +5 -4
  263. package/src/extensions/context/compaction.ts +3 -3
  264. package/src/extensions/plugin/plugin-config-loader.ts +37 -2
  265. package/src/extensions/plugin/plugin-loader.ts +69 -9
  266. package/src/extensions/plugin/plugin-module-import.ts +0 -2
  267. package/src/extensions/plugin/plugin-sandbox-bootstrap.ts +243 -39
  268. package/src/extensions/plugin/plugin-sandbox.ts +173 -29
  269. package/src/extensions/plugin/plugin-targeting.ts +32 -0
  270. package/src/extensions/tools/constants.ts +2 -0
  271. package/src/extensions/tools/definitions.ts +61 -71
  272. package/src/extensions/tools/executors/apply-patch.ts +69 -80
  273. package/src/extensions/tools/executors/editor.ts +4 -3
  274. package/src/extensions/tools/executors/search.ts +195 -3
  275. package/src/extensions/tools/helpers.ts +24 -0
  276. package/src/extensions/tools/index.ts +11 -2
  277. package/src/extensions/tools/presets.ts +32 -47
  278. package/src/extensions/tools/runtime.ts +261 -0
  279. package/src/extensions/tools/schemas.ts +17 -20
  280. package/src/extensions/tools/team/delegated-agent.ts +8 -3
  281. package/src/extensions/tools/team/multi-agent.ts +135 -19
  282. package/src/extensions/tools/team/team-tools.ts +172 -91
  283. package/src/extensions/tools/types.ts +0 -6
  284. package/src/hooks/hook-bridge.ts +489 -0
  285. package/src/hooks/hook-file-hooks.ts +66 -5
  286. package/src/hooks/hook-registry.ts +257 -0
  287. package/src/hooks/index.ts +0 -7
  288. package/src/hooks/subprocess-runner.ts +1 -1
  289. package/src/hooks/subprocess.ts +9 -0
  290. package/src/hub/browser-websocket.ts +159 -0
  291. package/src/hub/client.ts +633 -0
  292. package/src/hub/connect.ts +156 -0
  293. package/src/hub/daemon-entry.ts +122 -0
  294. package/src/hub/daemon.ts +284 -0
  295. package/src/hub/defaults.ts +70 -0
  296. package/src/hub/discovery.ts +247 -0
  297. package/src/hub/index.ts +14 -0
  298. package/src/hub/native-transport.ts +31 -0
  299. package/src/hub/runtime-handlers.ts +141 -0
  300. package/src/hub/server.ts +2317 -0
  301. package/src/hub/session-client.ts +502 -0
  302. package/src/hub/start-shared-server.ts +61 -0
  303. package/src/hub/transport.ts +14 -0
  304. package/src/hub/ui-client.ts +126 -0
  305. package/src/hub/workspace.ts +19 -0
  306. package/src/index.ts +169 -68
  307. package/src/llms/cline-recommended-models.ts +167 -0
  308. package/src/llms/configured-provider-registry.ts +193 -0
  309. package/src/llms/handler-factory.ts +56 -0
  310. package/src/llms/provider-defaults.ts +653 -0
  311. package/src/llms/provider-settings.ts +310 -0
  312. package/src/llms/runtime-config.ts +43 -0
  313. package/src/llms/runtime-registry.ts +172 -0
  314. package/src/llms/runtime-types.ts +121 -0
  315. package/src/runtime/agent-config-adapter.ts +636 -0
  316. package/src/runtime/agent-runtime-config-builder.ts +205 -0
  317. package/src/runtime/error-feedback.ts +142 -0
  318. package/src/runtime/history.ts +137 -0
  319. package/src/runtime/host.ts +127 -267
  320. package/src/runtime/index.ts +1 -0
  321. package/src/runtime/loop-detection.ts +162 -0
  322. package/src/runtime/mistake-tracker.ts +221 -0
  323. package/src/runtime/rules.ts +12 -0
  324. package/src/runtime/runtime-builder.ts +85 -13
  325. package/src/runtime/runtime-event-adapter.ts +412 -0
  326. package/src/runtime/runtime-host.ts +134 -62
  327. package/src/runtime/runtime-oauth-token-manager.ts +11 -15
  328. package/src/runtime/session-runtime-orchestrator.ts +1253 -0
  329. package/src/runtime/session-runtime.ts +16 -26
  330. package/src/runtime/user-input-builder.ts +167 -0
  331. package/src/services/global-settings.ts +122 -0
  332. package/src/services/local-runtime-bootstrap.ts +175 -31
  333. package/src/services/plugin-tools.ts +86 -0
  334. package/src/services/providers/local-provider-registry.ts +277 -61
  335. package/src/services/providers/local-provider-service.ts +109 -44
  336. package/src/services/session-data.ts +18 -10
  337. package/src/services/session-telemetry.ts +6 -15
  338. package/src/services/storage/file-team-store.ts +1 -5
  339. package/src/services/storage/provider-settings-legacy-migration.ts +14 -51
  340. package/src/services/storage/provider-settings-manager.ts +17 -2
  341. package/src/services/storage/sqlite-team-store.ts +1 -5
  342. package/src/services/workspace-manifest.ts +18 -0
  343. package/src/session/conversation-store.ts +77 -0
  344. package/src/session/file-session-service.ts +1 -1
  345. package/src/session/index.ts +6 -27
  346. package/src/session/message-builder.ts +941 -0
  347. package/src/session/persistence-service.ts +119 -504
  348. package/src/session/session-manifest-store.ts +158 -0
  349. package/src/session/session-row.ts +199 -0
  350. package/src/session/session-service.ts +17 -376
  351. package/src/session/session-team-coordination.ts +1 -1
  352. package/src/session/subagent-session-manager.ts +397 -0
  353. package/src/session/team-persistence-store.ts +176 -0
  354. package/src/transports/hub.ts +1081 -0
  355. package/src/transports/local.ts +419 -93
  356. package/src/transports/remote.ts +27 -0
  357. package/src/transports/runtime-host-support.ts +63 -9
  358. package/src/types/chat-schema.ts +4 -5
  359. package/src/types/config.ts +17 -7
  360. package/src/types/events.ts +8 -6
  361. package/src/types/index.ts +3 -0
  362. package/src/types/provider-settings.ts +18 -7
  363. package/src/types/session.ts +7 -6
  364. package/src/types.ts +42 -2
  365. package/dist/hooks/persistent.d.ts +0 -64
  366. package/dist/hooks/persistent.d.ts.map +0 -1
  367. package/dist/runtime/rpc-runtime-ensure.d.ts +0 -65
  368. package/dist/runtime/rpc-runtime-ensure.d.ts.map +0 -1
  369. package/dist/runtime/rpc-spawn-lease.d.ts +0 -8
  370. package/dist/runtime/rpc-spawn-lease.d.ts.map +0 -1
  371. package/dist/services/telemetry/index.js +0 -15
  372. package/dist/session/rpc-session-service.d.ts +0 -16
  373. package/dist/session/rpc-session-service.d.ts.map +0 -1
  374. package/dist/session/sqlite-rpc-session-backend.d.ts +0 -31
  375. package/dist/session/sqlite-rpc-session-backend.d.ts.map +0 -1
  376. package/dist/transports/rpc.d.ts +0 -51
  377. package/dist/transports/rpc.d.ts.map +0 -1
  378. package/src/ClineCore.test.ts +0 -226
  379. package/src/account/cline-account-service.test.ts +0 -185
  380. package/src/account/featurebase-token.test.ts +0 -175
  381. package/src/account/rpc.test.ts +0 -63
  382. package/src/auth/bounded-ttl-cache.test.ts +0 -38
  383. package/src/auth/client.test.ts +0 -69
  384. package/src/auth/cline.test.ts +0 -267
  385. package/src/auth/codex.test.ts +0 -170
  386. package/src/auth/oca.test.ts +0 -340
  387. package/src/auth/server.test.ts +0 -287
  388. package/src/auth/utils.test.ts +0 -128
  389. package/src/extensions/config/agent-config-loader.test.ts +0 -236
  390. package/src/extensions/config/hooks-config-loader.test.ts +0 -20
  391. package/src/extensions/config/runtime-commands.test.ts +0 -115
  392. package/src/extensions/config/unified-config-file-watcher.test.ts +0 -196
  393. package/src/extensions/config/user-instruction-config-loader.test.ts +0 -246
  394. package/src/extensions/context/compaction.test.ts +0 -483
  395. package/src/extensions/mcp/config-loader.test.ts +0 -238
  396. package/src/extensions/mcp/manager.test.ts +0 -105
  397. package/src/extensions/plugin/plugin-config-loader.test.ts +0 -184
  398. package/src/extensions/plugin/plugin-loader.test.ts +0 -292
  399. package/src/extensions/plugin/plugin-sandbox.test.ts +0 -423
  400. package/src/extensions/tools/definitions.test.ts +0 -780
  401. package/src/extensions/tools/executors/bash.test.ts +0 -87
  402. package/src/extensions/tools/executors/editor.test.ts +0 -35
  403. package/src/extensions/tools/executors/file-read.test.ts +0 -125
  404. package/src/extensions/tools/model-tool-routing.test.ts +0 -86
  405. package/src/extensions/tools/presets.test.ts +0 -70
  406. package/src/extensions/tools/team/multi-agent.lifecycle.test.ts +0 -455
  407. package/src/extensions/tools/team/spawn-agent-tool.test.ts +0 -381
  408. package/src/extensions/tools/team/team-tools.test.ts +0 -918
  409. package/src/hooks/checkpoint-hooks.test.ts +0 -168
  410. package/src/hooks/hook-file-hooks.test.ts +0 -311
  411. package/src/hooks/persistent.ts +0 -661
  412. package/src/runtime/history.test.ts +0 -114
  413. package/src/runtime/host.test.ts +0 -230
  414. package/src/runtime/rpc-runtime-ensure.test.ts +0 -123
  415. package/src/runtime/rpc-runtime-ensure.ts +0 -659
  416. package/src/runtime/rpc-spawn-lease.test.ts +0 -81
  417. package/src/runtime/rpc-spawn-lease.ts +0 -156
  418. package/src/runtime/runtime-builder.team-persistence.test.ts +0 -245
  419. package/src/runtime/runtime-builder.test.ts +0 -615
  420. package/src/runtime/runtime-oauth-token-manager.test.ts +0 -137
  421. package/src/runtime/runtime-parity.test.ts +0 -143
  422. package/src/services/providers/local-provider-service.test.ts +0 -1062
  423. package/src/services/session-data.test.ts +0 -160
  424. package/src/services/storage/provider-settings-legacy-migration.test.ts +0 -424
  425. package/src/services/storage/provider-settings-manager.test.ts +0 -191
  426. package/src/services/telemetry/OpenTelemetryAdapter.test.ts +0 -157
  427. package/src/services/telemetry/OpenTelemetryProvider.test.ts +0 -326
  428. package/src/services/telemetry/TelemetryLoggerSink.test.ts +0 -42
  429. package/src/services/telemetry/TelemetryService.test.ts +0 -134
  430. package/src/services/telemetry/distinct-id.test.ts +0 -57
  431. package/src/services/workspace/file-indexer.d.ts +0 -11
  432. package/src/services/workspace/file-indexer.test.ts +0 -156
  433. package/src/services/workspace/mention-enricher.test.ts +0 -106
  434. package/src/session/persistence-service.test.ts +0 -300
  435. package/src/session/rpc-session-service.ts +0 -114
  436. package/src/session/session-service.team-persistence.test.ts +0 -48
  437. package/src/session/sqlite-rpc-session-backend.ts +0 -301
  438. package/src/transports/local.e2e.test.ts +0 -380
  439. package/src/transports/local.test.ts +0 -2559
  440. package/src/transports/rpc.test.ts +0 -82
  441. package/src/transports/rpc.ts +0 -665
@@ -1,7 +1,9 @@
1
1
  /**
2
2
  * Apply Patch Executor
3
3
  *
4
- * Built-in implementation for the legacy apply_patch format.
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.
5
7
  */
6
8
 
7
9
  import * as fs from "node:fs/promises";
@@ -25,6 +27,10 @@ interface FileChange {
25
27
  movePath?: string;
26
28
  }
27
29
 
30
+ interface NormalizedPatchInput {
31
+ lines: string[];
32
+ }
33
+
28
34
  /**
29
35
  * Options for the apply_patch executor
30
36
  */
@@ -63,104 +69,87 @@ function resolveFilePath(
63
69
  return resolved;
64
70
  }
65
71
 
66
- function stripBashWrapper(lines: string[]): string[] {
67
- const result: string[] = [];
68
- let insidePatch = false;
69
- let foundBegin = false;
70
- let foundContent = false;
71
-
72
- for (let i = 0; i < lines.length; i++) {
73
- const line = lines[i];
74
- if (
75
- !insidePatch &&
76
- BASH_WRAPPERS.some((wrapper) => line.startsWith(wrapper))
77
- ) {
78
- continue;
79
- }
80
-
81
- if (line.startsWith(PATCH_MARKERS.BEGIN)) {
82
- insidePatch = true;
83
- foundBegin = true;
84
- result.push(line);
85
- continue;
86
- }
72
+ function normalizeLineEndings(input: string): string[] {
73
+ return input.split("\n").map((line) => line.replace(/\r$/, ""));
74
+ }
87
75
 
88
- if (line === PATCH_MARKERS.END) {
89
- insidePatch = false;
90
- result.push(line);
91
- continue;
92
- }
76
+ function isWrapperLine(line: string): boolean {
77
+ if (line.trim() === "") {
78
+ return false;
79
+ }
80
+ return BASH_WRAPPERS.some((wrapper) => line.startsWith(wrapper));
81
+ }
93
82
 
94
- const isPatchContent =
95
- line.startsWith(PATCH_MARKERS.ADD) ||
96
- line.startsWith(PATCH_MARKERS.UPDATE) ||
97
- line.startsWith(PATCH_MARKERS.DELETE) ||
98
- line.startsWith(PATCH_MARKERS.MOVE) ||
99
- line.startsWith(PATCH_MARKERS.SECTION) ||
100
- line.startsWith("+") ||
101
- line.startsWith("-") ||
102
- line.startsWith(" ") ||
103
- line === "***";
104
-
105
- if (isPatchContent && i !== lines.length - 1) {
106
- foundContent = true;
107
- }
83
+ function trimWrapperLines(lines: string[]): string[] {
84
+ let start = 0;
85
+ let end = lines.length;
108
86
 
109
- if (
110
- insidePatch ||
111
- (!foundBegin && isPatchContent) ||
112
- (line === "" && foundContent)
113
- ) {
114
- result.push(line);
115
- }
87
+ while (start < end && isWrapperLine(lines[start] ?? "")) {
88
+ start++;
116
89
  }
117
90
 
118
- while (result.length > 0 && result[result.length - 1] === "") {
119
- result.pop();
91
+ while (end > start && isWrapperLine(lines[end - 1] ?? "")) {
92
+ end--;
120
93
  }
121
94
 
122
- return !foundBegin && !foundContent ? lines : result;
95
+ return lines.slice(start, end);
123
96
  }
124
97
 
125
- function preprocessLines(input: string): string[] {
126
- let lines = input.split("\n").map((line) => line.replace(/\r$/, ""));
127
- lines = stripBashWrapper(lines);
98
+ function normalizePatchInput(input: string): NormalizedPatchInput {
99
+ const rawLines = normalizeLineEndings(input);
100
+ const beginIndex = rawLines.findIndex((line) =>
101
+ line.startsWith(PATCH_MARKERS.BEGIN),
102
+ );
103
+ let endIndex = -1;
104
+ for (let i = rawLines.length - 1; i >= 0; i--) {
105
+ if (rawLines[i]?.startsWith(PATCH_MARKERS.END)) {
106
+ endIndex = i;
107
+ break;
108
+ }
109
+ }
110
+
111
+ if (beginIndex !== -1 || endIndex !== -1) {
112
+ if (beginIndex === -1 || endIndex === -1 || endIndex < beginIndex) {
113
+ throw new DiffError(
114
+ "Invalid patch text - incomplete sentinels. Try breaking it into smaller patches.",
115
+ );
116
+ }
117
+ const lines = rawLines.slice(beginIndex, endIndex + 1);
118
+ return {
119
+ lines,
120
+ };
121
+ }
128
122
 
129
- const hasBegin = lines.length > 0 && lines[0].startsWith(PATCH_MARKERS.BEGIN);
130
- const hasEnd =
131
- lines.length > 0 && lines[lines.length - 1] === PATCH_MARKERS.END;
132
- if (!hasBegin && !hasEnd) {
133
- return [PATCH_MARKERS.BEGIN, ...lines, PATCH_MARKERS.END];
123
+ const stripped = trimWrapperLines(rawLines);
124
+ while (stripped.length > 0 && stripped[0] === "") {
125
+ stripped.shift();
134
126
  }
135
- if (hasBegin && hasEnd) {
136
- return lines;
127
+ while (stripped.length > 0 && stripped[stripped.length - 1] === "") {
128
+ stripped.pop();
137
129
  }
138
- throw new DiffError(
139
- "Invalid patch text - incomplete sentinels. Try breaking it into smaller patches.",
140
- );
130
+
131
+ const lines = [PATCH_MARKERS.BEGIN, ...stripped, PATCH_MARKERS.END];
132
+ return {
133
+ lines,
134
+ };
141
135
  }
142
136
 
143
137
  function extractFilesForOperations(
144
- text: string,
138
+ lines: readonly string[],
145
139
  markers: readonly string[],
146
140
  ): string[] {
147
- const lines = stripBashWrapper(text.split("\n"));
148
- const files: string[] = [];
141
+ const files = new Set<string>();
149
142
 
150
143
  for (const line of lines) {
151
144
  for (const marker of markers) {
152
- if (!line.startsWith(marker)) {
153
- continue;
154
- }
155
- const file = line.substring(marker.length).trim();
156
- if (!text.trim().endsWith(file)) {
157
- files.push(file);
145
+ if (line.startsWith(marker)) {
146
+ files.add(line.substring(marker.length).trim());
147
+ break;
158
148
  }
159
- break;
160
149
  }
161
150
  }
162
151
 
163
- return files;
152
+ return [...files];
164
153
  }
165
154
 
166
155
  function applyChunks(
@@ -197,12 +186,12 @@ function applyChunks(
197
186
  }
198
187
 
199
188
  async function loadFiles(
200
- rawInput: string,
189
+ lines: readonly string[],
201
190
  cwd: string,
202
191
  encoding: BufferEncoding,
203
192
  restrictToCwd: boolean,
204
193
  ): Promise<Record<string, string>> {
205
- const filesToLoad = extractFilesForOperations(rawInput, [
194
+ const filesToLoad = extractFilesForOperations(lines, [
206
195
  PATCH_MARKERS.UPDATE,
207
196
  PATCH_MARKERS.DELETE,
208
197
  ]);
@@ -328,14 +317,14 @@ export function createApplyPatchExecutor(
328
317
  cwd: string,
329
318
  _context: ToolContext,
330
319
  ): Promise<string> => {
331
- const lines = preprocessLines(input.input);
320
+ const normalizedInput = normalizePatchInput(input.input);
332
321
  const currentFiles = await loadFiles(
333
- input.input,
322
+ normalizedInput.lines,
334
323
  cwd,
335
324
  encoding,
336
325
  restrictToCwd,
337
326
  );
338
- const parser = new PatchParser(lines, currentFiles);
327
+ const parser = new PatchParser(normalizedInput.lines, currentFiles);
339
328
  const { patch, fuzz } = parser.parse();
340
329
  const changes = patchToChanges(patch, currentFiles);
341
330
  const touched = await applyChanges(changes, cwd, encoding, restrictToCwd);
@@ -157,14 +157,15 @@ async function insertInFile(
157
157
  ): Promise<string> {
158
158
  const content = await fs.readFile(filePath, encoding);
159
159
  const lines = content.split("\n");
160
- const insertLine = insertLineOneBased - 1; // Convert to zero-based index
160
+ const maxBoundaryLine = lines.length + 1;
161
161
 
162
- if (insertLine < 0 || insertLine > lines.length) {
162
+ if (insertLineOneBased < 1 || insertLineOneBased > maxBoundaryLine) {
163
163
  throw new Error(
164
- `Invalid line number: ${insertLineOneBased}. Valid range: 1-${lines.length}`,
164
+ `Invalid insert_line: ${insertLineOneBased}. insert_line must be a positive one-based boundary line in the range 1-${maxBoundaryLine}. Use ${maxBoundaryLine} to append at EOF.`,
165
165
  );
166
166
  }
167
167
 
168
+ const insertLine = insertLineOneBased - 1;
168
169
  lines.splice(insertLine, 0, ...newStr.split("\n"));
169
170
  await fs.writeFile(filePath, lines.join("\n"), { encoding });
170
171
 
@@ -1,9 +1,10 @@
1
1
  /**
2
2
  * Search Executor
3
3
  *
4
- * Built-in implementation for searching the codebase using regex.
4
+ * Built-in implementation for searching the codebase using ripgrep (if available) or regex.
5
5
  */
6
6
 
7
+ import { spawn } from "node:child_process";
7
8
  import * as fs from "node:fs/promises";
8
9
  import * as path from "node:path";
9
10
  import type { ToolContext } from "@clinebot/shared";
@@ -118,6 +119,152 @@ interface SearchMatch {
118
119
  context: string[];
119
120
  }
120
121
 
122
+ let rgAvailable: boolean | null = null;
123
+
124
+ function checkRipgrepAvailable(): Promise<boolean> {
125
+ if (rgAvailable !== null) {
126
+ return Promise.resolve(rgAvailable);
127
+ }
128
+
129
+ return new Promise((resolve) => {
130
+ const child = spawn("rg", ["--version"], {
131
+ stdio: ["ignore", "pipe", "pipe"],
132
+ });
133
+
134
+ child.on("close", (code) => {
135
+ rgAvailable = code === 0;
136
+ resolve(rgAvailable);
137
+ });
138
+
139
+ child.on("error", () => {
140
+ rgAvailable = false;
141
+ resolve(false);
142
+ });
143
+
144
+ setTimeout(() => {
145
+ if (!child.killed) {
146
+ child.kill("SIGTERM");
147
+ }
148
+ if (rgAvailable === null) {
149
+ rgAvailable = false;
150
+ resolve(false);
151
+ }
152
+ }, 1000);
153
+ });
154
+ }
155
+
156
+ function searchWithRipgrep(
157
+ query: string,
158
+ cwd: string,
159
+ maxResults: number,
160
+ contextLines: number,
161
+ timeoutMs: number = 5000,
162
+ abortSignal?: AbortSignal,
163
+ ): Promise<SearchMatch[] | null> {
164
+ return new Promise((resolve) => {
165
+ const child = spawn(
166
+ "rg",
167
+ ["--json", `--context=${contextLines}`, "--max-count=1", "-i", query],
168
+ {
169
+ cwd,
170
+ stdio: ["ignore", "pipe", "pipe"],
171
+ },
172
+ );
173
+
174
+ let stdout = "";
175
+ let resolved = false;
176
+
177
+ const cleanup = () => {
178
+ if (!child.killed) {
179
+ child.kill("SIGTERM");
180
+ }
181
+ };
182
+
183
+ const timeout = setTimeout(() => {
184
+ if (!resolved) {
185
+ resolved = true;
186
+ cleanup();
187
+ resolve(null);
188
+ }
189
+ }, timeoutMs);
190
+
191
+ const finalize = (result: SearchMatch[] | null) => {
192
+ if (!resolved) {
193
+ resolved = true;
194
+ clearTimeout(timeout);
195
+ cleanup();
196
+ resolve(result);
197
+ }
198
+ };
199
+
200
+ if (abortSignal?.aborted) {
201
+ cleanup();
202
+ resolve(null);
203
+ return;
204
+ }
205
+
206
+ abortSignal?.addEventListener("abort", () => {
207
+ finalize(null);
208
+ });
209
+
210
+ child.stdout.on("data", (chunk: Buffer | string) => {
211
+ stdout += chunk.toString();
212
+ });
213
+
214
+ child.stderr.on("data", () => {
215
+ // Ignore stderr
216
+ });
217
+
218
+ child.on("close", (code: number | null) => {
219
+ if (code === 0 || code === 1) {
220
+ try {
221
+ const matches: SearchMatch[] = [];
222
+ const lines = stdout.split("\n").filter((line) => line.trim());
223
+
224
+ for (const line of lines) {
225
+ if (matches.length >= maxResults) break;
226
+
227
+ const json = JSON.parse(line);
228
+ if (json.type === "match") {
229
+ const matchData = json.data;
230
+ const contextLines: string[] = [];
231
+
232
+ if (json.data.submatches && json.data.submatches.length > 0) {
233
+ const submatch = json.data.submatches[0];
234
+ matches.push({
235
+ file: matchData.path.text,
236
+ line: matchData.line_number,
237
+ column: (submatch?.start ?? 0) + 1,
238
+ match: submatch?.match?.text ?? "",
239
+ context: contextLines,
240
+ });
241
+ }
242
+ } else if (json.type === "context" && matches.length > 0) {
243
+ const lastMatch = matches[matches.length - 1];
244
+ const prefix =
245
+ json.data.line_number === lastMatch.line ? ">" : " ";
246
+ lastMatch.context.push(
247
+ `${prefix} ${json.data.line_number}: ${json.data.lines?.text ?? json.data.line?.text ?? ""}`,
248
+ );
249
+ }
250
+ }
251
+
252
+ finalize(matches.length > 0 ? matches : null);
253
+ } catch {
254
+ finalize(null);
255
+ }
256
+ return;
257
+ }
258
+
259
+ finalize(null);
260
+ });
261
+
262
+ child.on("error", () => {
263
+ finalize(null);
264
+ });
265
+ });
266
+ }
267
+
121
268
  function shouldIncludeFile(
122
269
  relativePath: string,
123
270
  excludeDirs: Set<string>,
@@ -173,9 +320,49 @@ export function createSearchExecutor(
173
320
  return async (
174
321
  query: string,
175
322
  cwd: string,
176
- _context: ToolContext,
323
+ context: ToolContext,
177
324
  ): Promise<string> => {
178
- // Compile regex
325
+ // Check for abort before starting
326
+ if (context.abortSignal?.aborted) {
327
+ throw new Error("Search operation aborted");
328
+ }
329
+
330
+ // Try ripgrep first if available
331
+ const isRgAvailable = await checkRipgrepAvailable();
332
+ let rgMatches: SearchMatch[] | null = null;
333
+ if (isRgAvailable) {
334
+ rgMatches = await searchWithRipgrep(
335
+ query,
336
+ cwd,
337
+ maxResults,
338
+ contextLines,
339
+ 5000,
340
+ context.abortSignal,
341
+ );
342
+ }
343
+
344
+ if (rgMatches) {
345
+ const resultLines: string[] = [
346
+ `Found ${rgMatches.length} result${rgMatches.length === 1 ? "" : "s"} for pattern: ${query}`,
347
+ "",
348
+ ];
349
+
350
+ for (const match of rgMatches) {
351
+ resultLines.push(`${match.file}:${match.line}:${match.column}`);
352
+ resultLines.push(...match.context);
353
+ resultLines.push("");
354
+ }
355
+
356
+ if (rgMatches.length >= maxResults) {
357
+ resultLines.push(
358
+ `(Showing first ${maxResults} results. Refine your search for more specific results.)`,
359
+ );
360
+ }
361
+
362
+ return resultLines.join("\n");
363
+ }
364
+
365
+ // Fallback to manual regex search
179
366
  let regex: RegExp;
180
367
  try {
181
368
  regex = new RegExp(query, "gim");
@@ -192,6 +379,11 @@ export function createSearchExecutor(
192
379
 
193
380
  // Search files from the fast index.
194
381
  for (const relativePath of fileList) {
382
+ // Check for abort signal
383
+ if (context.abortSignal?.aborted) {
384
+ throw new Error("Search operation aborted");
385
+ }
386
+
195
387
  if (
196
388
  !shouldIncludeFile(
197
389
  relativePath,
@@ -76,6 +76,13 @@ export function normalizeReadFileRequests(input: unknown): ReadFileRequest[] {
76
76
  return filePaths.map((filePath) => ({ path: filePath }));
77
77
  }
78
78
 
79
+ if ("paths" in validate) {
80
+ const paths = Array.isArray(validate.paths)
81
+ ? validate.paths
82
+ : [validate.paths];
83
+ return paths.map((path) => (typeof path === "string" ? { path } : path));
84
+ }
85
+
79
86
  return [validate];
80
87
  }
81
88
 
@@ -89,6 +96,15 @@ export function formatReadFileQuery(request: ReadFileRequest): string {
89
96
  return `${path}:${start}-${end}`;
90
97
  }
91
98
 
99
+ export function getReadFileRangeError(request: ReadFileRequest): string | null {
100
+ const { start_line, end_line } = request;
101
+ if (start_line == null || end_line == null || start_line <= end_line) {
102
+ return null;
103
+ }
104
+
105
+ return `start_line must be less than or equal to end_line (received start_line: ${start_line}, end_line: ${end_line})`;
106
+ }
107
+
92
108
  export function normalizeRunCommandsInput(
93
109
  input: unknown,
94
110
  ): Array<string | StructuredCommandInput> {
@@ -108,6 +124,14 @@ export function normalizeRunCommandsInput(
108
124
  : [validate.commands];
109
125
  }
110
126
 
127
+ if ("command" in validate) {
128
+ return "args" in validate ? [validate] : [validate.command];
129
+ }
130
+
131
+ if ("cmd" in validate) {
132
+ return [validate.cmd];
133
+ }
134
+
111
135
  return [validate];
112
136
  }
113
137
 
@@ -53,6 +53,15 @@ export {
53
53
  type ToolPresetName,
54
54
  ToolPresets,
55
55
  } from "./presets";
56
+ export {
57
+ type BuiltinToolAvailabilityContext,
58
+ getCoreAcpToolNames,
59
+ getCoreBuiltinToolCatalog,
60
+ getCoreDefaultEnabledToolIds,
61
+ getCoreHeadlessToolNames,
62
+ resolveCoreSelectedToolIds,
63
+ type ToolCatalogEntry,
64
+ } from "./runtime";
56
65
  // Schemas
57
66
  export {
58
67
  type ApplyPatchInput,
@@ -78,6 +87,7 @@ export {
78
87
  type WebFetchRequest,
79
88
  WebFetchRequestSchema,
80
89
  } from "./schemas";
90
+ export { TEAM_TOOL_NAMES } from "./team/team-tools";
81
91
  // Types
82
92
  export type {
83
93
  ApplyPatchExecutor,
@@ -133,8 +143,7 @@ export interface CreateBuiltinToolsOptions
133
143
  *
134
144
  * @example
135
145
  * ```typescript
136
- * import { Agent } from "@clinebot/agents"
137
- * import { createBuiltinTools } from "@clinebot/core"
146
+ * import { Agent, createBuiltinTools } from "@clinebot/core"
138
147
  *
139
148
  * const tools = createBuiltinTools({
140
149
  * cwd: "/path/to/project",
@@ -4,7 +4,7 @@
4
4
  * Pre-configured tool combinations for common use cases.
5
5
  */
6
6
 
7
- import type { Tool, ToolPolicy } from "@clinebot/shared";
7
+ import type { AgentMode, Tool, ToolPolicy } from "@clinebot/shared";
8
8
  import { ALL_DEFAULT_TOOL_NAMES } from "./constants";
9
9
  import { createDefaultTools } from "./definitions";
10
10
  import type { CreateDefaultToolsOptions, DefaultToolsConfig } from "./types";
@@ -19,91 +19,73 @@ export interface ToolPresetConfig extends DefaultToolsConfig {
19
19
  */
20
20
  export const ToolPresets = {
21
21
  /**
22
- * Browser-based tools (no shell access, no web fetch)
23
- */
24
- browser: {
25
- enableReadFiles: false,
26
- enableSearch: false,
27
- enableBash: false,
28
- enableWebFetch: false,
29
- enableApplyPatch: false,
30
- enableEditor: false,
31
- enableSkills: true,
32
- enableAskQuestion: true,
33
- enableSubmitAndExit: false,
34
- enableSpawnAgent: true,
35
- enableAgentTeams: true,
36
- },
37
-
38
- /**
39
- * Search-focused tools (read_files + search_codebase)
40
- * Good for code exploration and analysis agents
22
+ * Act mode (full development tools)
23
+ * Good for coding assistants and task automation
41
24
  */
42
- search: {
25
+ act: {
43
26
  enableReadFiles: true,
44
27
  enableSearch: true,
45
- enableBash: false,
46
- enableWebFetch: false,
28
+ enableBash: true,
29
+ enableWebFetch: true,
47
30
  enableApplyPatch: false,
48
- enableEditor: false,
49
- enableSkills: false,
50
- enableAskQuestion: false,
31
+ enableEditor: true,
32
+ enableSkills: true,
33
+ enableAskQuestion: true,
51
34
  enableSubmitAndExit: false,
52
35
  enableSpawnAgent: true,
53
36
  enableAgentTeams: true,
54
37
  },
55
38
 
56
39
  /**
57
- * Full development tools (all tools enabled) - Act mode
58
- * Good for coding assistants and task automation
40
+ * Plan mode (read-only, no shell access)
41
+ * Good for analysis and documentation agents
59
42
  */
60
- development: {
43
+ plan: {
61
44
  enableReadFiles: true,
62
45
  enableSearch: true,
63
46
  enableBash: true,
64
47
  enableWebFetch: true,
65
48
  enableApplyPatch: false,
66
- enableEditor: true,
49
+ enableEditor: false,
67
50
  enableSkills: true,
68
51
  enableAskQuestion: true,
69
- enableSubmitAndExit: true,
52
+ enableSubmitAndExit: false,
70
53
  enableSpawnAgent: true,
71
54
  enableAgentTeams: true,
72
55
  },
73
56
 
74
57
  /**
75
- * Read-only tools (no shell access) - Plan mode
76
- * Good for analysis and documentation agents
58
+ * Search-focused tools (read_files + search_codebase)
59
+ * Good for code exploration and analysis agents
77
60
  */
78
- readonly: {
61
+ search: {
79
62
  enableReadFiles: true,
80
63
  enableSearch: true,
81
- enableBash: true,
82
- enableWebFetch: true,
64
+ enableBash: false,
65
+ enableWebFetch: false,
83
66
  enableApplyPatch: false,
84
67
  enableEditor: false,
85
- enableSkills: true,
86
- enableAskQuestion: true,
68
+ enableSkills: false,
69
+ enableAskQuestion: false,
87
70
  enableSubmitAndExit: false,
88
71
  enableSpawnAgent: true,
89
72
  enableAgentTeams: true,
90
73
  },
91
74
 
92
75
  /**
93
- * Minimal tools (file reading only)
94
- * Good for focused single-file tasks
76
+ * Minimal tools for focused tasks
95
77
  */
96
78
  minimal: {
97
79
  enableReadFiles: false,
98
80
  enableSearch: false,
99
- enableBash: false,
81
+ enableBash: true,
100
82
  enableWebFetch: false,
101
83
  enableApplyPatch: false,
102
84
  enableEditor: false,
103
85
  enableSkills: false,
104
- enableAskQuestion: true,
86
+ enableAskQuestion: false,
105
87
  enableSubmitAndExit: false,
106
- enableSpawnAgent: false,
88
+ enableSpawnAgent: true,
107
89
  enableAgentTeams: false,
108
90
  },
109
91
 
@@ -132,12 +114,15 @@ export const ToolPresets = {
132
114
  export type ToolPresetName = keyof typeof ToolPresets;
133
115
 
134
116
  export function resolveToolPresetName(options: {
135
- mode?: "act" | "plan" | "yolo";
117
+ mode?: AgentMode;
136
118
  }): ToolPresetName {
137
119
  if (options.mode === "plan") {
138
- return "readonly";
120
+ return "plan";
121
+ }
122
+ if (options.mode === "yolo") {
123
+ return "yolo";
139
124
  }
140
- return options.mode === "yolo" ? "yolo" : "development";
125
+ return "act";
141
126
  }
142
127
 
143
128
  /**
@@ -177,7 +162,7 @@ export function createToolPoliciesWithPreset(
177
162
  *
178
163
  * @example
179
164
  * ```typescript
180
- * const tools = createDefaultToolsWithPreset("readonly", {
165
+ * const tools = createDefaultToolsWithPreset("plan", {
181
166
  * executors: {
182
167
  * readFile: async ({ path }) => fs.readFile(path, "utf-8"),
183
168
  * search: async (query, cwd) => searchFiles(query, cwd),