@machina.ai/cell-cli-core 1.8.2-rc1 → 1.11.0-rc1

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 (381) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.js +1 -1
  3. package/dist/index.js.map +1 -1
  4. package/dist/package.json +5 -3
  5. package/dist/src/agents/codebase-investigator.d.ts +36 -1
  6. package/dist/src/agents/codebase-investigator.js +93 -34
  7. package/dist/src/agents/codebase-investigator.js.map +1 -1
  8. package/dist/src/agents/executor.d.ts +15 -11
  9. package/dist/src/agents/executor.js +271 -115
  10. package/dist/src/agents/executor.js.map +1 -1
  11. package/dist/src/agents/executor.test.js +508 -242
  12. package/dist/src/agents/executor.test.js.map +1 -1
  13. package/dist/src/agents/invocation.d.ts +5 -2
  14. package/dist/src/agents/invocation.js +4 -2
  15. package/dist/src/agents/invocation.js.map +1 -1
  16. package/dist/src/agents/invocation.test.js +9 -0
  17. package/dist/src/agents/invocation.test.js.map +1 -1
  18. package/dist/src/agents/registry.d.ts +2 -1
  19. package/dist/src/agents/registry.js +28 -4
  20. package/dist/src/agents/registry.js.map +1 -1
  21. package/dist/src/agents/subagent-tool-wrapper.d.ts +3 -1
  22. package/dist/src/agents/subagent-tool-wrapper.js +4 -3
  23. package/dist/src/agents/subagent-tool-wrapper.js.map +1 -1
  24. package/dist/src/agents/subagent-tool-wrapper.test.js +8 -1
  25. package/dist/src/agents/subagent-tool-wrapper.test.js.map +1 -1
  26. package/dist/src/agents/types.d.ts +35 -6
  27. package/dist/src/agents/types.js +1 -0
  28. package/dist/src/agents/types.js.map +1 -1
  29. package/dist/src/code_assist/converter.d.ts +1 -0
  30. package/dist/src/code_assist/converter.js +1 -0
  31. package/dist/src/code_assist/converter.js.map +1 -1
  32. package/dist/src/code_assist/converter.test.js +19 -0
  33. package/dist/src/code_assist/converter.test.js.map +1 -1
  34. package/dist/src/code_assist/oauth-credential-storage.js +1 -1
  35. package/dist/src/code_assist/oauth-credential-storage.js.map +1 -1
  36. package/dist/src/code_assist/oauth-credential-storage.test.js +1 -1
  37. package/dist/src/code_assist/oauth-credential-storage.test.js.map +1 -1
  38. package/dist/src/code_assist/oauth2.js +13 -12
  39. package/dist/src/code_assist/oauth2.js.map +1 -1
  40. package/dist/src/code_assist/oauth2.test.js +14 -13
  41. package/dist/src/code_assist/oauth2.test.js.map +1 -1
  42. package/dist/src/code_assist/setup.js +4 -2
  43. package/dist/src/code_assist/setup.js.map +1 -1
  44. package/dist/src/config/config.d.ts +58 -18
  45. package/dist/src/config/config.js +125 -36
  46. package/dist/src/config/config.js.map +1 -1
  47. package/dist/src/config/config.test.js +125 -18
  48. package/dist/src/config/config.test.js.map +1 -1
  49. package/dist/src/config/storage.d.ts +0 -1
  50. package/dist/src/config/storage.js +2 -2
  51. package/dist/src/config/storage.js.map +1 -1
  52. package/dist/src/config/storage.test.js +7 -6
  53. package/dist/src/config/storage.test.js.map +1 -1
  54. package/dist/src/confirmation-bus/message-bus.d.ts +2 -1
  55. package/dist/src/confirmation-bus/message-bus.js +7 -1
  56. package/dist/src/confirmation-bus/message-bus.js.map +1 -1
  57. package/dist/src/confirmation-bus/types.d.ts +12 -2
  58. package/dist/src/confirmation-bus/types.js +1 -0
  59. package/dist/src/confirmation-bus/types.js.map +1 -1
  60. package/dist/src/core/client.d.ts +3 -1
  61. package/dist/src/core/client.js +70 -19
  62. package/dist/src/core/client.js.map +1 -1
  63. package/dist/src/core/client.test.js +199 -25
  64. package/dist/src/core/client.test.js.map +1 -1
  65. package/dist/src/core/contentGenerator.js +3 -1
  66. package/dist/src/core/contentGenerator.js.map +1 -1
  67. package/dist/src/core/coreToolScheduler.d.ts +7 -0
  68. package/dist/src/core/coreToolScheduler.js +58 -22
  69. package/dist/src/core/coreToolScheduler.js.map +1 -1
  70. package/dist/src/core/coreToolScheduler.test.js +351 -3
  71. package/dist/src/core/coreToolScheduler.test.js.map +1 -1
  72. package/dist/src/core/geminiChat.d.ts +7 -11
  73. package/dist/src/core/geminiChat.js +33 -70
  74. package/dist/src/core/geminiChat.js.map +1 -1
  75. package/dist/src/core/geminiChat.test.js +93 -228
  76. package/dist/src/core/geminiChat.test.js.map +1 -1
  77. package/dist/src/core/logger.js +11 -10
  78. package/dist/src/core/logger.js.map +1 -1
  79. package/dist/src/core/logger.test.js +2 -2
  80. package/dist/src/core/logger.test.js.map +1 -1
  81. package/dist/src/core/nonInteractiveToolExecutor.d.ts +3 -2
  82. package/dist/src/core/nonInteractiveToolExecutor.js +2 -2
  83. package/dist/src/core/nonInteractiveToolExecutor.js.map +1 -1
  84. package/dist/src/core/nonInteractiveToolExecutor.test.js +11 -8
  85. package/dist/src/core/nonInteractiveToolExecutor.test.js.map +1 -1
  86. package/dist/src/core/prompts.d.ts +2 -1
  87. package/dist/src/core/prompts.js +58 -123
  88. package/dist/src/core/prompts.js.map +1 -1
  89. package/dist/src/core/prompts.test.js +83 -29
  90. package/dist/src/core/prompts.test.js.map +1 -1
  91. package/dist/src/core/turn.d.ts +16 -2
  92. package/dist/src/core/turn.js +15 -2
  93. package/dist/src/core/turn.js.map +1 -1
  94. package/dist/src/core/turn.test.js +62 -2
  95. package/dist/src/core/turn.test.js.map +1 -1
  96. package/dist/src/generated/git-commit.d.ts +2 -2
  97. package/dist/src/generated/git-commit.js +2 -2
  98. package/dist/src/generated/git-commit.js.map +1 -1
  99. package/dist/src/ide/detect-ide.test.js +11 -0
  100. package/dist/src/ide/detect-ide.test.js.map +1 -1
  101. package/dist/src/ide/ide-client.js +5 -4
  102. package/dist/src/ide/ide-client.js.map +1 -1
  103. package/dist/src/ide/ide-client.test.js +4 -4
  104. package/dist/src/ide/ide-installer.js +1 -1
  105. package/dist/src/ide/ide-installer.js.map +1 -1
  106. package/dist/src/ide/ide-installer.test.js +13 -1
  107. package/dist/src/ide/ide-installer.test.js.map +1 -1
  108. package/dist/src/ide/process-utils.js +85 -75
  109. package/dist/src/ide/process-utils.js.map +1 -1
  110. package/dist/src/ide/process-utils.test.js +83 -90
  111. package/dist/src/ide/process-utils.test.js.map +1 -1
  112. package/dist/src/index.d.ts +6 -0
  113. package/dist/src/index.js +6 -0
  114. package/dist/src/index.js.map +1 -1
  115. package/dist/src/mcp/oauth-provider.js +21 -20
  116. package/dist/src/mcp/oauth-provider.js.map +1 -1
  117. package/dist/src/mcp/oauth-utils.js +9 -8
  118. package/dist/src/mcp/oauth-utils.js.map +1 -1
  119. package/dist/src/mcp/oauth-utils.test.js +13 -2
  120. package/dist/src/mcp/oauth-utils.test.js.map +1 -1
  121. package/dist/src/mcp/token-storage/file-token-storage.js +2 -1
  122. package/dist/src/mcp/token-storage/file-token-storage.js.map +1 -1
  123. package/dist/src/mcp/token-storage/file-token-storage.test.js +4 -3
  124. package/dist/src/mcp/token-storage/file-token-storage.test.js.map +1 -1
  125. package/dist/src/output/stream-json-formatter.d.ts +32 -0
  126. package/dist/src/output/stream-json-formatter.js +52 -0
  127. package/dist/src/output/stream-json-formatter.js.map +1 -0
  128. package/dist/src/output/stream-json-formatter.test.js +479 -0
  129. package/dist/src/output/stream-json-formatter.test.js.map +1 -0
  130. package/dist/src/output/types.d.ts +63 -1
  131. package/dist/src/output/types.js +11 -0
  132. package/dist/src/output/types.js.map +1 -1
  133. package/dist/src/prompts/prompt-registry.js +2 -1
  134. package/dist/src/prompts/prompt-registry.js.map +1 -1
  135. package/dist/src/routing/strategies/classifierStrategy.js +3 -2
  136. package/dist/src/routing/strategies/classifierStrategy.js.map +1 -1
  137. package/dist/src/services/chatRecordingService.d.ts +2 -1
  138. package/dist/src/services/chatRecordingService.js +2 -1
  139. package/dist/src/services/chatRecordingService.js.map +1 -1
  140. package/dist/src/services/loopDetectionService.js +3 -2
  141. package/dist/src/services/loopDetectionService.js.map +1 -1
  142. package/dist/src/services/shellExecutionService.d.ts +1 -0
  143. package/dist/src/services/shellExecutionService.js +177 -91
  144. package/dist/src/services/shellExecutionService.js.map +1 -1
  145. package/dist/src/services/shellExecutionService.test.js +113 -12
  146. package/dist/src/services/shellExecutionService.test.js.map +1 -1
  147. package/dist/src/telemetry/activity-monitor.d.ts +116 -0
  148. package/dist/src/telemetry/activity-monitor.js +209 -0
  149. package/dist/src/telemetry/activity-monitor.js.map +1 -0
  150. package/dist/src/telemetry/activity-monitor.test.d.ts +6 -0
  151. package/dist/src/telemetry/activity-monitor.test.js +248 -0
  152. package/dist/src/telemetry/activity-monitor.test.js.map +1 -0
  153. package/dist/src/telemetry/clearcut-logger/clearcut-logger.d.ts +15 -2
  154. package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +154 -31
  155. package/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +1 -1
  156. package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js +84 -15
  157. package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js.map +1 -1
  158. package/dist/src/telemetry/clearcut-logger/event-metadata-key.d.ts +16 -3
  159. package/dist/src/telemetry/clearcut-logger/event-metadata-key.js +38 -5
  160. package/dist/src/telemetry/clearcut-logger/event-metadata-key.js.map +1 -1
  161. package/dist/src/telemetry/constants.d.ts +0 -28
  162. package/dist/src/telemetry/constants.js +0 -29
  163. package/dist/src/telemetry/constants.js.map +1 -1
  164. package/dist/src/telemetry/index.d.ts +6 -3
  165. package/dist/src/telemetry/index.js +12 -4
  166. package/dist/src/telemetry/index.js.map +1 -1
  167. package/dist/src/telemetry/loggers.d.ts +8 -2
  168. package/dist/src/telemetry/loggers.js +165 -299
  169. package/dist/src/telemetry/loggers.js.map +1 -1
  170. package/dist/src/telemetry/loggers.test.js +213 -21
  171. package/dist/src/telemetry/loggers.test.js.map +1 -1
  172. package/dist/src/telemetry/memory-monitor.d.ts +149 -0
  173. package/dist/src/telemetry/memory-monitor.js +335 -0
  174. package/dist/src/telemetry/memory-monitor.js.map +1 -0
  175. package/dist/src/telemetry/memory-monitor.test.d.ts +6 -0
  176. package/dist/src/telemetry/memory-monitor.test.js +472 -0
  177. package/dist/src/telemetry/memory-monitor.test.js.map +1 -0
  178. package/dist/src/telemetry/metrics.d.ts +131 -4
  179. package/dist/src/telemetry/metrics.js +182 -6
  180. package/dist/src/telemetry/metrics.js.map +1 -1
  181. package/dist/src/telemetry/metrics.test.js +360 -1
  182. package/dist/src/telemetry/metrics.test.js.map +1 -1
  183. package/dist/src/telemetry/sdk.js +3 -2
  184. package/dist/src/telemetry/sdk.js.map +1 -1
  185. package/dist/src/telemetry/telemetryAttributes.d.ts +8 -0
  186. package/dist/src/telemetry/telemetryAttributes.js +18 -0
  187. package/dist/src/telemetry/telemetryAttributes.js.map +1 -0
  188. package/dist/src/telemetry/types.d.ts +163 -7
  189. package/dist/src/telemetry/types.js +691 -38
  190. package/dist/src/telemetry/types.js.map +1 -1
  191. package/dist/src/telemetry/uiTelemetry.d.ts +1 -1
  192. package/dist/src/telemetry/uiTelemetry.js +1 -1
  193. package/dist/src/telemetry/uiTelemetry.js.map +1 -1
  194. package/dist/src/telemetry/uiTelemetry.test.js +1 -1
  195. package/dist/src/telemetry/uiTelemetry.test.js.map +1 -1
  196. package/dist/src/tools/edit.js +8 -7
  197. package/dist/src/tools/edit.js.map +1 -1
  198. package/dist/src/tools/edit.test.js +0 -1
  199. package/dist/src/tools/edit.test.js.map +1 -1
  200. package/dist/src/tools/glob.d.ts +3 -2
  201. package/dist/src/tools/glob.js +8 -7
  202. package/dist/src/tools/glob.js.map +1 -1
  203. package/dist/src/tools/grep.d.ts +3 -2
  204. package/dist/src/tools/grep.js +20 -14
  205. package/dist/src/tools/grep.js.map +1 -1
  206. package/dist/src/tools/ls.d.ts +3 -2
  207. package/dist/src/tools/ls.js +8 -7
  208. package/dist/src/tools/ls.js.map +1 -1
  209. package/dist/src/tools/mcp-client-manager.d.ts +2 -9
  210. package/dist/src/tools/mcp-client-manager.js +6 -14
  211. package/dist/src/tools/mcp-client-manager.js.map +1 -1
  212. package/dist/src/tools/mcp-client-manager.test.js +16 -6
  213. package/dist/src/tools/mcp-client-manager.test.js.map +1 -1
  214. package/dist/src/tools/mcp-client.d.ts +3 -2
  215. package/dist/src/tools/mcp-client.js +49 -52
  216. package/dist/src/tools/mcp-client.js.map +1 -1
  217. package/dist/src/tools/mcp-client.test.js +168 -5
  218. package/dist/src/tools/mcp-client.test.js.map +1 -1
  219. package/dist/src/tools/mcp-tool.d.ts +2 -1
  220. package/dist/src/tools/mcp-tool.js +7 -3
  221. package/dist/src/tools/mcp-tool.js.map +1 -1
  222. package/dist/src/tools/memoryTool.d.ts +2 -2
  223. package/dist/src/tools/memoryTool.js +4 -4
  224. package/dist/src/tools/memoryTool.js.map +1 -1
  225. package/dist/src/tools/memoryTool.test.js +9 -8
  226. package/dist/src/tools/memoryTool.test.js.map +1 -1
  227. package/dist/src/tools/message-bus-integration.test.js +14 -1
  228. package/dist/src/tools/message-bus-integration.test.js.map +1 -1
  229. package/dist/src/tools/read-file.d.ts +4 -3
  230. package/dist/src/tools/read-file.js +9 -8
  231. package/dist/src/tools/read-file.js.map +1 -1
  232. package/dist/src/tools/read-many-files.d.ts +4 -3
  233. package/dist/src/tools/read-many-files.js +11 -8
  234. package/dist/src/tools/read-many-files.js.map +1 -1
  235. package/dist/src/tools/read-many-files.test.js +0 -1
  236. package/dist/src/tools/read-many-files.test.js.map +1 -1
  237. package/dist/src/tools/ripGrep.d.ts +3 -2
  238. package/dist/src/tools/ripGrep.js +47 -17
  239. package/dist/src/tools/ripGrep.js.map +1 -1
  240. package/dist/src/tools/ripGrep.test.js +106 -60
  241. package/dist/src/tools/ripGrep.test.js.map +1 -1
  242. package/dist/src/tools/shell.d.ts +1 -1
  243. package/dist/src/tools/shell.js +31 -14
  244. package/dist/src/tools/shell.js.map +1 -1
  245. package/dist/src/tools/shell.test.js +63 -9
  246. package/dist/src/tools/shell.test.js.map +1 -1
  247. package/dist/src/tools/smart-edit.d.ts +1 -20
  248. package/dist/src/tools/smart-edit.js +64 -61
  249. package/dist/src/tools/smart-edit.js.map +1 -1
  250. package/dist/src/tools/smart-edit.test.js +70 -87
  251. package/dist/src/tools/smart-edit.test.js.map +1 -1
  252. package/dist/src/tools/tool-error.d.ts +21 -0
  253. package/dist/src/tools/tool-error.js +27 -0
  254. package/dist/src/tools/tool-error.js.map +1 -1
  255. package/dist/src/tools/tool-names.d.ts +17 -0
  256. package/dist/src/tools/tool-names.js +21 -0
  257. package/dist/src/tools/tool-names.js.map +1 -0
  258. package/dist/src/tools/tool-registry.js +4 -3
  259. package/dist/src/tools/tool-registry.js.map +1 -1
  260. package/dist/src/tools/tools.d.ts +17 -10
  261. package/dist/src/tools/tools.js +54 -39
  262. package/dist/src/tools/tools.js.map +1 -1
  263. package/dist/src/tools/web-fetch.d.ts +11 -3
  264. package/dist/src/tools/web-fetch.js +90 -32
  265. package/dist/src/tools/web-fetch.js.map +1 -1
  266. package/dist/src/tools/web-fetch.test.js +388 -8
  267. package/dist/src/tools/web-fetch.test.js.map +1 -1
  268. package/dist/src/tools/web-search.d.ts +4 -3
  269. package/dist/src/tools/web-search.js +10 -7
  270. package/dist/src/tools/web-search.js.map +1 -1
  271. package/dist/src/tools/write-file.d.ts +1 -1
  272. package/dist/src/tools/write-file.js +3 -2
  273. package/dist/src/tools/write-file.js.map +1 -1
  274. package/dist/src/tools/write-file.test.js +0 -1
  275. package/dist/src/tools/write-file.test.js.map +1 -1
  276. package/dist/src/tools/write-todos.d.ts +3 -8
  277. package/dist/src/tools/write-todos.js +14 -7
  278. package/dist/src/tools/write-todos.js.map +1 -1
  279. package/dist/src/tools/write-todos.test.js +2 -2
  280. package/dist/src/tools/write-todos.test.js.map +1 -1
  281. package/dist/src/utils/bfsFileSearch.js +3 -2
  282. package/dist/src/utils/bfsFileSearch.js.map +1 -1
  283. package/dist/src/utils/debugLogger.d.ts +25 -0
  284. package/dist/src/utils/debugLogger.js +33 -0
  285. package/dist/src/utils/debugLogger.js.map +1 -0
  286. package/dist/src/utils/debugLogger.test.d.ts +6 -0
  287. package/dist/src/utils/debugLogger.test.js +67 -0
  288. package/dist/src/utils/debugLogger.test.js.map +1 -0
  289. package/dist/src/utils/delay.d.ts +16 -0
  290. package/dist/src/utils/delay.js +43 -0
  291. package/dist/src/utils/delay.js.map +1 -0
  292. package/dist/src/utils/delay.test.d.ts +6 -0
  293. package/dist/src/utils/delay.test.js +88 -0
  294. package/dist/src/utils/delay.test.js.map +1 -0
  295. package/dist/src/utils/editCorrector.js +6 -10
  296. package/dist/src/utils/editCorrector.js.map +1 -1
  297. package/dist/src/utils/editCorrector.test.js +3 -5
  298. package/dist/src/utils/editCorrector.test.js.map +1 -1
  299. package/dist/src/utils/editor.js +33 -37
  300. package/dist/src/utils/editor.js.map +1 -1
  301. package/dist/src/utils/editor.test.js +1 -0
  302. package/dist/src/utils/editor.test.js.map +1 -1
  303. package/dist/src/utils/environmentContext.js +0 -33
  304. package/dist/src/utils/environmentContext.js.map +1 -1
  305. package/dist/src/utils/environmentContext.test.js +0 -34
  306. package/dist/src/utils/environmentContext.test.js.map +1 -1
  307. package/dist/src/utils/fetch.d.ts +1 -0
  308. package/dist/src/utils/fetch.js +9 -0
  309. package/dist/src/utils/fetch.js.map +1 -1
  310. package/dist/src/utils/fileUtils.d.ts +4 -0
  311. package/dist/src/utils/fileUtils.js +34 -2
  312. package/dist/src/utils/fileUtils.js.map +1 -1
  313. package/dist/src/utils/fileUtils.test.js +12 -1
  314. package/dist/src/utils/fileUtils.test.js.map +1 -1
  315. package/dist/src/utils/formatters.d.ts +1 -0
  316. package/dist/src/utils/formatters.js +2 -1
  317. package/dist/src/utils/formatters.js.map +1 -1
  318. package/dist/src/utils/formatters.test.d.ts +6 -0
  319. package/dist/src/utils/formatters.test.js +26 -0
  320. package/dist/src/utils/formatters.test.js.map +1 -0
  321. package/dist/src/utils/getFolderStructure.js +2 -1
  322. package/dist/src/utils/getFolderStructure.js.map +1 -1
  323. package/dist/src/utils/getFolderStructure.test.js +7 -6
  324. package/dist/src/utils/getFolderStructure.test.js.map +1 -1
  325. package/dist/src/utils/gitIgnoreParser.js +7 -6
  326. package/dist/src/utils/gitIgnoreParser.js.map +1 -1
  327. package/dist/src/utils/gitIgnoreParser.test.js +30 -0
  328. package/dist/src/utils/gitIgnoreParser.test.js.map +1 -1
  329. package/dist/src/utils/installationManager.test.js +2 -1
  330. package/dist/src/utils/installationManager.test.js.map +1 -1
  331. package/dist/src/utils/llm-edit-fixer.js +5 -4
  332. package/dist/src/utils/llm-edit-fixer.js.map +1 -1
  333. package/dist/src/utils/memoryDiscovery.d.ts +3 -1
  334. package/dist/src/utils/memoryDiscovery.js +14 -12
  335. package/dist/src/utils/memoryDiscovery.js.map +1 -1
  336. package/dist/src/utils/memoryDiscovery.test.js +136 -36
  337. package/dist/src/utils/memoryDiscovery.test.js.map +1 -1
  338. package/dist/src/utils/memoryImportProcessor.js +3 -2
  339. package/dist/src/utils/memoryImportProcessor.js.map +1 -1
  340. package/dist/src/utils/nextSpeakerChecker.js +2 -1
  341. package/dist/src/utils/nextSpeakerChecker.js.map +1 -1
  342. package/dist/src/utils/pathCorrector.d.ts +25 -0
  343. package/dist/src/utils/pathCorrector.js +33 -0
  344. package/dist/src/utils/pathCorrector.js.map +1 -0
  345. package/dist/src/utils/pathCorrector.test.d.ts +6 -0
  346. package/dist/src/utils/pathCorrector.test.js +83 -0
  347. package/dist/src/utils/pathCorrector.test.js.map +1 -0
  348. package/dist/src/utils/retry.d.ts +3 -1
  349. package/dist/src/utils/retry.js +44 -33
  350. package/dist/src/utils/retry.js.map +1 -1
  351. package/dist/src/utils/retry.test.js +102 -40
  352. package/dist/src/utils/retry.test.js.map +1 -1
  353. package/dist/src/utils/safeJsonStringify.d.ts +4 -4
  354. package/dist/src/utils/safeJsonStringify.js +31 -7
  355. package/dist/src/utils/safeJsonStringify.js.map +1 -1
  356. package/dist/src/utils/shell-utils.d.ts +15 -2
  357. package/dist/src/utils/shell-utils.js +354 -137
  358. package/dist/src/utils/shell-utils.js.map +1 -1
  359. package/dist/src/utils/shell-utils.test.js +154 -60
  360. package/dist/src/utils/shell-utils.test.js.map +1 -1
  361. package/dist/src/utils/systemEncoding.js +5 -4
  362. package/dist/src/utils/systemEncoding.js.map +1 -1
  363. package/dist/src/utils/tool-utils.d.ts +2 -2
  364. package/dist/src/utils/tool-utils.js +15 -6
  365. package/dist/src/utils/tool-utils.js.map +1 -1
  366. package/dist/src/utils/tool-utils.test.js +8 -0
  367. package/dist/src/utils/tool-utils.test.js.map +1 -1
  368. package/dist/src/utils/userAccountManager.js +5 -4
  369. package/dist/src/utils/userAccountManager.js.map +1 -1
  370. package/dist/src/utils/userAccountManager.test.js +2 -1
  371. package/dist/src/utils/userAccountManager.test.js.map +1 -1
  372. package/dist/src/utils/workspaceContext.js +2 -1
  373. package/dist/src/utils/workspaceContext.js.map +1 -1
  374. package/dist/tsconfig.tsbuildinfo +1 -1
  375. package/package.json +5 -3
  376. package/dist/src/core/subagent.d.ts +0 -236
  377. package/dist/src/core/subagent.js +0 -482
  378. package/dist/src/core/subagent.js.map +0 -1
  379. package/dist/src/core/subagent.test.js +0 -530
  380. package/dist/src/core/subagent.test.js.map +0 -1
  381. /package/dist/src/{core/subagent.test.d.ts → output/stream-json-formatter.test.d.ts} +0 -0
@@ -6,17 +6,12 @@
6
6
  import path from 'node:path';
7
7
  import fs from 'node:fs';
8
8
  import os from 'node:os';
9
- import { LSTool } from '../tools/ls.js';
10
- import { EditTool } from '../tools/edit.js';
11
- import { GlobTool } from '../tools/glob.js';
12
- import { GrepTool } from '../tools/grep.js';
13
- import { ReadFileTool } from '../tools/read-file.js';
14
- import { ReadManyFilesTool } from '../tools/read-many-files.js';
15
- import { ShellTool } from '../tools/shell.js';
16
- import { WriteFileTool } from '../tools/write-file.js';
9
+ import { EDIT_TOOL_NAME, GLOB_TOOL_NAME, GREP_TOOL_NAME, MEMORY_TOOL_NAME, READ_FILE_TOOL_NAME, READ_MANY_FILES_TOOL_NAME, SHELL_TOOL_NAME, WRITE_FILE_TOOL_NAME, } from '../tools/tool-names.js';
17
10
  import process from 'node:process';
18
11
  import { isGitRepository } from '../utils/gitUtils.js';
19
- import { MemoryTool, CELL_CONFIG_DIR } from '../tools/memoryTool.js';
12
+ import { CodebaseInvestigatorAgent } from '../agents/codebase-investigator.js';
13
+ import { CELL_DIR } from '../utils/paths.js';
14
+ import { debugLogger } from '../utils/debugLogger.js';
20
15
  export function resolvePathFromEnv(envVar) {
21
16
  // Handle the case where the environment variable is not set, empty, or just whitespace.
22
17
  const trimmedEnvVar = envVar?.trim();
@@ -45,7 +40,7 @@ export function resolvePathFromEnv(envVar) {
45
40
  }
46
41
  catch (error) {
47
42
  // If os.homedir() fails, we catch the error instead of crashing.
48
- console.warn(`Could not resolve home directory for path: ${trimmedEnvVar}`, error);
43
+ debugLogger.warn(`Could not resolve home directory for path: ${trimmedEnvVar}`, error);
49
44
  // Return null to indicate the path resolution failed.
50
45
  return { isSwitch: false, value: null, isDisabled: false };
51
46
  }
@@ -57,11 +52,11 @@ export function resolvePathFromEnv(envVar) {
57
52
  isDisabled: false,
58
53
  };
59
54
  }
60
- export function getCoreSystemPrompt(userMemory) {
55
+ export function getCoreSystemPrompt(config, userMemory) {
61
56
  // A flag to indicate whether the system prompt override is active.
62
57
  let systemMdEnabled = false;
63
58
  // The default path for the system prompt file. This can be overridden.
64
- let systemMdPath = path.resolve(path.join(CELL_CONFIG_DIR, 'system.md'));
59
+ let systemMdPath = path.resolve(path.join(CELL_DIR, 'system.md'));
65
60
  // Resolve the environment variable to get either a path or a switch value.
66
61
  const systemMdResolution = resolvePathFromEnv(process.env['CELL_SYSTEM_MD']);
67
62
  // Proceed only if the environment variable is set and is not disabled.
@@ -76,10 +71,13 @@ export function getCoreSystemPrompt(userMemory) {
76
71
  throw new Error(`missing system prompt file '${systemMdPath}'`);
77
72
  }
78
73
  }
74
+ const enableCodebaseInvestigator = config
75
+ .getToolRegistry()
76
+ .getAllToolNames()
77
+ .includes(CodebaseInvestigatorAgent.name);
79
78
  const basePrompt = systemMdEnabled
80
79
  ? fs.readFileSync(systemMdPath, 'utf8')
81
- : `
82
- You are an interactive CLI agent specializing in software engineering tasks. Your primary goal is to help users safely and efficiently, adhering strictly to the following instructions and utilizing your available tools.
80
+ : `You are an interactive CLI agent specializing in software engineering tasks. Your primary goal is to help users safely and efficiently, adhering strictly to the following instructions and utilizing your available tools.
83
81
 
84
82
  # Core Mandates
85
83
 
@@ -91,23 +89,32 @@ You are an interactive CLI agent specializing in software engineering tasks. You
91
89
  - **Proactiveness:** Fulfill the user's request thoroughly. When adding features or fixing bugs, this includes adding tests to ensure quality. Consider all created files, especially tests, to be permanent artifacts unless the user says otherwise.
92
90
  - **Confirm Ambiguity/Expansion:** Do not take significant actions beyond the clear scope of the request without confirming with the user. If asked *how* to do something, explain first, don't just do it.
93
91
  - **Explaining Changes:** After completing a code modification or file operation *do not* provide summaries unless asked.
94
- - **Path Construction:** Before using any file system tool (e.g., ${ReadFileTool.Name}' or '${WriteFileTool.Name}'), you must construct the full absolute path for the file_path argument. Always combine the absolute path of the project's root directory with the file's path relative to the root. For example, if the project root is /path/to/project/ and the file is foo/bar/baz.txt, the final path you must use is /path/to/project/foo/bar/baz.txt. If the user provides a relative path, you must resolve it against the root directory to create an absolute path.
92
+ - **Path Construction:** Before using any file system tool (e.g., ${READ_FILE_TOOL_NAME}' or '${WRITE_FILE_TOOL_NAME}'), you must construct the full absolute path for the file_path argument. Always combine the absolute path of the project's root directory with the file's path relative to the root. For example, if the project root is /path/to/project/ and the file is foo/bar/baz.txt, the final path you must use is /path/to/project/foo/bar/baz.txt. If the user provides a relative path, you must resolve it against the root directory to create an absolute path.
95
93
  - **Do Not revert changes:** Do not revert changes to the codebase unless asked to do so by the user. Only revert changes made by you if they have resulted in an error or if the user has explicitly asked you to revert the changes.
96
94
 
95
+
97
96
  # Primary Workflows
98
97
 
99
98
  ## Software Engineering Tasks
100
99
  When requested to perform tasks like fixing bugs, adding features, refactoring, or explaining code, follow this sequence:
101
- 1. **Understand:** Think about the user's request and the relevant codebase context. Use '${GrepTool.Name}' and '${GlobTool.Name}' search tools extensively (in parallel if independent) to understand file structures, existing code patterns, and conventions. Use '${ReadFileTool.Name}' and '${ReadManyFilesTool.Name}' to understand context and validate any assumptions you may have.
102
- 2. **Plan:** Build a coherent and grounded (based on the understanding in step 1) plan for how you intend to resolve the user's task. Share an extremely concise yet clear plan with the user if it would help the user understand your thought process. As part of the plan, you should use an iterative development process that includes writing unit tests to verify your changes. Use output logs or debug statements as part of this process to arrive at a solution.
103
- 3. **Implement:** Use the available tools (e.g., '${EditTool.Name}', '${WriteFileTool.Name}' '${ShellTool.Name}' ...) to act on the plan, strictly adhering to the project's established conventions (detailed under 'Core Mandates').
100
+ ${(function () {
101
+ if (enableCodebaseInvestigator) {
102
+ return `
103
+ 1. **Understand & Strategize:** Think about the user's request and the relevant codebase context. When the task involves **complex refactoring, codebase exploration or system-wide analysis**, your **first and primary tool** must be '${CodebaseInvestigatorAgent.name}'. Use it to build a comprehensive understanding of the code, its structure, and dependencies. For **simple, targeted searches** (like finding a specific function name, file path, or variable declaration), you should use '${GREP_TOOL_NAME}' or '${GLOB_TOOL_NAME}' directly.
104
+ 2. **Plan:** Build a coherent and grounded (based on the understanding in step 1) plan for how you intend to resolve the user's task. If '${CodebaseInvestigatorAgent.name}' was used, do not ignore the output of '${CodebaseInvestigatorAgent.name}', you must use it as the foundation of your plan. Share an extremely concise yet clear plan with the user if it would help the user understand your thought process. As part of the plan, you should use an iterative development process that includes writing unit tests to verify your changes. Use output logs or debug statements as part of this process to arrive at a solution.`;
105
+ }
106
+ return `
107
+ 1. **Understand:** Think about the user's request and the relevant codebase context. Use '${GREP_TOOL_NAME}' and '${GLOB_TOOL_NAME}' search tools extensively (in parallel if independent) to understand file structures, existing code patterns, and conventions. Use '${READ_FILE_TOOL_NAME}' and '${READ_MANY_FILES_TOOL_NAME}' to understand context and validate any assumptions you may have.
108
+ 2. **Plan:** Build a coherent and grounded (based on the understanding in step 1) plan for how you intend to resolve the user's task. Share an extremely concise yet clear plan with the user if it would help the user understand your thought process. As part of the plan, you should use an iterative development process that includes writing unit tests to verify your changes. Use output logs or debug statements as part of this process to arrive at a solution.`;
109
+ })()}
110
+ 3. **Implement:** Use the available tools (e.g., '${EDIT_TOOL_NAME}', '${WRITE_FILE_TOOL_NAME}' '${SHELL_TOOL_NAME}' ...) to act on the plan, strictly adhering to the project's established conventions (detailed under 'Core Mandates').
104
111
  4. **Verify (Tests):** If applicable and feasible, verify the changes using the project's testing procedures. Identify the correct test commands and frameworks by examining 'README' files, build/package configuration (e.g., 'package.json'), or existing test execution patterns. NEVER assume standard test commands.
105
112
  5. **Verify (Standards):** VERY IMPORTANT: After making code changes, execute the project-specific build, linting and type-checking commands (e.g., 'tsc', 'npm run lint', 'ruff check .') that you have identified for this project (or obtained from the user). This ensures code quality and adherence to standards. If unsure about these commands, you can ask the user if they'd like you to run them and if so how to.
106
113
  6. **Finalize:** After all verification passes, consider the task complete. Do not remove or revert any changes or created files (like tests). Await the user's next instruction.
107
114
 
108
115
  ## New Applications
109
116
 
110
- **Goal:** Autonomously implement and deliver a visually appealing, substantially complete, and functional prototype. Utilize all tools at your disposal to implement the application. Some tools you may especially find useful are '${WriteFileTool.Name}', '${EditTool.Name}' and '${ShellTool.Name}'.
117
+ **Goal:** Autonomously implement and deliver a visually appealing, substantially complete, and functional prototype. Utilize all tools at your disposal to implement the application. Some tools you may especially find useful are '${WRITE_FILE_TOOL_NAME}', '${EDIT_TOOL_NAME}' and '${SHELL_TOOL_NAME}'.
111
118
 
112
119
  1. **Understand Requirements:** Analyze the user's request to identify core features, desired user experience (UX), visual aesthetic, application type/platform (web, mobile, desktop, CLI, library, 2D or 3D game), and explicit constraints. If critical information for initial planning is missing or ambiguous, ask concise, targeted clarification questions.
113
120
  2. **Propose Plan:** Formulate an internal development plan. Present a clear, concise, high-level summary to the user. This summary must effectively convey the application's type and core purpose, key technologies to be used, main features and how users will interact with them, and the general approach to the visual design and user experience (UX) with the intention of delivering something beautiful, modern, and polished, especially for UI-based applications. For applications requiring visual assets (like games or rich UIs), briefly describe the strategy for sourcing or generating placeholders (e.g., simple geometric shapes, procedurally generated patterns, or open-source assets if feasible and licenses permit) to ensure a visually complete initial prototype. Ensure this information is presented in a structured and easily digestible manner.
@@ -120,11 +127,29 @@ When requested to perform tasks like fixing bugs, adding features, refactoring,
120
127
  - **3d Games:** HTML/CSS/JavaScript with Three.js.
121
128
  - **2d Games:** HTML/CSS/JavaScript.
122
129
  3. **User Approval:** Obtain user approval for the proposed plan.
123
- 4. **Implementation:** Autonomously implement each feature and design element per the approved plan utilizing all available tools. When starting ensure you scaffold the application using '${ShellTool.Name}' for commands like 'npm init', 'npx create-react-app'. Aim for full scope completion. Proactively create or source necessary placeholder assets (e.g., images, icons, game sprites, 3D models using basic primitives if complex assets are not generatable) to ensure the application is visually coherent and functional, minimizing reliance on the user to provide these. If the model can generate simple assets (e.g., a uniformly colored square sprite, a simple 3D cube), it should do so. Otherwise, it should clearly indicate what kind of placeholder has been used and, if absolutely necessary, what the user might replace it with. Use placeholders only when essential for progress, intending to replace them with more refined versions or instruct the user on replacement during polishing if generation is not feasible.
130
+ 4. **Implementation:** Autonomously implement each feature and design element per the approved plan utilizing all available tools. When starting ensure you scaffold the application using '${SHELL_TOOL_NAME}' for commands like 'npm init', 'npx create-react-app'. Aim for full scope completion. Proactively create or source necessary placeholder assets (e.g., images, icons, game sprites, 3D models using basic primitives if complex assets are not generatable) to ensure the application is visually coherent and functional, minimizing reliance on the user to provide these. If the model can generate simple assets (e.g., a uniformly colored square sprite, a simple 3D cube), it should do so. Otherwise, it should clearly indicate what kind of placeholder has been used and, if absolutely necessary, what the user might replace it with. Use placeholders only when essential for progress, intending to replace them with more refined versions or instruct the user on replacement during polishing if generation is not feasible.
124
131
  5. **Verify:** Review work against the original request, the approved plan. Fix bugs, deviations, and all placeholders where feasible, or ensure placeholders are visually adequate for a prototype. Ensure styling, interactions, produce a high-quality, functional and beautiful prototype aligned with design goals. Finally, but MOST importantly, build the application and ensure there are no compile errors.
125
132
  6. **Solicit Feedback:** If still applicable, provide instructions on how to start the application and request user feedback on the prototype.
126
133
 
127
134
  # Operational Guidelines
135
+ ${(function () {
136
+ if (config.getEnableShellOutputEfficiency()) {
137
+ const tempDir = config.storage.getProjectTempDir();
138
+ return `
139
+ ## Shell tool output token efficiency:
140
+
141
+ IT IS CRITICAL TO FOLLOW THESE GUIDELINES TO AVOID EXCESSIVE TOKEN CONSUMPTION.
142
+
143
+ - Always prefer command flags that reduce output verbosity when using '${SHELL_TOOL_NAME}'.
144
+ - Aim to minimize tool output tokens while still capturing necessary information.
145
+ - If a command is expected to produce a lot of output, use quiet or silent flags where available and appropriate.
146
+ - Always consider the trade-off between output verbosity and the need for information. If a command's full output is essential for understanding the result, avoid overly aggressive quieting that might obscure important details.
147
+ - If a command does not have quiet/silent flags or for commands with potentially long output that may not be useful, redirect stdout and stderr to temp files in the project's temporary directory: ${tempDir}. For example: 'command > ${path.posix.join(tempDir, 'out.log')} 2> ${path.posix.join(tempDir, 'err.log')}'.
148
+ - After the command runs, inspect the temp files (e.g. '${path.posix.join(tempDir, 'out.log')}' and '${path.posix.join(tempDir, 'err.log')}') using commands like 'grep', 'tail', 'head', ... (or platform equivalents). Remove the temp files when done.
149
+ `;
150
+ }
151
+ return '';
152
+ })()}
128
153
 
129
154
  ## Tone and Style (CLI Interaction)
130
155
  - **Concise & Direct:** Adopt a professional, direct, and concise tone suitable for a CLI environment.
@@ -137,16 +162,23 @@ When requested to perform tasks like fixing bugs, adding features, refactoring,
137
162
  - **Quality:** Always deliver production quality code, based on the spacific languaje best practices, SOLID and KISS principles.
138
163
 
139
164
  ## Security and Safety Rules
140
- - **Explain Critical Commands:** Before executing commands with '${ShellTool.Name}' that modify the file system, codebase, or system state, you *must* provide a brief explanation of the command's purpose and potential impact. Prioritize user understanding and safety. You should not ask permission to use the tool; the user will be presented with a confirmation dialogue upon use (you do not need to tell them this).
165
+ - **Explain Critical Commands:** Before executing commands with '${SHELL_TOOL_NAME}' that modify the file system, codebase, or system state, you *must* provide a brief explanation of the command's purpose and potential impact. Prioritize user understanding and safety. You should not ask permission to use the tool; the user will be presented with a confirmation dialogue upon use (you do not need to tell them this).
141
166
  - **Security First:** Always apply security best practices. Never introduce code that exposes, logs, or commits secrets, API keys, or other sensitive information.
142
167
 
143
168
  ## Tool Usage
144
- - **File Paths:** Always use absolute paths when referring to files with tools like '${ReadFileTool.Name}' or '${WriteFileTool.Name}'. Relative paths are not supported. You must provide an absolute path.
169
+ - **File Paths:** Always use absolute paths when referring to files with tools like '${READ_FILE_TOOL_NAME}' or '${WRITE_FILE_TOOL_NAME}'. Relative paths are not supported. You must provide an absolute path.
145
170
  - **Parallelism:** Execute multiple independent tool calls in parallel when feasible (i.e. searching the codebase).
146
- - **Command Execution:** Use the '${ShellTool.Name}' tool for running shell commands, remembering the safety rule to explain modifying commands first.
171
+ - **Command Execution:** Use the '${SHELL_TOOL_NAME}' tool for running shell commands, remembering the safety rule to explain modifying commands first.
147
172
  - **Background Processes:** Use background processes (via \`&\`) for commands that are unlikely to stop on their own, e.g. \`node server.js &\`. If unsure, ask the user.
148
- - **Interactive Commands:** Try to avoid shell commands that are likely to require user interaction (e.g. \`git rebase -i\`). Use non-interactive versions of commands (e.g. \`npm init -y\` instead of \`npm init\`) when available, and otherwise remind the user that interactive shell commands are not supported and may cause hangs until canceled by the user.
149
- - **Remembering Facts:** Use the '${MemoryTool.Name}' tool to remember specific, *user-related* facts or preferences when the user explicitly asks, or when they state a clear, concise piece of information that would help personalize or streamline *your future interactions with them* (e.g., preferred coding style, common project paths they use, personal tool aliases). This tool is for user-specific information that should persist across sessions. Do *not* use it for general project context or information. If unsure whether to save something, you can ask the user, "Should I remember that for you?"
173
+ ${(function () {
174
+ if (!config.isInteractiveShellEnabled()) {
175
+ return `- **Interactive Commands:** Some commands are interactive, meaning they can accept user input during their execution (e.g. ssh, vim). Only execute non-interactive commands. Use non-interactive versions of commands (e.g. \`npm init -y\` instead of \`npm init\`) when available. Interactive shell commands are not supported and may cause hangs until canceled by the user.`;
176
+ }
177
+ else {
178
+ return `- **Interactive Commands:** Prefer non-interactive commands when it makes sense; however, some commands are only interactive and expect user input during their execution (e.g. ssh, vim). If you choose to execute an interactive command consider letting the user know they can press \`ctrl + f\` to focus into the shell to provide input.`;
179
+ }
180
+ })()}
181
+ - **Remembering Facts:** Use the '${MEMORY_TOOL_NAME}' tool to remember specific, *user-related* facts or preferences when the user explicitly asks, or when they state a clear, concise piece of information that would help personalize or streamline *your future interactions with them* (e.g., preferred coding style, common project paths they use, personal tool aliases). This tool is for user-specific information that should persist across sessions. Do *not* use it for general project context or information. If unsure whether to save something, you can ask the user, "Should I remember that for you?"
150
182
  - **Respect User Confirmations:** Most tool calls (also denoted as 'function calls') will first require confirmation from the user, where they will either approve or cancel the function call. If a user cancels a function call, respect their choice and do _not_ try to make the function call again. It is okay to request the tool call again _only_ if the user requests that same tool call on a subsequent prompt. When a user cancels a function call, assume best intentions from the user and consider inquiring if they prefer any alternative paths forward.
151
183
 
152
184
  ## Interaction Details
@@ -199,105 +231,8 @@ ${(function () {
199
231
  return '';
200
232
  })()}
201
233
 
202
- # Examples (Illustrating Tone and Workflow)
203
- <example>
204
- user: 1 + 2
205
- model: 3
206
- </example>
207
-
208
- <example>
209
- user: is 13 a prime number?
210
- model: true
211
- </example>
212
-
213
- <example>
214
- user: list files here.
215
- model: [tool_call: ${LSTool.Name} for path '/path/to/project']
216
- </example>
217
-
218
- <example>
219
- user: start the server implemented in server.js
220
- model: [tool_call: ${ShellTool.Name} for 'node server.js &' because it must run in the background]
221
- </example>
222
-
223
- <example>
224
- user: Refactor the auth logic in src/auth.py to use the requests library instead of urllib.
225
- model: Okay, I can refactor 'src/auth.py'.
226
- First, I'll analyze the code and check for a test safety net before planning any changes.
227
- [tool_call: ${GlobTool.Name} for path 'tests/test_auth.py']
228
- [tool_call: ${ReadFileTool.Name} for absolute_path '/path/to/tests/test_auth.py']
229
- (After analysis)
230
- Great, 'tests/test_auth.py' exists and covers the core authentication logic. With this safety net in place, I can safely plan the refactoring.
231
- I'll also confirm 'requests' is a dependency.
232
- [tool_call: ${ReadFileTool.Name} for absolute_path '/path/to/requirements.txt']
233
- (After analysis)
234
- Looks good, 'requests' is available.
235
-
236
- Here's the plan:
237
- 1. Replace the 'urllib' calls with 'requests'.
238
- 2. Add proper 'try...except' error handling for the new network calls.
239
- 3. Remove the old 'urllib' import.
240
- 4. Run the project's linter and tests to verify the changes.
241
-
242
- Should I proceed?
243
- user: Yes
244
- model:
245
- [tool_call: ${WriteFileTool.Name} or ${EditTool.Name} to apply the refactoring to 'src/auth.py']
246
- Refactoring complete. Running verification...
247
- [tool_call: ${ShellTool.Name} for 'ruff check src/auth.py && pytest']
248
- (After verification passes)
249
- All checks passed. This is a stable checkpoint.
250
- ${(function () {
251
- if (isGitRepository(process.cwd())) {
252
- return `Would you like me to write a commit message and commit these changes?`;
253
- }
254
- return '';
255
- })()}
256
- </example>
257
-
258
- <example>
259
- user: Delete the temp directory.
260
- model: I can run \`rm -rf /path/to/project/temp\`. This will permanently delete the directory and all its contents.
261
- </example>
262
-
263
- <example>
264
- user: Write tests for someFile.ts
265
- model:
266
- Okay, I can write those tests. First, I'll read \`someFile.ts\` to understand its functionality.
267
- [tool_call: ${ReadFileTool.Name} for absolute_path '/path/to/someFile.ts' or use ${GlobTool.Name} to find \`someFile.ts\` if its location is unknown]
268
- Now I'll look for existing or related test files to understand current testing conventions and dependencies.
269
- [tool_call: ${ReadManyFilesTool.Name} for paths ['**/*.test.ts', 'src/**/*.spec.ts'] assuming someFile.ts is in the src directory]
270
- (After reviewing existing tests and the file content)
271
- [tool_call: ${WriteFileTool.Name} to create /path/to/someFile.test.ts with the test code]
272
- I've written the tests. Now I'll run the project's test command to verify them.
273
- [tool_call: ${ShellTool.Name} for 'npm run test']
274
- </example>
275
-
276
- <example>
277
- user: How do I update the user's profile information in this system?
278
- model:
279
- I'm not immediately sure how user profile information is updated. I'll search the codebase for terms like 'UserProfile', 'updateProfile', or 'editUser' to find relevant files or API endpoints.
280
- [tool_call: ${GrepTool.Name} for pattern 'UserProfile|updateProfile|editUser']
281
- (After reviewing search results, assuming a relevant file like '/path/to/UserProfileService.java' was found)
282
- Okay, \`/path/to/UserProfileService.java\` seems like the most relevant file. I'll read its content to understand how updates are handled.
283
- [tool_call: ${ReadFileTool.Name} for absolute_path '/path/to/UserProfileService.java']
284
- (After reading the file)
285
- It appears the \`updateUserProfile\` method in \`UserProfileService.java\` is responsible for this. It expects a user ID and a \`UserProfileDTO\` object...
286
- </example>
287
-
288
- <example>
289
- user: Where are all the 'app.config' files in this project? I need to check their settings.
290
- model:
291
- [tool_call: ${GlobTool.Name} for pattern '**/app.config']
292
- (Assuming GlobTool returns a list of paths like ['/path/to/moduleA/app.config', '/path/to/moduleB/app.config'])
293
- I found the following 'app.config' files:
294
- - /path/to/moduleA/app.config
295
- - /path/to/moduleB/app.config
296
- To help you check their settings, I can read their contents. Which one would you like to start with, or should I read all of them?
297
- </example>
298
-
299
234
  # Final Reminder
300
- Your core function is efficient and safe assistance. Balance extreme conciseness with the crucial need for clarity, especially regarding safety and potential system modifications. Always prioritize user control and project conventions. Never make assumptions about the contents of files; instead use '${ReadFileTool.Name}' or '${ReadManyFilesTool.Name}' to ensure you aren't making broad assumptions. Finally, you are an agent - please keep going until the user's query is completely resolved.
235
+ Your core function is efficient and safe assistance. Balance extreme conciseness with the crucial need for clarity, especially regarding safety and potential system modifications. Always prioritize user control and project conventions. Never make assumptions about the contents of files; instead use '${READ_FILE_TOOL_NAME}' or '${READ_MANY_FILES_TOOL_NAME}' to ensure you aren't making broad assumptions. Finally, you are an agent - please keep going until the user's query is completely resolved.
301
236
  `.trim();
302
237
  // if CELL_WRITE_SYSTEM_MD is set (and not 0|false), write base system prompt to file
303
238
  const writeSystemMdResolution = resolvePathFromEnv(process.env['CELL_WRITE_SYSTEM_MD']);
@@ -1 +1 @@
1
- {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../src/core/prompts.ts"],"names":[],"mappings":"AAAA;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AC,YAAY;YACd,CAAC,CAAC,uBAAuB,CAAC,KAAK,CAAC;QAElC,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC3D,EAAE,CAAC,aAAa,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IAC1C,CAAC;IAED,MAAM,YAAY,GAChB,UAAU,IAAI,UAAU,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;QACxC,CAAC,CAAC,cAAc,UAAU,CAAC,IAAI,EAAE,EAAE;QACnC,CAAC,CAAC,EAAE,CAAC;IAET,OAAO,GAAG,UAAU,GAAG,YAAY,EAAE,CAAC;AACxC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwDR,CAAC,IAAI,EAAE,CAAC;AACT,CAAC"}
@@ -9,7 +9,8 @@ import { isGitRepository } from '../utils/gitUtils.js';
9
9
  import fs from 'node:fs';
10
10
  import os from 'node:os';
11
11
  import path from 'node:path';
12
- import { CELL_CONFIG_DIR } from '../tools/memoryTool.js';
12
+ import { CodebaseInvestigatorAgent } from '../agents/codebase-investigator.js';
13
+ import { CELL_DIR } from '../utils/paths.js';
13
14
  // Mock tool names if they are dynamically generated or complex
14
15
  vi.mock('../tools/ls', () => ({ LSTool: { Name: 'list_directory' } }));
15
16
  vi.mock('../tools/edit', () => ({ EditTool: { Name: 'replace' } }));
@@ -25,33 +26,48 @@ vi.mock('../tools/shell', () => ({
25
26
  vi.mock('../tools/write-file', () => ({
26
27
  WriteFileTool: { Name: 'write_file' },
27
28
  }));
29
+ vi.mock('../agents/codebase-investigator.js', () => ({
30
+ CodebaseInvestigatorAgent: { name: 'codebase_investigator' },
31
+ }));
28
32
  vi.mock('../utils/gitUtils', () => ({
29
33
  isGitRepository: vi.fn(),
30
34
  }));
31
35
  vi.mock('node:fs');
32
36
  describe('Core System Prompt (prompts.ts)', () => {
37
+ let mockConfig;
33
38
  beforeEach(() => {
34
39
  vi.resetAllMocks();
35
40
  vi.stubEnv('CELL_SYSTEM_MD', undefined);
36
41
  vi.stubEnv('CELL_WRITE_SYSTEM_MD', undefined);
42
+ mockConfig = {
43
+ getToolRegistry: vi.fn().mockReturnValue({
44
+ getAllToolNames: vi.fn().mockReturnValue([]),
45
+ }),
46
+ getEnableShellOutputEfficiency: vi.fn().mockReturnValue(true),
47
+ storage: {
48
+ getProjectTempDir: vi.fn().mockReturnValue('/tmp/project-temp'),
49
+ },
50
+ isInteractive: vi.fn().mockReturnValue(true),
51
+ isInteractiveShellEnabled: vi.fn().mockReturnValue(true),
52
+ };
37
53
  });
38
54
  it('should return the base prompt when no userMemory is provided', () => {
39
55
  vi.stubEnv('SANDBOX', undefined);
40
- const prompt = getCoreSystemPrompt();
56
+ const prompt = getCoreSystemPrompt(mockConfig, '');
41
57
  expect(prompt).not.toContain('---\n\n'); // Separator should not be present
42
58
  expect(prompt).toContain('You are an interactive CLI agent'); // Check for core content
43
59
  expect(prompt).toMatchSnapshot(); // Use snapshot for base prompt structure
44
60
  });
45
61
  it('should return the base prompt when userMemory is empty string', () => {
46
62
  vi.stubEnv('SANDBOX', undefined);
47
- const prompt = getCoreSystemPrompt('');
63
+ const prompt = getCoreSystemPrompt(mockConfig, '');
48
64
  expect(prompt).not.toContain('---\n\n');
49
65
  expect(prompt).toContain('You are an interactive CLI agent');
50
66
  expect(prompt).toMatchSnapshot();
51
67
  });
52
68
  it('should return the base prompt when userMemory is whitespace only', () => {
53
69
  vi.stubEnv('SANDBOX', undefined);
54
- const prompt = getCoreSystemPrompt(' \n \t ');
70
+ const prompt = getCoreSystemPrompt(mockConfig, ' \n \t ');
55
71
  expect(prompt).not.toContain('---\n\n');
56
72
  expect(prompt).toContain('You are an interactive CLI agent');
57
73
  expect(prompt).toMatchSnapshot();
@@ -60,14 +76,14 @@ describe('Core System Prompt (prompts.ts)', () => {
60
76
  vi.stubEnv('SANDBOX', undefined);
61
77
  const memory = 'This is custom user memory.\nBe extra polite.';
62
78
  const expectedSuffix = `\n\n---\n\n${memory}`;
63
- const prompt = getCoreSystemPrompt(memory);
79
+ const prompt = getCoreSystemPrompt(mockConfig, memory);
64
80
  expect(prompt.endsWith(expectedSuffix)).toBe(true);
65
81
  expect(prompt).toContain('You are an interactive CLI agent'); // Ensure base prompt follows
66
82
  expect(prompt).toMatchSnapshot(); // Snapshot the combined prompt
67
83
  });
68
84
  it('should include sandbox-specific instructions when SANDBOX env var is set', () => {
69
85
  vi.stubEnv('SANDBOX', 'true'); // Generic sandbox value
70
- const prompt = getCoreSystemPrompt();
86
+ const prompt = getCoreSystemPrompt(mockConfig);
71
87
  expect(prompt).toContain('# Sandbox');
72
88
  expect(prompt).not.toContain('# macOS Seatbelt');
73
89
  expect(prompt).not.toContain('# Outside of Sandbox');
@@ -75,15 +91,15 @@ describe('Core System Prompt (prompts.ts)', () => {
75
91
  });
76
92
  it('should include seatbelt-specific instructions when SANDBOX env var is "sandbox-exec"', () => {
77
93
  vi.stubEnv('SANDBOX', 'sandbox-exec');
78
- const prompt = getCoreSystemPrompt();
94
+ const prompt = getCoreSystemPrompt(mockConfig);
79
95
  expect(prompt).toContain('# macOS Seatbelt');
80
96
  expect(prompt).not.toContain('# Sandbox');
81
97
  expect(prompt).not.toContain('# Outside of Sandbox');
82
98
  expect(prompt).toMatchSnapshot();
83
99
  });
84
100
  it('should include non-sandbox instructions when SANDBOX env var is not set', () => {
85
- vi.stubEnv('SANDBOX', undefined); // Ensure it's not set
86
- const prompt = getCoreSystemPrompt();
101
+ vi.stubEnv('SANDBOX', undefined); // Ensure it\'s not set
102
+ const prompt = getCoreSystemPrompt(mockConfig);
87
103
  expect(prompt).toContain('# Outside of Sandbox');
88
104
  expect(prompt).not.toContain('# Sandbox');
89
105
  expect(prompt).not.toContain('# macOS Seatbelt');
@@ -92,27 +108,65 @@ describe('Core System Prompt (prompts.ts)', () => {
92
108
  it('should include git instructions when in a git repo', () => {
93
109
  vi.stubEnv('SANDBOX', undefined);
94
110
  vi.mocked(isGitRepository).mockReturnValue(true);
95
- const prompt = getCoreSystemPrompt();
111
+ const prompt = getCoreSystemPrompt(mockConfig);
96
112
  expect(prompt).toContain('# Git Repository');
97
113
  expect(prompt).toMatchSnapshot();
98
114
  });
99
115
  it('should not include git instructions when not in a git repo', () => {
100
116
  vi.stubEnv('SANDBOX', undefined);
101
117
  vi.mocked(isGitRepository).mockReturnValue(false);
102
- const prompt = getCoreSystemPrompt();
118
+ const prompt = getCoreSystemPrompt(mockConfig);
103
119
  expect(prompt).not.toContain('# Git Repository');
104
120
  expect(prompt).toMatchSnapshot();
105
121
  });
122
+ it('should return the interactive avoidance prompt when in non-interactive mode', () => {
123
+ vi.stubEnv('SANDBOX', undefined);
124
+ mockConfig.isInteractive = vi.fn().mockReturnValue(false);
125
+ const prompt = getCoreSystemPrompt(mockConfig, '');
126
+ expect(prompt).toContain('**Interactive Commands:**'); // Check for interactive prompt
127
+ expect(prompt).toMatchSnapshot(); // Use snapshot for base prompt structure
128
+ });
129
+ describe('with CodebaseInvestigator enabled', () => {
130
+ beforeEach(() => {
131
+ mockConfig = {
132
+ getToolRegistry: vi.fn().mockReturnValue({
133
+ getAllToolNames: vi
134
+ .fn()
135
+ .mockReturnValue([CodebaseInvestigatorAgent.name]),
136
+ }),
137
+ getEnableShellOutputEfficiency: vi.fn().mockReturnValue(true),
138
+ storage: {
139
+ getProjectTempDir: vi.fn().mockReturnValue('/tmp/project-temp'),
140
+ },
141
+ isInteractive: vi.fn().mockReturnValue(false),
142
+ isInteractiveShellEnabled: vi.fn().mockReturnValue(false),
143
+ };
144
+ });
145
+ it('should include CodebaseInvestigator instructions in the prompt', () => {
146
+ const prompt = getCoreSystemPrompt(mockConfig);
147
+ expect(prompt).toContain(`your **first and primary tool** must be '${CodebaseInvestigatorAgent.name}'`);
148
+ expect(prompt).toContain(`do not ignore the output of '${CodebaseInvestigatorAgent.name}'`);
149
+ expect(prompt).not.toContain("Use 'search_file_content' and 'glob' search tools extensively");
150
+ });
151
+ });
152
+ describe('with CodebaseInvestigator disabled', () => {
153
+ // No beforeEach needed, will use the default from the parent describe
154
+ it('should include standard tool instructions in the prompt', () => {
155
+ const prompt = getCoreSystemPrompt(mockConfig);
156
+ expect(prompt).not.toContain(`your **first and primary tool** must be '${CodebaseInvestigatorAgent.name}'`);
157
+ expect(prompt).toContain("Use 'search_file_content' and 'glob' search tools extensively");
158
+ });
159
+ });
106
160
  describe('CELL_SYSTEM_MD environment variable', () => {
107
161
  it('should use default prompt when CELL_SYSTEM_MD is "false"', () => {
108
162
  vi.stubEnv('CELL_SYSTEM_MD', 'false');
109
- const prompt = getCoreSystemPrompt();
163
+ const prompt = getCoreSystemPrompt(mockConfig);
110
164
  expect(fs.readFileSync).not.toHaveBeenCalled();
111
165
  expect(prompt).not.toContain('custom system prompt');
112
166
  });
113
167
  it('should use default prompt when CELL_SYSTEM_MD is "0"', () => {
114
168
  vi.stubEnv('CELL_SYSTEM_MD', '0');
115
- const prompt = getCoreSystemPrompt();
169
+ const prompt = getCoreSystemPrompt(mockConfig);
116
170
  expect(fs.readFileSync).not.toHaveBeenCalled();
117
171
  expect(prompt).not.toContain('custom system prompt');
118
172
  });
@@ -120,23 +174,23 @@ describe('Core System Prompt (prompts.ts)', () => {
120
174
  const customPath = '/non/existent/path/system.md';
121
175
  vi.stubEnv('CELL_SYSTEM_MD', customPath);
122
176
  vi.mocked(fs.existsSync).mockReturnValue(false);
123
- expect(() => getCoreSystemPrompt()).toThrow(`missing system prompt file '${path.resolve(customPath)}'`);
177
+ expect(() => getCoreSystemPrompt(mockConfig)).toThrow(`missing system prompt file '${path.resolve(customPath)}'`);
124
178
  });
125
179
  it('should read from default path when CELL_SYSTEM_MD is "true"', () => {
126
- const defaultPath = path.resolve(path.join(CELL_CONFIG_DIR, 'system.md'));
180
+ const defaultPath = path.resolve(path.join(CELL_DIR, 'system.md'));
127
181
  vi.stubEnv('CELL_SYSTEM_MD', 'true');
128
182
  vi.mocked(fs.existsSync).mockReturnValue(true);
129
183
  vi.mocked(fs.readFileSync).mockReturnValue('custom system prompt');
130
- const prompt = getCoreSystemPrompt();
184
+ const prompt = getCoreSystemPrompt(mockConfig);
131
185
  expect(fs.readFileSync).toHaveBeenCalledWith(defaultPath, 'utf8');
132
186
  expect(prompt).toBe('custom system prompt');
133
187
  });
134
188
  it('should read from default path when CELL_SYSTEM_MD is "1"', () => {
135
- const defaultPath = path.resolve(path.join(CELL_CONFIG_DIR, 'system.md'));
189
+ const defaultPath = path.resolve(path.join(CELL_DIR, 'system.md'));
136
190
  vi.stubEnv('CELL_SYSTEM_MD', '1');
137
191
  vi.mocked(fs.existsSync).mockReturnValue(true);
138
192
  vi.mocked(fs.readFileSync).mockReturnValue('custom system prompt');
139
- const prompt = getCoreSystemPrompt();
193
+ const prompt = getCoreSystemPrompt(mockConfig);
140
194
  expect(fs.readFileSync).toHaveBeenCalledWith(defaultPath, 'utf8');
141
195
  expect(prompt).toBe('custom system prompt');
142
196
  });
@@ -145,7 +199,7 @@ describe('Core System Prompt (prompts.ts)', () => {
145
199
  vi.stubEnv('CELL_SYSTEM_MD', customPath);
146
200
  vi.mocked(fs.existsSync).mockReturnValue(true);
147
201
  vi.mocked(fs.readFileSync).mockReturnValue('custom system prompt');
148
- const prompt = getCoreSystemPrompt();
202
+ const prompt = getCoreSystemPrompt(mockConfig);
149
203
  expect(fs.readFileSync).toHaveBeenCalledWith(customPath, 'utf8');
150
204
  expect(prompt).toBe('custom system prompt');
151
205
  });
@@ -157,7 +211,7 @@ describe('Core System Prompt (prompts.ts)', () => {
157
211
  vi.stubEnv('CELL_SYSTEM_MD', customPath);
158
212
  vi.mocked(fs.existsSync).mockReturnValue(true);
159
213
  vi.mocked(fs.readFileSync).mockReturnValue('custom system prompt');
160
- const prompt = getCoreSystemPrompt();
214
+ const prompt = getCoreSystemPrompt(mockConfig);
161
215
  expect(fs.readFileSync).toHaveBeenCalledWith(path.resolve(expectedPath), 'utf8');
162
216
  expect(prompt).toBe('custom system prompt');
163
217
  });
@@ -165,30 +219,30 @@ describe('Core System Prompt (prompts.ts)', () => {
165
219
  describe('CELL_WRITE_SYSTEM_MD environment variable', () => {
166
220
  it('should not write to file when CELL_WRITE_SYSTEM_MD is "false"', () => {
167
221
  vi.stubEnv('CELL_WRITE_SYSTEM_MD', 'false');
168
- getCoreSystemPrompt();
222
+ getCoreSystemPrompt(mockConfig);
169
223
  expect(fs.writeFileSync).not.toHaveBeenCalled();
170
224
  });
171
225
  it('should not write to file when CELL_WRITE_SYSTEM_MD is "0"', () => {
172
226
  vi.stubEnv('CELL_WRITE_SYSTEM_MD', '0');
173
- getCoreSystemPrompt();
227
+ getCoreSystemPrompt(mockConfig);
174
228
  expect(fs.writeFileSync).not.toHaveBeenCalled();
175
229
  });
176
230
  it('should write to default path when CELL_WRITE_SYSTEM_MD is "true"', () => {
177
- const defaultPath = path.resolve(path.join(CELL_CONFIG_DIR, 'system.md'));
231
+ const defaultPath = path.resolve(path.join(CELL_DIR, 'system.md'));
178
232
  vi.stubEnv('CELL_WRITE_SYSTEM_MD', 'true');
179
- getCoreSystemPrompt();
233
+ getCoreSystemPrompt(mockConfig);
180
234
  expect(fs.writeFileSync).toHaveBeenCalledWith(defaultPath, expect.any(String));
181
235
  });
182
236
  it('should write to default path when CELL_WRITE_SYSTEM_MD is "1"', () => {
183
- const defaultPath = path.resolve(path.join(CELL_CONFIG_DIR, 'system.md'));
237
+ const defaultPath = path.resolve(path.join(CELL_DIR, 'system.md'));
184
238
  vi.stubEnv('CELL_WRITE_SYSTEM_MD', '1');
185
- getCoreSystemPrompt();
239
+ getCoreSystemPrompt(mockConfig);
186
240
  expect(fs.writeFileSync).toHaveBeenCalledWith(defaultPath, expect.any(String));
187
241
  });
188
242
  it('should write to custom path when CELL_WRITE_SYSTEM_MD provides one', () => {
189
243
  const customPath = path.resolve('/custom/path/system.md');
190
244
  vi.stubEnv('CELL_WRITE_SYSTEM_MD', customPath);
191
- getCoreSystemPrompt();
245
+ getCoreSystemPrompt(mockConfig);
192
246
  expect(fs.writeFileSync).toHaveBeenCalledWith(customPath, expect.any(String));
193
247
  });
194
248
  it('should expand tilde in custom path when CELL_WRITE_SYSTEM_MD is set', () => {
@@ -197,7 +251,7 @@ describe('Core System Prompt (prompts.ts)', () => {
197
251
  const customPath = '~/custom/system.md';
198
252
  const expectedPath = path.join(homeDir, 'custom/system.md');
199
253
  vi.stubEnv('CELL_WRITE_SYSTEM_MD', customPath);
200
- getCoreSystemPrompt();
254
+ getCoreSystemPrompt(mockConfig);
201
255
  expect(fs.writeFileSync).toHaveBeenCalledWith(path.resolve(expectedPath), expect.any(String));
202
256
  });
203
257
  it('should expand tilde in custom path when CELL_WRITE_SYSTEM_MD is just ~', () => {
@@ -206,7 +260,7 @@ describe('Core System Prompt (prompts.ts)', () => {
206
260
  const customPath = '~';
207
261
  const expectedPath = homeDir;
208
262
  vi.stubEnv('CELL_WRITE_SYSTEM_MD', customPath);
209
- getCoreSystemPrompt();
263
+ getCoreSystemPrompt(mockConfig);
210
264
  expect(fs.writeFileSync).toHaveBeenCalledWith(path.resolve(expectedPath), expect.any(String));
211
265
  });
212
266
  });