@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,780 +0,0 @@
1
- import { describe, expect, it, vi } from "vitest";
2
- import {
3
- createDefaultTools,
4
- createReadFilesTool,
5
- createSkillsTool,
6
- createWindowsShellTool,
7
- } from "./definitions";
8
- import { INPUT_ARG_CHAR_LIMIT } from "./schemas";
9
- import type { SkillsExecutorWithMetadata } from "./types";
10
-
11
- function createMockSkillsExecutor(
12
- fn: (...args: unknown[]) => Promise<string> = async () => "ok",
13
- configuredSkills?: SkillsExecutorWithMetadata["configuredSkills"],
14
- ): SkillsExecutorWithMetadata {
15
- const executor = fn as SkillsExecutorWithMetadata;
16
- executor.configuredSkills = configuredSkills;
17
- return executor;
18
- }
19
-
20
- describe("default skills tool", () => {
21
- it("is included only when enabled with a skills executor", () => {
22
- const toolsWithoutExecutor = createDefaultTools({
23
- executors: {},
24
- enableSkills: true,
25
- });
26
- expect(toolsWithoutExecutor.map((tool) => tool.name)).not.toContain(
27
- "skills",
28
- );
29
-
30
- const toolsWithExecutor = createDefaultTools({
31
- executors: {
32
- skills: createMockSkillsExecutor(),
33
- },
34
- enableSkills: true,
35
- });
36
- expect(toolsWithExecutor.map((tool) => tool.name)).toContain("skills");
37
- });
38
-
39
- it("includes configured skill names in description", () => {
40
- const executor = createMockSkillsExecutor(
41
- async () => "ok",
42
- [
43
- { id: "commit", name: "commit", disabled: false },
44
- {
45
- id: "review-pr",
46
- name: "review-pr",
47
- description: "Review a PR",
48
- disabled: false,
49
- },
50
- { id: "disabled-skill", name: "disabled-skill", disabled: true },
51
- ],
52
- );
53
- const tool = createSkillsTool(executor);
54
- expect(tool.description).toContain("Available skills: commit, review-pr.");
55
- expect(tool.description).not.toContain("disabled-skill");
56
- });
57
-
58
- it("omits skill list from description when no skills are configured", () => {
59
- const executor = createMockSkillsExecutor(async () => "ok");
60
- const tool = createSkillsTool(executor);
61
- expect(tool.description).not.toContain("Available skills");
62
- });
63
-
64
- it("validates and executes skill invocation input", async () => {
65
- const execute = vi.fn(async () => "loaded");
66
- const tools = createDefaultTools({
67
- executors: {
68
- skills: createMockSkillsExecutor(execute),
69
- },
70
- enableReadFiles: false,
71
- enableSearch: false,
72
- enableBash: false,
73
- enableWebFetch: false,
74
- enableEditor: false,
75
- enableSkills: true,
76
- });
77
- const skillsTool = tools.find((tool) => tool.name === "skills");
78
- expect(skillsTool).toBeDefined();
79
- if (!skillsTool) {
80
- throw new Error("Expected skills tool to be defined.");
81
- }
82
-
83
- const result = await skillsTool.execute(
84
- { skill: "commit", args: "-m 'fix'" },
85
- {
86
- agentId: "agent-1",
87
- conversationId: "conv-1",
88
- iteration: 1,
89
- },
90
- );
91
-
92
- expect(result).toBe("loaded");
93
- expect(execute).toHaveBeenCalledWith(
94
- "commit",
95
- "-m 'fix'",
96
- expect.objectContaining({
97
- agentId: "agent-1",
98
- conversationId: "conv-1",
99
- iteration: 1,
100
- }),
101
- );
102
- });
103
- });
104
-
105
- describe("default ask_question tool", () => {
106
- it("is enabled by default when executor is provided", () => {
107
- const tools = createDefaultTools({
108
- executors: {
109
- askQuestion: async () => "ok",
110
- },
111
- });
112
- expect(tools.map((tool) => tool.name)).toContain("ask_question");
113
- });
114
-
115
- it("is excluded when explicitly disabled", () => {
116
- const tools = createDefaultTools({
117
- executors: {
118
- askQuestion: async () => "ok",
119
- },
120
- enableAskQuestion: false,
121
- });
122
- expect(tools.map((tool) => tool.name)).not.toContain("ask_question");
123
- });
124
-
125
- it("is included only when enabled with an askQuestion executor", () => {
126
- const toolsWithoutExecutor = createDefaultTools({
127
- executors: {},
128
- enableAskQuestion: true,
129
- });
130
- expect(toolsWithoutExecutor.map((tool) => tool.name)).not.toContain(
131
- "ask_question",
132
- );
133
-
134
- const toolsWithExecutor = createDefaultTools({
135
- executors: {
136
- askQuestion: async () => "ok",
137
- },
138
- enableAskQuestion: true,
139
- });
140
- expect(toolsWithExecutor.map((tool) => tool.name)).toContain(
141
- "ask_question",
142
- );
143
- });
144
-
145
- it("validates and executes ask_question input", async () => {
146
- const execute = vi.fn(async () => "asked");
147
- const tools = createDefaultTools({
148
- executors: {
149
- askQuestion: execute,
150
- },
151
- enableReadFiles: false,
152
- enableSearch: false,
153
- enableBash: false,
154
- enableWebFetch: false,
155
- enableEditor: false,
156
- enableSkills: false,
157
- enableAskQuestion: true,
158
- });
159
- const askTool = tools.find((tool) => tool.name === "ask_question");
160
- expect(askTool).toBeDefined();
161
- if (!askTool) {
162
- throw new Error("Expected ask_question tool to be defined.");
163
- }
164
-
165
- const result = await askTool.execute(
166
- {
167
- question: "Which approach should I take?",
168
- options: ["Option 1", "Option 2"],
169
- },
170
- {
171
- agentId: "agent-1",
172
- conversationId: "conv-1",
173
- iteration: 1,
174
- },
175
- );
176
-
177
- expect(result).toBe("asked");
178
- expect(execute).toHaveBeenCalledWith(
179
- "Which approach should I take?",
180
- ["Option 1", "Option 2"],
181
- expect.objectContaining({
182
- agentId: "agent-1",
183
- conversationId: "conv-1",
184
- iteration: 1,
185
- }),
186
- );
187
- });
188
- });
189
-
190
- describe("default submit_and_exit tool", () => {
191
- it("is excluded by default even when executor is provided", () => {
192
- const tools = createDefaultTools({
193
- executors: {
194
- submit: async () => "ok",
195
- },
196
- });
197
- expect(tools.map((tool) => tool.name)).not.toContain("submit_and_exit");
198
- });
199
-
200
- it("is included only when enabled with a submit executor", () => {
201
- const toolsWithoutExecutor = createDefaultTools({
202
- executors: {},
203
- enableSubmitAndExit: true,
204
- });
205
- expect(toolsWithoutExecutor.map((tool) => tool.name)).not.toContain(
206
- "submit_and_exit",
207
- );
208
-
209
- const toolsWithExecutor = createDefaultTools({
210
- executors: {
211
- submit: async () => "ok",
212
- },
213
- enableSubmitAndExit: true,
214
- });
215
- expect(toolsWithExecutor.map((tool) => tool.name)).toContain(
216
- "submit_and_exit",
217
- );
218
- });
219
-
220
- it("validates and executes submit_and_exit input", async () => {
221
- const execute = vi.fn(async () => "submitted");
222
- const tools = createDefaultTools({
223
- executors: {
224
- submit: execute,
225
- },
226
- enableReadFiles: false,
227
- enableSearch: false,
228
- enableBash: false,
229
- enableWebFetch: false,
230
- enableEditor: false,
231
- enableSkills: false,
232
- enableAskQuestion: false,
233
- enableSubmitAndExit: true,
234
- });
235
- const submitTool = tools.find((tool) => tool.name === "submit_and_exit");
236
- expect(submitTool).toBeDefined();
237
- if (!submitTool) {
238
- throw new Error("Expected submit_and_exit tool to be defined.");
239
- }
240
-
241
- const result = await submitTool.execute(
242
- {
243
- summary: "Done and verified with the requested checks.",
244
- verified: true,
245
- },
246
- {
247
- agentId: "agent-1",
248
- conversationId: "conv-1",
249
- iteration: 1,
250
- },
251
- );
252
-
253
- expect(result).toBe("submitted");
254
- expect(execute).toHaveBeenCalledWith(
255
- "Done and verified with the requested checks.",
256
- true,
257
- expect.objectContaining({
258
- agentId: "agent-1",
259
- conversationId: "conv-1",
260
- iteration: 1,
261
- }),
262
- );
263
- });
264
- });
265
-
266
- describe("default apply_patch tool", () => {
267
- it("is included only when enabled with an applyPatch executor", () => {
268
- const toolsWithoutExecutor = createDefaultTools({
269
- executors: {},
270
- enableApplyPatch: true,
271
- });
272
- expect(toolsWithoutExecutor.map((tool) => tool.name)).not.toContain(
273
- "apply_patch",
274
- );
275
-
276
- const toolsWithExecutor = createDefaultTools({
277
- executors: {
278
- applyPatch: async () => "ok",
279
- },
280
- enableApplyPatch: true,
281
- });
282
- expect(toolsWithExecutor.map((tool) => tool.name)).toContain("apply_patch");
283
- });
284
-
285
- it("validates and executes apply_patch input", async () => {
286
- const execute = vi.fn(async () => "patched");
287
- const tools = createDefaultTools({
288
- executors: {
289
- applyPatch: execute,
290
- },
291
- enableReadFiles: false,
292
- enableSearch: false,
293
- enableBash: false,
294
- enableWebFetch: false,
295
- enableEditor: false,
296
- enableSkills: false,
297
- enableAskQuestion: false,
298
- enableApplyPatch: true,
299
- });
300
-
301
- const applyPatchTool = tools.find((tool) => tool.name === "apply_patch");
302
- expect(applyPatchTool).toBeDefined();
303
- if (!applyPatchTool) {
304
- throw new Error("Expected apply_patch tool to be defined.");
305
- }
306
-
307
- const result = await applyPatchTool.execute(
308
- { input: "*** Begin Patch\n*** End Patch" },
309
- {
310
- agentId: "agent-1",
311
- conversationId: "conv-1",
312
- iteration: 1,
313
- },
314
- );
315
-
316
- expect(result).toEqual({
317
- query: "apply_patch",
318
- result: "patched",
319
- success: true,
320
- });
321
- expect(execute).toHaveBeenCalledWith(
322
- { input: "*** Begin Patch\n*** End Patch" },
323
- process.cwd(),
324
- expect.objectContaining({
325
- agentId: "agent-1",
326
- conversationId: "conv-1",
327
- iteration: 1,
328
- }),
329
- );
330
- });
331
- });
332
-
333
- describe("default run_commands tool", () => {
334
- it("accepts object input with commands as a single string", async () => {
335
- const execute = vi.fn(async (command: string | { command: string }) =>
336
- typeof command === "string" ? `ran:${command}` : `ran:${command.command}`,
337
- );
338
- const tool = createWindowsShellTool(execute);
339
-
340
- const result = await tool.execute({ commands: "ls" } as never, {
341
- agentId: "agent-1",
342
- conversationId: "conv-1",
343
- iteration: 1,
344
- });
345
-
346
- expect(result).toEqual([
347
- {
348
- query: "ls",
349
- result: "ran:ls",
350
- success: true,
351
- },
352
- ]);
353
- expect(execute).toHaveBeenCalledTimes(1);
354
- expect(execute).toHaveBeenCalledWith(
355
- "ls",
356
- process.cwd(),
357
- expect.objectContaining({
358
- agentId: "agent-1",
359
- conversationId: "conv-1",
360
- iteration: 1,
361
- }),
362
- );
363
- });
364
-
365
- it("accepts structured commands and preserves argv", async () => {
366
- const execute = vi.fn(
367
- async (command: string | { command: string; args?: string[] }) =>
368
- typeof command === "string"
369
- ? `ran:${command}`
370
- : `ran:${command.command}:${(command.args ?? []).join(",")}`,
371
- );
372
- const tool = createWindowsShellTool(execute);
373
-
374
- const result = await tool.execute(
375
- {
376
- commands: {
377
- command: "node",
378
- args: ["-e", "console.log('ok')"],
379
- },
380
- } as never,
381
- {
382
- agentId: "agent-1",
383
- conversationId: "conv-1",
384
- iteration: 1,
385
- },
386
- );
387
-
388
- expect(result).toEqual([
389
- {
390
- query: "node -e console.log('ok')",
391
- result: "ran:node:-e,console.log('ok')",
392
- success: true,
393
- },
394
- ]);
395
- expect(execute).toHaveBeenCalledWith(
396
- {
397
- command: "node",
398
- args: ["-e", "console.log('ok')"],
399
- },
400
- process.cwd(),
401
- expect.objectContaining({
402
- agentId: "agent-1",
403
- conversationId: "conv-1",
404
- iteration: 1,
405
- }),
406
- );
407
- });
408
- });
409
-
410
- describe("default read_files tool", () => {
411
- it("normalizes ranged file requests and passes them to the executor", async () => {
412
- const execute = vi.fn(async () => "selected lines");
413
- const tool = createReadFilesTool(execute);
414
-
415
- const result = await tool.execute(
416
- {
417
- files: [
418
- {
419
- path: "/tmp/example.ts",
420
- start_line: 3,
421
- end_line: 5,
422
- },
423
- ],
424
- },
425
- {
426
- agentId: "agent-1",
427
- conversationId: "conv-1",
428
- iteration: 1,
429
- },
430
- );
431
-
432
- expect(result).toEqual([
433
- {
434
- query: "/tmp/example.ts:3-5",
435
- result: "selected lines",
436
- success: true,
437
- },
438
- ]);
439
- expect(execute).toHaveBeenCalledWith(
440
- {
441
- path: "/tmp/example.ts",
442
- start_line: 3,
443
- end_line: 5,
444
- },
445
- expect.objectContaining({
446
- agentId: "agent-1",
447
- conversationId: "conv-1",
448
- iteration: 1,
449
- }),
450
- );
451
- });
452
-
453
- it("keeps legacy string inputs reading full file content", async () => {
454
- const execute = vi.fn(async () => "full file");
455
- const tool = createReadFilesTool(execute);
456
-
457
- await tool.execute("/tmp/example.ts" as never, {
458
- agentId: "agent-1",
459
- conversationId: "conv-1",
460
- iteration: 1,
461
- });
462
-
463
- expect(execute).toHaveBeenCalledWith(
464
- { path: "/tmp/example.ts" },
465
- expect.objectContaining({
466
- agentId: "agent-1",
467
- conversationId: "conv-1",
468
- iteration: 1,
469
- }),
470
- );
471
- });
472
-
473
- it("treats null line bounds as full-file boundaries", async () => {
474
- const execute = vi.fn(async () => "full file");
475
- const tool = createReadFilesTool(execute);
476
-
477
- const result = await tool.execute(
478
- {
479
- files: [
480
- {
481
- path: "/tmp/example.ts",
482
- start_line: null,
483
- end_line: null,
484
- },
485
- ],
486
- },
487
- {
488
- agentId: "agent-1",
489
- conversationId: "conv-1",
490
- iteration: 1,
491
- },
492
- );
493
-
494
- expect(result).toEqual([
495
- {
496
- query: "/tmp/example.ts",
497
- result: "full file",
498
- success: true,
499
- },
500
- ]);
501
- expect(execute).toHaveBeenCalledWith(
502
- {
503
- path: "/tmp/example.ts",
504
- start_line: null,
505
- end_line: null,
506
- },
507
- expect.objectContaining({
508
- agentId: "agent-1",
509
- conversationId: "conv-1",
510
- iteration: 1,
511
- }),
512
- );
513
- });
514
- });
515
-
516
- describe("zod schema conversion", () => {
517
- it("preserves read_files required properties in generated JSON schema", () => {
518
- const tool = createReadFilesTool(async () => "ok");
519
- const inputSchema = tool.inputSchema as Record<string, unknown>;
520
- const properties = inputSchema.properties as Record<string, unknown>;
521
- expect(inputSchema.type).toBe("object");
522
- expect(properties.files).toMatchObject({
523
- type: "array",
524
- items: {
525
- type: "object",
526
- properties: {
527
- path: {
528
- type: "string",
529
- description:
530
- "The absolute file path of a text file to read content from",
531
- },
532
- start_line: {
533
- anyOf: [{ type: "integer" }, { type: "null" }],
534
- description:
535
- "Optional one-based starting line number to read from; use null or omit for the start of the file",
536
- },
537
- end_line: {
538
- anyOf: [{ type: "integer" }, { type: "null" }],
539
- description:
540
- "Optional one-based ending line number to read through; use null or omit for the end of the file",
541
- },
542
- },
543
- required: ["path"],
544
- },
545
- description:
546
- "Array of file read requests. Omit start_line/end_line or set them to null to return the full file content boundaries; provide integers to return only that inclusive one-based line range. Prefer this tool over running terminal command to get file content for better performance and reliability.",
547
- });
548
- expect(inputSchema.required).toEqual(["files"]);
549
- });
550
-
551
- it("exposes skills args as optional nullable in tool schemas", () => {
552
- const tools = createDefaultTools({
553
- executors: {
554
- skills: createMockSkillsExecutor(),
555
- },
556
- enableReadFiles: false,
557
- enableSearch: false,
558
- enableBash: false,
559
- enableWebFetch: false,
560
- enableEditor: false,
561
- enableApplyPatch: false,
562
- enableAskQuestion: false,
563
- enableSkills: true,
564
- });
565
- const skills = tools.find((tool) => tool.name === "skills");
566
- expect(skills).toBeDefined();
567
- if (!skills) {
568
- throw new Error("Expected skills tool.");
569
- }
570
- const schema = skills.inputSchema as {
571
- required?: string[];
572
- properties?: Record<string, unknown>;
573
- };
574
- expect(schema.required).toEqual(["skill"]);
575
- expect(schema.properties).toHaveProperty("args");
576
- });
577
- });
578
-
579
- describe("default editor tool", () => {
580
- it("accepts replacement edits without insert fields", async () => {
581
- const execute = vi.fn(async () => "patched");
582
- const tools = createDefaultTools({
583
- executors: {
584
- editor: execute,
585
- },
586
- enableReadFiles: false,
587
- enableSearch: false,
588
- enableBash: false,
589
- enableWebFetch: false,
590
- enableSkills: false,
591
- enableAskQuestion: false,
592
- enableApplyPatch: false,
593
- enableEditor: true,
594
- });
595
- const editorTool = tools.find((tool) => tool.name === "editor");
596
- expect(editorTool).toBeDefined();
597
- if (!editorTool) {
598
- throw new Error("Expected editor tool to be defined.");
599
- }
600
-
601
- const result = await editorTool.execute(
602
- {
603
- path: "/tmp/example.ts",
604
- old_text: "before",
605
- new_text: "after",
606
- },
607
- {
608
- agentId: "agent-1",
609
- conversationId: "conv-1",
610
- iteration: 1,
611
- },
612
- );
613
-
614
- expect(result).toEqual({
615
- query: "edit:/tmp/example.ts",
616
- result: "patched",
617
- success: true,
618
- });
619
- expect(execute).toHaveBeenCalledWith(
620
- expect.objectContaining({
621
- path: "/tmp/example.ts",
622
- old_text: "before",
623
- new_text: "after",
624
- }),
625
- process.cwd(),
626
- expect.objectContaining({
627
- agentId: "agent-1",
628
- conversationId: "conv-1",
629
- iteration: 1,
630
- }),
631
- );
632
- });
633
-
634
- it("allows edit without old_text so missing files can be created", async () => {
635
- const execute = vi.fn(async () => "patched");
636
- const tools = createDefaultTools({
637
- executors: {
638
- editor: execute,
639
- },
640
- enableReadFiles: false,
641
- enableSearch: false,
642
- enableBash: false,
643
- enableWebFetch: false,
644
- enableSkills: false,
645
- enableAskQuestion: false,
646
- enableApplyPatch: false,
647
- enableEditor: true,
648
- });
649
- const editorTool = tools.find((tool) => tool.name === "editor");
650
- expect(editorTool).toBeDefined();
651
- if (!editorTool) {
652
- throw new Error("Expected editor tool to be defined.");
653
- }
654
-
655
- const result = await editorTool.execute(
656
- {
657
- path: "/tmp/example.ts",
658
- new_text: "created",
659
- },
660
- {
661
- agentId: "agent-1",
662
- conversationId: "conv-1",
663
- iteration: 1,
664
- },
665
- );
666
-
667
- expect(result).toEqual({
668
- query: "edit:/tmp/example.ts",
669
- result: "patched",
670
- success: true,
671
- });
672
- expect(execute).toHaveBeenCalledWith(
673
- expect.objectContaining({
674
- path: "/tmp/example.ts",
675
- new_text: "created",
676
- }),
677
- process.cwd(),
678
- expect.anything(),
679
- );
680
- });
681
-
682
- it("treats insert_line as an insert operation", async () => {
683
- const execute = vi.fn(async () => "patched");
684
- const tools = createDefaultTools({
685
- executors: {
686
- editor: execute,
687
- },
688
- enableReadFiles: false,
689
- enableSearch: false,
690
- enableBash: false,
691
- enableWebFetch: false,
692
- enableSkills: false,
693
- enableAskQuestion: false,
694
- enableApplyPatch: false,
695
- enableEditor: true,
696
- });
697
- const editorTool = tools.find((tool) => tool.name === "editor");
698
- expect(editorTool).toBeDefined();
699
- if (!editorTool) {
700
- throw new Error("Expected editor tool to be defined.");
701
- }
702
-
703
- const result = await editorTool.execute(
704
- {
705
- path: "/tmp/example.ts",
706
- new_text: "after",
707
- insert_line: 3,
708
- },
709
- {
710
- agentId: "agent-1",
711
- conversationId: "conv-1",
712
- iteration: 1,
713
- },
714
- );
715
-
716
- expect(result).toEqual({
717
- query: "insert:/tmp/example.ts",
718
- result: "patched",
719
- success: true,
720
- });
721
- expect(execute).toHaveBeenCalledWith(
722
- expect.objectContaining({
723
- path: "/tmp/example.ts",
724
- new_text: "after",
725
- insert_line: 3,
726
- }),
727
- process.cwd(),
728
- expect.anything(),
729
- );
730
- });
731
-
732
- it("returns a recoverable tool error when text exceeds the soft character limit", async () => {
733
- const execute = vi.fn(async () => "patched");
734
- const tools = createDefaultTools({
735
- executors: {
736
- editor: execute,
737
- },
738
- enableReadFiles: false,
739
- enableSearch: false,
740
- enableBash: false,
741
- enableWebFetch: false,
742
- enableSkills: false,
743
- enableAskQuestion: false,
744
- enableApplyPatch: false,
745
- enableEditor: true,
746
- });
747
- const editorTool = tools.find((tool) => tool.name === "editor");
748
- expect(editorTool).toBeDefined();
749
- if (!editorTool) {
750
- throw new Error("Expected editor tool to be defined.");
751
- }
752
-
753
- const oversizedText = "x".repeat(INPUT_ARG_CHAR_LIMIT + 1);
754
- const result = await editorTool.execute(
755
- {
756
- path: "/tmp/example.ts",
757
- new_text: oversizedText,
758
- },
759
- {
760
- agentId: "agent-1",
761
- conversationId: "conv-1",
762
- iteration: 1,
763
- },
764
- );
765
-
766
- expect(result).toEqual({
767
- query: "edit:/tmp/example.ts",
768
- result: "",
769
- error: expect.stringContaining("new_text was"),
770
- success: false,
771
- });
772
- if (typeof result !== "object" || result == null || !("error" in result)) {
773
- throw new Error("Expected editor tool result to include an error.");
774
- }
775
- expect(result.error).toContain(
776
- `recommended limit of ${INPUT_ARG_CHAR_LIMIT}`,
777
- );
778
- expect(execute).not.toHaveBeenCalled();
779
- });
780
- });