@clinebot/core 0.0.28 → 0.0.30

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 (340) hide show
  1. package/README.md +7 -0
  2. package/dist/ClineCore.d.ts +28 -2
  3. package/dist/ClineCore.d.ts.map +1 -1
  4. package/dist/account/cline-account-service.d.ts +1 -1
  5. package/dist/account/cline-account-service.d.ts.map +1 -1
  6. package/dist/account/index.d.ts +1 -1
  7. package/dist/account/index.d.ts.map +1 -1
  8. package/dist/account/types.d.ts +5 -0
  9. package/dist/account/types.d.ts.map +1 -1
  10. package/dist/auth/bounded-ttl-cache.d.ts +14 -0
  11. package/dist/auth/bounded-ttl-cache.d.ts.map +1 -0
  12. package/dist/auth/cline.d.ts +27 -2
  13. package/dist/auth/cline.d.ts.map +1 -1
  14. package/dist/auth/oca.d.ts.map +1 -1
  15. package/dist/chat/chat-schema.d.ts +11 -11
  16. package/dist/extensions/config/agent-config-loader.d.ts.map +1 -0
  17. package/dist/{agents → extensions/config}/agent-config-parser.d.ts +2 -2
  18. package/dist/extensions/config/agent-config-parser.d.ts.map +1 -0
  19. package/dist/{agents → extensions/config}/hooks-config-loader.d.ts +1 -1
  20. package/dist/extensions/config/hooks-config-loader.d.ts.map +1 -0
  21. package/dist/{agents → extensions/config}/index.d.ts +2 -4
  22. package/dist/extensions/config/index.d.ts.map +1 -0
  23. package/dist/{runtime/commands.d.ts → extensions/config/runtime-commands.d.ts} +2 -3
  24. package/dist/extensions/config/runtime-commands.d.ts.map +1 -0
  25. package/dist/extensions/config/unified-config-file-watcher.d.ts.map +1 -0
  26. package/dist/extensions/config/user-instruction-config-loader.d.ts.map +1 -0
  27. package/dist/extensions/context/agentic-compaction.d.ts +13 -0
  28. package/dist/extensions/context/agentic-compaction.d.ts.map +1 -0
  29. package/dist/extensions/context/basic-compaction.d.ts +9 -0
  30. package/dist/extensions/context/basic-compaction.d.ts.map +1 -0
  31. package/dist/extensions/context/compaction-shared.d.ts +60 -0
  32. package/dist/extensions/context/compaction-shared.d.ts.map +1 -0
  33. package/dist/extensions/context/compaction.d.ts +20 -0
  34. package/dist/extensions/context/compaction.d.ts.map +1 -0
  35. package/dist/extensions/index.d.ts +5 -0
  36. package/dist/extensions/index.d.ts.map +1 -0
  37. package/dist/extensions/mcp/client.d.ts +3 -0
  38. package/dist/extensions/mcp/client.d.ts.map +1 -0
  39. package/dist/extensions/mcp/config-loader.d.ts.map +1 -0
  40. package/dist/extensions/mcp/index.d.ts +9 -0
  41. package/dist/extensions/mcp/index.d.ts.map +1 -0
  42. package/dist/{mcp → extensions/mcp}/manager.d.ts +1 -2
  43. package/dist/extensions/mcp/manager.d.ts.map +1 -0
  44. package/dist/extensions/mcp/name-transform.d.ts +3 -0
  45. package/dist/extensions/mcp/name-transform.d.ts.map +1 -0
  46. package/dist/extensions/mcp/policies.d.ts +15 -0
  47. package/dist/extensions/mcp/policies.d.ts.map +1 -0
  48. package/dist/extensions/mcp/tools.d.ts +4 -0
  49. package/dist/extensions/mcp/tools.d.ts.map +1 -0
  50. package/dist/{mcp → extensions/mcp}/types.d.ts +29 -1
  51. package/dist/extensions/mcp/types.d.ts.map +1 -0
  52. package/dist/{agents → extensions/plugin}/plugin-config-loader.d.ts +1 -1
  53. package/dist/extensions/plugin/plugin-config-loader.d.ts.map +1 -0
  54. package/dist/{agents → extensions/plugin}/plugin-loader.d.ts +1 -1
  55. package/dist/extensions/plugin/plugin-loader.d.ts.map +1 -0
  56. package/dist/extensions/plugin/plugin-module-import.d.ts +5 -0
  57. package/dist/extensions/plugin/plugin-module-import.d.ts.map +1 -0
  58. package/dist/{agents → extensions/plugin}/plugin-sandbox.d.ts +1 -1
  59. package/dist/extensions/plugin/plugin-sandbox.d.ts.map +1 -0
  60. package/dist/extensions/plugin-sandbox-bootstrap.js +485 -0
  61. package/dist/hooks/index.d.ts +4 -0
  62. package/dist/hooks/index.d.ts.map +1 -0
  63. package/dist/hooks/persistent.d.ts +64 -0
  64. package/dist/hooks/persistent.d.ts.map +1 -0
  65. package/dist/hooks/subprocess-runner.d.ts +22 -0
  66. package/dist/hooks/subprocess-runner.d.ts.map +1 -0
  67. package/dist/hooks/subprocess.d.ts +189 -0
  68. package/dist/hooks/subprocess.d.ts.map +1 -0
  69. package/dist/index.d.ts +22 -25
  70. package/dist/index.d.ts.map +1 -1
  71. package/dist/index.js +560 -447
  72. package/dist/prompt/default-system.d.ts +2 -0
  73. package/dist/prompt/default-system.d.ts.map +1 -0
  74. package/dist/providers/local-provider-service.d.ts +1 -1
  75. package/dist/providers/local-provider-service.d.ts.map +1 -1
  76. package/dist/runtime/checkpoint-hooks.d.ts +21 -0
  77. package/dist/runtime/checkpoint-hooks.d.ts.map +1 -0
  78. package/dist/runtime/hook-file-hooks.d.ts +1 -1
  79. package/dist/runtime/hook-file-hooks.d.ts.map +1 -1
  80. package/dist/runtime/rules.d.ts +1 -1
  81. package/dist/runtime/rules.d.ts.map +1 -1
  82. package/dist/runtime/runtime-builder.d.ts +1 -1
  83. package/dist/runtime/runtime-builder.d.ts.map +1 -1
  84. package/dist/runtime/session-runtime.d.ts +25 -5
  85. package/dist/runtime/session-runtime.d.ts.map +1 -1
  86. package/dist/runtime/subprocess-sandbox.d.ts.map +1 -0
  87. package/dist/runtime/team-runtime-registry.d.ts +1 -1
  88. package/dist/runtime/team-runtime-registry.d.ts.map +1 -1
  89. package/dist/runtime/tool-approval.d.ts +1 -1
  90. package/dist/session/default-session-manager.d.ts +9 -3
  91. package/dist/session/default-session-manager.d.ts.map +1 -1
  92. package/dist/session/file-session-service.d.ts +1 -1
  93. package/dist/session/file-session-service.d.ts.map +1 -1
  94. package/dist/session/{unified-session-persistence-service.d.ts → persistence-service.d.ts} +11 -42
  95. package/dist/session/persistence-service.d.ts.map +1 -0
  96. package/dist/session/rpc-session-service.d.ts +1 -1
  97. package/dist/session/rpc-session-service.d.ts.map +1 -1
  98. package/dist/session/session-agent-events.d.ts +1 -1
  99. package/dist/session/session-artifacts.d.ts.map +1 -1
  100. package/dist/session/session-config-builder.d.ts.map +1 -1
  101. package/dist/session/session-graph.d.ts +1 -1
  102. package/dist/session/session-graph.d.ts.map +1 -1
  103. package/dist/session/session-host.d.ts.map +1 -1
  104. package/dist/session/session-manager.d.ts +6 -5
  105. package/dist/session/session-manager.d.ts.map +1 -1
  106. package/dist/session/session-manifest.d.ts +1 -1
  107. package/dist/session/session-service.d.ts +3 -2
  108. package/dist/session/session-service.d.ts.map +1 -1
  109. package/dist/session/session-team-coordination.d.ts +2 -1
  110. package/dist/session/session-team-coordination.d.ts.map +1 -1
  111. package/dist/session/utils/helpers.d.ts +51 -3
  112. package/dist/session/utils/helpers.d.ts.map +1 -1
  113. package/dist/session/utils/types.d.ts +41 -7
  114. package/dist/session/utils/types.d.ts.map +1 -1
  115. package/dist/session/workspace-manager.d.ts +1 -2
  116. package/dist/session/workspace-manager.d.ts.map +1 -1
  117. package/dist/session/workspace-manifest.d.ts +1 -22
  118. package/dist/session/workspace-manifest.d.ts.map +1 -1
  119. package/dist/storage/file-team-store.d.ts +2 -1
  120. package/dist/storage/file-team-store.d.ts.map +1 -1
  121. package/dist/storage/sqlite-team-store.d.ts +4 -1
  122. package/dist/storage/sqlite-team-store.d.ts.map +1 -1
  123. package/dist/storage/team-store.d.ts.map +1 -1
  124. package/dist/team/delegated-agent.d.ts +44 -0
  125. package/dist/team/delegated-agent.d.ts.map +1 -0
  126. package/dist/team/index.d.ts +1 -0
  127. package/dist/team/index.d.ts.map +1 -1
  128. package/dist/team/multi-agent.d.ts +229 -0
  129. package/dist/team/multi-agent.d.ts.map +1 -0
  130. package/dist/team/projections.d.ts +2 -2
  131. package/dist/team/projections.d.ts.map +1 -1
  132. package/dist/team/runtime.d.ts +5 -0
  133. package/dist/team/runtime.d.ts.map +1 -0
  134. package/dist/team/spawn-agent-tool.d.ts +85 -0
  135. package/dist/team/spawn-agent-tool.d.ts.map +1 -0
  136. package/dist/team/subagent-prompts.d.ts +4 -0
  137. package/dist/team/subagent-prompts.d.ts.map +1 -0
  138. package/dist/team/team-tools.d.ts +35 -0
  139. package/dist/team/team-tools.d.ts.map +1 -0
  140. package/dist/telemetry/OpenTelemetryProvider.d.ts +11 -1
  141. package/dist/telemetry/OpenTelemetryProvider.d.ts.map +1 -1
  142. package/dist/telemetry/{LoggerTelemetryAdapter.d.ts → TelemetryLoggerSink.d.ts} +10 -4
  143. package/dist/telemetry/TelemetryLoggerSink.d.ts.map +1 -0
  144. package/dist/telemetry/TelemetryService.d.ts.map +1 -1
  145. package/dist/telemetry/index.js +15 -28
  146. package/dist/tools/definitions.d.ts +4 -3
  147. package/dist/tools/definitions.d.ts.map +1 -1
  148. package/dist/tools/index.d.ts +5 -5
  149. package/dist/tools/index.d.ts.map +1 -1
  150. package/dist/tools/model-tool-routing.d.ts.map +1 -1
  151. package/dist/tools/presets.d.ts +26 -0
  152. package/dist/tools/presets.d.ts.map +1 -1
  153. package/dist/tools/schemas.d.ts +8 -0
  154. package/dist/tools/schemas.d.ts.map +1 -1
  155. package/dist/tools/types.d.ts +23 -2
  156. package/dist/tools/types.d.ts.map +1 -1
  157. package/dist/types/config.d.ts +47 -3
  158. package/dist/types/config.d.ts.map +1 -1
  159. package/dist/types/events.d.ts +1 -1
  160. package/dist/types/provider-settings.d.ts +1 -1
  161. package/dist/types/provider-settings.d.ts.map +1 -1
  162. package/dist/types/storage.d.ts +2 -1
  163. package/dist/types/storage.d.ts.map +1 -1
  164. package/dist/types.d.ts +7 -16
  165. package/dist/types.d.ts.map +1 -1
  166. package/package.json +15 -12
  167. package/src/ClineCore.test.ts +150 -0
  168. package/src/ClineCore.ts +114 -8
  169. package/src/account/cline-account-service.test.ts +84 -0
  170. package/src/account/cline-account-service.ts +2 -2
  171. package/src/account/index.ts +1 -0
  172. package/src/account/types.ts +6 -0
  173. package/src/auth/bounded-ttl-cache.test.ts +38 -0
  174. package/src/auth/bounded-ttl-cache.ts +53 -0
  175. package/src/auth/cline.test.ts +173 -36
  176. package/src/auth/cline.ts +395 -93
  177. package/src/auth/oca.test.ts +125 -0
  178. package/src/auth/oca.ts +17 -4
  179. package/src/{agents → extensions/config}/agent-config-loader.test.ts +1 -1
  180. package/src/{agents → extensions/config}/agent-config-parser.ts +2 -2
  181. package/src/{agents → extensions/config}/hooks-config-loader.ts +1 -1
  182. package/src/{agents → extensions/config}/index.ts +7 -11
  183. package/src/{runtime/commands.test.ts → extensions/config/runtime-commands.test.ts} +20 -3
  184. package/src/{runtime/commands.ts → extensions/config/runtime-commands.ts} +1 -8
  185. package/src/{agents → extensions/config}/unified-config-file-watcher.ts +15 -2
  186. package/src/{agents → extensions/config}/user-instruction-config-loader.test.ts +90 -2
  187. package/src/{agents → extensions/config}/user-instruction-config-loader.ts +126 -12
  188. package/src/extensions/context/agentic-compaction.ts +119 -0
  189. package/src/extensions/context/basic-compaction.ts +275 -0
  190. package/src/extensions/context/compaction-shared.ts +458 -0
  191. package/src/extensions/context/compaction.test.ts +477 -0
  192. package/src/extensions/context/compaction.ts +203 -0
  193. package/src/extensions/index.ts +12 -0
  194. package/src/extensions/mcp/client.ts +420 -0
  195. package/src/{mcp → extensions/mcp}/index.ts +16 -0
  196. package/src/{mcp → extensions/mcp}/manager.test.ts +1 -2
  197. package/src/{mcp → extensions/mcp}/manager.ts +3 -5
  198. package/src/extensions/mcp/name-transform.ts +33 -0
  199. package/src/extensions/mcp/policies.ts +47 -0
  200. package/src/extensions/mcp/tools.ts +47 -0
  201. package/src/{mcp → extensions/mcp}/types.ts +35 -7
  202. package/src/{agents → extensions/plugin}/plugin-config-loader.test.ts +18 -13
  203. package/src/{agents → extensions/plugin}/plugin-config-loader.ts +1 -1
  204. package/src/{agents → extensions/plugin}/plugin-loader.test.ts +41 -4
  205. package/src/extensions/plugin/plugin-loader.ts +106 -0
  206. package/src/extensions/plugin/plugin-module-import.ts +278 -0
  207. package/src/{agents → extensions/plugin}/plugin-sandbox-bootstrap.ts +30 -92
  208. package/src/{agents → extensions/plugin}/plugin-sandbox.test.ts +60 -3
  209. package/src/{agents → extensions/plugin}/plugin-sandbox.ts +146 -56
  210. package/src/hooks/index.ts +25 -0
  211. package/src/hooks/persistent.ts +661 -0
  212. package/src/hooks/subprocess-runner.ts +196 -0
  213. package/src/hooks/subprocess.ts +669 -0
  214. package/src/index.ts +200 -118
  215. package/src/prompt/default-system.ts +21 -0
  216. package/src/providers/local-provider-registry.ts +1 -1
  217. package/src/providers/local-provider-service.test.ts +23 -2
  218. package/src/providers/local-provider-service.ts +2 -2
  219. package/src/runtime/checkpoint-hooks.test.ts +168 -0
  220. package/src/runtime/checkpoint-hooks.ts +186 -0
  221. package/src/runtime/hook-file-hooks.test.ts +40 -1
  222. package/src/runtime/hook-file-hooks.ts +35 -16
  223. package/src/runtime/index.ts +4 -19
  224. package/src/runtime/rules.ts +4 -1
  225. package/src/runtime/runtime-builder.team-persistence.test.ts +3 -6
  226. package/src/runtime/runtime-builder.test.ts +266 -160
  227. package/src/runtime/runtime-builder.ts +120 -47
  228. package/src/runtime/runtime-parity.test.ts +22 -22
  229. package/src/runtime/session-runtime.ts +36 -6
  230. package/src/runtime/{sandbox/subprocess-sandbox.ts → subprocess-sandbox.ts} +24 -3
  231. package/src/runtime/team-runtime-registry.ts +1 -4
  232. package/src/runtime/tool-approval.ts +1 -1
  233. package/src/session/default-session-manager.e2e.test.ts +2 -2
  234. package/src/session/default-session-manager.test.ts +553 -9
  235. package/src/session/default-session-manager.ts +162 -46
  236. package/src/session/file-session-service.ts +3 -3
  237. package/src/session/index.ts +6 -6
  238. package/src/session/persistence-service.test.ts +212 -0
  239. package/src/session/{unified-session-persistence-service.ts → persistence-service.ts} +106 -172
  240. package/src/session/rpc-session-service.ts +3 -3
  241. package/src/session/runtime-oauth-token-manager.ts +1 -1
  242. package/src/session/session-agent-events.ts +1 -1
  243. package/src/session/session-artifacts.ts +32 -4
  244. package/src/session/session-config-builder.ts +22 -9
  245. package/src/session/session-graph.ts +1 -1
  246. package/src/session/session-host.ts +19 -11
  247. package/src/session/session-manager.ts +11 -6
  248. package/src/session/session-service.team-persistence.test.ts +1 -1
  249. package/src/session/session-service.ts +6 -9
  250. package/src/session/session-team-coordination.ts +7 -3
  251. package/src/session/session-telemetry.ts +1 -1
  252. package/src/session/utils/helpers.test.ts +160 -0
  253. package/src/session/utils/helpers.ts +289 -42
  254. package/src/session/utils/types.ts +47 -7
  255. package/src/session/workspace-manager.ts +5 -3
  256. package/src/session/workspace-manifest.ts +3 -49
  257. package/src/storage/file-team-store.ts +2 -5
  258. package/src/storage/provider-settings-legacy-migration.ts +2 -2
  259. package/src/storage/provider-settings-manager.test.ts +1 -1
  260. package/src/storage/sqlite-team-store.ts +212 -125
  261. package/src/storage/team-store.ts +1 -5
  262. package/src/team/delegated-agent.ts +131 -0
  263. package/src/team/index.ts +1 -0
  264. package/src/team/multi-agent.lifecycle.test.ts +201 -0
  265. package/src/team/multi-agent.ts +1666 -0
  266. package/src/team/projections.ts +2 -4
  267. package/src/team/runtime.ts +54 -0
  268. package/src/team/spawn-agent-tool.test.ts +387 -0
  269. package/src/team/spawn-agent-tool.ts +207 -0
  270. package/src/team/subagent-prompts.ts +41 -0
  271. package/src/team/team-tools.test.ts +802 -0
  272. package/src/team/team-tools.ts +792 -0
  273. package/src/telemetry/OpenTelemetryAdapter.ts +1 -1
  274. package/src/telemetry/OpenTelemetryProvider.test.ts +216 -3
  275. package/src/telemetry/OpenTelemetryProvider.ts +110 -20
  276. package/src/telemetry/TelemetryLoggerSink.test.ts +42 -0
  277. package/src/telemetry/{LoggerTelemetryAdapter.ts → TelemetryLoggerSink.ts} +21 -14
  278. package/src/telemetry/TelemetryService.test.ts +7 -7
  279. package/src/telemetry/TelemetryService.ts +2 -4
  280. package/src/tools/definitions.test.ts +76 -0
  281. package/src/tools/definitions.ts +41 -2
  282. package/src/tools/executors/apply-patch.ts +1 -1
  283. package/src/tools/executors/editor.ts +1 -1
  284. package/src/tools/executors/file-read.ts +1 -1
  285. package/src/tools/executors/search.ts +1 -1
  286. package/src/tools/executors/web-fetch.ts +1 -1
  287. package/src/tools/index.ts +6 -1
  288. package/src/tools/model-tool-routing.ts +2 -0
  289. package/src/tools/presets.test.ts +8 -0
  290. package/src/tools/presets.ts +40 -2
  291. package/src/tools/schemas.ts +19 -0
  292. package/src/tools/types.ts +31 -2
  293. package/src/types/config.ts +61 -7
  294. package/src/types/events.ts +1 -1
  295. package/src/types/index.ts +0 -1
  296. package/src/types/provider-settings.ts +1 -1
  297. package/src/types/storage.ts +2 -5
  298. package/src/types.ts +32 -44
  299. package/dist/agents/agent-config-loader.d.ts.map +0 -1
  300. package/dist/agents/agent-config-parser.d.ts.map +0 -1
  301. package/dist/agents/hooks-config-loader.d.ts.map +0 -1
  302. package/dist/agents/index.d.ts.map +0 -1
  303. package/dist/agents/plugin-config-loader.d.ts.map +0 -1
  304. package/dist/agents/plugin-loader.d.ts.map +0 -1
  305. package/dist/agents/plugin-sandbox-bootstrap.js +0 -446
  306. package/dist/agents/plugin-sandbox.d.ts.map +0 -1
  307. package/dist/agents/unified-config-file-watcher.d.ts.map +0 -1
  308. package/dist/agents/user-instruction-config-loader.d.ts.map +0 -1
  309. package/dist/mcp/config-loader.d.ts.map +0 -1
  310. package/dist/mcp/index.d.ts +0 -5
  311. package/dist/mcp/index.d.ts.map +0 -1
  312. package/dist/mcp/manager.d.ts.map +0 -1
  313. package/dist/mcp/types.d.ts.map +0 -1
  314. package/dist/runtime/commands.d.ts.map +0 -1
  315. package/dist/runtime/sandbox/subprocess-sandbox.d.ts.map +0 -1
  316. package/dist/runtime/skills.d.ts +0 -14
  317. package/dist/runtime/skills.d.ts.map +0 -1
  318. package/dist/runtime/workflows.d.ts +0 -14
  319. package/dist/runtime/workflows.d.ts.map +0 -1
  320. package/dist/session/unified-session-persistence-service.d.ts.map +0 -1
  321. package/dist/telemetry/LoggerTelemetryAdapter.d.ts.map +0 -1
  322. package/dist/types/workspace.d.ts +0 -8
  323. package/dist/types/workspace.d.ts.map +0 -1
  324. package/src/agents/plugin-loader.ts +0 -175
  325. package/src/runtime/skills.ts +0 -44
  326. package/src/runtime/workflows.test.ts +0 -119
  327. package/src/runtime/workflows.ts +0 -45
  328. package/src/session/unified-session-persistence-service.test.ts +0 -85
  329. package/src/telemetry/LoggerTelemetryAdapter.test.ts +0 -42
  330. package/src/types/workspace.ts +0 -7
  331. /package/dist/{agents → extensions/config}/agent-config-loader.d.ts +0 -0
  332. /package/dist/{agents → extensions/config}/unified-config-file-watcher.d.ts +0 -0
  333. /package/dist/{agents → extensions/config}/user-instruction-config-loader.d.ts +0 -0
  334. /package/dist/{mcp → extensions/mcp}/config-loader.d.ts +0 -0
  335. /package/dist/runtime/{sandbox/subprocess-sandbox.d.ts → subprocess-sandbox.d.ts} +0 -0
  336. /package/src/{agents → extensions/config}/agent-config-loader.ts +0 -0
  337. /package/src/{agents → extensions/config}/hooks-config-loader.test.ts +0 -0
  338. /package/src/{agents → extensions/config}/unified-config-file-watcher.test.ts +0 -0
  339. /package/src/{mcp → extensions/mcp}/config-loader.test.ts +0 -0
  340. /package/src/{mcp → extensions/mcp}/config-loader.ts +0 -0
@@ -187,6 +187,82 @@ describe("default ask_question tool", () => {
187
187
  });
188
188
  });
189
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
+
190
266
  describe("default apply_patch tool", () => {
191
267
  it("is included only when enabled with an applyPatch executor", () => {
192
268
  const toolsWithoutExecutor = createDefaultTools({
@@ -4,8 +4,12 @@
4
4
  * Factory functions for creating the default tools.
5
5
  */
6
6
 
7
- import { createTool, type Tool } from "@clinebot/agents";
8
- import { validateWithZod, zodToJsonSchema } from "@clinebot/shared";
7
+ import {
8
+ createTool,
9
+ type Tool,
10
+ validateWithZod,
11
+ zodToJsonSchema,
12
+ } from "@clinebot/shared";
9
13
  import {
10
14
  formatError,
11
15
  formatReadFileQuery,
@@ -37,6 +41,8 @@ import {
37
41
  SkillsInputSchema,
38
42
  type StructuredCommandInput,
39
43
  StructuredCommandsInputUnionSchema,
44
+ type SubmitInput,
45
+ SubmitInputSchema,
40
46
  } from "./schemas";
41
47
  import type {
42
48
  ApplyPatchExecutor,
@@ -49,6 +55,7 @@ import type {
49
55
  SearchExecutor,
50
56
  SkillsExecutorWithMetadata,
51
57
  ToolOperationResult,
58
+ VerifySubmitExecutor,
52
59
  WebFetchExecutor,
53
60
  } from "./types";
54
61
 
@@ -603,6 +610,34 @@ export function createAskQuestionTool(
603
610
  });
604
611
  }
605
612
 
613
+ export function createSubmitAndExitTool(
614
+ executor: VerifySubmitExecutor,
615
+ config: Pick<DefaultToolsConfig, "submitTimeoutMs"> = {},
616
+ ): Tool<SubmitInput, string> {
617
+ const timeoutMs = config.submitTimeoutMs ?? 15000;
618
+
619
+ return createTool<SubmitInput, string>({
620
+ name: "submit_and_exit",
621
+ description:
622
+ "Submit the final answer and exit the conversation. " +
623
+ "For example, submit a summary of the investigation and confirm the issue is resolved. " +
624
+ "You should only submit once all necessary steps are completed. " +
625
+ "Provide a summary of the investigation and confirm the issue is resolved.",
626
+ inputSchema: zodToJsonSchema(SubmitInputSchema),
627
+ timeoutMs,
628
+ retryable: false,
629
+ maxRetries: 0,
630
+ execute: async (input, context) => {
631
+ const validatedInput = validateWithZod(SubmitInputSchema, input);
632
+ return withTimeout(
633
+ executor(validatedInput.summary, validatedInput.verified, context),
634
+ timeoutMs,
635
+ `submit_and_exit timed out after ${timeoutMs}ms`,
636
+ );
637
+ },
638
+ });
639
+ }
640
+
606
641
  // =============================================================================
607
642
  // Default Tools Factory
608
643
  // =============================================================================
@@ -657,6 +692,7 @@ export function createDefaultTools(options: CreateDefaultToolsOptions): Tool[] {
657
692
  enableEditor = true,
658
693
  enableSkills = true,
659
694
  enableAskQuestion = true,
695
+ enableSubmitAndExit = false,
660
696
  ...config
661
697
  } = options;
662
698
 
@@ -703,6 +739,9 @@ export function createDefaultTools(options: CreateDefaultToolsOptions): Tool[] {
703
739
  // Add ask_question tool if enabled and executor provided
704
740
  if (enableAskQuestion && executors.askQuestion) {
705
741
  tools.push(createAskQuestionTool(executors.askQuestion, config));
742
+ } else if (enableSubmitAndExit && executors.submit) {
743
+ // Add submit_and_exit tool if enabled and executor provided
744
+ tools.push(createSubmitAndExitTool(executors.submit, config));
706
745
  }
707
746
 
708
747
  return tools;
@@ -6,7 +6,7 @@
6
6
 
7
7
  import * as fs from "node:fs/promises";
8
8
  import * as path from "node:path";
9
- import type { ToolContext } from "@clinebot/agents";
9
+ import type { ToolContext } from "@clinebot/shared";
10
10
  import type { ApplyPatchInput } from "../schemas";
11
11
  import type { ApplyPatchExecutor } from "../types";
12
12
  import {
@@ -6,7 +6,7 @@
6
6
 
7
7
  import * as fs from "node:fs/promises";
8
8
  import * as path from "node:path";
9
- import type { ToolContext } from "@clinebot/agents";
9
+ import type { ToolContext } from "@clinebot/shared";
10
10
  import type { EditFileInput } from "../schemas";
11
11
  import type { EditorExecutor } from "../types";
12
12
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  import * as fs from "node:fs/promises";
8
8
  import * as path from "node:path";
9
- import type { ToolContext } from "@clinebot/agents";
9
+ import type { ToolContext } from "@clinebot/shared";
10
10
  import type { ReadFileRequest } from "../schemas";
11
11
  import type { FileReadExecutor } from "../types";
12
12
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  import * as fs from "node:fs/promises";
8
8
  import * as path from "node:path";
9
- import type { ToolContext } from "@clinebot/agents";
9
+ import type { ToolContext } from "@clinebot/shared";
10
10
  import { getFileIndex } from "../../input";
11
11
  import type { SearchExecutor } from "../types";
12
12
 
@@ -4,7 +4,7 @@
4
4
  * Built-in implementation for fetching web content using native fetch.
5
5
  */
6
6
 
7
- import type { ToolContext } from "@clinebot/agents";
7
+ import type { ToolContext } from "@clinebot/shared";
8
8
  import type { WebFetchExecutor } from "../types";
9
9
 
10
10
  /**
@@ -18,6 +18,7 @@ export {
18
18
  createReadFilesTool,
19
19
  createSearchTool,
20
20
  createSkillsTool,
21
+ createSubmitAndExitTool,
21
22
  createWebFetchTool,
22
23
  createWindowsShellTool,
23
24
  } from "./definitions";
@@ -47,6 +48,7 @@ export {
47
48
  export {
48
49
  createDefaultToolsWithPreset,
49
50
  createToolPoliciesWithPreset,
51
+ resolveToolPresetName,
50
52
  type ToolPolicyPresetName,
51
53
  type ToolPresetName,
52
54
  ToolPresets,
@@ -71,6 +73,8 @@ export {
71
73
  SearchCodebaseInputSchema,
72
74
  type SkillsInput,
73
75
  SkillsInputSchema,
76
+ type SubmitInput,
77
+ SubmitInputSchema,
74
78
  type WebFetchRequest,
75
79
  WebFetchRequestSchema,
76
80
  } from "./schemas";
@@ -90,6 +94,7 @@ export type {
90
94
  SkillsExecutorWithMetadata,
91
95
  ToolExecutors,
92
96
  ToolOperationResult,
97
+ VerifySubmitExecutor,
93
98
  WebFetchExecutor,
94
99
  } from "./types";
95
100
 
@@ -97,7 +102,7 @@ export type {
97
102
  // Convenience: Create Tools with Built-in Executors
98
103
  // =============================================================================
99
104
 
100
- import type { Tool } from "@clinebot/agents";
105
+ import type { Tool } from "@clinebot/shared";
101
106
  import { createDefaultTools } from "./definitions";
102
107
  import {
103
108
  createDefaultExecutors,
@@ -43,6 +43,7 @@ const TOOL_NAME_TO_FLAG: Record<
43
43
  | "enableEditor"
44
44
  | "enableSkills"
45
45
  | "enableAskQuestion"
46
+ | "enableSubmitAndExit"
46
47
  >
47
48
  > = {
48
49
  read_files: "enableReadFiles",
@@ -53,6 +54,7 @@ const TOOL_NAME_TO_FLAG: Record<
53
54
  editor: "enableEditor",
54
55
  skills: "enableSkills",
55
56
  ask_question: "enableAskQuestion",
57
+ submit_and_exit: "enableSubmitAndExit",
56
58
  };
57
59
 
58
60
  export const DEFAULT_MODEL_TOOL_ROUTING_RULES: ToolRoutingRule[] = [
@@ -14,6 +14,14 @@ describe("default tool presets", () => {
14
14
  expect(ToolPresets.yolo.enableAskQuestion).toBe(false);
15
15
  });
16
16
 
17
+ it("disables spawn and team tools by default in yolo mode", () => {
18
+ expect(ToolPresets.development.enableSpawnAgent).toBe(true);
19
+ expect(ToolPresets.development.enableAgentTeams).toBe(true);
20
+ expect(ToolPresets.yolo.enableSpawnAgent).toBe(false);
21
+ expect(ToolPresets.yolo.enableAgentTeams).toBe(false);
22
+ expect(ToolPresets.yolo.enableSubmitAndExit).toBe(true);
23
+ });
24
+
17
25
  it("yolo preset excludes ask_question even when its executor exists", () => {
18
26
  const tools = createDefaultToolsWithPreset("yolo", {
19
27
  executors: {
@@ -9,6 +9,11 @@ import { ALL_DEFAULT_TOOL_NAMES } from "./constants";
9
9
  import { createDefaultTools } from "./definitions";
10
10
  import type { CreateDefaultToolsOptions, DefaultToolsConfig } from "./types";
11
11
 
12
+ export interface ToolPresetConfig extends DefaultToolsConfig {
13
+ enableSpawnAgent?: boolean;
14
+ enableAgentTeams?: boolean;
15
+ }
16
+
12
17
  /**
13
18
  * Preset configurations for common use cases
14
19
  */
@@ -25,6 +30,9 @@ export const ToolPresets = {
25
30
  enableEditor: false,
26
31
  enableSkills: true,
27
32
  enableAskQuestion: true,
33
+ enableSubmitAndExit: false,
34
+ enableSpawnAgent: true,
35
+ enableAgentTeams: true,
28
36
  },
29
37
 
30
38
  /**
@@ -40,6 +48,9 @@ export const ToolPresets = {
40
48
  enableEditor: false,
41
49
  enableSkills: false,
42
50
  enableAskQuestion: false,
51
+ enableSubmitAndExit: false,
52
+ enableSpawnAgent: true,
53
+ enableAgentTeams: true,
43
54
  },
44
55
 
45
56
  /**
@@ -55,6 +66,9 @@ export const ToolPresets = {
55
66
  enableEditor: true,
56
67
  enableSkills: true,
57
68
  enableAskQuestion: true,
69
+ enableSubmitAndExit: true,
70
+ enableSpawnAgent: true,
71
+ enableAgentTeams: true,
58
72
  },
59
73
 
60
74
  /**
@@ -70,6 +84,9 @@ export const ToolPresets = {
70
84
  enableEditor: false,
71
85
  enableSkills: true,
72
86
  enableAskQuestion: true,
87
+ enableSubmitAndExit: false,
88
+ enableSpawnAgent: true,
89
+ enableAgentTeams: true,
73
90
  },
74
91
 
75
92
  /**
@@ -85,6 +102,9 @@ export const ToolPresets = {
85
102
  enableEditor: false,
86
103
  enableSkills: false,
87
104
  enableAskQuestion: true,
105
+ enableSubmitAndExit: false,
106
+ enableSpawnAgent: false,
107
+ enableAgentTeams: false,
88
108
  },
89
109
 
90
110
  /**
@@ -100,14 +120,27 @@ export const ToolPresets = {
100
120
  enableEditor: true,
101
121
  enableSkills: true,
102
122
  enableAskQuestion: false,
123
+ enableSubmitAndExit: true,
124
+ enableSpawnAgent: false,
125
+ enableAgentTeams: false,
103
126
  },
104
- } as const satisfies Record<string, DefaultToolsConfig>;
127
+ } as const satisfies Record<string, ToolPresetConfig>;
105
128
 
106
129
  /**
107
130
  * Type for preset names
108
131
  */
109
132
  export type ToolPresetName = keyof typeof ToolPresets;
110
133
 
134
+ export function resolveToolPresetName(options: {
135
+ mode?: "act" | "plan";
136
+ yolo?: boolean;
137
+ }): ToolPresetName {
138
+ if (options.mode === "plan") {
139
+ return "readonly";
140
+ }
141
+ return options.yolo === true ? "yolo" : "development";
142
+ }
143
+
111
144
  /**
112
145
  * Tool policy preset names
113
146
  */
@@ -161,8 +194,13 @@ export function createDefaultToolsWithPreset(
161
194
  Partial<DefaultToolsConfig>,
162
195
  ): Tool[] {
163
196
  const preset = ToolPresets[presetName];
197
+ const {
198
+ enableSpawnAgent: _enableSpawnAgent,
199
+ enableAgentTeams: _enableAgentTeams,
200
+ ...toolConfig
201
+ } = preset;
164
202
  return createDefaultTools({
165
- ...preset,
203
+ ...toolConfig,
166
204
  ...options,
167
205
  });
168
206
  }
@@ -269,6 +269,20 @@ export const AskQuestionInputSchema = z.object({
269
269
  ),
270
270
  });
271
271
 
272
+ export const SubmitInputSchema = z.object({
273
+ summary: z
274
+ .string()
275
+ .min(10)
276
+ .describe(
277
+ "Summarization of the investigation, steps taken, and resolution status to submit at the end of the session. Before submitting, read the problem again along with any provided test's assertions carefully and confirm your fix produces the expected output.",
278
+ ),
279
+ verified: z
280
+ .boolean()
281
+ .describe(
282
+ `Have you verified that the issue is resolved to the best of your knowledge, including updating and creating all the requested files and items? 'True' if you have completed the investigation and taken all necessary steps to resolve the issue.\n'False' if you have done all you can but cannot resolve the issue or if you are stuck and cannot proceed further. =\nIMPORTANT: You must run the specific failing test(s) mentioned in the issue or test patch and include the test output in your reasoning. If the test still fails after your fix, you must revise. Do NOT submit with 'true' unless the test output shows the test passing.`,
283
+ ),
284
+ });
285
+
272
286
  // =============================================================================
273
287
  // Type Definitions (derived from Zod schemas)
274
288
  // =============================================================================
@@ -325,3 +339,8 @@ export type SkillsInput = z.infer<typeof SkillsInputSchema>;
325
339
  * Input for the ask_followup_question tool
326
340
  */
327
341
  export type AskQuestionInput = z.infer<typeof AskQuestionInputSchema>;
342
+
343
+ /**
344
+ * Input for the submit and exit tool
345
+ */
346
+ export type SubmitInput = z.infer<typeof SubmitInputSchema>;
@@ -4,7 +4,7 @@
4
4
  * Type definitions for executors, configuration, and results.
5
5
  */
6
6
 
7
- import type { ToolContext } from "@clinebot/agents";
7
+ import type { ToolContext } from "@clinebot/shared";
8
8
  import type {
9
9
  ApplyPatchInput,
10
10
  EditFileInput,
@@ -172,6 +172,20 @@ export interface SkillsExecutorWithMetadata {
172
172
  configuredSkills?: SkillsExecutorSkillMetadata[];
173
173
  }
174
174
 
175
+ /**
176
+ * Executor for verifying a user's response to a question
177
+ *
178
+ * @param summary - Summary of the solution ans steps taken
179
+ * @param verified - Boolean indicating if the solution has been verified
180
+ * @param context - Tool execution context
181
+ * @returns Executor-specific result payload
182
+ */
183
+ export type VerifySubmitExecutor = (
184
+ summary: string,
185
+ verified: boolean,
186
+ context: ToolContext,
187
+ ) => Promise<string>;
188
+
175
189
  /**
176
190
  * Collection of all tool executors
177
191
  */
@@ -192,6 +206,8 @@ export interface ToolExecutors {
192
206
  skills?: SkillsExecutorWithMetadata;
193
207
  /** Follow-up question implementation */
194
208
  askQuestion?: AskQuestionExecutor;
209
+ /** Final submission implementation */
210
+ submit?: VerifySubmitExecutor;
195
211
  }
196
212
 
197
213
  // =============================================================================
@@ -209,7 +225,8 @@ export type DefaultToolName =
209
225
  | "apply_patch"
210
226
  | "editor"
211
227
  | "skills"
212
- | "ask_question";
228
+ | "ask_question"
229
+ | "submit_and_exit";
213
230
 
214
231
  /**
215
232
  * Configuration for enabling/disabling default tools
@@ -263,6 +280,12 @@ export interface DefaultToolsConfig {
263
280
  */
264
281
  enableAskQuestion?: boolean;
265
282
 
283
+ /**
284
+ * Enable the submit_and_exit tool
285
+ * @default false
286
+ */
287
+ enableSubmitAndExit?: boolean;
288
+
266
289
  /**
267
290
  * Current working directory for tools that need it
268
291
  */
@@ -315,6 +338,12 @@ export interface DefaultToolsConfig {
315
338
  * @default 15000
316
339
  */
317
340
  askQuestionTimeoutMs?: number;
341
+
342
+ /**
343
+ * Timeout for submit_and_exit operations in milliseconds
344
+ * @default 15000
345
+ */
346
+ submitTimeoutMs?: number;
318
347
  }
319
348
 
320
349
  /**
@@ -1,21 +1,21 @@
1
+ import type * as LlmsProviders from "@clinebot/llms";
1
2
  import type {
2
3
  AgentConfig,
3
4
  AgentHooks,
5
+ AgentMode,
6
+ BasicLogger,
4
7
  ConsecutiveMistakeLimitContext,
5
8
  ConsecutiveMistakeLimitDecision,
9
+ ExtensionContext,
6
10
  HookErrorMode,
7
- TeamEvent,
8
- Tool,
9
- } from "@clinebot/agents";
10
- import type * as LlmsProviders from "@clinebot/llms/providers";
11
- import type {
12
- AgentMode,
13
- BasicLogger,
14
11
  ITelemetryService,
12
+ MessageWithMetadata,
15
13
  SessionExecutionConfig,
16
14
  SessionPromptConfig,
17
15
  SessionWorkspaceConfig,
16
+ Tool,
18
17
  } from "@clinebot/shared";
18
+ import type { TeamEvent } from "../team";
19
19
  import type { ToolRoutingRule } from "../tools/model-tool-routing";
20
20
 
21
21
  export type CoreAgentMode = AgentMode;
@@ -42,6 +42,57 @@ export interface CoreRuntimeFeatures {
42
42
  enableTools: boolean;
43
43
  enableSpawnAgent: boolean;
44
44
  enableAgentTeams: boolean;
45
+ yolo?: boolean;
46
+ }
47
+
48
+ export interface CoreCompactionContext {
49
+ agentId: string;
50
+ conversationId: string;
51
+ parentAgentId: string | null;
52
+ iteration: number;
53
+ messages: MessageWithMetadata[];
54
+ model: {
55
+ id: string;
56
+ provider: string;
57
+ info?: LlmsProviders.ModelInfo;
58
+ };
59
+ contextWindowTokens: number;
60
+ triggerTokens: number;
61
+ thresholdRatio: number;
62
+ utilizationRatio: number;
63
+ }
64
+
65
+ export interface CoreCompactionResult {
66
+ messages: MessageWithMetadata[];
67
+ }
68
+
69
+ export interface CoreCompactionSummarizerConfig {
70
+ providerId: string;
71
+ modelId: string;
72
+ apiKey?: string;
73
+ baseUrl?: string;
74
+ headers?: Record<string, string>;
75
+ knownModels?: Record<string, LlmsProviders.ModelInfo>;
76
+ providerConfig?: LlmsProviders.ProviderConfig;
77
+ maxOutputTokens?: number;
78
+ }
79
+
80
+ export type CoreCompactionStrategy = "basic" | "agentic";
81
+
82
+ export interface CoreCompactionConfig {
83
+ enabled?: boolean;
84
+ strategy?: CoreCompactionStrategy;
85
+ thresholdRatio?: number;
86
+ reserveTokens?: number;
87
+ preserveRecentTokens?: number;
88
+ contextWindowTokens?: number;
89
+ summarizer?: CoreCompactionSummarizerConfig;
90
+ compact?: (
91
+ context: CoreCompactionContext,
92
+ ) =>
93
+ | Promise<CoreCompactionResult | undefined>
94
+ | CoreCompactionResult
95
+ | undefined;
45
96
  }
46
97
 
47
98
  export interface CoreSessionConfig
@@ -67,10 +118,12 @@ export interface CoreSessionConfig
67
118
  hookErrorMode?: HookErrorMode;
68
119
  logger?: BasicLogger;
69
120
  telemetry?: ITelemetryService;
121
+ extensionContext?: ExtensionContext;
70
122
  extraTools?: Tool[];
71
123
  pluginPaths?: string[];
72
124
  extensions?: AgentConfig["extensions"];
73
125
  execution?: AgentConfig["execution"];
126
+ compaction?: CoreCompactionConfig;
74
127
  onTeamEvent?: (event: TeamEvent) => void;
75
128
  onConsecutiveMistakeLimitReached?: (
76
129
  context: ConsecutiveMistakeLimitContext,
@@ -83,4 +136,5 @@ export interface CoreSessionConfig
83
136
  * skills are surfaced in tool metadata and invocable by name.
84
137
  */
85
138
  skills?: string[];
139
+ workspaceMetadata?: string;
86
140
  }
@@ -60,7 +60,7 @@ export type CoreSessionEvent =
60
60
  type: "agent_event";
61
61
  payload: {
62
62
  sessionId: string;
63
- event: import("@clinebot/agents").AgentEvent;
63
+ event: import("@clinebot/shared").AgentEvent;
64
64
  };
65
65
  }
66
66
  | { type: "team_progress"; payload: SessionTeamProgressEvent }
@@ -21,4 +21,3 @@ export type {
21
21
  } from "./provider-settings";
22
22
  export type { SessionRecord, SessionRef } from "./sessions";
23
23
  export type { ArtifactStore, SessionStore, TeamStore } from "./storage";
24
- export type { WorkspaceInfo } from "./workspace";
@@ -1,4 +1,4 @@
1
- import * as LlmsProviders from "@clinebot/llms/providers";
1
+ import * as LlmsProviders from "@clinebot/llms";
2
2
  import { z } from "zod";
3
3
 
4
4
  export type ProviderConfig = LlmsProviders.ProviderConfig;
@@ -1,8 +1,5 @@
1
- import type {
2
- TeamEvent,
3
- TeamRuntimeState,
4
- TeamTeammateSpec,
5
- } from "@clinebot/agents";
1
+ import type { TeamRuntimeState, TeamTeammateSpec } from "@clinebot/shared";
2
+ import type { TeamEvent } from "../team";
6
3
  import type { SessionStatus } from "./common";
7
4
  import type { SessionRecord } from "./sessions";
8
5