@google/gemini-cli-core 0.0.1

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 (854) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +320 -0
  3. package/dist/.last_build +0 -0
  4. package/dist/index.d.ts +16 -0
  5. package/dist/index.js +17 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/src/__mocks__/fs/promises.d.ts +11 -0
  8. package/dist/src/__mocks__/fs/promises.js +17 -0
  9. package/dist/src/__mocks__/fs/promises.js.map +1 -0
  10. package/dist/src/code_assist/codeAssist.d.ts +12 -0
  11. package/dist/src/code_assist/codeAssist.js +31 -0
  12. package/dist/src/code_assist/codeAssist.js.map +1 -0
  13. package/dist/src/code_assist/converter.d.ts +74 -0
  14. package/dist/src/code_assist/converter.js +160 -0
  15. package/dist/src/code_assist/converter.js.map +1 -0
  16. package/dist/src/code_assist/converter.test.d.ts +6 -0
  17. package/dist/src/code_assist/converter.test.js +372 -0
  18. package/dist/src/code_assist/converter.test.js.map +1 -0
  19. package/dist/src/code_assist/oauth-credential-storage.d.ts +25 -0
  20. package/dist/src/code_assist/oauth-credential-storage.js +109 -0
  21. package/dist/src/code_assist/oauth-credential-storage.js.map +1 -0
  22. package/dist/src/code_assist/oauth-credential-storage.test.d.ts +6 -0
  23. package/dist/src/code_assist/oauth-credential-storage.test.js +136 -0
  24. package/dist/src/code_assist/oauth-credential-storage.test.js.map +1 -0
  25. package/dist/src/code_assist/oauth2.d.ts +22 -0
  26. package/dist/src/code_assist/oauth2.js +416 -0
  27. package/dist/src/code_assist/oauth2.js.map +1 -0
  28. package/dist/src/code_assist/oauth2.test.d.ts +6 -0
  29. package/dist/src/code_assist/oauth2.test.js +817 -0
  30. package/dist/src/code_assist/oauth2.test.js.map +1 -0
  31. package/dist/src/code_assist/server.d.ts +37 -0
  32. package/dist/src/code_assist/server.js +148 -0
  33. package/dist/src/code_assist/server.js.map +1 -0
  34. package/dist/src/code_assist/server.test.d.ts +6 -0
  35. package/dist/src/code_assist/server.test.js +159 -0
  36. package/dist/src/code_assist/server.test.js.map +1 -0
  37. package/dist/src/code_assist/setup.d.ts +20 -0
  38. package/dist/src/code_assist/setup.js +101 -0
  39. package/dist/src/code_assist/setup.js.map +1 -0
  40. package/dist/src/code_assist/setup.test.d.ts +6 -0
  41. package/dist/src/code_assist/setup.test.js +171 -0
  42. package/dist/src/code_assist/setup.test.js.map +1 -0
  43. package/dist/src/code_assist/types.d.ts +163 -0
  44. package/dist/src/code_assist/types.js +46 -0
  45. package/dist/src/code_assist/types.js.map +1 -0
  46. package/dist/src/config/config.d.ts +378 -0
  47. package/dist/src/config/config.js +765 -0
  48. package/dist/src/config/config.js.map +1 -0
  49. package/dist/src/config/config.test.d.ts +6 -0
  50. package/dist/src/config/config.test.js +712 -0
  51. package/dist/src/config/config.test.js.map +1 -0
  52. package/dist/src/config/flashFallback.test.d.ts +6 -0
  53. package/dist/src/config/flashFallback.test.js +87 -0
  54. package/dist/src/config/flashFallback.test.js.map +1 -0
  55. package/dist/src/config/models.d.ts +25 -0
  56. package/dist/src/config/models.js +39 -0
  57. package/dist/src/config/models.js.map +1 -0
  58. package/dist/src/config/models.test.d.ts +6 -0
  59. package/dist/src/config/models.test.js +55 -0
  60. package/dist/src/config/models.test.js.map +1 -0
  61. package/dist/src/config/storage.d.ts +34 -0
  62. package/dist/src/config/storage.js +95 -0
  63. package/dist/src/config/storage.js.map +1 -0
  64. package/dist/src/config/storage.test.d.ts +6 -0
  65. package/dist/src/config/storage.test.js +47 -0
  66. package/dist/src/config/storage.test.js.map +1 -0
  67. package/dist/src/confirmation-bus/index.d.ts +7 -0
  68. package/dist/src/confirmation-bus/index.js +8 -0
  69. package/dist/src/confirmation-bus/index.js.map +1 -0
  70. package/dist/src/confirmation-bus/message-bus.d.ts +17 -0
  71. package/dist/src/confirmation-bus/message-bus.js +81 -0
  72. package/dist/src/confirmation-bus/message-bus.js.map +1 -0
  73. package/dist/src/confirmation-bus/message-bus.test.d.ts +6 -0
  74. package/dist/src/confirmation-bus/message-bus.test.js +164 -0
  75. package/dist/src/confirmation-bus/message-bus.test.js.map +1 -0
  76. package/dist/src/confirmation-bus/types.d.ts +38 -0
  77. package/dist/src/confirmation-bus/types.js +15 -0
  78. package/dist/src/confirmation-bus/types.js.map +1 -0
  79. package/dist/src/core/baseLlmClient.d.ts +46 -0
  80. package/dist/src/core/baseLlmClient.js +112 -0
  81. package/dist/src/core/baseLlmClient.js.map +1 -0
  82. package/dist/src/core/baseLlmClient.test.d.ts +6 -0
  83. package/dist/src/core/baseLlmClient.test.js +253 -0
  84. package/dist/src/core/baseLlmClient.test.js.map +1 -0
  85. package/dist/src/core/client.d.ts +60 -0
  86. package/dist/src/core/client.js +602 -0
  87. package/dist/src/core/client.js.map +1 -0
  88. package/dist/src/core/client.test.d.ts +6 -0
  89. package/dist/src/core/client.test.js +1758 -0
  90. package/dist/src/core/client.test.js.map +1 -0
  91. package/dist/src/core/contentGenerator.d.ts +32 -0
  92. package/dist/src/core/contentGenerator.js +76 -0
  93. package/dist/src/core/contentGenerator.js.map +1 -0
  94. package/dist/src/core/contentGenerator.test.d.ts +6 -0
  95. package/dist/src/core/contentGenerator.test.js +122 -0
  96. package/dist/src/core/contentGenerator.test.js.map +1 -0
  97. package/dist/src/core/coreToolScheduler.d.ts +131 -0
  98. package/dist/src/core/coreToolScheduler.js +706 -0
  99. package/dist/src/core/coreToolScheduler.js.map +1 -0
  100. package/dist/src/core/coreToolScheduler.test.d.ts +6 -0
  101. package/dist/src/core/coreToolScheduler.test.js +1151 -0
  102. package/dist/src/core/coreToolScheduler.test.js.map +1 -0
  103. package/dist/src/core/geminiChat.d.ts +128 -0
  104. package/dist/src/core/geminiChat.js +537 -0
  105. package/dist/src/core/geminiChat.js.map +1 -0
  106. package/dist/src/core/geminiChat.test.d.ts +6 -0
  107. package/dist/src/core/geminiChat.test.js +1163 -0
  108. package/dist/src/core/geminiChat.test.js.map +1 -0
  109. package/dist/src/core/geminiRequest.d.ts +13 -0
  110. package/dist/src/core/geminiRequest.js +11 -0
  111. package/dist/src/core/geminiRequest.js.map +1 -0
  112. package/dist/src/core/logger.d.ts +60 -0
  113. package/dist/src/core/logger.js +360 -0
  114. package/dist/src/core/logger.js.map +1 -0
  115. package/dist/src/core/logger.test.d.ts +6 -0
  116. package/dist/src/core/logger.test.js +534 -0
  117. package/dist/src/core/logger.test.js.map +1 -0
  118. package/dist/src/core/loggingContentGenerator.d.ts +25 -0
  119. package/dist/src/core/loggingContentGenerator.js +94 -0
  120. package/dist/src/core/loggingContentGenerator.js.map +1 -0
  121. package/dist/src/core/nonInteractiveToolExecutor.d.ts +10 -0
  122. package/dist/src/core/nonInteractiveToolExecutor.js +24 -0
  123. package/dist/src/core/nonInteractiveToolExecutor.js.map +1 -0
  124. package/dist/src/core/nonInteractiveToolExecutor.test.d.ts +6 -0
  125. package/dist/src/core/nonInteractiveToolExecutor.test.js +294 -0
  126. package/dist/src/core/nonInteractiveToolExecutor.test.js.map +1 -0
  127. package/dist/src/core/prompts.d.ts +17 -0
  128. package/dist/src/core/prompts.js +380 -0
  129. package/dist/src/core/prompts.js.map +1 -0
  130. package/dist/src/core/prompts.test.d.ts +6 -0
  131. package/dist/src/core/prompts.test.js +343 -0
  132. package/dist/src/core/prompts.test.js.map +1 -0
  133. package/dist/src/core/subagent.d.ts +236 -0
  134. package/dist/src/core/subagent.js +482 -0
  135. package/dist/src/core/subagent.js.map +1 -0
  136. package/dist/src/core/subagent.test.d.ts +6 -0
  137. package/dist/src/core/subagent.test.js +530 -0
  138. package/dist/src/core/subagent.test.js.map +1 -0
  139. package/dist/src/core/tokenLimits.d.ts +10 -0
  140. package/dist/src/core/tokenLimits.js +28 -0
  141. package/dist/src/core/tokenLimits.js.map +1 -0
  142. package/dist/src/core/turn.d.ts +141 -0
  143. package/dist/src/core/turn.js +188 -0
  144. package/dist/src/core/turn.js.map +1 -0
  145. package/dist/src/core/turn.test.d.ts +6 -0
  146. package/dist/src/core/turn.test.js +628 -0
  147. package/dist/src/core/turn.test.js.map +1 -0
  148. package/dist/src/fallback/handler.d.ts +7 -0
  149. package/dist/src/fallback/handler.js +51 -0
  150. package/dist/src/fallback/handler.js.map +1 -0
  151. package/dist/src/fallback/handler.test.d.ts +6 -0
  152. package/dist/src/fallback/handler.test.js +130 -0
  153. package/dist/src/fallback/handler.test.js.map +1 -0
  154. package/dist/src/fallback/types.d.ts +14 -0
  155. package/dist/src/fallback/types.js +7 -0
  156. package/dist/src/fallback/types.js.map +1 -0
  157. package/dist/src/generated/git-commit.d.ts +7 -0
  158. package/dist/src/generated/git-commit.js +10 -0
  159. package/dist/src/generated/git-commit.js.map +1 -0
  160. package/dist/src/ide/constants.d.ts +9 -0
  161. package/dist/src/ide/constants.js +10 -0
  162. package/dist/src/ide/constants.js.map +1 -0
  163. package/dist/src/ide/detect-ide.d.ts +53 -0
  164. package/dist/src/ide/detect-ide.js +58 -0
  165. package/dist/src/ide/detect-ide.js.map +1 -0
  166. package/dist/src/ide/detect-ide.test.d.ts +6 -0
  167. package/dist/src/ide/detect-ide.test.js +69 -0
  168. package/dist/src/ide/detect-ide.test.js.map +1 -0
  169. package/dist/src/ide/ide-client.d.ts +109 -0
  170. package/dist/src/ide/ide-client.js +640 -0
  171. package/dist/src/ide/ide-client.js.map +1 -0
  172. package/dist/src/ide/ide-client.test.d.ts +6 -0
  173. package/dist/src/ide/ide-client.test.js +388 -0
  174. package/dist/src/ide/ide-client.test.js.map +1 -0
  175. package/dist/src/ide/ide-installer.d.ts +14 -0
  176. package/dist/src/ide/ide-installer.js +111 -0
  177. package/dist/src/ide/ide-installer.js.map +1 -0
  178. package/dist/src/ide/ide-installer.test.d.ts +6 -0
  179. package/dist/src/ide/ide-installer.test.js +131 -0
  180. package/dist/src/ide/ide-installer.test.js.map +1 -0
  181. package/dist/src/ide/ideContext.d.ts +44 -0
  182. package/dist/src/ide/ideContext.js +101 -0
  183. package/dist/src/ide/ideContext.js.map +1 -0
  184. package/dist/src/ide/ideContext.test.d.ts +6 -0
  185. package/dist/src/ide/ideContext.test.js +393 -0
  186. package/dist/src/ide/ideContext.test.js.map +1 -0
  187. package/dist/src/ide/process-utils.d.ts +21 -0
  188. package/dist/src/ide/process-utils.js +171 -0
  189. package/dist/src/ide/process-utils.js.map +1 -0
  190. package/dist/src/ide/process-utils.test.d.ts +6 -0
  191. package/dist/src/ide/process-utils.test.js +158 -0
  192. package/dist/src/ide/process-utils.test.js.map +1 -0
  193. package/dist/src/ide/types.d.ts +486 -0
  194. package/dist/src/ide/types.js +138 -0
  195. package/dist/src/ide/types.js.map +1 -0
  196. package/dist/src/index.d.ts +87 -0
  197. package/dist/src/index.js +97 -0
  198. package/dist/src/index.js.map +1 -0
  199. package/dist/src/index.test.d.ts +6 -0
  200. package/dist/src/index.test.js +12 -0
  201. package/dist/src/index.test.js.map +1 -0
  202. package/dist/src/mcp/google-auth-provider.d.ts +23 -0
  203. package/dist/src/mcp/google-auth-provider.js +72 -0
  204. package/dist/src/mcp/google-auth-provider.js.map +1 -0
  205. package/dist/src/mcp/google-auth-provider.test.d.ts +6 -0
  206. package/dist/src/mcp/google-auth-provider.test.js +89 -0
  207. package/dist/src/mcp/google-auth-provider.test.js.map +1 -0
  208. package/dist/src/mcp/oauth-provider.d.ts +149 -0
  209. package/dist/src/mcp/oauth-provider.js +608 -0
  210. package/dist/src/mcp/oauth-provider.js.map +1 -0
  211. package/dist/src/mcp/oauth-provider.test.d.ts +6 -0
  212. package/dist/src/mcp/oauth-provider.test.js +711 -0
  213. package/dist/src/mcp/oauth-provider.test.js.map +1 -0
  214. package/dist/src/mcp/oauth-token-storage.d.ts +65 -0
  215. package/dist/src/mcp/oauth-token-storage.js +180 -0
  216. package/dist/src/mcp/oauth-token-storage.js.map +1 -0
  217. package/dist/src/mcp/oauth-token-storage.test.d.ts +6 -0
  218. package/dist/src/mcp/oauth-token-storage.test.js +299 -0
  219. package/dist/src/mcp/oauth-token-storage.test.js.map +1 -0
  220. package/dist/src/mcp/oauth-utils.d.ts +119 -0
  221. package/dist/src/mcp/oauth-utils.js +235 -0
  222. package/dist/src/mcp/oauth-utils.js.map +1 -0
  223. package/dist/src/mcp/oauth-utils.test.d.ts +6 -0
  224. package/dist/src/mcp/oauth-utils.test.js +199 -0
  225. package/dist/src/mcp/oauth-utils.test.js.map +1 -0
  226. package/dist/src/mcp/token-storage/base-token-storage.d.ts +19 -0
  227. package/dist/src/mcp/token-storage/base-token-storage.js +36 -0
  228. package/dist/src/mcp/token-storage/base-token-storage.js.map +1 -0
  229. package/dist/src/mcp/token-storage/base-token-storage.test.d.ts +6 -0
  230. package/dist/src/mcp/token-storage/base-token-storage.test.js +160 -0
  231. package/dist/src/mcp/token-storage/base-token-storage.test.js.map +1 -0
  232. package/dist/src/mcp/token-storage/file-token-storage.d.ts +24 -0
  233. package/dist/src/mcp/token-storage/file-token-storage.js +144 -0
  234. package/dist/src/mcp/token-storage/file-token-storage.js.map +1 -0
  235. package/dist/src/mcp/token-storage/file-token-storage.test.d.ts +6 -0
  236. package/dist/src/mcp/token-storage/file-token-storage.test.js +235 -0
  237. package/dist/src/mcp/token-storage/file-token-storage.test.js.map +1 -0
  238. package/dist/src/mcp/token-storage/hybrid-token-storage.d.ts +23 -0
  239. package/dist/src/mcp/token-storage/hybrid-token-storage.js +78 -0
  240. package/dist/src/mcp/token-storage/hybrid-token-storage.js.map +1 -0
  241. package/dist/src/mcp/token-storage/hybrid-token-storage.test.d.ts +6 -0
  242. package/dist/src/mcp/token-storage/hybrid-token-storage.test.js +193 -0
  243. package/dist/src/mcp/token-storage/hybrid-token-storage.test.js.map +1 -0
  244. package/dist/src/mcp/token-storage/index.d.ts +11 -0
  245. package/dist/src/mcp/token-storage/index.js +12 -0
  246. package/dist/src/mcp/token-storage/index.js.map +1 -0
  247. package/dist/src/mcp/token-storage/keychain-token-storage.d.ts +31 -0
  248. package/dist/src/mcp/token-storage/keychain-token-storage.js +190 -0
  249. package/dist/src/mcp/token-storage/keychain-token-storage.js.map +1 -0
  250. package/dist/src/mcp/token-storage/keychain-token-storage.test.d.ts +6 -0
  251. package/dist/src/mcp/token-storage/keychain-token-storage.test.js +254 -0
  252. package/dist/src/mcp/token-storage/keychain-token-storage.test.js.map +1 -0
  253. package/dist/src/mcp/token-storage/types.d.ts +38 -0
  254. package/dist/src/mcp/token-storage/types.js +11 -0
  255. package/dist/src/mcp/token-storage/types.js.map +1 -0
  256. package/dist/src/mocks/msw.d.ts +6 -0
  257. package/dist/src/mocks/msw.js +8 -0
  258. package/dist/src/mocks/msw.js.map +1 -0
  259. package/dist/src/output/json-formatter.d.ts +11 -0
  260. package/dist/src/output/json-formatter.js +30 -0
  261. package/dist/src/output/json-formatter.js.map +1 -0
  262. package/dist/src/output/json-formatter.test.d.ts +6 -0
  263. package/dist/src/output/json-formatter.test.js +266 -0
  264. package/dist/src/output/json-formatter.test.js.map +1 -0
  265. package/dist/src/output/types.d.ts +20 -0
  266. package/dist/src/output/types.js +11 -0
  267. package/dist/src/output/types.js.map +1 -0
  268. package/dist/src/policy/index.d.ts +7 -0
  269. package/dist/src/policy/index.js +8 -0
  270. package/dist/src/policy/index.js.map +1 -0
  271. package/dist/src/policy/policy-engine.d.ts +30 -0
  272. package/dist/src/policy/policy-engine.js +83 -0
  273. package/dist/src/policy/policy-engine.js.map +1 -0
  274. package/dist/src/policy/policy-engine.test.d.ts +6 -0
  275. package/dist/src/policy/policy-engine.test.js +470 -0
  276. package/dist/src/policy/policy-engine.test.js.map +1 -0
  277. package/dist/src/policy/stable-stringify.d.ts +58 -0
  278. package/dist/src/policy/stable-stringify.js +122 -0
  279. package/dist/src/policy/stable-stringify.js.map +1 -0
  280. package/dist/src/policy/types.d.ts +47 -0
  281. package/dist/src/policy/types.js +12 -0
  282. package/dist/src/policy/types.js.map +1 -0
  283. package/dist/src/prompts/mcp-prompts.d.ts +8 -0
  284. package/dist/src/prompts/mcp-prompts.js +13 -0
  285. package/dist/src/prompts/mcp-prompts.js.map +1 -0
  286. package/dist/src/prompts/prompt-registry.d.ts +34 -0
  287. package/dist/src/prompts/prompt-registry.js +63 -0
  288. package/dist/src/prompts/prompt-registry.js.map +1 -0
  289. package/dist/src/routing/modelRouterService.d.ts +23 -0
  290. package/dist/src/routing/modelRouterService.js +70 -0
  291. package/dist/src/routing/modelRouterService.js.map +1 -0
  292. package/dist/src/routing/modelRouterService.test.d.ts +6 -0
  293. package/dist/src/routing/modelRouterService.test.js +98 -0
  294. package/dist/src/routing/modelRouterService.test.js.map +1 -0
  295. package/dist/src/routing/routingStrategy.d.ts +62 -0
  296. package/dist/src/routing/routingStrategy.js +7 -0
  297. package/dist/src/routing/routingStrategy.js.map +1 -0
  298. package/dist/src/routing/strategies/classifierStrategy.d.ts +12 -0
  299. package/dist/src/routing/strategies/classifierStrategy.js +173 -0
  300. package/dist/src/routing/strategies/classifierStrategy.js.map +1 -0
  301. package/dist/src/routing/strategies/classifierStrategy.test.d.ts +6 -0
  302. package/dist/src/routing/strategies/classifierStrategy.test.js +192 -0
  303. package/dist/src/routing/strategies/classifierStrategy.test.js.map +1 -0
  304. package/dist/src/routing/strategies/compositeStrategy.d.ts +26 -0
  305. package/dist/src/routing/strategies/compositeStrategy.js +67 -0
  306. package/dist/src/routing/strategies/compositeStrategy.js.map +1 -0
  307. package/dist/src/routing/strategies/compositeStrategy.test.d.ts +6 -0
  308. package/dist/src/routing/strategies/compositeStrategy.test.js +123 -0
  309. package/dist/src/routing/strategies/compositeStrategy.test.js.map +1 -0
  310. package/dist/src/routing/strategies/defaultStrategy.d.ts +12 -0
  311. package/dist/src/routing/strategies/defaultStrategy.js +20 -0
  312. package/dist/src/routing/strategies/defaultStrategy.js.map +1 -0
  313. package/dist/src/routing/strategies/defaultStrategy.test.d.ts +6 -0
  314. package/dist/src/routing/strategies/defaultStrategy.test.js +26 -0
  315. package/dist/src/routing/strategies/defaultStrategy.test.js.map +1 -0
  316. package/dist/src/routing/strategies/fallbackStrategy.d.ts +12 -0
  317. package/dist/src/routing/strategies/fallbackStrategy.js +25 -0
  318. package/dist/src/routing/strategies/fallbackStrategy.js.map +1 -0
  319. package/dist/src/routing/strategies/fallbackStrategy.test.d.ts +6 -0
  320. package/dist/src/routing/strategies/fallbackStrategy.test.js +55 -0
  321. package/dist/src/routing/strategies/fallbackStrategy.test.js.map +1 -0
  322. package/dist/src/routing/strategies/overrideStrategy.d.ts +15 -0
  323. package/dist/src/routing/strategies/overrideStrategy.js +28 -0
  324. package/dist/src/routing/strategies/overrideStrategy.js.map +1 -0
  325. package/dist/src/routing/strategies/overrideStrategy.test.d.ts +6 -0
  326. package/dist/src/routing/strategies/overrideStrategy.test.js +42 -0
  327. package/dist/src/routing/strategies/overrideStrategy.test.js.map +1 -0
  328. package/dist/src/services/chatRecordingService.d.ts +144 -0
  329. package/dist/src/services/chatRecordingService.js +330 -0
  330. package/dist/src/services/chatRecordingService.js.map +1 -0
  331. package/dist/src/services/chatRecordingService.test.d.ts +6 -0
  332. package/dist/src/services/chatRecordingService.test.js +332 -0
  333. package/dist/src/services/chatRecordingService.test.js.map +1 -0
  334. package/dist/src/services/fileDiscoveryService.d.ts +45 -0
  335. package/dist/src/services/fileDiscoveryService.js +105 -0
  336. package/dist/src/services/fileDiscoveryService.js.map +1 -0
  337. package/dist/src/services/fileDiscoveryService.test.d.ts +6 -0
  338. package/dist/src/services/fileDiscoveryService.test.js +143 -0
  339. package/dist/src/services/fileDiscoveryService.test.js.map +1 -0
  340. package/dist/src/services/fileSystemService.d.ts +31 -0
  341. package/dist/src/services/fileSystemService.js +18 -0
  342. package/dist/src/services/fileSystemService.js.map +1 -0
  343. package/dist/src/services/fileSystemService.test.d.ts +6 -0
  344. package/dist/src/services/fileSystemService.test.js +41 -0
  345. package/dist/src/services/fileSystemService.test.js.map +1 -0
  346. package/dist/src/services/gitService.d.ts +23 -0
  347. package/dist/src/services/gitService.js +107 -0
  348. package/dist/src/services/gitService.js.map +1 -0
  349. package/dist/src/services/gitService.test.d.ts +6 -0
  350. package/dist/src/services/gitService.test.js +202 -0
  351. package/dist/src/services/gitService.test.js.map +1 -0
  352. package/dist/src/services/loopDetectionService.d.ts +103 -0
  353. package/dist/src/services/loopDetectionService.js +379 -0
  354. package/dist/src/services/loopDetectionService.js.map +1 -0
  355. package/dist/src/services/loopDetectionService.test.d.ts +6 -0
  356. package/dist/src/services/loopDetectionService.test.js +587 -0
  357. package/dist/src/services/loopDetectionService.test.js.map +1 -0
  358. package/dist/src/services/shellExecutionService.d.ts +100 -0
  359. package/dist/src/services/shellExecutionService.js +466 -0
  360. package/dist/src/services/shellExecutionService.js.map +1 -0
  361. package/dist/src/services/shellExecutionService.test.d.ts +6 -0
  362. package/dist/src/services/shellExecutionService.test.js +614 -0
  363. package/dist/src/services/shellExecutionService.test.js.map +1 -0
  364. package/dist/src/telemetry/activity-detector.d.ts +41 -0
  365. package/dist/src/telemetry/activity-detector.js +61 -0
  366. package/dist/src/telemetry/activity-detector.js.map +1 -0
  367. package/dist/src/telemetry/activity-detector.test.d.ts +6 -0
  368. package/dist/src/telemetry/activity-detector.test.js +136 -0
  369. package/dist/src/telemetry/activity-detector.test.js.map +1 -0
  370. package/dist/src/telemetry/activity-types.d.ts +19 -0
  371. package/dist/src/telemetry/activity-types.js +21 -0
  372. package/dist/src/telemetry/activity-types.js.map +1 -0
  373. package/dist/src/telemetry/clearcut-logger/clearcut-logger.d.ts +135 -0
  374. package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +892 -0
  375. package/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +1 -0
  376. package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.d.ts +17 -0
  377. package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js +507 -0
  378. package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js.map +1 -0
  379. package/dist/src/telemetry/clearcut-logger/event-metadata-key.d.ts +107 -0
  380. package/dist/src/telemetry/clearcut-logger/event-metadata-key.js +275 -0
  381. package/dist/src/telemetry/clearcut-logger/event-metadata-key.js.map +1 -0
  382. package/dist/src/telemetry/constants.d.ts +40 -0
  383. package/dist/src/telemetry/constants.js +41 -0
  384. package/dist/src/telemetry/constants.js.map +1 -0
  385. package/dist/src/telemetry/file-exporters.d.ts +29 -0
  386. package/dist/src/telemetry/file-exporters.js +62 -0
  387. package/dist/src/telemetry/file-exporters.js.map +1 -0
  388. package/dist/src/telemetry/gcp-exporters.d.ts +34 -0
  389. package/dist/src/telemetry/gcp-exporters.js +117 -0
  390. package/dist/src/telemetry/gcp-exporters.js.map +1 -0
  391. package/dist/src/telemetry/gcp-exporters.test.d.ts +6 -0
  392. package/dist/src/telemetry/gcp-exporters.test.js +318 -0
  393. package/dist/src/telemetry/gcp-exporters.test.js.map +1 -0
  394. package/dist/src/telemetry/high-water-mark-tracker.d.ts +43 -0
  395. package/dist/src/telemetry/high-water-mark-tracker.js +88 -0
  396. package/dist/src/telemetry/high-water-mark-tracker.js.map +1 -0
  397. package/dist/src/telemetry/high-water-mark-tracker.test.d.ts +6 -0
  398. package/dist/src/telemetry/high-water-mark-tracker.test.js +152 -0
  399. package/dist/src/telemetry/high-water-mark-tracker.test.js.map +1 -0
  400. package/dist/src/telemetry/index.d.ts +26 -0
  401. package/dist/src/telemetry/index.js +26 -0
  402. package/dist/src/telemetry/index.js.map +1 -0
  403. package/dist/src/telemetry/integration.test.circular.d.ts +6 -0
  404. package/dist/src/telemetry/integration.test.circular.js +54 -0
  405. package/dist/src/telemetry/integration.test.circular.js.map +1 -0
  406. package/dist/src/telemetry/loggers.d.ts +33 -0
  407. package/dist/src/telemetry/loggers.js +536 -0
  408. package/dist/src/telemetry/loggers.js.map +1 -0
  409. package/dist/src/telemetry/loggers.test.circular.d.ts +6 -0
  410. package/dist/src/telemetry/loggers.test.circular.js +107 -0
  411. package/dist/src/telemetry/loggers.test.circular.js.map +1 -0
  412. package/dist/src/telemetry/loggers.test.d.ts +6 -0
  413. package/dist/src/telemetry/loggers.test.js +887 -0
  414. package/dist/src/telemetry/loggers.test.js.map +1 -0
  415. package/dist/src/telemetry/metrics.d.ts +37 -0
  416. package/dist/src/telemetry/metrics.js +231 -0
  417. package/dist/src/telemetry/metrics.js.map +1 -0
  418. package/dist/src/telemetry/metrics.test.d.ts +6 -0
  419. package/dist/src/telemetry/metrics.test.js +264 -0
  420. package/dist/src/telemetry/metrics.test.js.map +1 -0
  421. package/dist/src/telemetry/rate-limiter.d.ts +48 -0
  422. package/dist/src/telemetry/rate-limiter.js +100 -0
  423. package/dist/src/telemetry/rate-limiter.js.map +1 -0
  424. package/dist/src/telemetry/rate-limiter.test.d.ts +6 -0
  425. package/dist/src/telemetry/rate-limiter.test.js +207 -0
  426. package/dist/src/telemetry/rate-limiter.test.js.map +1 -0
  427. package/dist/src/telemetry/sdk.d.ts +9 -0
  428. package/dist/src/telemetry/sdk.js +178 -0
  429. package/dist/src/telemetry/sdk.js.map +1 -0
  430. package/dist/src/telemetry/sdk.test.d.ts +6 -0
  431. package/dist/src/telemetry/sdk.test.js +177 -0
  432. package/dist/src/telemetry/sdk.test.js.map +1 -0
  433. package/dist/src/telemetry/telemetry-utils.d.ts +6 -0
  434. package/dist/src/telemetry/telemetry-utils.js +14 -0
  435. package/dist/src/telemetry/telemetry-utils.js.map +1 -0
  436. package/dist/src/telemetry/telemetry-utils.test.d.ts +6 -0
  437. package/dist/src/telemetry/telemetry-utils.test.js +40 -0
  438. package/dist/src/telemetry/telemetry-utils.test.js.map +1 -0
  439. package/dist/src/telemetry/telemetry.test.d.ts +6 -0
  440. package/dist/src/telemetry/telemetry.test.js +50 -0
  441. package/dist/src/telemetry/telemetry.test.js.map +1 -0
  442. package/dist/src/telemetry/tool-call-decision.d.ts +13 -0
  443. package/dist/src/telemetry/tool-call-decision.js +29 -0
  444. package/dist/src/telemetry/tool-call-decision.js.map +1 -0
  445. package/dist/src/telemetry/types.d.ts +284 -0
  446. package/dist/src/telemetry/types.js +487 -0
  447. package/dist/src/telemetry/types.js.map +1 -0
  448. package/dist/src/telemetry/uiTelemetry.d.ts +75 -0
  449. package/dist/src/telemetry/uiTelemetry.js +152 -0
  450. package/dist/src/telemetry/uiTelemetry.js.map +1 -0
  451. package/dist/src/telemetry/uiTelemetry.test.d.ts +6 -0
  452. package/dist/src/telemetry/uiTelemetry.test.js +558 -0
  453. package/dist/src/telemetry/uiTelemetry.test.js.map +1 -0
  454. package/dist/src/test-utils/config.d.ts +17 -0
  455. package/dist/src/test-utils/config.js +32 -0
  456. package/dist/src/test-utils/config.js.map +1 -0
  457. package/dist/src/test-utils/index.d.ts +6 -0
  458. package/dist/src/test-utils/index.js +7 -0
  459. package/dist/src/test-utils/index.js.map +1 -0
  460. package/dist/src/test-utils/mock-tool.d.ts +41 -0
  461. package/dist/src/test-utils/mock-tool.js +51 -0
  462. package/dist/src/test-utils/mock-tool.js.map +1 -0
  463. package/dist/src/test-utils/mockWorkspaceContext.d.ts +13 -0
  464. package/dist/src/test-utils/mockWorkspaceContext.js +24 -0
  465. package/dist/src/test-utils/mockWorkspaceContext.js.map +1 -0
  466. package/dist/src/test-utils/tools.d.ts +45 -0
  467. package/dist/src/test-utils/tools.js +105 -0
  468. package/dist/src/test-utils/tools.js.map +1 -0
  469. package/dist/src/tools/diffOptions.d.ts +9 -0
  470. package/dist/src/tools/diffOptions.js +46 -0
  471. package/dist/src/tools/diffOptions.js.map +1 -0
  472. package/dist/src/tools/diffOptions.test.d.ts +6 -0
  473. package/dist/src/tools/diffOptions.test.js +155 -0
  474. package/dist/src/tools/diffOptions.test.js.map +1 -0
  475. package/dist/src/tools/edit.d.ts +56 -0
  476. package/dist/src/tools/edit.js +414 -0
  477. package/dist/src/tools/edit.js.map +1 -0
  478. package/dist/src/tools/edit.test.d.ts +6 -0
  479. package/dist/src/tools/edit.test.js +824 -0
  480. package/dist/src/tools/edit.test.js.map +1 -0
  481. package/dist/src/tools/glob.d.ts +56 -0
  482. package/dist/src/tools/glob.js +243 -0
  483. package/dist/src/tools/glob.js.map +1 -0
  484. package/dist/src/tools/glob.test.d.ts +6 -0
  485. package/dist/src/tools/glob.test.js +426 -0
  486. package/dist/src/tools/glob.test.js.map +1 -0
  487. package/dist/src/tools/grep.d.ts +47 -0
  488. package/dist/src/tools/grep.js +517 -0
  489. package/dist/src/tools/grep.js.map +1 -0
  490. package/dist/src/tools/grep.test.d.ts +6 -0
  491. package/dist/src/tools/grep.test.js +295 -0
  492. package/dist/src/tools/grep.test.js.map +1 -0
  493. package/dist/src/tools/ls.d.ts +68 -0
  494. package/dist/src/tools/ls.js +214 -0
  495. package/dist/src/tools/ls.js.map +1 -0
  496. package/dist/src/tools/ls.test.d.ts +6 -0
  497. package/dist/src/tools/ls.test.js +249 -0
  498. package/dist/src/tools/ls.test.js.map +1 -0
  499. package/dist/src/tools/mcp-client-manager.d.ts +40 -0
  500. package/dist/src/tools/mcp-client-manager.js +83 -0
  501. package/dist/src/tools/mcp-client-manager.js.map +1 -0
  502. package/dist/src/tools/mcp-client-manager.test.d.ts +6 -0
  503. package/dist/src/tools/mcp-client-manager.test.js +58 -0
  504. package/dist/src/tools/mcp-client-manager.test.js.map +1 -0
  505. package/dist/src/tools/mcp-client.d.ts +199 -0
  506. package/dist/src/tools/mcp-client.js +1000 -0
  507. package/dist/src/tools/mcp-client.js.map +1 -0
  508. package/dist/src/tools/mcp-client.test.d.ts +6 -0
  509. package/dist/src/tools/mcp-client.test.js +454 -0
  510. package/dist/src/tools/mcp-client.test.js.map +1 -0
  511. package/dist/src/tools/mcp-tool.d.ts +24 -0
  512. package/dist/src/tools/mcp-tool.js +240 -0
  513. package/dist/src/tools/mcp-tool.js.map +1 -0
  514. package/dist/src/tools/mcp-tool.test.d.ts +6 -0
  515. package/dist/src/tools/mcp-tool.test.js +597 -0
  516. package/dist/src/tools/mcp-tool.test.js.map +1 -0
  517. package/dist/src/tools/memoryTool.d.ts +40 -0
  518. package/dist/src/tools/memoryTool.js +268 -0
  519. package/dist/src/tools/memoryTool.js.map +1 -0
  520. package/dist/src/tools/memoryTool.test.d.ts +6 -0
  521. package/dist/src/tools/memoryTool.test.js +298 -0
  522. package/dist/src/tools/memoryTool.test.js.map +1 -0
  523. package/dist/src/tools/modifiable-tool.d.ts +32 -0
  524. package/dist/src/tools/modifiable-tool.js +88 -0
  525. package/dist/src/tools/modifiable-tool.js.map +1 -0
  526. package/dist/src/tools/modifiable-tool.test.d.ts +6 -0
  527. package/dist/src/tools/modifiable-tool.test.js +193 -0
  528. package/dist/src/tools/modifiable-tool.test.js.map +1 -0
  529. package/dist/src/tools/read-file.d.ts +35 -0
  530. package/dist/src/tools/read-file.js +132 -0
  531. package/dist/src/tools/read-file.js.map +1 -0
  532. package/dist/src/tools/read-file.test.d.ts +6 -0
  533. package/dist/src/tools/read-file.test.js +340 -0
  534. package/dist/src/tools/read-file.test.js.map +1 -0
  535. package/dist/src/tools/read-many-files.d.ts +60 -0
  536. package/dist/src/tools/read-many-files.js +382 -0
  537. package/dist/src/tools/read-many-files.js.map +1 -0
  538. package/dist/src/tools/read-many-files.test.d.ts +6 -0
  539. package/dist/src/tools/read-many-files.test.js +565 -0
  540. package/dist/src/tools/read-many-files.test.js.map +1 -0
  541. package/dist/src/tools/ripGrep.d.ts +55 -0
  542. package/dist/src/tools/ripGrep.js +393 -0
  543. package/dist/src/tools/ripGrep.js.map +1 -0
  544. package/dist/src/tools/ripGrep.test.d.ts +6 -0
  545. package/dist/src/tools/ripGrep.test.js +976 -0
  546. package/dist/src/tools/ripGrep.test.js.map +1 -0
  547. package/dist/src/tools/shell.d.ts +32 -0
  548. package/dist/src/tools/shell.js +316 -0
  549. package/dist/src/tools/shell.js.map +1 -0
  550. package/dist/src/tools/shell.test.d.ts +6 -0
  551. package/dist/src/tools/shell.test.js +301 -0
  552. package/dist/src/tools/shell.test.js.map +1 -0
  553. package/dist/src/tools/smart-edit.d.ts +72 -0
  554. package/dist/src/tools/smart-edit.js +594 -0
  555. package/dist/src/tools/smart-edit.js.map +1 -0
  556. package/dist/src/tools/smart-edit.test.d.ts +6 -0
  557. package/dist/src/tools/smart-edit.test.js +419 -0
  558. package/dist/src/tools/smart-edit.test.js.map +1 -0
  559. package/dist/src/tools/tool-error.d.ts +43 -0
  560. package/dist/src/tools/tool-error.js +58 -0
  561. package/dist/src/tools/tool-error.js.map +1 -0
  562. package/dist/src/tools/tool-registry.d.ts +87 -0
  563. package/dist/src/tools/tool-registry.js +370 -0
  564. package/dist/src/tools/tool-registry.js.map +1 -0
  565. package/dist/src/tools/tool-registry.test.d.ts +6 -0
  566. package/dist/src/tools/tool-registry.test.js +332 -0
  567. package/dist/src/tools/tool-registry.test.js.map +1 -0
  568. package/dist/src/tools/tools.d.ts +281 -0
  569. package/dist/src/tools/tools.js +257 -0
  570. package/dist/src/tools/tools.js.map +1 -0
  571. package/dist/src/tools/tools.test.d.ts +6 -0
  572. package/dist/src/tools/tools.test.js +205 -0
  573. package/dist/src/tools/tools.test.js.map +1 -0
  574. package/dist/src/tools/web-fetch.d.ts +27 -0
  575. package/dist/src/tools/web-fetch.js +244 -0
  576. package/dist/src/tools/web-fetch.js.map +1 -0
  577. package/dist/src/tools/web-fetch.test.d.ts +6 -0
  578. package/dist/src/tools/web-fetch.test.js +114 -0
  579. package/dist/src/tools/web-fetch.test.js.map +1 -0
  580. package/dist/src/tools/web-search.d.ts +49 -0
  581. package/dist/src/tools/web-search.js +139 -0
  582. package/dist/src/tools/web-search.js.map +1 -0
  583. package/dist/src/tools/web-search.test.d.ts +6 -0
  584. package/dist/src/tools/web-search.test.js +207 -0
  585. package/dist/src/tools/web-search.test.js.map +1 -0
  586. package/dist/src/tools/write-file.d.ts +52 -0
  587. package/dist/src/tools/write-file.js +309 -0
  588. package/dist/src/tools/write-file.js.map +1 -0
  589. package/dist/src/tools/write-file.test.d.ts +6 -0
  590. package/dist/src/tools/write-file.test.js +611 -0
  591. package/dist/src/tools/write-file.test.js.map +1 -0
  592. package/dist/src/utils/LruCache.d.ts +13 -0
  593. package/dist/src/utils/LruCache.js +38 -0
  594. package/dist/src/utils/LruCache.js.map +1 -0
  595. package/dist/src/utils/bfsFileSearch.d.ts +24 -0
  596. package/dist/src/utils/bfsFileSearch.js +95 -0
  597. package/dist/src/utils/bfsFileSearch.js.map +1 -0
  598. package/dist/src/utils/bfsFileSearch.test.d.ts +6 -0
  599. package/dist/src/utils/bfsFileSearch.test.js +163 -0
  600. package/dist/src/utils/bfsFileSearch.test.js.map +1 -0
  601. package/dist/src/utils/browser.d.ts +13 -0
  602. package/dist/src/utils/browser.js +50 -0
  603. package/dist/src/utils/browser.js.map +1 -0
  604. package/dist/src/utils/editCorrector.d.ts +54 -0
  605. package/dist/src/utils/editCorrector.js +588 -0
  606. package/dist/src/utils/editCorrector.js.map +1 -0
  607. package/dist/src/utils/editCorrector.test.d.ts +6 -0
  608. package/dist/src/utils/editCorrector.test.js +515 -0
  609. package/dist/src/utils/editCorrector.test.js.map +1 -0
  610. package/dist/src/utils/editor.d.ts +28 -0
  611. package/dist/src/utils/editor.js +173 -0
  612. package/dist/src/utils/editor.js.map +1 -0
  613. package/dist/src/utils/editor.test.d.ts +6 -0
  614. package/dist/src/utils/editor.test.js +431 -0
  615. package/dist/src/utils/editor.test.js.map +1 -0
  616. package/dist/src/utils/environmentContext.d.ts +21 -0
  617. package/dist/src/utils/environmentContext.js +90 -0
  618. package/dist/src/utils/environmentContext.js.map +1 -0
  619. package/dist/src/utils/environmentContext.test.d.ts +6 -0
  620. package/dist/src/utils/environmentContext.test.js +140 -0
  621. package/dist/src/utils/environmentContext.test.js.map +1 -0
  622. package/dist/src/utils/errorParsing.d.ts +8 -0
  623. package/dist/src/utils/errorParsing.js +93 -0
  624. package/dist/src/utils/errorParsing.js.map +1 -0
  625. package/dist/src/utils/errorParsing.test.d.ts +6 -0
  626. package/dist/src/utils/errorParsing.test.js +172 -0
  627. package/dist/src/utils/errorParsing.test.js.map +1 -0
  628. package/dist/src/utils/errorReporting.d.ts +14 -0
  629. package/dist/src/utils/errorReporting.js +88 -0
  630. package/dist/src/utils/errorReporting.js.map +1 -0
  631. package/dist/src/utils/errorReporting.test.d.ts +6 -0
  632. package/dist/src/utils/errorReporting.test.js +130 -0
  633. package/dist/src/utils/errorReporting.test.js.map +1 -0
  634. package/dist/src/utils/errors.d.ts +39 -0
  635. package/dist/src/utils/errors.js +96 -0
  636. package/dist/src/utils/errors.js.map +1 -0
  637. package/dist/src/utils/fetch.d.ts +11 -0
  638. package/dist/src/utils/fetch.js +51 -0
  639. package/dist/src/utils/fetch.js.map +1 -0
  640. package/dist/src/utils/fileUtils.d.ts +69 -0
  641. package/dist/src/utils/fileUtils.js +405 -0
  642. package/dist/src/utils/fileUtils.js.map +1 -0
  643. package/dist/src/utils/fileUtils.test.d.ts +6 -0
  644. package/dist/src/utils/fileUtils.test.js +682 -0
  645. package/dist/src/utils/fileUtils.test.js.map +1 -0
  646. package/dist/src/utils/filesearch/crawlCache.d.ts +25 -0
  647. package/dist/src/utils/filesearch/crawlCache.js +57 -0
  648. package/dist/src/utils/filesearch/crawlCache.js.map +1 -0
  649. package/dist/src/utils/filesearch/crawlCache.test.d.ts +6 -0
  650. package/dist/src/utils/filesearch/crawlCache.test.js +103 -0
  651. package/dist/src/utils/filesearch/crawlCache.test.js.map +1 -0
  652. package/dist/src/utils/filesearch/crawler.d.ts +15 -0
  653. package/dist/src/utils/filesearch/crawler.js +50 -0
  654. package/dist/src/utils/filesearch/crawler.js.map +1 -0
  655. package/dist/src/utils/filesearch/crawler.test.d.ts +6 -0
  656. package/dist/src/utils/filesearch/crawler.test.js +468 -0
  657. package/dist/src/utils/filesearch/crawler.test.js.map +1 -0
  658. package/dist/src/utils/filesearch/fileSearch.d.ts +38 -0
  659. package/dist/src/utils/filesearch/fileSearch.js +191 -0
  660. package/dist/src/utils/filesearch/fileSearch.js.map +1 -0
  661. package/dist/src/utils/filesearch/fileSearch.test.d.ts +6 -0
  662. package/dist/src/utils/filesearch/fileSearch.test.js +642 -0
  663. package/dist/src/utils/filesearch/fileSearch.test.js.map +1 -0
  664. package/dist/src/utils/filesearch/ignore.d.ts +42 -0
  665. package/dist/src/utils/filesearch/ignore.js +106 -0
  666. package/dist/src/utils/filesearch/ignore.js.map +1 -0
  667. package/dist/src/utils/filesearch/ignore.test.d.ts +6 -0
  668. package/dist/src/utils/filesearch/ignore.test.js +144 -0
  669. package/dist/src/utils/filesearch/ignore.test.js.map +1 -0
  670. package/dist/src/utils/filesearch/result-cache.d.ts +33 -0
  671. package/dist/src/utils/filesearch/result-cache.js +59 -0
  672. package/dist/src/utils/filesearch/result-cache.js.map +1 -0
  673. package/dist/src/utils/filesearch/result-cache.test.d.ts +6 -0
  674. package/dist/src/utils/filesearch/result-cache.test.js +46 -0
  675. package/dist/src/utils/filesearch/result-cache.test.js.map +1 -0
  676. package/dist/src/utils/flashFallback.test.d.ts +6 -0
  677. package/dist/src/utils/flashFallback.test.js +122 -0
  678. package/dist/src/utils/flashFallback.test.js.map +1 -0
  679. package/dist/src/utils/formatters.d.ts +6 -0
  680. package/dist/src/utils/formatters.js +16 -0
  681. package/dist/src/utils/formatters.js.map +1 -0
  682. package/dist/src/utils/geminiIgnoreParser.d.ts +18 -0
  683. package/dist/src/utils/geminiIgnoreParser.js +61 -0
  684. package/dist/src/utils/geminiIgnoreParser.js.map +1 -0
  685. package/dist/src/utils/geminiIgnoreParser.test.d.ts +6 -0
  686. package/dist/src/utils/geminiIgnoreParser.test.js +50 -0
  687. package/dist/src/utils/geminiIgnoreParser.test.js.map +1 -0
  688. package/dist/src/utils/generateContentResponseUtilities.d.ts +13 -0
  689. package/dist/src/utils/generateContentResponseUtilities.js +80 -0
  690. package/dist/src/utils/generateContentResponseUtilities.js.map +1 -0
  691. package/dist/src/utils/generateContentResponseUtilities.test.d.ts +6 -0
  692. package/dist/src/utils/generateContentResponseUtilities.test.js +235 -0
  693. package/dist/src/utils/generateContentResponseUtilities.test.js.map +1 -0
  694. package/dist/src/utils/getFolderStructure.d.ts +31 -0
  695. package/dist/src/utils/getFolderStructure.js +246 -0
  696. package/dist/src/utils/getFolderStructure.js.map +1 -0
  697. package/dist/src/utils/getFolderStructure.test.d.ts +6 -0
  698. package/dist/src/utils/getFolderStructure.test.js +282 -0
  699. package/dist/src/utils/getFolderStructure.test.js.map +1 -0
  700. package/dist/src/utils/getPty.d.ts +19 -0
  701. package/dist/src/utils/getPty.js +23 -0
  702. package/dist/src/utils/getPty.js.map +1 -0
  703. package/dist/src/utils/gitIgnoreParser.d.ts +16 -0
  704. package/dist/src/utils/gitIgnoreParser.js +152 -0
  705. package/dist/src/utils/gitIgnoreParser.js.map +1 -0
  706. package/dist/src/utils/gitIgnoreParser.test.d.ts +6 -0
  707. package/dist/src/utils/gitIgnoreParser.test.js +185 -0
  708. package/dist/src/utils/gitIgnoreParser.test.js.map +1 -0
  709. package/dist/src/utils/gitUtils.d.ts +17 -0
  710. package/dist/src/utils/gitUtils.js +61 -0
  711. package/dist/src/utils/gitUtils.js.map +1 -0
  712. package/dist/src/utils/ignorePatterns.d.ts +103 -0
  713. package/dist/src/utils/ignorePatterns.js +220 -0
  714. package/dist/src/utils/ignorePatterns.js.map +1 -0
  715. package/dist/src/utils/ignorePatterns.test.d.ts +6 -0
  716. package/dist/src/utils/ignorePatterns.test.js +250 -0
  717. package/dist/src/utils/ignorePatterns.test.js.map +1 -0
  718. package/dist/src/utils/installationManager.d.ts +16 -0
  719. package/dist/src/utils/installationManager.js +50 -0
  720. package/dist/src/utils/installationManager.js.map +1 -0
  721. package/dist/src/utils/installationManager.test.d.ts +6 -0
  722. package/dist/src/utils/installationManager.test.js +83 -0
  723. package/dist/src/utils/installationManager.test.js.map +1 -0
  724. package/dist/src/utils/language-detection.d.ts +6 -0
  725. package/dist/src/utils/language-detection.js +101 -0
  726. package/dist/src/utils/language-detection.js.map +1 -0
  727. package/dist/src/utils/llm-edit-fixer.d.ts +26 -0
  728. package/dist/src/utils/llm-edit-fixer.js +121 -0
  729. package/dist/src/utils/llm-edit-fixer.js.map +1 -0
  730. package/dist/src/utils/llm-edit-fixer.test.d.ts +6 -0
  731. package/dist/src/utils/llm-edit-fixer.test.js +105 -0
  732. package/dist/src/utils/llm-edit-fixer.test.js.map +1 -0
  733. package/dist/src/utils/memoryDiscovery.d.ts +16 -0
  734. package/dist/src/utils/memoryDiscovery.js +254 -0
  735. package/dist/src/utils/memoryDiscovery.js.map +1 -0
  736. package/dist/src/utils/memoryDiscovery.test.d.ts +6 -0
  737. package/dist/src/utils/memoryDiscovery.test.js +244 -0
  738. package/dist/src/utils/memoryDiscovery.test.js.map +1 -0
  739. package/dist/src/utils/memoryImportProcessor.d.ts +42 -0
  740. package/dist/src/utils/memoryImportProcessor.js +296 -0
  741. package/dist/src/utils/memoryImportProcessor.js.map +1 -0
  742. package/dist/src/utils/memoryImportProcessor.test.d.ts +6 -0
  743. package/dist/src/utils/memoryImportProcessor.test.js +573 -0
  744. package/dist/src/utils/memoryImportProcessor.test.js.map +1 -0
  745. package/dist/src/utils/messageInspectors.d.ts +8 -0
  746. package/dist/src/utils/messageInspectors.js +16 -0
  747. package/dist/src/utils/messageInspectors.js.map +1 -0
  748. package/dist/src/utils/nextSpeakerChecker.d.ts +12 -0
  749. package/dist/src/utils/nextSpeakerChecker.js +97 -0
  750. package/dist/src/utils/nextSpeakerChecker.js.map +1 -0
  751. package/dist/src/utils/nextSpeakerChecker.test.d.ts +6 -0
  752. package/dist/src/utils/nextSpeakerChecker.test.js +179 -0
  753. package/dist/src/utils/nextSpeakerChecker.test.js.map +1 -0
  754. package/dist/src/utils/partUtils.d.ts +35 -0
  755. package/dist/src/utils/partUtils.js +133 -0
  756. package/dist/src/utils/partUtils.js.map +1 -0
  757. package/dist/src/utils/partUtils.test.d.ts +6 -0
  758. package/dist/src/utils/partUtils.test.js +241 -0
  759. package/dist/src/utils/partUtils.test.js.map +1 -0
  760. package/dist/src/utils/pathReader.d.ts +17 -0
  761. package/dist/src/utils/pathReader.js +92 -0
  762. package/dist/src/utils/pathReader.js.map +1 -0
  763. package/dist/src/utils/pathReader.test.d.ts +6 -0
  764. package/dist/src/utils/pathReader.test.js +363 -0
  765. package/dist/src/utils/pathReader.test.js.map +1 -0
  766. package/dist/src/utils/paths.d.ts +58 -0
  767. package/dist/src/utils/paths.js +159 -0
  768. package/dist/src/utils/paths.js.map +1 -0
  769. package/dist/src/utils/paths.test.d.ts +6 -0
  770. package/dist/src/utils/paths.test.js +225 -0
  771. package/dist/src/utils/paths.test.js.map +1 -0
  772. package/dist/src/utils/promptIdContext.d.ts +7 -0
  773. package/dist/src/utils/promptIdContext.js +8 -0
  774. package/dist/src/utils/promptIdContext.js.map +1 -0
  775. package/dist/src/utils/quotaErrorDetection.d.ts +18 -0
  776. package/dist/src/utils/quotaErrorDetection.js +65 -0
  777. package/dist/src/utils/quotaErrorDetection.js.map +1 -0
  778. package/dist/src/utils/retry.d.ts +30 -0
  779. package/dist/src/utils/retry.js +276 -0
  780. package/dist/src/utils/retry.js.map +1 -0
  781. package/dist/src/utils/retry.test.d.ts +6 -0
  782. package/dist/src/utils/retry.test.js +325 -0
  783. package/dist/src/utils/retry.test.js.map +1 -0
  784. package/dist/src/utils/safeJsonStringify.d.ts +13 -0
  785. package/dist/src/utils/safeJsonStringify.js +25 -0
  786. package/dist/src/utils/safeJsonStringify.js.map +1 -0
  787. package/dist/src/utils/safeJsonStringify.test.d.ts +6 -0
  788. package/dist/src/utils/safeJsonStringify.test.js +61 -0
  789. package/dist/src/utils/safeJsonStringify.test.js.map +1 -0
  790. package/dist/src/utils/schemaValidator.d.ts +15 -0
  791. package/dist/src/utils/schemaValidator.js +38 -0
  792. package/dist/src/utils/schemaValidator.js.map +1 -0
  793. package/dist/src/utils/secure-browser-launcher.d.ts +23 -0
  794. package/dist/src/utils/secure-browser-launcher.js +165 -0
  795. package/dist/src/utils/secure-browser-launcher.js.map +1 -0
  796. package/dist/src/utils/secure-browser-launcher.test.d.ts +6 -0
  797. package/dist/src/utils/secure-browser-launcher.test.js +149 -0
  798. package/dist/src/utils/secure-browser-launcher.test.js.map +1 -0
  799. package/dist/src/utils/session.d.ts +6 -0
  800. package/dist/src/utils/session.js +8 -0
  801. package/dist/src/utils/session.js.map +1 -0
  802. package/dist/src/utils/shell-utils.d.ts +122 -0
  803. package/dist/src/utils/shell-utils.js +393 -0
  804. package/dist/src/utils/shell-utils.js.map +1 -0
  805. package/dist/src/utils/shell-utils.test.d.ts +6 -0
  806. package/dist/src/utils/shell-utils.test.js +332 -0
  807. package/dist/src/utils/shell-utils.test.js.map +1 -0
  808. package/dist/src/utils/summarizer.d.ts +25 -0
  809. package/dist/src/utils/summarizer.js +51 -0
  810. package/dist/src/utils/summarizer.js.map +1 -0
  811. package/dist/src/utils/summarizer.test.d.ts +6 -0
  812. package/dist/src/utils/summarizer.test.js +131 -0
  813. package/dist/src/utils/summarizer.test.js.map +1 -0
  814. package/dist/src/utils/systemEncoding.d.ts +40 -0
  815. package/dist/src/utils/systemEncoding.js +149 -0
  816. package/dist/src/utils/systemEncoding.js.map +1 -0
  817. package/dist/src/utils/systemEncoding.test.d.ts +6 -0
  818. package/dist/src/utils/systemEncoding.test.js +368 -0
  819. package/dist/src/utils/systemEncoding.test.js.map +1 -0
  820. package/dist/src/utils/terminalSerializer.d.ts +28 -0
  821. package/dist/src/utils/terminalSerializer.js +432 -0
  822. package/dist/src/utils/terminalSerializer.js.map +1 -0
  823. package/dist/src/utils/terminalSerializer.test.d.ts +6 -0
  824. package/dist/src/utils/terminalSerializer.test.js +176 -0
  825. package/dist/src/utils/terminalSerializer.test.js.map +1 -0
  826. package/dist/src/utils/testUtils.d.ts +29 -0
  827. package/dist/src/utils/testUtils.js +70 -0
  828. package/dist/src/utils/testUtils.js.map +1 -0
  829. package/dist/src/utils/textUtils.d.ts +18 -0
  830. package/dist/src/utils/textUtils.js +42 -0
  831. package/dist/src/utils/textUtils.js.map +1 -0
  832. package/dist/src/utils/textUtils.test.d.ts +6 -0
  833. package/dist/src/utils/textUtils.test.js +59 -0
  834. package/dist/src/utils/textUtils.test.js.map +1 -0
  835. package/dist/src/utils/tool-utils.d.ts +19 -0
  836. package/dist/src/utils/tool-utils.js +58 -0
  837. package/dist/src/utils/tool-utils.js.map +1 -0
  838. package/dist/src/utils/tool-utils.test.d.ts +6 -0
  839. package/dist/src/utils/tool-utils.test.js +61 -0
  840. package/dist/src/utils/tool-utils.test.js.map +1 -0
  841. package/dist/src/utils/userAccountManager.d.ts +20 -0
  842. package/dist/src/utils/userAccountManager.js +114 -0
  843. package/dist/src/utils/userAccountManager.js.map +1 -0
  844. package/dist/src/utils/userAccountManager.test.d.ts +6 -0
  845. package/dist/src/utils/userAccountManager.test.js +223 -0
  846. package/dist/src/utils/userAccountManager.test.js.map +1 -0
  847. package/dist/src/utils/workspaceContext.d.ts +66 -0
  848. package/dist/src/utils/workspaceContext.js +171 -0
  849. package/dist/src/utils/workspaceContext.js.map +1 -0
  850. package/dist/src/utils/workspaceContext.test.d.ts +6 -0
  851. package/dist/src/utils/workspaceContext.test.js +318 -0
  852. package/dist/src/utils/workspaceContext.test.js.map +1 -0
  853. package/dist/tsconfig.tsbuildinfo +1 -0
  854. package/package.json +91 -0
@@ -0,0 +1,824 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /* eslint-disable @typescript-eslint/no-explicit-any */
7
+ const mockEnsureCorrectEdit = vi.hoisted(() => vi.fn());
8
+ const mockGenerateJson = vi.hoisted(() => vi.fn());
9
+ const mockOpenDiff = vi.hoisted(() => vi.fn());
10
+ import { IdeClient } from '../ide/ide-client.js';
11
+ vi.mock('../ide/ide-client.js', () => ({
12
+ IdeClient: {
13
+ getInstance: vi.fn(),
14
+ },
15
+ }));
16
+ vi.mock('../utils/editCorrector.js', () => ({
17
+ ensureCorrectEdit: mockEnsureCorrectEdit,
18
+ }));
19
+ vi.mock('../core/client.js', () => ({
20
+ GeminiClient: vi.fn().mockImplementation(() => ({
21
+ generateJson: mockGenerateJson,
22
+ })),
23
+ }));
24
+ vi.mock('../utils/editor.js', () => ({
25
+ openDiff: mockOpenDiff,
26
+ }));
27
+ vi.mock('../telemetry/loggers.js', () => ({
28
+ logFileOperation: vi.fn(),
29
+ }));
30
+ import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
31
+ import { applyReplacement, EditTool } from './edit.js';
32
+ import { ToolConfirmationOutcome } from './tools.js';
33
+ import { ToolErrorType } from './tool-error.js';
34
+ import path from 'node:path';
35
+ import fs from 'node:fs';
36
+ import os from 'node:os';
37
+ import { ApprovalMode } from '../config/config.js';
38
+ import { createMockWorkspaceContext } from '../test-utils/mockWorkspaceContext.js';
39
+ import { StandardFileSystemService } from '../services/fileSystemService.js';
40
+ describe('EditTool', () => {
41
+ let tool;
42
+ let tempDir;
43
+ let rootDir;
44
+ let mockConfig;
45
+ let geminiClient;
46
+ let baseLlmClient;
47
+ beforeEach(() => {
48
+ vi.restoreAllMocks();
49
+ tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'edit-tool-test-'));
50
+ rootDir = path.join(tempDir, 'root');
51
+ fs.mkdirSync(rootDir);
52
+ geminiClient = {
53
+ generateJson: mockGenerateJson, // mockGenerateJson is already defined and hoisted
54
+ };
55
+ baseLlmClient = {
56
+ generateJson: vi.fn(),
57
+ };
58
+ mockConfig = {
59
+ getGeminiClient: vi.fn().mockReturnValue(geminiClient),
60
+ getBaseLlmClient: vi.fn().mockReturnValue(baseLlmClient),
61
+ getTargetDir: () => rootDir,
62
+ getApprovalMode: vi.fn(),
63
+ setApprovalMode: vi.fn(),
64
+ getWorkspaceContext: () => createMockWorkspaceContext(rootDir),
65
+ getFileSystemService: () => new StandardFileSystemService(),
66
+ getIdeMode: () => false,
67
+ // getGeminiConfig: () => ({ apiKey: 'test-api-key' }), // This was not a real Config method
68
+ // Add other properties/methods of Config if EditTool uses them
69
+ // Minimal other methods to satisfy Config type if needed by EditTool constructor or other direct uses:
70
+ getApiKey: () => 'test-api-key',
71
+ getModel: () => 'test-model',
72
+ getSandbox: () => false,
73
+ getDebugMode: () => false,
74
+ getQuestion: () => undefined,
75
+ getFullContext: () => false,
76
+ getToolDiscoveryCommand: () => undefined,
77
+ getToolCallCommand: () => undefined,
78
+ getMcpServerCommand: () => undefined,
79
+ getMcpServers: () => undefined,
80
+ getUserAgent: () => 'test-agent',
81
+ getUserMemory: () => '',
82
+ setUserMemory: vi.fn(),
83
+ getGeminiMdFileCount: () => 0,
84
+ setGeminiMdFileCount: vi.fn(),
85
+ getToolRegistry: () => ({}), // Minimal mock for ToolRegistry
86
+ };
87
+ // Reset mocks before each test
88
+ mockConfig.getApprovalMode.mockClear();
89
+ // Default to not skipping confirmation
90
+ mockConfig.getApprovalMode.mockReturnValue(ApprovalMode.DEFAULT);
91
+ // Reset mocks and set default implementation for ensureCorrectEdit
92
+ mockEnsureCorrectEdit.mockReset();
93
+ mockEnsureCorrectEdit.mockImplementation(async (_, currentContent, params) => {
94
+ let occurrences = 0;
95
+ if (params.old_string && currentContent) {
96
+ // Simple string counting for the mock
97
+ let index = currentContent.indexOf(params.old_string);
98
+ while (index !== -1) {
99
+ occurrences++;
100
+ index = currentContent.indexOf(params.old_string, index + 1);
101
+ }
102
+ }
103
+ else if (params.old_string === '') {
104
+ occurrences = 0; // Creating a new file
105
+ }
106
+ return Promise.resolve({ params, occurrences });
107
+ });
108
+ // Default mock for generateJson to return the snippet unchanged
109
+ mockGenerateJson.mockReset();
110
+ mockGenerateJson.mockImplementation(async (contents, schema) => {
111
+ // The problematic_snippet is the last part of the user's content
112
+ const userContent = contents.find((c) => c.role === 'user');
113
+ let promptText = '';
114
+ if (userContent && userContent.parts) {
115
+ promptText = userContent.parts
116
+ .filter((p) => typeof p.text === 'string')
117
+ .map((p) => p.text)
118
+ .join('\n');
119
+ }
120
+ const snippetMatch = promptText.match(/Problematic target snippet:\n```\n([\s\S]*?)\n```/);
121
+ const problematicSnippet = snippetMatch && snippetMatch[1] ? snippetMatch[1] : '';
122
+ if (schema.properties?.corrected_target_snippet) {
123
+ return Promise.resolve({
124
+ corrected_target_snippet: problematicSnippet,
125
+ });
126
+ }
127
+ if (schema.properties?.corrected_new_string) {
128
+ // For new_string correction, we might need more sophisticated logic,
129
+ // but for now, returning original is a safe default if not specified by a test.
130
+ const originalNewStringMatch = promptText.match(/original_new_string \(what was intended to replace original_old_string\):\n```\n([\s\S]*?)\n```/);
131
+ const originalNewString = originalNewStringMatch && originalNewStringMatch[1]
132
+ ? originalNewStringMatch[1]
133
+ : '';
134
+ return Promise.resolve({ corrected_new_string: originalNewString });
135
+ }
136
+ return Promise.resolve({}); // Default empty object if schema doesn't match
137
+ });
138
+ tool = new EditTool(mockConfig);
139
+ });
140
+ afterEach(() => {
141
+ fs.rmSync(tempDir, { recursive: true, force: true });
142
+ });
143
+ describe('applyReplacement', () => {
144
+ it('should return newString if isNewFile is true', () => {
145
+ expect(applyReplacement(null, 'old', 'new', true)).toBe('new');
146
+ expect(applyReplacement('existing', 'old', 'new', true)).toBe('new');
147
+ });
148
+ it('should return newString if currentContent is null and oldString is empty (defensive)', () => {
149
+ expect(applyReplacement(null, '', 'new', false)).toBe('new');
150
+ });
151
+ it('should return empty string if currentContent is null and oldString is not empty (defensive)', () => {
152
+ expect(applyReplacement(null, 'old', 'new', false)).toBe('');
153
+ });
154
+ it('should replace oldString with newString in currentContent', () => {
155
+ expect(applyReplacement('hello old world old', 'old', 'new', false)).toBe('hello new world new');
156
+ });
157
+ it('should return currentContent if oldString is empty and not a new file', () => {
158
+ expect(applyReplacement('hello world', '', 'new', false)).toBe('hello world');
159
+ });
160
+ it('should treat $ literally and not as replacement pattern', () => {
161
+ const current = "price is $100 and pattern end is ' '";
162
+ const oldStr = 'price is $100';
163
+ const newStr = 'price is $200';
164
+ const result = applyReplacement(current, oldStr, newStr, false);
165
+ expect(result).toBe("price is $200 and pattern end is ' '");
166
+ });
167
+ it("should treat $' literally and not as a replacement pattern", () => {
168
+ const current = 'foo';
169
+ const oldStr = 'foo';
170
+ const newStr = "bar$'baz";
171
+ const result = applyReplacement(current, oldStr, newStr, false);
172
+ expect(result).toBe("bar$'baz");
173
+ });
174
+ it('should treat $& literally and not as a replacement pattern', () => {
175
+ const current = 'hello world';
176
+ const oldStr = 'hello';
177
+ const newStr = '$&-replacement';
178
+ const result = applyReplacement(current, oldStr, newStr, false);
179
+ expect(result).toBe('$&-replacement world');
180
+ });
181
+ it('should treat $` literally and not as a replacement pattern', () => {
182
+ const current = 'prefix-middle-suffix';
183
+ const oldStr = 'middle';
184
+ const newStr = 'new$`content';
185
+ const result = applyReplacement(current, oldStr, newStr, false);
186
+ expect(result).toBe('prefix-new$`content-suffix');
187
+ });
188
+ it('should treat $1, $2 capture groups literally', () => {
189
+ const current = 'test string';
190
+ const oldStr = 'test';
191
+ const newStr = '$1$2replacement';
192
+ const result = applyReplacement(current, oldStr, newStr, false);
193
+ expect(result).toBe('$1$2replacement string');
194
+ });
195
+ it('should use replaceAll for normal strings without problematic $ sequences', () => {
196
+ const current = 'normal text replacement';
197
+ const oldStr = 'text';
198
+ const newStr = 'string';
199
+ const result = applyReplacement(current, oldStr, newStr, false);
200
+ expect(result).toBe('normal string replacement');
201
+ });
202
+ it('should handle multiple occurrences with problematic $ sequences', () => {
203
+ const current = 'foo bar foo baz';
204
+ const oldStr = 'foo';
205
+ const newStr = "test$'end";
206
+ const result = applyReplacement(current, oldStr, newStr, false);
207
+ expect(result).toBe("test$'end bar test$'end baz");
208
+ });
209
+ it('should handle complex regex patterns with $ at end', () => {
210
+ const current = "| select('match', '^[sv]d[a-z]$')";
211
+ const oldStr = "'^[sv]d[a-z]$'";
212
+ const newStr = "'^[sv]d[a-z]$' # updated";
213
+ const result = applyReplacement(current, oldStr, newStr, false);
214
+ expect(result).toBe("| select('match', '^[sv]d[a-z]$' # updated)");
215
+ });
216
+ it('should handle empty replacement with problematic $ in newString', () => {
217
+ const current = 'test content';
218
+ const oldStr = 'nothing';
219
+ const newStr = "replacement$'text";
220
+ const result = applyReplacement(current, oldStr, newStr, false);
221
+ expect(result).toBe('test content'); // No replacement because oldStr not found
222
+ });
223
+ it('should handle $$ (escaped dollar) correctly', () => {
224
+ const current = 'price value';
225
+ const oldStr = 'value';
226
+ const newStr = '$$100';
227
+ const result = applyReplacement(current, oldStr, newStr, false);
228
+ expect(result).toBe('price $$100');
229
+ });
230
+ });
231
+ describe('validateToolParams', () => {
232
+ it('should return null for valid params', () => {
233
+ const params = {
234
+ file_path: path.join(rootDir, 'test.txt'),
235
+ old_string: 'old',
236
+ new_string: 'new',
237
+ };
238
+ expect(tool.validateToolParams(params)).toBeNull();
239
+ });
240
+ it('should return error for relative path', () => {
241
+ const params = {
242
+ file_path: 'test.txt',
243
+ old_string: 'old',
244
+ new_string: 'new',
245
+ };
246
+ expect(tool.validateToolParams(params)).toMatch(/File path must be absolute/);
247
+ });
248
+ it('should return error for path outside root', () => {
249
+ const params = {
250
+ file_path: path.join(tempDir, 'outside-root.txt'),
251
+ old_string: 'old',
252
+ new_string: 'new',
253
+ };
254
+ const error = tool.validateToolParams(params);
255
+ expect(error).toContain('File path must be within one of the workspace directories');
256
+ });
257
+ });
258
+ describe('shouldConfirmExecute', () => {
259
+ const testFile = 'edit_me.txt';
260
+ let filePath;
261
+ beforeEach(() => {
262
+ filePath = path.join(rootDir, testFile);
263
+ });
264
+ it('should throw an error if params are invalid', async () => {
265
+ const params = {
266
+ file_path: 'relative.txt',
267
+ old_string: 'old',
268
+ new_string: 'new',
269
+ };
270
+ expect(() => tool.build(params)).toThrow();
271
+ });
272
+ it('should request confirmation for valid edit', async () => {
273
+ fs.writeFileSync(filePath, 'some old content here');
274
+ const params = {
275
+ file_path: filePath,
276
+ old_string: 'old',
277
+ new_string: 'new',
278
+ };
279
+ // ensureCorrectEdit will be called by shouldConfirmExecute
280
+ mockEnsureCorrectEdit.mockResolvedValueOnce({ params, occurrences: 1 });
281
+ const invocation = tool.build(params);
282
+ const confirmation = await invocation.shouldConfirmExecute(new AbortController().signal);
283
+ expect(confirmation).toEqual(expect.objectContaining({
284
+ title: `Confirm Edit: ${testFile}`,
285
+ fileName: testFile,
286
+ fileDiff: expect.any(String),
287
+ }));
288
+ });
289
+ it('should return false if old_string is not found (ensureCorrectEdit returns 0)', async () => {
290
+ fs.writeFileSync(filePath, 'some content here');
291
+ const params = {
292
+ file_path: filePath,
293
+ old_string: 'not_found',
294
+ new_string: 'new',
295
+ };
296
+ mockEnsureCorrectEdit.mockResolvedValueOnce({ params, occurrences: 0 });
297
+ const invocation = tool.build(params);
298
+ const confirmation = await invocation.shouldConfirmExecute(new AbortController().signal);
299
+ expect(confirmation).toBe(false);
300
+ });
301
+ it('should return false if multiple occurrences of old_string are found (ensureCorrectEdit returns > 1)', async () => {
302
+ fs.writeFileSync(filePath, 'old old content here');
303
+ const params = {
304
+ file_path: filePath,
305
+ old_string: 'old',
306
+ new_string: 'new',
307
+ };
308
+ mockEnsureCorrectEdit.mockResolvedValueOnce({ params, occurrences: 2 });
309
+ const invocation = tool.build(params);
310
+ const confirmation = await invocation.shouldConfirmExecute(new AbortController().signal);
311
+ expect(confirmation).toBe(false);
312
+ });
313
+ it('should request confirmation for creating a new file (empty old_string)', async () => {
314
+ const newFileName = 'new_file.txt';
315
+ const newFilePath = path.join(rootDir, newFileName);
316
+ const params = {
317
+ file_path: newFilePath,
318
+ old_string: '',
319
+ new_string: 'new file content',
320
+ };
321
+ // ensureCorrectEdit might not be called if old_string is empty,
322
+ // as shouldConfirmExecute handles this for diff generation.
323
+ // If it is called, it should return 0 occurrences for a new file.
324
+ mockEnsureCorrectEdit.mockResolvedValueOnce({ params, occurrences: 0 });
325
+ const invocation = tool.build(params);
326
+ const confirmation = await invocation.shouldConfirmExecute(new AbortController().signal);
327
+ expect(confirmation).toEqual(expect.objectContaining({
328
+ title: `Confirm Edit: ${newFileName}`,
329
+ fileName: newFileName,
330
+ fileDiff: expect.any(String),
331
+ }));
332
+ });
333
+ it('should use corrected params from ensureCorrectEdit for diff generation', async () => {
334
+ const originalContent = 'This is the original string to be replaced.';
335
+ const originalOldString = 'original string';
336
+ const originalNewString = 'new string';
337
+ const correctedOldString = 'original string to be replaced'; // More specific
338
+ const correctedNewString = 'completely new string'; // Different replacement
339
+ const expectedFinalContent = 'This is the completely new string.';
340
+ fs.writeFileSync(filePath, originalContent);
341
+ const params = {
342
+ file_path: filePath,
343
+ old_string: originalOldString,
344
+ new_string: originalNewString,
345
+ };
346
+ // The main beforeEach already calls mockEnsureCorrectEdit.mockReset()
347
+ // Set a specific mock for this test case
348
+ let mockCalled = false;
349
+ mockEnsureCorrectEdit.mockImplementationOnce(async (_, content, p, client, baseClient) => {
350
+ mockCalled = true;
351
+ expect(content).toBe(originalContent);
352
+ expect(p).toBe(params);
353
+ expect(client).toBe(geminiClient);
354
+ expect(baseClient).toBe(baseLlmClient);
355
+ return {
356
+ params: {
357
+ file_path: filePath,
358
+ old_string: correctedOldString,
359
+ new_string: correctedNewString,
360
+ },
361
+ occurrences: 1,
362
+ };
363
+ });
364
+ const invocation = tool.build(params);
365
+ const confirmation = (await invocation.shouldConfirmExecute(new AbortController().signal));
366
+ expect(mockCalled).toBe(true); // Check if the mock implementation was run
367
+ // expect(mockEnsureCorrectEdit).toHaveBeenCalledWith(originalContent, params, expect.anything()); // Keep this commented for now
368
+ expect(confirmation).toEqual(expect.objectContaining({
369
+ title: `Confirm Edit: ${testFile}`,
370
+ fileName: testFile,
371
+ }));
372
+ // Check that the diff is based on the corrected strings leading to the new state
373
+ expect(confirmation.fileDiff).toContain(`-${originalContent}`);
374
+ expect(confirmation.fileDiff).toContain(`+${expectedFinalContent}`);
375
+ // Verify that applying the correctedOldString and correctedNewString to originalContent
376
+ // indeed produces the expectedFinalContent, which is what the diff should reflect.
377
+ const patchedContent = originalContent.replace(correctedOldString, // This was the string identified by ensureCorrectEdit for replacement
378
+ correctedNewString);
379
+ expect(patchedContent).toBe(expectedFinalContent);
380
+ });
381
+ });
382
+ describe('execute', () => {
383
+ const testFile = 'execute_me.txt';
384
+ let filePath;
385
+ beforeEach(() => {
386
+ filePath = path.join(rootDir, testFile);
387
+ // Default for execute tests, can be overridden
388
+ mockEnsureCorrectEdit.mockImplementation(async (_, content, params) => {
389
+ let occurrences = 0;
390
+ if (params.old_string && content) {
391
+ let index = content.indexOf(params.old_string);
392
+ while (index !== -1) {
393
+ occurrences++;
394
+ index = content.indexOf(params.old_string, index + 1);
395
+ }
396
+ }
397
+ else if (params.old_string === '') {
398
+ occurrences = 0;
399
+ }
400
+ return { params, occurrences };
401
+ });
402
+ });
403
+ it('should throw error if file path is not absolute', async () => {
404
+ const params = {
405
+ file_path: 'relative.txt',
406
+ old_string: 'old',
407
+ new_string: 'new',
408
+ };
409
+ expect(() => tool.build(params)).toThrow(/File path must be absolute/);
410
+ });
411
+ it('should throw error if file path is empty', async () => {
412
+ const params = {
413
+ file_path: '',
414
+ old_string: 'old',
415
+ new_string: 'new',
416
+ };
417
+ expect(() => tool.build(params)).toThrow(/The 'file_path' parameter must be non-empty./);
418
+ });
419
+ it('should edit an existing file and return diff with fileName', async () => {
420
+ const initialContent = 'This is some old text.';
421
+ const newContent = 'This is some new text.'; // old -> new
422
+ fs.writeFileSync(filePath, initialContent, 'utf8');
423
+ const params = {
424
+ file_path: filePath,
425
+ old_string: 'old',
426
+ new_string: 'new',
427
+ };
428
+ // Specific mock for this test's execution path in calculateEdit
429
+ // ensureCorrectEdit is NOT called by calculateEdit, only by shouldConfirmExecute
430
+ // So, the default mockEnsureCorrectEdit should correctly return 1 occurrence for 'old' in initialContent
431
+ const invocation = tool.build(params);
432
+ const result = await invocation.execute(new AbortController().signal);
433
+ expect(result.llmContent).toMatch(/Successfully modified file/);
434
+ expect(fs.readFileSync(filePath, 'utf8')).toBe(newContent);
435
+ const display = result.returnDisplay;
436
+ expect(display.fileDiff).toMatch(initialContent);
437
+ expect(display.fileDiff).toMatch(newContent);
438
+ expect(display.fileName).toBe(testFile);
439
+ });
440
+ it('should create a new file if old_string is empty and file does not exist, and return created message', async () => {
441
+ const newFileName = 'brand_new_file.txt';
442
+ const newFilePath = path.join(rootDir, newFileName);
443
+ const fileContent = 'Content for the new file.';
444
+ const params = {
445
+ file_path: newFilePath,
446
+ old_string: '',
447
+ new_string: fileContent,
448
+ };
449
+ mockConfig.getApprovalMode.mockReturnValueOnce(ApprovalMode.AUTO_EDIT);
450
+ const invocation = tool.build(params);
451
+ const result = await invocation.execute(new AbortController().signal);
452
+ expect(result.llmContent).toMatch(/Created new file/);
453
+ expect(fs.existsSync(newFilePath)).toBe(true);
454
+ expect(fs.readFileSync(newFilePath, 'utf8')).toBe(fileContent);
455
+ const display = result.returnDisplay;
456
+ expect(display.fileDiff).toMatch(/\+Content for the new file\./);
457
+ expect(display.fileName).toBe(newFileName);
458
+ expect(result.returnDisplay.diffStat).toStrictEqual({
459
+ model_added_lines: 1,
460
+ model_removed_lines: 0,
461
+ model_added_chars: 25,
462
+ model_removed_chars: 0,
463
+ user_added_lines: 0,
464
+ user_removed_lines: 0,
465
+ user_added_chars: 0,
466
+ user_removed_chars: 0,
467
+ });
468
+ });
469
+ it('should return error if old_string is not found in file', async () => {
470
+ fs.writeFileSync(filePath, 'Some content.', 'utf8');
471
+ const params = {
472
+ file_path: filePath,
473
+ old_string: 'nonexistent',
474
+ new_string: 'replacement',
475
+ };
476
+ // The default mockEnsureCorrectEdit will return 0 occurrences for 'nonexistent'
477
+ const invocation = tool.build(params);
478
+ const result = await invocation.execute(new AbortController().signal);
479
+ expect(result.llmContent).toMatch(/0 occurrences found for old_string in/);
480
+ expect(result.returnDisplay).toMatch(/Failed to edit, could not find the string to replace./);
481
+ });
482
+ it('should return error if multiple occurrences of old_string are found', async () => {
483
+ fs.writeFileSync(filePath, 'multiple old old strings', 'utf8');
484
+ const params = {
485
+ file_path: filePath,
486
+ old_string: 'old',
487
+ new_string: 'new',
488
+ };
489
+ // The default mockEnsureCorrectEdit will return 2 occurrences for 'old'
490
+ const invocation = tool.build(params);
491
+ const result = await invocation.execute(new AbortController().signal);
492
+ expect(result.llmContent).toMatch(/Expected 1 occurrence but found 2 for old_string in file/);
493
+ expect(result.returnDisplay).toMatch(/Failed to edit, expected 1 occurrence but found 2/);
494
+ });
495
+ it('should successfully replace multiple occurrences when expected_replacements specified', async () => {
496
+ fs.writeFileSync(filePath, 'old text\nold text\nold text', 'utf8');
497
+ const params = {
498
+ file_path: filePath,
499
+ old_string: 'old',
500
+ new_string: 'new',
501
+ expected_replacements: 3,
502
+ };
503
+ const invocation = tool.build(params);
504
+ const result = await invocation.execute(new AbortController().signal);
505
+ expect(result.llmContent).toMatch(/Successfully modified file/);
506
+ expect(fs.readFileSync(filePath, 'utf8')).toBe('new text\nnew text\nnew text');
507
+ const display = result.returnDisplay;
508
+ expect(display.fileDiff).toMatch(/-old text\n-old text\n-old text/);
509
+ expect(display.fileDiff).toMatch(/\+new text\n\+new text\n\+new text/);
510
+ expect(display.fileName).toBe(testFile);
511
+ expect(result.returnDisplay.diffStat).toStrictEqual({
512
+ model_added_lines: 3,
513
+ model_removed_lines: 3,
514
+ model_added_chars: 24,
515
+ model_removed_chars: 24,
516
+ user_added_lines: 0,
517
+ user_removed_lines: 0,
518
+ user_added_chars: 0,
519
+ user_removed_chars: 0,
520
+ });
521
+ });
522
+ it('should return error if expected_replacements does not match actual occurrences', async () => {
523
+ fs.writeFileSync(filePath, 'old text old text', 'utf8');
524
+ const params = {
525
+ file_path: filePath,
526
+ old_string: 'old',
527
+ new_string: 'new',
528
+ expected_replacements: 3, // Expecting 3 but only 2 exist
529
+ };
530
+ const invocation = tool.build(params);
531
+ const result = await invocation.execute(new AbortController().signal);
532
+ expect(result.llmContent).toMatch(/Expected 3 occurrences but found 2 for old_string in file/);
533
+ expect(result.returnDisplay).toMatch(/Failed to edit, expected 3 occurrences but found 2/);
534
+ });
535
+ it('should return error if trying to create a file that already exists (empty old_string)', async () => {
536
+ fs.writeFileSync(filePath, 'Existing content', 'utf8');
537
+ const params = {
538
+ file_path: filePath,
539
+ old_string: '',
540
+ new_string: 'new content',
541
+ };
542
+ const invocation = tool.build(params);
543
+ const result = await invocation.execute(new AbortController().signal);
544
+ expect(result.llmContent).toMatch(/File already exists, cannot create/);
545
+ expect(result.returnDisplay).toMatch(/Attempted to create a file that already exists/);
546
+ });
547
+ it('should include modification message when proposed content is modified', async () => {
548
+ const initialContent = 'Line 1\nold line\nLine 3\nLine 4\nLine 5\n';
549
+ fs.writeFileSync(filePath, initialContent, 'utf8');
550
+ const params = {
551
+ file_path: filePath,
552
+ old_string: 'old',
553
+ new_string: 'new',
554
+ modified_by_user: true,
555
+ ai_proposed_content: 'Line 1\nAI line\nLine 3\nLine 4\nLine 5\n',
556
+ };
557
+ mockConfig.getApprovalMode.mockReturnValueOnce(ApprovalMode.AUTO_EDIT);
558
+ const invocation = tool.build(params);
559
+ const result = await invocation.execute(new AbortController().signal);
560
+ expect(result.llmContent).toMatch(/User modified the `new_string` content/);
561
+ expect(result.returnDisplay.diffStat).toStrictEqual({
562
+ model_added_lines: 1,
563
+ model_removed_lines: 1,
564
+ model_added_chars: 7,
565
+ model_removed_chars: 8,
566
+ user_added_lines: 1,
567
+ user_removed_lines: 1,
568
+ user_added_chars: 8,
569
+ user_removed_chars: 7,
570
+ });
571
+ });
572
+ it('should not include modification message when proposed content is not modified', async () => {
573
+ const initialContent = 'This is some old text.';
574
+ fs.writeFileSync(filePath, initialContent, 'utf8');
575
+ const params = {
576
+ file_path: filePath,
577
+ old_string: 'old',
578
+ new_string: 'new',
579
+ modified_by_user: false,
580
+ };
581
+ mockConfig.getApprovalMode.mockReturnValueOnce(ApprovalMode.AUTO_EDIT);
582
+ const invocation = tool.build(params);
583
+ const result = await invocation.execute(new AbortController().signal);
584
+ expect(result.llmContent).not.toMatch(/User modified the `new_string` content/);
585
+ });
586
+ it('should not include modification message when modified_by_user is not provided', async () => {
587
+ const initialContent = 'This is some old text.';
588
+ fs.writeFileSync(filePath, initialContent, 'utf8');
589
+ const params = {
590
+ file_path: filePath,
591
+ old_string: 'old',
592
+ new_string: 'new',
593
+ };
594
+ mockConfig.getApprovalMode.mockReturnValueOnce(ApprovalMode.AUTO_EDIT);
595
+ const invocation = tool.build(params);
596
+ const result = await invocation.execute(new AbortController().signal);
597
+ expect(result.llmContent).not.toMatch(/User modified the `new_string` content/);
598
+ });
599
+ it('should return error if old_string and new_string are identical', async () => {
600
+ const initialContent = 'This is some identical text.';
601
+ fs.writeFileSync(filePath, initialContent, 'utf8');
602
+ const params = {
603
+ file_path: filePath,
604
+ old_string: 'identical',
605
+ new_string: 'identical',
606
+ };
607
+ const invocation = tool.build(params);
608
+ const result = await invocation.execute(new AbortController().signal);
609
+ expect(result.llmContent).toMatch(/No changes to apply/);
610
+ expect(result.returnDisplay).toMatch(/No changes to apply/);
611
+ });
612
+ it('should return EDIT_NO_CHANGE error if replacement results in identical content', async () => {
613
+ // This can happen if ensureCorrectEdit finds a fuzzy match, but the literal
614
+ // string replacement with `replaceAll` results in no change.
615
+ const initialContent = 'line 1\nline 2\nline 3'; // Note the double space
616
+ fs.writeFileSync(filePath, initialContent, 'utf8');
617
+ const params = {
618
+ file_path: filePath,
619
+ // old_string has a single space, so it won't be found by replaceAll
620
+ old_string: 'line 1\nline 2\nline 3',
621
+ new_string: 'line 1\nnew line 2\nline 3',
622
+ };
623
+ // Mock ensureCorrectEdit to simulate it finding a match (e.g., via fuzzy matching)
624
+ // but it doesn't correct the old_string to the literal content.
625
+ mockEnsureCorrectEdit.mockResolvedValueOnce({ params, occurrences: 1 });
626
+ const invocation = tool.build(params);
627
+ const result = await invocation.execute(new AbortController().signal);
628
+ expect(result.error?.type).toBe(ToolErrorType.EDIT_NO_CHANGE);
629
+ expect(result.returnDisplay).toMatch(/No changes to apply. The new content is identical to the current content./);
630
+ // Ensure the file was not actually changed
631
+ expect(fs.readFileSync(filePath, 'utf8')).toBe(initialContent);
632
+ });
633
+ });
634
+ describe('Error Scenarios', () => {
635
+ const testFile = 'error_test.txt';
636
+ let filePath;
637
+ beforeEach(() => {
638
+ filePath = path.join(rootDir, testFile);
639
+ });
640
+ it('should return FILE_NOT_FOUND error', async () => {
641
+ const params = {
642
+ file_path: filePath,
643
+ old_string: 'any',
644
+ new_string: 'new',
645
+ };
646
+ const invocation = tool.build(params);
647
+ const result = await invocation.execute(new AbortController().signal);
648
+ expect(result.error?.type).toBe(ToolErrorType.FILE_NOT_FOUND);
649
+ });
650
+ it('should return ATTEMPT_TO_CREATE_EXISTING_FILE error', async () => {
651
+ fs.writeFileSync(filePath, 'existing content', 'utf8');
652
+ const params = {
653
+ file_path: filePath,
654
+ old_string: '',
655
+ new_string: 'new content',
656
+ };
657
+ const invocation = tool.build(params);
658
+ const result = await invocation.execute(new AbortController().signal);
659
+ expect(result.error?.type).toBe(ToolErrorType.ATTEMPT_TO_CREATE_EXISTING_FILE);
660
+ });
661
+ it('should return NO_OCCURRENCE_FOUND error', async () => {
662
+ fs.writeFileSync(filePath, 'content', 'utf8');
663
+ const params = {
664
+ file_path: filePath,
665
+ old_string: 'not-found',
666
+ new_string: 'new',
667
+ };
668
+ const invocation = tool.build(params);
669
+ const result = await invocation.execute(new AbortController().signal);
670
+ expect(result.error?.type).toBe(ToolErrorType.EDIT_NO_OCCURRENCE_FOUND);
671
+ });
672
+ it('should return EXPECTED_OCCURRENCE_MISMATCH error', async () => {
673
+ fs.writeFileSync(filePath, 'one one two', 'utf8');
674
+ const params = {
675
+ file_path: filePath,
676
+ old_string: 'one',
677
+ new_string: 'new',
678
+ expected_replacements: 3,
679
+ };
680
+ const invocation = tool.build(params);
681
+ const result = await invocation.execute(new AbortController().signal);
682
+ expect(result.error?.type).toBe(ToolErrorType.EDIT_EXPECTED_OCCURRENCE_MISMATCH);
683
+ });
684
+ it('should return NO_CHANGE error', async () => {
685
+ fs.writeFileSync(filePath, 'content', 'utf8');
686
+ const params = {
687
+ file_path: filePath,
688
+ old_string: 'content',
689
+ new_string: 'content',
690
+ };
691
+ const invocation = tool.build(params);
692
+ const result = await invocation.execute(new AbortController().signal);
693
+ expect(result.error?.type).toBe(ToolErrorType.EDIT_NO_CHANGE);
694
+ });
695
+ it('should throw INVALID_PARAMETERS error for relative path', async () => {
696
+ const params = {
697
+ file_path: 'relative/path.txt',
698
+ old_string: 'a',
699
+ new_string: 'b',
700
+ };
701
+ expect(() => tool.build(params)).toThrow();
702
+ });
703
+ it('should return FILE_WRITE_FAILURE on write error', async () => {
704
+ fs.writeFileSync(filePath, 'content', 'utf8');
705
+ // Make file readonly to trigger a write error
706
+ fs.chmodSync(filePath, '444');
707
+ const params = {
708
+ file_path: filePath,
709
+ old_string: 'content',
710
+ new_string: 'new content',
711
+ };
712
+ const invocation = tool.build(params);
713
+ const result = await invocation.execute(new AbortController().signal);
714
+ expect(result.error?.type).toBe(ToolErrorType.FILE_WRITE_FAILURE);
715
+ });
716
+ });
717
+ describe('getDescription', () => {
718
+ it('should return "No file changes to..." if old_string and new_string are the same', () => {
719
+ const testFileName = 'test.txt';
720
+ const params = {
721
+ file_path: path.join(rootDir, testFileName),
722
+ old_string: 'identical_string',
723
+ new_string: 'identical_string',
724
+ };
725
+ const invocation = tool.build(params);
726
+ // shortenPath will be called internally, resulting in just the file name
727
+ expect(invocation.getDescription()).toBe(`No file changes to ${testFileName}`);
728
+ });
729
+ it('should return a snippet of old and new strings if they are different', () => {
730
+ const testFileName = 'test.txt';
731
+ const params = {
732
+ file_path: path.join(rootDir, testFileName),
733
+ old_string: 'this is the old string value',
734
+ new_string: 'this is the new string value',
735
+ };
736
+ const invocation = tool.build(params);
737
+ // shortenPath will be called internally, resulting in just the file name
738
+ // The snippets are truncated at 30 chars + '...'
739
+ expect(invocation.getDescription()).toBe(`${testFileName}: this is the old string value => this is the new string value`);
740
+ });
741
+ it('should handle very short strings correctly in the description', () => {
742
+ const testFileName = 'short.txt';
743
+ const params = {
744
+ file_path: path.join(rootDir, testFileName),
745
+ old_string: 'old',
746
+ new_string: 'new',
747
+ };
748
+ const invocation = tool.build(params);
749
+ expect(invocation.getDescription()).toBe(`${testFileName}: old => new`);
750
+ });
751
+ it('should truncate long strings in the description', () => {
752
+ const testFileName = 'long.txt';
753
+ const params = {
754
+ file_path: path.join(rootDir, testFileName),
755
+ old_string: 'this is a very long old string that will definitely be truncated',
756
+ new_string: 'this is a very long new string that will also be truncated',
757
+ };
758
+ const invocation = tool.build(params);
759
+ expect(invocation.getDescription()).toBe(`${testFileName}: this is a very long old string... => this is a very long new string...`);
760
+ });
761
+ });
762
+ describe('workspace boundary validation', () => {
763
+ it('should validate paths are within workspace root', () => {
764
+ const validPath = {
765
+ file_path: path.join(rootDir, 'file.txt'),
766
+ old_string: 'old',
767
+ new_string: 'new',
768
+ };
769
+ expect(tool.validateToolParams(validPath)).toBeNull();
770
+ });
771
+ it('should reject paths outside workspace root', () => {
772
+ const invalidPath = {
773
+ file_path: '/etc/passwd',
774
+ old_string: 'root',
775
+ new_string: 'hacked',
776
+ };
777
+ const error = tool.validateToolParams(invalidPath);
778
+ expect(error).toContain('File path must be within one of the workspace directories');
779
+ expect(error).toContain(rootDir);
780
+ });
781
+ });
782
+ describe('IDE mode', () => {
783
+ const testFile = 'edit_me.txt';
784
+ let filePath;
785
+ let ideClient;
786
+ beforeEach(() => {
787
+ filePath = path.join(rootDir, testFile);
788
+ ideClient = {
789
+ openDiff: vi.fn(),
790
+ isDiffingEnabled: vi.fn().mockReturnValue(true),
791
+ };
792
+ vi.mocked(IdeClient.getInstance).mockResolvedValue(ideClient);
793
+ mockConfig.getIdeMode = () => true;
794
+ });
795
+ it('should call ideClient.openDiff and update params on confirmation', async () => {
796
+ const initialContent = 'some old content here';
797
+ const newContent = 'some new content here';
798
+ const modifiedContent = 'some modified content here';
799
+ fs.writeFileSync(filePath, initialContent);
800
+ const params = {
801
+ file_path: filePath,
802
+ old_string: 'old',
803
+ new_string: 'new',
804
+ };
805
+ mockEnsureCorrectEdit.mockResolvedValueOnce({
806
+ params: { ...params, old_string: 'old', new_string: 'new' },
807
+ occurrences: 1,
808
+ });
809
+ ideClient.openDiff.mockResolvedValueOnce({
810
+ status: 'accepted',
811
+ content: modifiedContent,
812
+ });
813
+ const invocation = tool.build(params);
814
+ const confirmation = await invocation.shouldConfirmExecute(new AbortController().signal);
815
+ expect(ideClient.openDiff).toHaveBeenCalledWith(filePath, newContent);
816
+ if (confirmation && 'onConfirm' in confirmation) {
817
+ await confirmation.onConfirm(ToolConfirmationOutcome.ProceedOnce);
818
+ }
819
+ expect(params.old_string).toBe(initialContent);
820
+ expect(params.new_string).toBe(modifiedContent);
821
+ });
822
+ });
823
+ });
824
+ //# sourceMappingURL=edit.test.js.map