@google/gemini-cli-core 0.24.0-nightly.20260103.30f5c4af4 → 0.24.0-preview.0

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 (297) hide show
  1. package/dist/docs/cli/settings.md +1 -0
  2. package/dist/docs/cli/skills.md +156 -0
  3. package/dist/docs/cli/telemetry.md +3 -3
  4. package/dist/docs/cli/tutorials/skills-getting-started.md +124 -0
  5. package/dist/docs/cli/tutorials.md +4 -0
  6. package/dist/docs/get-started/configuration.md +32 -5
  7. package/dist/docs/sidebar.json +4 -0
  8. package/dist/src/agents/a2a-client-manager.d.ts +5 -0
  9. package/dist/src/agents/a2a-client-manager.js +130 -0
  10. package/dist/src/agents/a2a-client-manager.js.map +1 -1
  11. package/dist/src/agents/a2a-client-manager.test.js +27 -1
  12. package/dist/src/agents/a2a-client-manager.test.js.map +1 -1
  13. package/dist/src/agents/a2aUtils.d.ts +28 -0
  14. package/dist/src/agents/a2aUtils.js +111 -0
  15. package/dist/src/agents/a2aUtils.js.map +1 -0
  16. package/dist/src/agents/a2aUtils.test.js +147 -0
  17. package/dist/src/agents/a2aUtils.test.js.map +1 -0
  18. package/dist/src/agents/delegate-to-agent-tool.d.ts +2 -2
  19. package/dist/src/agents/delegate-to-agent-tool.js +6 -6
  20. package/dist/src/agents/delegate-to-agent-tool.js.map +1 -1
  21. package/dist/src/agents/delegate-to-agent-tool.test.js +37 -7
  22. package/dist/src/agents/delegate-to-agent-tool.test.js.map +1 -1
  23. package/dist/src/agents/introspection-agent.js +2 -2
  24. package/dist/src/agents/introspection-agent.js.map +1 -1
  25. package/dist/src/agents/introspection-agent.test.js +2 -2
  26. package/dist/src/agents/introspection-agent.test.js.map +1 -1
  27. package/dist/src/agents/local-executor.js +1 -1
  28. package/dist/src/agents/local-executor.js.map +1 -1
  29. package/dist/src/agents/local-executor.test.js +2 -2
  30. package/dist/src/agents/local-executor.test.js.map +1 -1
  31. package/dist/src/agents/local-invocation.d.ts +2 -2
  32. package/dist/src/agents/local-invocation.js +3 -3
  33. package/dist/src/agents/local-invocation.js.map +1 -1
  34. package/dist/src/agents/local-invocation.test.js +7 -5
  35. package/dist/src/agents/local-invocation.test.js.map +1 -1
  36. package/dist/src/agents/remote-invocation.d.ts +17 -3
  37. package/dist/src/agents/remote-invocation.js +104 -6
  38. package/dist/src/agents/remote-invocation.js.map +1 -1
  39. package/dist/src/agents/remote-invocation.test.js +184 -18
  40. package/dist/src/agents/remote-invocation.test.js.map +1 -1
  41. package/dist/src/agents/subagent-tool-wrapper.d.ts +2 -2
  42. package/dist/src/agents/subagent-tool-wrapper.js +6 -5
  43. package/dist/src/agents/subagent-tool-wrapper.js.map +1 -1
  44. package/dist/src/agents/subagent-tool-wrapper.test.js +17 -10
  45. package/dist/src/agents/subagent-tool-wrapper.test.js.map +1 -1
  46. package/dist/src/agents/types.d.ts +6 -0
  47. package/dist/src/code_assist/oauth2.js +31 -1
  48. package/dist/src/code_assist/oauth2.js.map +1 -1
  49. package/dist/src/code_assist/oauth2.test.js +75 -3
  50. package/dist/src/code_assist/oauth2.test.js.map +1 -1
  51. package/dist/src/code_assist/server.d.ts +5 -0
  52. package/dist/src/code_assist/server.js +19 -4
  53. package/dist/src/code_assist/server.js.map +1 -1
  54. package/dist/src/code_assist/server.test.js +19 -0
  55. package/dist/src/code_assist/server.test.js.map +1 -1
  56. package/dist/src/code_assist/setup.js +6 -4
  57. package/dist/src/code_assist/setup.js.map +1 -1
  58. package/dist/src/code_assist/setup.test.js +63 -0
  59. package/dist/src/code_assist/setup.test.js.map +1 -1
  60. package/dist/src/code_assist/types.d.ts +18 -0
  61. package/dist/src/config/config.d.ts +19 -3
  62. package/dist/src/config/config.js +49 -25
  63. package/dist/src/config/config.js.map +1 -1
  64. package/dist/src/config/config.test.js +81 -4
  65. package/dist/src/config/config.test.js.map +1 -1
  66. package/dist/src/config/models.js +6 -4
  67. package/dist/src/config/models.js.map +1 -1
  68. package/dist/src/config/models.test.js +21 -1
  69. package/dist/src/config/models.test.js.map +1 -1
  70. package/dist/src/core/client.js +39 -7
  71. package/dist/src/core/client.js.map +1 -1
  72. package/dist/src/core/client.test.js +93 -0
  73. package/dist/src/core/client.test.js.map +1 -1
  74. package/dist/src/core/contentGenerator.js +1 -1
  75. package/dist/src/core/contentGenerator.js.map +1 -1
  76. package/dist/src/core/contentGenerator.test.js +1 -1
  77. package/dist/src/core/contentGenerator.test.js.map +1 -1
  78. package/dist/src/core/coreToolHookTriggers.test.js +11 -9
  79. package/dist/src/core/coreToolHookTriggers.test.js.map +1 -1
  80. package/dist/src/core/coreToolScheduler.d.ts +1 -0
  81. package/dist/src/core/coreToolScheduler.js +30 -106
  82. package/dist/src/core/coreToolScheduler.js.map +1 -1
  83. package/dist/src/core/coreToolScheduler.test.js +21 -21
  84. package/dist/src/core/coreToolScheduler.test.js.map +1 -1
  85. package/dist/src/core/loggingContentGenerator.js +14 -2
  86. package/dist/src/core/loggingContentGenerator.js.map +1 -1
  87. package/dist/src/core/prompts.js +1 -1
  88. package/dist/src/core/prompts.js.map +1 -1
  89. package/dist/src/core/sessionHookTriggers.d.ts +3 -2
  90. package/dist/src/core/sessionHookTriggers.js +8 -1
  91. package/dist/src/core/sessionHookTriggers.js.map +1 -1
  92. package/dist/src/core/turn.d.ts +16 -2
  93. package/dist/src/core/turn.js +2 -0
  94. package/dist/src/core/turn.js.map +1 -1
  95. package/dist/src/generated/git-commit.d.ts +2 -2
  96. package/dist/src/generated/git-commit.js +2 -2
  97. package/dist/src/generated/git-commit.js.map +1 -1
  98. package/dist/src/hooks/hookEventHandler.d.ts +6 -2
  99. package/dist/src/hooks/hookEventHandler.js +24 -3
  100. package/dist/src/hooks/hookEventHandler.js.map +1 -1
  101. package/dist/src/hooks/hookEventHandler.test.js +31 -8
  102. package/dist/src/hooks/hookEventHandler.test.js.map +1 -1
  103. package/dist/src/hooks/hookRunner.d.ts +2 -2
  104. package/dist/src/hooks/hookRunner.js +12 -4
  105. package/dist/src/hooks/hookRunner.js.map +1 -1
  106. package/dist/src/hooks/hookRunner.test.js +33 -0
  107. package/dist/src/hooks/hookRunner.test.js.map +1 -1
  108. package/dist/src/index.d.ts +3 -1
  109. package/dist/src/index.js +3 -2
  110. package/dist/src/index.js.map +1 -1
  111. package/dist/src/policy/config.js +60 -22
  112. package/dist/src/policy/config.js.map +1 -1
  113. package/dist/src/policy/config.test.js +21 -0
  114. package/dist/src/policy/config.test.js.map +1 -1
  115. package/dist/src/policy/persistence.test.js +1 -1
  116. package/dist/src/policy/persistence.test.js.map +1 -1
  117. package/dist/src/policy/policy-engine.js +22 -6
  118. package/dist/src/policy/policy-engine.js.map +1 -1
  119. package/dist/src/policy/policy-engine.test.js +206 -1
  120. package/dist/src/policy/policy-engine.test.js.map +1 -1
  121. package/dist/src/policy/toml-loader.d.ts +0 -8
  122. package/dist/src/policy/toml-loader.js +7 -70
  123. package/dist/src/policy/toml-loader.js.map +1 -1
  124. package/dist/src/policy/toml-loader.test.js +16 -6
  125. package/dist/src/policy/toml-loader.test.js.map +1 -1
  126. package/dist/src/policy/utils.d.ts +21 -0
  127. package/dist/src/policy/utils.js +42 -0
  128. package/dist/src/policy/utils.js.map +1 -0
  129. package/dist/src/policy/utils.test.js +64 -0
  130. package/dist/src/policy/utils.test.js.map +1 -0
  131. package/dist/src/scheduler/tool-executor.d.ts +22 -0
  132. package/dist/src/scheduler/tool-executor.js +198 -0
  133. package/dist/src/scheduler/tool-executor.js.map +1 -0
  134. package/dist/src/scheduler/tool-executor.test.d.ts +6 -0
  135. package/dist/src/scheduler/tool-executor.test.js +231 -0
  136. package/dist/src/scheduler/tool-executor.test.js.map +1 -0
  137. package/dist/src/skills/skillLoader.d.ts +28 -0
  138. package/dist/src/skills/skillLoader.js +77 -0
  139. package/dist/src/skills/skillLoader.js.map +1 -0
  140. package/dist/src/skills/skillLoader.test.d.ts +6 -0
  141. package/dist/src/skills/skillLoader.test.js +73 -0
  142. package/dist/src/skills/skillLoader.test.js.map +1 -0
  143. package/dist/src/{services → skills}/skillManager.d.ts +10 -20
  144. package/dist/src/skills/skillManager.js +89 -0
  145. package/dist/src/skills/skillManager.js.map +1 -0
  146. package/dist/src/skills/skillManager.test.d.ts +6 -0
  147. package/dist/src/skills/skillManager.test.js +128 -0
  148. package/dist/src/skills/skillManager.test.js.map +1 -0
  149. package/dist/src/telemetry/clearcut-logger/clearcut-logger.d.ts +5 -5
  150. package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +8 -8
  151. package/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +1 -1
  152. package/dist/src/telemetry/clearcut-logger/event-metadata-key.d.ts +2 -2
  153. package/dist/src/telemetry/clearcut-logger/event-metadata-key.js +4 -4
  154. package/dist/src/telemetry/clearcut-logger/event-metadata-key.js.map +1 -1
  155. package/dist/src/telemetry/loggers.d.ts +3 -3
  156. package/dist/src/telemetry/loggers.js +4 -4
  157. package/dist/src/telemetry/loggers.js.map +1 -1
  158. package/dist/src/telemetry/loggers.test.js +6 -5
  159. package/dist/src/telemetry/loggers.test.js.map +1 -1
  160. package/dist/src/telemetry/types.d.ts +7 -7
  161. package/dist/src/telemetry/types.js +10 -10
  162. package/dist/src/telemetry/types.js.map +1 -1
  163. package/dist/src/test-utils/mock-message-bus.d.ts +1 -0
  164. package/dist/src/test-utils/mock-message-bus.js +29 -0
  165. package/dist/src/test-utils/mock-message-bus.js.map +1 -1
  166. package/dist/src/test-utils/mock-tool.d.ts +5 -3
  167. package/dist/src/test-utils/mock-tool.js +11 -10
  168. package/dist/src/test-utils/mock-tool.js.map +1 -1
  169. package/dist/src/tools/activate-skill.d.ts +2 -2
  170. package/dist/src/tools/activate-skill.js +6 -1
  171. package/dist/src/tools/activate-skill.js.map +1 -1
  172. package/dist/src/tools/activate-skill.test.js +7 -5
  173. package/dist/src/tools/activate-skill.test.js.map +1 -1
  174. package/dist/src/tools/confirmation-policy.test.js +2 -12
  175. package/dist/src/tools/confirmation-policy.test.js.map +1 -1
  176. package/dist/src/tools/edit.d.ts +27 -5
  177. package/dist/src/tools/edit.js +444 -137
  178. package/dist/src/tools/edit.js.map +1 -1
  179. package/dist/src/tools/edit.test.js +257 -525
  180. package/dist/src/tools/edit.test.js.map +1 -1
  181. package/dist/src/tools/get-internal-docs.d.ts +2 -2
  182. package/dist/src/tools/get-internal-docs.js +6 -6
  183. package/dist/src/tools/get-internal-docs.js.map +1 -1
  184. package/dist/src/tools/get-internal-docs.test.js +2 -1
  185. package/dist/src/tools/get-internal-docs.test.js.map +1 -1
  186. package/dist/src/tools/glob.d.ts +2 -2
  187. package/dist/src/tools/glob.js +1 -1
  188. package/dist/src/tools/glob.js.map +1 -1
  189. package/dist/src/tools/glob.test.js +2 -1
  190. package/dist/src/tools/glob.test.js.map +1 -1
  191. package/dist/src/tools/grep.d.ts +2 -2
  192. package/dist/src/tools/grep.js +1 -1
  193. package/dist/src/tools/grep.js.map +1 -1
  194. package/dist/src/tools/grep.test.js +5 -4
  195. package/dist/src/tools/grep.test.js.map +1 -1
  196. package/dist/src/tools/ls.d.ts +2 -2
  197. package/dist/src/tools/ls.js +2 -2
  198. package/dist/src/tools/ls.js.map +1 -1
  199. package/dist/src/tools/ls.test.js +2 -1
  200. package/dist/src/tools/ls.test.js.map +1 -1
  201. package/dist/src/tools/mcp-client.d.ts +2 -2
  202. package/dist/src/tools/mcp-client.js +2 -1
  203. package/dist/src/tools/mcp-client.js.map +1 -1
  204. package/dist/src/tools/mcp-tool.d.ts +2 -2
  205. package/dist/src/tools/mcp-tool.js +7 -7
  206. package/dist/src/tools/mcp-tool.js.map +1 -1
  207. package/dist/src/tools/mcp-tool.test.js +11 -6
  208. package/dist/src/tools/mcp-tool.test.js.map +1 -1
  209. package/dist/src/tools/memoryTool.d.ts +3 -3
  210. package/dist/src/tools/memoryTool.js +2 -2
  211. package/dist/src/tools/memoryTool.js.map +1 -1
  212. package/dist/src/tools/memoryTool.test.js +5 -2
  213. package/dist/src/tools/memoryTool.test.js.map +1 -1
  214. package/dist/src/tools/message-bus-integration.test.js +10 -37
  215. package/dist/src/tools/message-bus-integration.test.js.map +1 -1
  216. package/dist/src/tools/read-file.d.ts +2 -2
  217. package/dist/src/tools/read-file.js +1 -1
  218. package/dist/src/tools/read-file.js.map +1 -1
  219. package/dist/src/tools/read-file.test.js +3 -2
  220. package/dist/src/tools/read-file.test.js.map +1 -1
  221. package/dist/src/tools/read-many-files.d.ts +2 -2
  222. package/dist/src/tools/read-many-files.js +2 -3
  223. package/dist/src/tools/read-many-files.js.map +1 -1
  224. package/dist/src/tools/read-many-files.test.js +3 -2
  225. package/dist/src/tools/read-many-files.test.js.map +1 -1
  226. package/dist/src/tools/ripGrep.d.ts +2 -2
  227. package/dist/src/tools/ripGrep.js +3 -4
  228. package/dist/src/tools/ripGrep.js.map +1 -1
  229. package/dist/src/tools/ripGrep.test.js +7 -6
  230. package/dist/src/tools/ripGrep.test.js.map +1 -1
  231. package/dist/src/tools/shell.d.ts +3 -4
  232. package/dist/src/tools/shell.js +9 -35
  233. package/dist/src/tools/shell.js.map +1 -1
  234. package/dist/src/tools/shell.test.js +40 -57
  235. package/dist/src/tools/shell.test.js.map +1 -1
  236. package/dist/src/tools/tool-registry.d.ts +11 -6
  237. package/dist/src/tools/tool-registry.js +13 -8
  238. package/dist/src/tools/tool-registry.js.map +1 -1
  239. package/dist/src/tools/tool-registry.test.js +14 -10
  240. package/dist/src/tools/tool-registry.test.js.map +1 -1
  241. package/dist/src/tools/tools.d.ts +5 -5
  242. package/dist/src/tools/tools.js +15 -17
  243. package/dist/src/tools/tools.js.map +1 -1
  244. package/dist/src/tools/tools.test.js +3 -1
  245. package/dist/src/tools/tools.test.js.map +1 -1
  246. package/dist/src/tools/web-fetch.d.ts +2 -2
  247. package/dist/src/tools/web-fetch.js +4 -4
  248. package/dist/src/tools/web-fetch.js.map +1 -1
  249. package/dist/src/tools/web-fetch.test.js +17 -19
  250. package/dist/src/tools/web-fetch.test.js.map +1 -1
  251. package/dist/src/tools/web-search.d.ts +2 -2
  252. package/dist/src/tools/web-search.js +3 -4
  253. package/dist/src/tools/web-search.js.map +1 -1
  254. package/dist/src/tools/web-search.test.js +2 -1
  255. package/dist/src/tools/web-search.test.js.map +1 -1
  256. package/dist/src/tools/write-file.d.ts +2 -2
  257. package/dist/src/tools/write-file.js +3 -3
  258. package/dist/src/tools/write-file.js.map +1 -1
  259. package/dist/src/tools/write-file.test.js +4 -1
  260. package/dist/src/tools/write-file.test.js.map +1 -1
  261. package/dist/src/tools/write-todos.d.ts +2 -2
  262. package/dist/src/tools/write-todos.js +5 -4
  263. package/dist/src/tools/write-todos.js.map +1 -1
  264. package/dist/src/tools/write-todos.test.js +2 -1
  265. package/dist/src/tools/write-todos.test.js.map +1 -1
  266. package/dist/src/utils/editCorrector.test.js +1 -1
  267. package/dist/src/utils/editCorrector.test.js.map +1 -1
  268. package/dist/src/utils/events.d.ts +46 -1
  269. package/dist/src/utils/events.js +21 -0
  270. package/dist/src/utils/events.js.map +1 -1
  271. package/dist/src/utils/events.test.js +25 -0
  272. package/dist/src/utils/events.test.js.map +1 -1
  273. package/dist/src/utils/shell-permissions.test.js +27 -0
  274. package/dist/src/utils/shell-permissions.test.js.map +1 -1
  275. package/dist/src/utils/terminal.d.ts +2 -0
  276. package/dist/src/utils/terminal.js +6 -0
  277. package/dist/src/utils/terminal.js.map +1 -1
  278. package/dist/src/utils/tokenCalculation.js +20 -5
  279. package/dist/src/utils/tokenCalculation.js.map +1 -1
  280. package/dist/src/utils/tokenCalculation.test.js +11 -2
  281. package/dist/src/utils/tokenCalculation.test.js.map +1 -1
  282. package/dist/src/utils/tool-utils.test.js +2 -1
  283. package/dist/src/utils/tool-utils.test.js.map +1 -1
  284. package/dist/tsconfig.tsbuildinfo +1 -1
  285. package/package.json +1 -1
  286. package/dist/google-gemini-cli-core-0.24.0-nightly.20251227.37be16243.tgz +0 -0
  287. package/dist/src/services/skillManager.js +0 -157
  288. package/dist/src/services/skillManager.js.map +0 -1
  289. package/dist/src/services/skillManager.test.js +0 -169
  290. package/dist/src/services/skillManager.test.js.map +0 -1
  291. package/dist/src/tools/smart-edit.d.ts +0 -78
  292. package/dist/src/tools/smart-edit.js +0 -722
  293. package/dist/src/tools/smart-edit.js.map +0 -1
  294. package/dist/src/tools/smart-edit.test.js +0 -591
  295. package/dist/src/tools/smart-edit.test.js.map +0 -1
  296. /package/dist/src/{services/skillManager.test.d.ts → agents/a2aUtils.test.d.ts} +0 -0
  297. /package/dist/src/{tools/smart-edit.test.d.ts → policy/utils.test.d.ts} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"smart-edit.js","sourceRoot":"","sources":["../../../src/tools/smart-edit.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,IAAI,EAEJ,uBAAuB,GAMxB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAGN,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,C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
3
- * Copyright 2025 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- /* eslint-disable @typescript-eslint/no-explicit-any */
7
- const mockFixLLMEditWithInstruction = 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/llm-edit-fixer.js', () => ({
17
- FixLLMEditWithInstruction: mockFixLLMEditWithInstruction,
18
- }));
19
- vi.mock('../core/client.js', () => ({
20
- GeminiClient: vi.fn().mockImplementation(() => ({
21
- generateJson: mockGenerateJson,
22
- getHistory: vi.fn().mockResolvedValue([]),
23
- })),
24
- }));
25
- vi.mock('../utils/editor.js', () => ({
26
- openDiff: mockOpenDiff,
27
- }));
28
- import { describe, it, expect, beforeEach, afterEach, vi, } from 'vitest';
29
- import { SmartEditTool, calculateReplacement, } from './smart-edit.js';
30
- import { ToolConfirmationOutcome } from './tools.js';
31
- import { ToolErrorType } from './tool-error.js';
32
- import path from 'node:path';
33
- import fs from 'node:fs';
34
- import os from 'node:os';
35
- import { ApprovalMode } from '../policy/types.js';
36
- import {} from '../config/config.js';
37
- import {} from '@google/genai';
38
- import { createMockWorkspaceContext } from '../test-utils/mockWorkspaceContext.js';
39
- import { StandardFileSystemService } from '../services/fileSystemService.js';
40
- describe('SmartEditTool', () => {
41
- let tool;
42
- let tempDir;
43
- let rootDir;
44
- let mockConfig;
45
- let geminiClient;
46
- let fileSystemService;
47
- let baseLlmClient;
48
- beforeEach(() => {
49
- vi.restoreAllMocks();
50
- tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'smart-edit-tool-test-'));
51
- rootDir = path.join(tempDir, 'root');
52
- fs.mkdirSync(rootDir);
53
- geminiClient = {
54
- generateJson: mockGenerateJson,
55
- getHistory: vi.fn().mockResolvedValue([]),
56
- };
57
- baseLlmClient = {
58
- generateJson: mockGenerateJson,
59
- };
60
- fileSystemService = new StandardFileSystemService();
61
- mockConfig = {
62
- getUsageStatisticsEnabled: vi.fn(() => true),
63
- getSessionId: vi.fn(() => 'mock-session-id'),
64
- getContentGeneratorConfig: vi.fn(() => ({ authType: 'mock' })),
65
- getProxy: vi.fn(() => undefined),
66
- getGeminiClient: vi.fn().mockReturnValue(geminiClient),
67
- getBaseLlmClient: vi.fn().mockReturnValue(baseLlmClient),
68
- getTargetDir: () => rootDir,
69
- getApprovalMode: vi.fn(),
70
- setApprovalMode: vi.fn(),
71
- getWorkspaceContext: () => createMockWorkspaceContext(rootDir),
72
- getFileSystemService: () => fileSystemService,
73
- getIdeMode: () => false,
74
- getApiKey: () => 'test-api-key',
75
- getModel: () => 'test-model',
76
- getSandbox: () => false,
77
- getDebugMode: () => false,
78
- getQuestion: () => undefined,
79
- getToolDiscoveryCommand: () => undefined,
80
- getToolCallCommand: () => undefined,
81
- getMcpServerCommand: () => undefined,
82
- getMcpServers: () => undefined,
83
- getUserAgent: () => 'test-agent',
84
- getUserMemory: () => '',
85
- setUserMemory: vi.fn(),
86
- getGeminiMdFileCount: () => 0,
87
- setGeminiMdFileCount: vi.fn(),
88
- getToolRegistry: () => ({}),
89
- isInteractive: () => false,
90
- getExperiments: () => { },
91
- };
92
- mockConfig.getApprovalMode.mockClear();
93
- mockConfig.getApprovalMode.mockReturnValue(ApprovalMode.DEFAULT);
94
- mockFixLLMEditWithInstruction.mockReset();
95
- mockFixLLMEditWithInstruction.mockResolvedValue({
96
- noChangesRequired: false,
97
- search: '',
98
- replace: '',
99
- explanation: 'LLM fix failed',
100
- });
101
- mockGenerateJson.mockReset();
102
- mockGenerateJson.mockImplementation(async (contents, schema) => {
103
- const userContent = contents.find((c) => c.role === 'user');
104
- let promptText = '';
105
- if (userContent && userContent.parts) {
106
- promptText = userContent.parts
107
- .filter((p) => typeof p.text === 'string')
108
- .map((p) => p.text)
109
- .join('\n');
110
- }
111
- const snippetMatch = promptText.match(/Problematic target snippet:\n```\n([\s\S]*?)\n```/);
112
- const problematicSnippet = snippetMatch && snippetMatch[1] ? snippetMatch[1] : '';
113
- if (schema.properties?.corrected_target_snippet) {
114
- return Promise.resolve({
115
- corrected_target_snippet: problematicSnippet,
116
- });
117
- }
118
- if (schema.properties?.corrected_new_string) {
119
- const originalNewStringMatch = promptText.match(/original_new_string \(what was intended to replace original_old_string\):\n```\n([\s\S]*?)\n```/);
120
- const originalNewString = originalNewStringMatch && originalNewStringMatch[1]
121
- ? originalNewStringMatch[1]
122
- : '';
123
- return Promise.resolve({ corrected_new_string: originalNewString });
124
- }
125
- return Promise.resolve({});
126
- });
127
- tool = new SmartEditTool(mockConfig);
128
- });
129
- afterEach(() => {
130
- fs.rmSync(tempDir, { recursive: true, force: true });
131
- });
132
- describe('calculateReplacement', () => {
133
- const abortSignal = new AbortController().signal;
134
- it.each([
135
- {
136
- name: 'perform an exact replacement',
137
- content: 'hello world',
138
- old_string: 'world',
139
- new_string: 'moon',
140
- expected: 'hello moon',
141
- occurrences: 1,
142
- },
143
- {
144
- name: 'perform a flexible, whitespace-insensitive replacement',
145
- content: ' hello\n world\n',
146
- old_string: 'hello\nworld',
147
- new_string: 'goodbye\nmoon',
148
- expected: ' goodbye\n moon\n',
149
- occurrences: 1,
150
- },
151
- {
152
- name: 'return 0 occurrences if no match is found',
153
- content: 'hello world',
154
- old_string: 'nomatch',
155
- new_string: 'moon',
156
- expected: 'hello world',
157
- occurrences: 0,
158
- },
159
- ])('should $name', async ({ content, old_string, new_string, expected, occurrences }) => {
160
- const result = await calculateReplacement(mockConfig, {
161
- params: {
162
- file_path: 'test.txt',
163
- instruction: 'test',
164
- old_string,
165
- new_string,
166
- },
167
- currentContent: content,
168
- abortSignal,
169
- });
170
- expect(result.newContent).toBe(expected);
171
- expect(result.occurrences).toBe(occurrences);
172
- });
173
- it('should perform a regex-based replacement for flexible intra-line whitespace', async () => {
174
- // This case would fail with the previous exact and line-trimming flexible logic
175
- // because the whitespace *within* the line is different.
176
- const content = ' function myFunc( a, b ) {\n return a + b;\n }';
177
- const result = await calculateReplacement(mockConfig, {
178
- params: {
179
- file_path: 'test.js',
180
- instruction: 'test',
181
- old_string: 'function myFunc(a, b) {', // Note the normalized whitespace
182
- new_string: 'const yourFunc = (a, b) => {',
183
- },
184
- currentContent: content,
185
- abortSignal,
186
- });
187
- // The indentation from the original line should be preserved and applied to the new string.
188
- const expectedContent = ' const yourFunc = (a, b) => {\n return a + b;\n }';
189
- expect(result.newContent).toBe(expectedContent);
190
- expect(result.occurrences).toBe(1);
191
- });
192
- });
193
- describe('validateToolParams', () => {
194
- it('should return null for valid params', () => {
195
- const params = {
196
- file_path: path.join(rootDir, 'test.txt'),
197
- instruction: 'An instruction',
198
- old_string: 'old',
199
- new_string: 'new',
200
- };
201
- expect(tool.validateToolParams(params)).toBeNull();
202
- });
203
- it('should return an error if path is outside the workspace', () => {
204
- const params = {
205
- file_path: path.join(os.tmpdir(), 'outside.txt'),
206
- instruction: 'An instruction',
207
- old_string: 'old',
208
- new_string: 'new',
209
- };
210
- expect(tool.validateToolParams(params)).toMatch(/must be within one of the workspace directories/);
211
- });
212
- });
213
- describe('execute', () => {
214
- const testFile = 'execute_me.txt';
215
- let filePath;
216
- beforeEach(() => {
217
- filePath = path.join(rootDir, testFile);
218
- });
219
- it('should reject when calculateEdit fails after an abort signal', async () => {
220
- const params = {
221
- file_path: path.join(rootDir, 'abort-execute.txt'),
222
- instruction: 'Abort during execute',
223
- old_string: 'old',
224
- new_string: 'new',
225
- };
226
- const invocation = tool.build(params);
227
- const abortController = new AbortController();
228
- const abortError = new Error('Abort requested during smart edit execution');
229
- const calculateSpy = vi
230
- .spyOn(invocation, 'calculateEdit')
231
- .mockImplementation(async () => {
232
- if (!abortController.signal.aborted) {
233
- abortController.abort();
234
- }
235
- throw abortError;
236
- });
237
- await expect(invocation.execute(abortController.signal)).rejects.toBe(abortError);
238
- calculateSpy.mockRestore();
239
- });
240
- it('should edit an existing file and return diff with fileName', async () => {
241
- const initialContent = 'This is some old text.';
242
- const newContent = 'This is some new text.';
243
- fs.writeFileSync(filePath, initialContent, 'utf8');
244
- const params = {
245
- file_path: filePath,
246
- instruction: 'Replace old with new',
247
- old_string: 'old',
248
- new_string: 'new',
249
- };
250
- const invocation = tool.build(params);
251
- const result = await invocation.execute(new AbortController().signal);
252
- expect(result.llmContent).toMatch(/Successfully modified file/);
253
- expect(fs.readFileSync(filePath, 'utf8')).toBe(newContent);
254
- const display = result.returnDisplay;
255
- expect(display.fileDiff).toMatch(initialContent);
256
- expect(display.fileDiff).toMatch(newContent);
257
- expect(display.fileName).toBe(testFile);
258
- });
259
- it('should return error if old_string is not found in file', async () => {
260
- fs.writeFileSync(filePath, 'Some content.', 'utf8');
261
- const params = {
262
- file_path: filePath,
263
- instruction: 'Replace non-existent text',
264
- old_string: 'nonexistent',
265
- new_string: 'replacement',
266
- };
267
- const invocation = tool.build(params);
268
- const result = await invocation.execute(new AbortController().signal);
269
- expect(result.llmContent).toMatch(/0 occurrences found for old_string/);
270
- expect(result.returnDisplay).toMatch(/Failed to edit, could not find the string to replace./);
271
- expect(mockFixLLMEditWithInstruction).toHaveBeenCalled();
272
- });
273
- it('should succeed if FixLLMEditWithInstruction corrects the params', async () => {
274
- const initialContent = 'This is some original text.';
275
- const finalContent = 'This is some brand new text.';
276
- fs.writeFileSync(filePath, initialContent, 'utf8');
277
- const params = {
278
- file_path: filePath,
279
- instruction: 'Replace original with brand new',
280
- old_string: 'wrong text', // This will fail first
281
- new_string: 'brand new text',
282
- };
283
- mockFixLLMEditWithInstruction.mockResolvedValueOnce({
284
- noChangesRequired: false,
285
- search: 'original text', // The corrected search string
286
- replace: 'brand new text',
287
- explanation: 'Corrected the search string to match the file content.',
288
- });
289
- const invocation = tool.build(params);
290
- const result = await invocation.execute(new AbortController().signal);
291
- expect(result.error).toBeUndefined();
292
- expect(result.llmContent).toMatch(/Successfully modified file/);
293
- expect(fs.readFileSync(filePath, 'utf8')).toBe(finalContent);
294
- expect(mockFixLLMEditWithInstruction).toHaveBeenCalledTimes(1);
295
- });
296
- it('should preserve CRLF line endings when editing a file', async () => {
297
- const initialContent = 'line one\r\nline two\r\n';
298
- const newContent = 'line one\r\nline three\r\n';
299
- fs.writeFileSync(filePath, initialContent, 'utf8');
300
- const params = {
301
- file_path: filePath,
302
- instruction: 'Replace two with three',
303
- old_string: 'line two',
304
- new_string: 'line three',
305
- };
306
- const invocation = tool.build(params);
307
- await invocation.execute(new AbortController().signal);
308
- const finalContent = fs.readFileSync(filePath, 'utf8');
309
- expect(finalContent).toBe(newContent);
310
- });
311
- it('should create a new file with CRLF line endings if new_string has them', async () => {
312
- const newContentWithCRLF = 'new line one\r\nnew line two\r\n';
313
- const params = {
314
- file_path: filePath,
315
- instruction: 'Create a new file',
316
- old_string: '',
317
- new_string: newContentWithCRLF,
318
- };
319
- const invocation = tool.build(params);
320
- await invocation.execute(new AbortController().signal);
321
- const finalContent = fs.readFileSync(filePath, 'utf8');
322
- expect(finalContent).toBe(newContentWithCRLF);
323
- });
324
- it('should return NO_CHANGE if FixLLMEditWithInstruction determines no changes are needed', async () => {
325
- const initialContent = 'The price is $100.';
326
- fs.writeFileSync(filePath, initialContent, 'utf8');
327
- const params = {
328
- file_path: filePath,
329
- instruction: 'Ensure the price is $100',
330
- old_string: 'price is $50', // Incorrect old string
331
- new_string: 'price is $100',
332
- };
333
- mockFixLLMEditWithInstruction.mockResolvedValueOnce({
334
- noChangesRequired: true,
335
- search: '',
336
- replace: '',
337
- explanation: 'The price is already correctly set to $100.',
338
- });
339
- const invocation = tool.build(params);
340
- const result = await invocation.execute(new AbortController().signal);
341
- expect(result.error?.type).toBe(ToolErrorType.EDIT_NO_CHANGE_LLM_JUDGEMENT);
342
- expect(result.llmContent).toMatch(/A secondary check by an LLM determined/);
343
- expect(fs.readFileSync(filePath, 'utf8')).toBe(initialContent); // File is unchanged
344
- });
345
- });
346
- describe('self-correction with content refresh to pull in external edits', () => {
347
- const testFile = 'test.txt';
348
- let filePath;
349
- beforeEach(() => {
350
- filePath = path.join(rootDir, testFile);
351
- });
352
- it('should use refreshed file content for self-correction if file was modified externally', async () => {
353
- const initialContent = 'This is the original content.';
354
- const externallyModifiedContent = 'This is the externally modified content.';
355
- fs.writeFileSync(filePath, initialContent, 'utf8');
356
- const params = {
357
- file_path: filePath,
358
- instruction: 'Replace "externally modified content" with "externally modified string"',
359
- old_string: 'externally modified content', // This will fail the first attempt, triggering self-correction.
360
- new_string: 'externally modified string',
361
- };
362
- // Spy on `readTextFile` to simulate an external file change between reads.
363
- const readTextFileSpy = vi
364
- .spyOn(fileSystemService, 'readTextFile')
365
- .mockResolvedValueOnce(initialContent) // First call in `calculateEdit`
366
- .mockResolvedValueOnce(externallyModifiedContent); // Second call in `attemptSelfCorrection`
367
- const invocation = tool.build(params);
368
- await invocation.execute(new AbortController().signal);
369
- // Assert that the file was read twice (initial read, then re-read for hash comparison).
370
- expect(readTextFileSpy).toHaveBeenCalledTimes(2);
371
- // Assert that the self-correction LLM was called with the updated content and a specific message.
372
- expect(mockFixLLMEditWithInstruction).toHaveBeenCalledWith(expect.any(String), // instruction
373
- params.old_string, params.new_string, expect.stringContaining('However, the file has been modified by either the user or an external process'), // errorForLlmEditFixer
374
- externallyModifiedContent, // The new content for correction
375
- expect.any(Object), // baseLlmClient
376
- expect.any(Object));
377
- });
378
- });
379
- describe('Error Scenarios', () => {
380
- const testFile = 'error_test.txt';
381
- let filePath;
382
- beforeEach(() => {
383
- filePath = path.join(rootDir, testFile);
384
- });
385
- it.each([
386
- {
387
- name: 'FILE_NOT_FOUND',
388
- setup: () => { }, // no file created
389
- params: { old_string: 'any', new_string: 'new' },
390
- expectedError: ToolErrorType.FILE_NOT_FOUND,
391
- },
392
- {
393
- name: 'ATTEMPT_TO_CREATE_EXISTING_FILE',
394
- setup: (fp) => fs.writeFileSync(fp, 'existing content', 'utf8'),
395
- params: { old_string: '', new_string: 'new content' },
396
- expectedError: ToolErrorType.ATTEMPT_TO_CREATE_EXISTING_FILE,
397
- },
398
- {
399
- name: 'NO_OCCURRENCE_FOUND',
400
- setup: (fp) => fs.writeFileSync(fp, 'content', 'utf8'),
401
- params: { old_string: 'not-found', new_string: 'new' },
402
- expectedError: ToolErrorType.EDIT_NO_OCCURRENCE_FOUND,
403
- },
404
- {
405
- name: 'EXPECTED_OCCURRENCE_MISMATCH',
406
- setup: (fp) => fs.writeFileSync(fp, 'one one two', 'utf8'),
407
- params: { old_string: 'one', new_string: 'new' },
408
- expectedError: ToolErrorType.EDIT_EXPECTED_OCCURRENCE_MISMATCH,
409
- },
410
- ])('should return $name error', async ({ setup, params, expectedError }) => {
411
- setup(filePath);
412
- const invocation = tool.build({
413
- file_path: filePath,
414
- instruction: 'test',
415
- ...params,
416
- });
417
- const result = await invocation.execute(new AbortController().signal);
418
- expect(result.error?.type).toBe(expectedError);
419
- });
420
- });
421
- describe('expected_replacements', () => {
422
- const testFile = 'replacements_test.txt';
423
- let filePath;
424
- beforeEach(() => {
425
- filePath = path.join(rootDir, testFile);
426
- });
427
- it.each([
428
- {
429
- name: 'succeed when occurrences match expected_replacements',
430
- content: 'foo foo foo',
431
- expected: 3,
432
- shouldSucceed: true,
433
- finalContent: 'bar bar bar',
434
- },
435
- {
436
- name: 'fail when occurrences do not match expected_replacements',
437
- content: 'foo foo foo',
438
- expected: 2,
439
- shouldSucceed: false,
440
- },
441
- {
442
- name: 'default to 1 expected replacement if not specified',
443
- content: 'foo foo',
444
- expected: undefined,
445
- shouldSucceed: false,
446
- },
447
- ])('should $name', async ({ content, expected, shouldSucceed, finalContent }) => {
448
- fs.writeFileSync(filePath, content, 'utf8');
449
- const params = {
450
- file_path: filePath,
451
- instruction: 'Replace all foo with bar',
452
- old_string: 'foo',
453
- new_string: 'bar',
454
- ...(expected !== undefined && { expected_replacements: expected }),
455
- };
456
- const invocation = tool.build(params);
457
- const result = await invocation.execute(new AbortController().signal);
458
- if (shouldSucceed) {
459
- expect(result.error).toBeUndefined();
460
- if (finalContent)
461
- expect(fs.readFileSync(filePath, 'utf8')).toBe(finalContent);
462
- }
463
- else {
464
- expect(result.error?.type).toBe(ToolErrorType.EDIT_EXPECTED_OCCURRENCE_MISMATCH);
465
- }
466
- });
467
- });
468
- describe('IDE mode', () => {
469
- const testFile = 'edit_me.txt';
470
- let filePath;
471
- let ideClient;
472
- beforeEach(() => {
473
- filePath = path.join(rootDir, testFile);
474
- ideClient = {
475
- openDiff: vi.fn(),
476
- isDiffingEnabled: vi.fn().mockReturnValue(true),
477
- };
478
- vi.mocked(IdeClient.getInstance).mockResolvedValue(ideClient);
479
- mockConfig.getIdeMode = () => true;
480
- });
481
- it('should call ideClient.openDiff and update params on confirmation', async () => {
482
- const initialContent = 'some old content here';
483
- const newContent = 'some new content here';
484
- const modifiedContent = 'some modified content here';
485
- fs.writeFileSync(filePath, initialContent);
486
- const params = {
487
- file_path: filePath,
488
- instruction: 'test',
489
- old_string: 'old',
490
- new_string: 'new',
491
- };
492
- ideClient.openDiff.mockResolvedValueOnce({
493
- status: 'accepted',
494
- content: modifiedContent,
495
- });
496
- const invocation = tool.build(params);
497
- const confirmation = await invocation.shouldConfirmExecute(new AbortController().signal);
498
- expect(ideClient.openDiff).toHaveBeenCalledWith(filePath, newContent);
499
- if (confirmation && 'onConfirm' in confirmation) {
500
- await confirmation.onConfirm(ToolConfirmationOutcome.ProceedOnce);
501
- }
502
- expect(params.old_string).toBe(initialContent);
503
- expect(params.new_string).toBe(modifiedContent);
504
- });
505
- });
506
- describe('shouldConfirmExecute', () => {
507
- it('should rethrow calculateEdit errors when the abort signal is triggered', async () => {
508
- const filePath = path.join(rootDir, 'abort-confirmation.txt');
509
- const params = {
510
- file_path: filePath,
511
- instruction: 'Abort during confirmation',
512
- old_string: 'old',
513
- new_string: 'new',
514
- };
515
- const invocation = tool.build(params);
516
- const abortController = new AbortController();
517
- const abortError = new Error('Abort requested during smart edit confirmation');
518
- const calculateSpy = vi
519
- .spyOn(invocation, 'calculateEdit')
520
- .mockImplementation(async () => {
521
- if (!abortController.signal.aborted) {
522
- abortController.abort();
523
- }
524
- throw abortError;
525
- });
526
- await expect(invocation.shouldConfirmExecute(abortController.signal)).rejects.toBe(abortError);
527
- calculateSpy.mockRestore();
528
- });
529
- });
530
- describe('multiple file edits', () => {
531
- it('should perform multiple removals and report correct diff stats', async () => {
532
- const numFiles = 10;
533
- const files = [];
534
- const expectedLinesRemoved = [];
535
- const actualLinesRemoved = [];
536
- // 1. Create 10 files with 5-10 lines each
537
- for (let i = 0; i < numFiles; i++) {
538
- const fileName = `test-file-${i}.txt`;
539
- const filePath = path.join(rootDir, fileName);
540
- const numLines = Math.floor(Math.random() * 6) + 5; // 5 to 10 lines
541
- const lines = Array.from({ length: numLines }, (_, j) => `File ${i}, Line ${j + 1}`);
542
- const content = lines.join('\n') + '\n';
543
- // Determine which lines to remove (2 or 3 lines)
544
- const numLinesToRemove = Math.floor(Math.random() * 2) + 2; // 2 or 3
545
- expectedLinesRemoved.push(numLinesToRemove);
546
- const startLineToRemove = 1; // Start removing from the second line
547
- const linesToRemove = lines.slice(startLineToRemove, startLineToRemove + numLinesToRemove);
548
- const toRemove = linesToRemove.join('\n') + '\n';
549
- fs.writeFileSync(filePath, content, 'utf8');
550
- files.push({
551
- path: filePath,
552
- initialContent: content,
553
- toRemove,
554
- });
555
- }
556
- // 2. Create and execute 10 tool calls for removal
557
- for (const file of files) {
558
- const params = {
559
- file_path: file.path,
560
- instruction: `Remove lines from the file`,
561
- old_string: file.toRemove,
562
- new_string: '', // Removing the content
563
- ai_proposed_string: '',
564
- };
565
- const invocation = tool.build(params);
566
- const result = await invocation.execute(new AbortController().signal);
567
- if (result.returnDisplay &&
568
- typeof result.returnDisplay === 'object' &&
569
- 'diffStat' in result.returnDisplay &&
570
- result.returnDisplay.diffStat) {
571
- actualLinesRemoved.push(result.returnDisplay.diffStat?.model_removed_lines);
572
- }
573
- else if (result.error) {
574
- throw result.error;
575
- }
576
- }
577
- // 3. Assert that the content was removed from each file
578
- for (const file of files) {
579
- const finalContent = fs.readFileSync(file.path, 'utf8');
580
- const expectedContent = file.initialContent.replace(file.toRemove, '');
581
- expect(finalContent).toBe(expectedContent);
582
- expect(finalContent).not.toContain(file.toRemove);
583
- }
584
- // 4. Assert that the total number of removed lines matches the diffStat total
585
- const totalExpectedRemoved = expectedLinesRemoved.reduce((sum, current) => sum + current, 0);
586
- const totalActualRemoved = actualLinesRemoved.reduce((sum, current) => sum + current, 0);
587
- expect(totalActualRemoved).toBe(totalExpectedRemoved);
588
- });
589
- });
590
- });
591
- //# sourceMappingURL=smart-edit.test.js.map