@office-ai/aioncli-core 0.1.18-beta.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 (567) hide show
  1. package/dist/.last_build +0 -0
  2. package/dist/index.d.ts +7 -0
  3. package/dist/index.js +8 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/src/__mocks__/fs/promises.d.ts +11 -0
  6. package/dist/src/__mocks__/fs/promises.js +17 -0
  7. package/dist/src/__mocks__/fs/promises.js.map +1 -0
  8. package/dist/src/code_assist/codeAssist.d.ts +9 -0
  9. package/dist/src/code_assist/codeAssist.js +19 -0
  10. package/dist/src/code_assist/codeAssist.js.map +1 -0
  11. package/dist/src/code_assist/converter.d.ts +70 -0
  12. package/dist/src/code_assist/converter.js +126 -0
  13. package/dist/src/code_assist/converter.js.map +1 -0
  14. package/dist/src/code_assist/converter.test.d.ts +6 -0
  15. package/dist/src/code_assist/converter.test.js +279 -0
  16. package/dist/src/code_assist/converter.test.js.map +1 -0
  17. package/dist/src/code_assist/oauth2.d.ts +20 -0
  18. package/dist/src/code_assist/oauth2.js +337 -0
  19. package/dist/src/code_assist/oauth2.js.map +1 -0
  20. package/dist/src/code_assist/oauth2.test.d.ts +6 -0
  21. package/dist/src/code_assist/oauth2.test.js +334 -0
  22. package/dist/src/code_assist/oauth2.test.js.map +1 -0
  23. package/dist/src/code_assist/server.d.ts +37 -0
  24. package/dist/src/code_assist/server.js +125 -0
  25. package/dist/src/code_assist/server.js.map +1 -0
  26. package/dist/src/code_assist/server.test.d.ts +6 -0
  27. package/dist/src/code_assist/server.test.js +134 -0
  28. package/dist/src/code_assist/server.test.js.map +1 -0
  29. package/dist/src/code_assist/setup.d.ts +20 -0
  30. package/dist/src/code_assist/setup.js +70 -0
  31. package/dist/src/code_assist/setup.js.map +1 -0
  32. package/dist/src/code_assist/setup.test.d.ts +6 -0
  33. package/dist/src/code_assist/setup.test.js +65 -0
  34. package/dist/src/code_assist/setup.test.js.map +1 -0
  35. package/dist/src/code_assist/types.d.ts +148 -0
  36. package/dist/src/code_assist/types.js +46 -0
  37. package/dist/src/code_assist/types.js.map +1 -0
  38. package/dist/src/config/config.d.ts +272 -0
  39. package/dist/src/config/config.js +554 -0
  40. package/dist/src/config/config.js.map +1 -0
  41. package/dist/src/config/config.test.d.ts +6 -0
  42. package/dist/src/config/config.test.js +365 -0
  43. package/dist/src/config/config.test.js.map +1 -0
  44. package/dist/src/config/flashFallback.test.d.ts +6 -0
  45. package/dist/src/config/flashFallback.test.js +87 -0
  46. package/dist/src/config/flashFallback.test.js.map +1 -0
  47. package/dist/src/config/models.d.ts +9 -0
  48. package/dist/src/config/models.js +10 -0
  49. package/dist/src/config/models.js.map +1 -0
  50. package/dist/src/core/client.d.ts +61 -0
  51. package/dist/src/core/client.js +485 -0
  52. package/dist/src/core/client.js.map +1 -0
  53. package/dist/src/core/client.test.d.ts +6 -0
  54. package/dist/src/core/client.test.js +1008 -0
  55. package/dist/src/core/client.test.js.map +1 -0
  56. package/dist/src/core/contentGenerator.d.ts +45 -0
  57. package/dist/src/core/contentGenerator.js +81 -0
  58. package/dist/src/core/contentGenerator.js.map +1 -0
  59. package/dist/src/core/contentGenerator.test.d.ts +6 -0
  60. package/dist/src/core/contentGenerator.test.js +100 -0
  61. package/dist/src/core/contentGenerator.test.js.map +1 -0
  62. package/dist/src/core/coreToolScheduler.d.ts +117 -0
  63. package/dist/src/core/coreToolScheduler.js +530 -0
  64. package/dist/src/core/coreToolScheduler.js.map +1 -0
  65. package/dist/src/core/coreToolScheduler.test.d.ts +6 -0
  66. package/dist/src/core/coreToolScheduler.test.js +625 -0
  67. package/dist/src/core/coreToolScheduler.test.js.map +1 -0
  68. package/dist/src/core/geminiChat.d.ts +118 -0
  69. package/dist/src/core/geminiChat.js +509 -0
  70. package/dist/src/core/geminiChat.js.map +1 -0
  71. package/dist/src/core/geminiChat.test.d.ts +6 -0
  72. package/dist/src/core/geminiChat.test.js +424 -0
  73. package/dist/src/core/geminiChat.test.js.map +1 -0
  74. package/dist/src/core/geminiRequest.d.ts +13 -0
  75. package/dist/src/core/geminiRequest.js +10 -0
  76. package/dist/src/core/geminiRequest.js.map +1 -0
  77. package/dist/src/core/logger.d.ts +37 -0
  78. package/dist/src/core/logger.js +273 -0
  79. package/dist/src/core/logger.js.map +1 -0
  80. package/dist/src/core/logger.test.d.ts +6 -0
  81. package/dist/src/core/logger.test.js +467 -0
  82. package/dist/src/core/logger.test.js.map +1 -0
  83. package/dist/src/core/loggingContentGenerator.d.ts +24 -0
  84. package/dist/src/core/loggingContentGenerator.js +89 -0
  85. package/dist/src/core/loggingContentGenerator.js.map +1 -0
  86. package/dist/src/core/modelCheck.d.ts +14 -0
  87. package/dist/src/core/modelCheck.js +62 -0
  88. package/dist/src/core/modelCheck.js.map +1 -0
  89. package/dist/src/core/nonInteractiveToolExecutor.d.ts +12 -0
  90. package/dist/src/core/nonInteractiveToolExecutor.js +124 -0
  91. package/dist/src/core/nonInteractiveToolExecutor.js.map +1 -0
  92. package/dist/src/core/nonInteractiveToolExecutor.test.d.ts +6 -0
  93. package/dist/src/core/nonInteractiveToolExecutor.test.js +165 -0
  94. package/dist/src/core/nonInteractiveToolExecutor.test.js.map +1 -0
  95. package/dist/src/core/openaiContentGenerator.d.ts +77 -0
  96. package/dist/src/core/openaiContentGenerator.js +1395 -0
  97. package/dist/src/core/openaiContentGenerator.js.map +1 -0
  98. package/dist/src/core/openaiContentGenerator.test.d.ts +6 -0
  99. package/dist/src/core/openaiContentGenerator.test.js +1904 -0
  100. package/dist/src/core/openaiContentGenerator.test.js.map +1 -0
  101. package/dist/src/core/prompts.d.ts +12 -0
  102. package/dist/src/core/prompts.js +359 -0
  103. package/dist/src/core/prompts.js.map +1 -0
  104. package/dist/src/core/prompts.test.d.ts +6 -0
  105. package/dist/src/core/prompts.test.js +214 -0
  106. package/dist/src/core/prompts.test.js.map +1 -0
  107. package/dist/src/core/subagent.d.ts +230 -0
  108. package/dist/src/core/subagent.js +447 -0
  109. package/dist/src/core/subagent.js.map +1 -0
  110. package/dist/src/core/subagent.test.d.ts +6 -0
  111. package/dist/src/core/subagent.test.js +515 -0
  112. package/dist/src/core/subagent.test.js.map +1 -0
  113. package/dist/src/core/tokenLimits.d.ts +10 -0
  114. package/dist/src/core/tokenLimits.js +28 -0
  115. package/dist/src/core/tokenLimits.js.map +1 -0
  116. package/dist/src/core/turn.d.ts +114 -0
  117. package/dist/src/core/turn.js +143 -0
  118. package/dist/src/core/turn.js.map +1 -0
  119. package/dist/src/core/turn.test.d.ts +6 -0
  120. package/dist/src/core/turn.test.js +369 -0
  121. package/dist/src/core/turn.test.js.map +1 -0
  122. package/dist/src/ide/detect-ide.d.ts +10 -0
  123. package/dist/src/ide/detect-ide.js +27 -0
  124. package/dist/src/ide/detect-ide.js.map +1 -0
  125. package/dist/src/ide/ide-client.d.ts +56 -0
  126. package/dist/src/ide/ide-client.js +268 -0
  127. package/dist/src/ide/ide-client.js.map +1 -0
  128. package/dist/src/ide/ide-installer.d.ts +14 -0
  129. package/dist/src/ide/ide-installer.js +109 -0
  130. package/dist/src/ide/ide-installer.js.map +1 -0
  131. package/dist/src/ide/ide-installer.test.d.ts +6 -0
  132. package/dist/src/ide/ide-installer.test.js +55 -0
  133. package/dist/src/ide/ide-installer.test.js.map +1 -0
  134. package/dist/src/ide/ideContext.d.ts +374 -0
  135. package/dist/src/ide/ideContext.js +147 -0
  136. package/dist/src/ide/ideContext.js.map +1 -0
  137. package/dist/src/ide/ideContext.test.d.ts +6 -0
  138. package/dist/src/ide/ideContext.test.js +265 -0
  139. package/dist/src/ide/ideContext.test.js.map +1 -0
  140. package/dist/src/index.d.ts +68 -0
  141. package/dist/src/index.js +78 -0
  142. package/dist/src/index.js.map +1 -0
  143. package/dist/src/index.test.d.ts +6 -0
  144. package/dist/src/index.test.js +12 -0
  145. package/dist/src/index.test.js.map +1 -0
  146. package/dist/src/mcp/google-auth-provider.d.ts +23 -0
  147. package/dist/src/mcp/google-auth-provider.js +63 -0
  148. package/dist/src/mcp/google-auth-provider.js.map +1 -0
  149. package/dist/src/mcp/google-auth-provider.test.d.ts +6 -0
  150. package/dist/src/mcp/google-auth-provider.test.js +54 -0
  151. package/dist/src/mcp/google-auth-provider.test.js.map +1 -0
  152. package/dist/src/mcp/oauth-provider.d.ts +147 -0
  153. package/dist/src/mcp/oauth-provider.js +484 -0
  154. package/dist/src/mcp/oauth-provider.js.map +1 -0
  155. package/dist/src/mcp/oauth-provider.test.d.ts +6 -0
  156. package/dist/src/mcp/oauth-provider.test.js +602 -0
  157. package/dist/src/mcp/oauth-provider.test.js.map +1 -0
  158. package/dist/src/mcp/oauth-token-storage.d.ts +83 -0
  159. package/dist/src/mcp/oauth-token-storage.js +151 -0
  160. package/dist/src/mcp/oauth-token-storage.js.map +1 -0
  161. package/dist/src/mcp/oauth-token-storage.test.d.ts +6 -0
  162. package/dist/src/mcp/oauth-token-storage.test.js +205 -0
  163. package/dist/src/mcp/oauth-token-storage.test.js.map +1 -0
  164. package/dist/src/mcp/oauth-utils.d.ts +109 -0
  165. package/dist/src/mcp/oauth-utils.js +183 -0
  166. package/dist/src/mcp/oauth-utils.js.map +1 -0
  167. package/dist/src/mcp/oauth-utils.test.d.ts +6 -0
  168. package/dist/src/mcp/oauth-utils.test.js +144 -0
  169. package/dist/src/mcp/oauth-utils.test.js.map +1 -0
  170. package/dist/src/prompts/mcp-prompts.d.ts +8 -0
  171. package/dist/src/prompts/mcp-prompts.js +13 -0
  172. package/dist/src/prompts/mcp-prompts.js.map +1 -0
  173. package/dist/src/prompts/prompt-registry.d.ts +34 -0
  174. package/dist/src/prompts/prompt-registry.js +63 -0
  175. package/dist/src/prompts/prompt-registry.js.map +1 -0
  176. package/dist/src/services/fileDiscoveryService.d.ts +35 -0
  177. package/dist/src/services/fileDiscoveryService.js +91 -0
  178. package/dist/src/services/fileDiscoveryService.js.map +1 -0
  179. package/dist/src/services/fileDiscoveryService.test.d.ts +6 -0
  180. package/dist/src/services/fileDiscoveryService.test.js +143 -0
  181. package/dist/src/services/fileDiscoveryService.test.js.map +1 -0
  182. package/dist/src/services/gitService.d.ts +21 -0
  183. package/dist/src/services/gitService.js +101 -0
  184. package/dist/src/services/gitService.js.map +1 -0
  185. package/dist/src/services/gitService.test.d.ts +6 -0
  186. package/dist/src/services/gitService.test.js +209 -0
  187. package/dist/src/services/gitService.test.js.map +1 -0
  188. package/dist/src/services/loopDetectionService.d.ts +97 -0
  189. package/dist/src/services/loopDetectionService.js +340 -0
  190. package/dist/src/services/loopDetectionService.js.map +1 -0
  191. package/dist/src/services/loopDetectionService.test.d.ts +6 -0
  192. package/dist/src/services/loopDetectionService.test.js +484 -0
  193. package/dist/src/services/loopDetectionService.test.js.map +1 -0
  194. package/dist/src/services/shellExecutionService.d.ts +70 -0
  195. package/dist/src/services/shellExecutionService.js +175 -0
  196. package/dist/src/services/shellExecutionService.js.map +1 -0
  197. package/dist/src/services/shellExecutionService.test.d.ts +6 -0
  198. package/dist/src/services/shellExecutionService.test.js +272 -0
  199. package/dist/src/services/shellExecutionService.test.js.map +1 -0
  200. package/dist/src/telemetry/clearcut-logger/clearcut-logger.d.ts +65 -0
  201. package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +652 -0
  202. package/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +1 -0
  203. package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.d.ts +6 -0
  204. package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js +186 -0
  205. package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js.map +1 -0
  206. package/dist/src/telemetry/clearcut-logger/event-metadata-key.d.ts +59 -0
  207. package/dist/src/telemetry/clearcut-logger/event-metadata-key.js +159 -0
  208. package/dist/src/telemetry/clearcut-logger/event-metadata-key.js.map +1 -0
  209. package/dist/src/telemetry/constants.d.ts +23 -0
  210. package/dist/src/telemetry/constants.js +24 -0
  211. package/dist/src/telemetry/constants.js.map +1 -0
  212. package/dist/src/telemetry/file-exporters.d.ts +28 -0
  213. package/dist/src/telemetry/file-exporters.js +62 -0
  214. package/dist/src/telemetry/file-exporters.js.map +1 -0
  215. package/dist/src/telemetry/index.d.ts +18 -0
  216. package/dist/src/telemetry/index.js +20 -0
  217. package/dist/src/telemetry/index.js.map +1 -0
  218. package/dist/src/telemetry/integration.test.circular.d.ts +6 -0
  219. package/dist/src/telemetry/integration.test.circular.js +53 -0
  220. package/dist/src/telemetry/integration.test.circular.js.map +1 -0
  221. package/dist/src/telemetry/loggers.d.ts +18 -0
  222. package/dist/src/telemetry/loggers.js +268 -0
  223. package/dist/src/telemetry/loggers.js.map +1 -0
  224. package/dist/src/telemetry/loggers.test.circular.d.ts +6 -0
  225. package/dist/src/telemetry/loggers.test.circular.js +107 -0
  226. package/dist/src/telemetry/loggers.test.circular.js.map +1 -0
  227. package/dist/src/telemetry/loggers.test.d.ts +6 -0
  228. package/dist/src/telemetry/loggers.test.js +568 -0
  229. package/dist/src/telemetry/loggers.test.js.map +1 -0
  230. package/dist/src/telemetry/metrics.d.ts +20 -0
  231. package/dist/src/telemetry/metrics.js +150 -0
  232. package/dist/src/telemetry/metrics.js.map +1 -0
  233. package/dist/src/telemetry/metrics.test.d.ts +6 -0
  234. package/dist/src/telemetry/metrics.test.js +212 -0
  235. package/dist/src/telemetry/metrics.test.js.map +1 -0
  236. package/dist/src/telemetry/sdk.d.ts +9 -0
  237. package/dist/src/telemetry/sdk.js +127 -0
  238. package/dist/src/telemetry/sdk.js.map +1 -0
  239. package/dist/src/telemetry/telemetry.test.d.ts +6 -0
  240. package/dist/src/telemetry/telemetry.test.js +50 -0
  241. package/dist/src/telemetry/telemetry.test.js.map +1 -0
  242. package/dist/src/telemetry/tool-call-decision.d.ts +13 -0
  243. package/dist/src/telemetry/tool-call-decision.js +29 -0
  244. package/dist/src/telemetry/tool-call-decision.js.map +1 -0
  245. package/dist/src/telemetry/types.d.ts +145 -0
  246. package/dist/src/telemetry/types.js +267 -0
  247. package/dist/src/telemetry/types.js.map +1 -0
  248. package/dist/src/telemetry/uiTelemetry.d.ts +71 -0
  249. package/dist/src/telemetry/uiTelemetry.js +140 -0
  250. package/dist/src/telemetry/uiTelemetry.js.map +1 -0
  251. package/dist/src/telemetry/uiTelemetry.test.d.ts +6 -0
  252. package/dist/src/telemetry/uiTelemetry.test.js +518 -0
  253. package/dist/src/telemetry/uiTelemetry.test.js.map +1 -0
  254. package/dist/src/test-utils/mockWorkspaceContext.d.ts +13 -0
  255. package/dist/src/test-utils/mockWorkspaceContext.js +24 -0
  256. package/dist/src/test-utils/mockWorkspaceContext.js.map +1 -0
  257. package/dist/src/test-utils/tools.d.ts +23 -0
  258. package/dist/src/test-utils/tools.js +41 -0
  259. package/dist/src/test-utils/tools.js.map +1 -0
  260. package/dist/src/tools/diffOptions.d.ts +9 -0
  261. package/dist/src/tools/diffOptions.js +38 -0
  262. package/dist/src/tools/diffOptions.js.map +1 -0
  263. package/dist/src/tools/diffOptions.test.d.ts +6 -0
  264. package/dist/src/tools/diffOptions.test.js +119 -0
  265. package/dist/src/tools/diffOptions.test.js.map +1 -0
  266. package/dist/src/tools/edit.d.ts +55 -0
  267. package/dist/src/tools/edit.js +398 -0
  268. package/dist/src/tools/edit.js.map +1 -0
  269. package/dist/src/tools/edit.test.d.ts +6 -0
  270. package/dist/src/tools/edit.test.js +681 -0
  271. package/dist/src/tools/edit.test.js.map +1 -0
  272. package/dist/src/tools/glob.d.ts +51 -0
  273. package/dist/src/tools/glob.js +226 -0
  274. package/dist/src/tools/glob.js.map +1 -0
  275. package/dist/src/tools/glob.test.d.ts +6 -0
  276. package/dist/src/tools/glob.test.js +330 -0
  277. package/dist/src/tools/glob.test.js.map +1 -0
  278. package/dist/src/tools/grep.d.ts +46 -0
  279. package/dist/src/tools/grep.js +503 -0
  280. package/dist/src/tools/grep.js.map +1 -0
  281. package/dist/src/tools/grep.test.d.ts +6 -0
  282. package/dist/src/tools/grep.test.js +272 -0
  283. package/dist/src/tools/grep.test.js.map +1 -0
  284. package/dist/src/tools/ls.d.ts +86 -0
  285. package/dist/src/tools/ls.js +224 -0
  286. package/dist/src/tools/ls.js.map +1 -0
  287. package/dist/src/tools/ls.test.d.ts +6 -0
  288. package/dist/src/tools/ls.test.js +356 -0
  289. package/dist/src/tools/ls.test.js.map +1 -0
  290. package/dist/src/tools/mcp-client.d.ts +149 -0
  291. package/dist/src/tools/mcp-client.js +844 -0
  292. package/dist/src/tools/mcp-client.js.map +1 -0
  293. package/dist/src/tools/mcp-client.test.d.ts +6 -0
  294. package/dist/src/tools/mcp-client.test.js +643 -0
  295. package/dist/src/tools/mcp-client.test.js.map +1 -0
  296. package/dist/src/tools/mcp-tool.d.ts +29 -0
  297. package/dist/src/tools/mcp-tool.js +202 -0
  298. package/dist/src/tools/mcp-tool.js.map +1 -0
  299. package/dist/src/tools/mcp-tool.test.d.ts +6 -0
  300. package/dist/src/tools/mcp-tool.test.js +501 -0
  301. package/dist/src/tools/mcp-tool.test.js.map +1 -0
  302. package/dist/src/tools/memoryTool.d.ts +43 -0
  303. package/dist/src/tools/memoryTool.js +290 -0
  304. package/dist/src/tools/memoryTool.js.map +1 -0
  305. package/dist/src/tools/memoryTool.test.d.ts +6 -0
  306. package/dist/src/tools/memoryTool.test.js +266 -0
  307. package/dist/src/tools/memoryTool.test.js.map +1 -0
  308. package/dist/src/tools/modifiable-tool.d.ts +32 -0
  309. package/dist/src/tools/modifiable-tool.js +88 -0
  310. package/dist/src/tools/modifiable-tool.js.map +1 -0
  311. package/dist/src/tools/modifiable-tool.test.d.ts +6 -0
  312. package/dist/src/tools/modifiable-tool.test.js +193 -0
  313. package/dist/src/tools/modifiable-tool.test.js.map +1 -0
  314. package/dist/src/tools/read-file.d.ts +34 -0
  315. package/dist/src/tools/read-file.js +152 -0
  316. package/dist/src/tools/read-file.js.map +1 -0
  317. package/dist/src/tools/read-file.test.d.ts +6 -0
  318. package/dist/src/tools/read-file.test.js +300 -0
  319. package/dist/src/tools/read-file.test.js.map +1 -0
  320. package/dist/src/tools/read-many-files.d.ts +61 -0
  321. package/dist/src/tools/read-many-files.js +421 -0
  322. package/dist/src/tools/read-many-files.js.map +1 -0
  323. package/dist/src/tools/read-many-files.test.d.ts +6 -0
  324. package/dist/src/tools/read-many-files.test.js +455 -0
  325. package/dist/src/tools/read-many-files.test.js.map +1 -0
  326. package/dist/src/tools/shell.d.ts +23 -0
  327. package/dist/src/tools/shell.js +313 -0
  328. package/dist/src/tools/shell.js.map +1 -0
  329. package/dist/src/tools/shell.test.d.ts +6 -0
  330. package/dist/src/tools/shell.test.js +321 -0
  331. package/dist/src/tools/shell.test.js.map +1 -0
  332. package/dist/src/tools/tool-error.d.ts +26 -0
  333. package/dist/src/tools/tool-error.js +31 -0
  334. package/dist/src/tools/tool-error.js.map +1 -0
  335. package/dist/src/tools/tool-registry.d.ts +85 -0
  336. package/dist/src/tools/tool-registry.js +390 -0
  337. package/dist/src/tools/tool-registry.js.map +1 -0
  338. package/dist/src/tools/tool-registry.test.d.ts +6 -0
  339. package/dist/src/tools/tool-registry.test.js +417 -0
  340. package/dist/src/tools/tool-registry.test.js.map +1 -0
  341. package/dist/src/tools/tools.d.ts +328 -0
  342. package/dist/src/tools/tools.js +281 -0
  343. package/dist/src/tools/tools.js.map +1 -0
  344. package/dist/src/tools/tools.test.d.ts +6 -0
  345. package/dist/src/tools/tools.test.js +117 -0
  346. package/dist/src/tools/tools.test.js.map +1 -0
  347. package/dist/src/tools/web-fetch.d.ts +29 -0
  348. package/dist/src/tools/web-fetch.js +246 -0
  349. package/dist/src/tools/web-fetch.js.map +1 -0
  350. package/dist/src/tools/web-fetch.test.d.ts +6 -0
  351. package/dist/src/tools/web-fetch.test.js +71 -0
  352. package/dist/src/tools/web-fetch.test.js.map +1 -0
  353. package/dist/src/tools/web-search.d.ts +49 -0
  354. package/dist/src/tools/web-search.js +120 -0
  355. package/dist/src/tools/web-search.js.map +1 -0
  356. package/dist/src/tools/write-file.d.ts +46 -0
  357. package/dist/src/tools/write-file.js +321 -0
  358. package/dist/src/tools/write-file.js.map +1 -0
  359. package/dist/src/tools/write-file.test.d.ts +6 -0
  360. package/dist/src/tools/write-file.test.js +572 -0
  361. package/dist/src/tools/write-file.test.js.map +1 -0
  362. package/dist/src/utils/LruCache.d.ts +13 -0
  363. package/dist/src/utils/LruCache.js +38 -0
  364. package/dist/src/utils/LruCache.js.map +1 -0
  365. package/dist/src/utils/bfsFileSearch.d.ts +24 -0
  366. package/dist/src/utils/bfsFileSearch.js +89 -0
  367. package/dist/src/utils/bfsFileSearch.js.map +1 -0
  368. package/dist/src/utils/bfsFileSearch.test.d.ts +6 -0
  369. package/dist/src/utils/bfsFileSearch.test.js +163 -0
  370. package/dist/src/utils/bfsFileSearch.test.js.map +1 -0
  371. package/dist/src/utils/browser.d.ts +13 -0
  372. package/dist/src/utils/browser.js +49 -0
  373. package/dist/src/utils/browser.js.map +1 -0
  374. package/dist/src/utils/editCorrector.d.ts +53 -0
  375. package/dist/src/utils/editCorrector.js +546 -0
  376. package/dist/src/utils/editCorrector.js.map +1 -0
  377. package/dist/src/utils/editCorrector.test.d.ts +6 -0
  378. package/dist/src/utils/editCorrector.test.js +564 -0
  379. package/dist/src/utils/editCorrector.test.js.map +1 -0
  380. package/dist/src/utils/editor.d.ts +28 -0
  381. package/dist/src/utils/editor.js +186 -0
  382. package/dist/src/utils/editor.js.map +1 -0
  383. package/dist/src/utils/editor.test.d.ts +6 -0
  384. package/dist/src/utils/editor.test.js +445 -0
  385. package/dist/src/utils/editor.test.js.map +1 -0
  386. package/dist/src/utils/environmentContext.d.ts +21 -0
  387. package/dist/src/utils/environmentContext.js +90 -0
  388. package/dist/src/utils/environmentContext.js.map +1 -0
  389. package/dist/src/utils/environmentContext.test.d.ts +6 -0
  390. package/dist/src/utils/environmentContext.test.js +139 -0
  391. package/dist/src/utils/environmentContext.test.js.map +1 -0
  392. package/dist/src/utils/errorReporting.d.ts +14 -0
  393. package/dist/src/utils/errorReporting.js +88 -0
  394. package/dist/src/utils/errorReporting.js.map +1 -0
  395. package/dist/src/utils/errorReporting.test.d.ts +6 -0
  396. package/dist/src/utils/errorReporting.test.js +130 -0
  397. package/dist/src/utils/errorReporting.test.js.map +1 -0
  398. package/dist/src/utils/errors.d.ts +14 -0
  399. package/dist/src/utils/errors.js +54 -0
  400. package/dist/src/utils/errors.js.map +1 -0
  401. package/dist/src/utils/fetch.d.ts +11 -0
  402. package/dist/src/utils/fetch.js +51 -0
  403. package/dist/src/utils/fetch.js.map +1 -0
  404. package/dist/src/utils/fileUtils.d.ts +56 -0
  405. package/dist/src/utils/fileUtils.js +314 -0
  406. package/dist/src/utils/fileUtils.js.map +1 -0
  407. package/dist/src/utils/fileUtils.test.d.ts +6 -0
  408. package/dist/src/utils/fileUtils.test.js +363 -0
  409. package/dist/src/utils/fileUtils.test.js.map +1 -0
  410. package/dist/src/utils/filesearch/crawlCache.d.ts +25 -0
  411. package/dist/src/utils/filesearch/crawlCache.js +57 -0
  412. package/dist/src/utils/filesearch/crawlCache.js.map +1 -0
  413. package/dist/src/utils/filesearch/crawlCache.test.d.ts +6 -0
  414. package/dist/src/utils/filesearch/crawlCache.test.js +103 -0
  415. package/dist/src/utils/filesearch/crawlCache.test.js.map +1 -0
  416. package/dist/src/utils/filesearch/fileSearch.d.ts +81 -0
  417. package/dist/src/utils/filesearch/fileSearch.js +241 -0
  418. package/dist/src/utils/filesearch/fileSearch.js.map +1 -0
  419. package/dist/src/utils/filesearch/fileSearch.test.d.ts +6 -0
  420. package/dist/src/utils/filesearch/fileSearch.test.js +654 -0
  421. package/dist/src/utils/filesearch/fileSearch.test.js.map +1 -0
  422. package/dist/src/utils/filesearch/ignore.d.ts +35 -0
  423. package/dist/src/utils/filesearch/ignore.js +81 -0
  424. package/dist/src/utils/filesearch/ignore.js.map +1 -0
  425. package/dist/src/utils/filesearch/ignore.test.d.ts +6 -0
  426. package/dist/src/utils/filesearch/ignore.test.js +57 -0
  427. package/dist/src/utils/filesearch/ignore.test.js.map +1 -0
  428. package/dist/src/utils/filesearch/result-cache.d.ts +34 -0
  429. package/dist/src/utils/filesearch/result-cache.js +61 -0
  430. package/dist/src/utils/filesearch/result-cache.js.map +1 -0
  431. package/dist/src/utils/filesearch/result-cache.test.d.ts +6 -0
  432. package/dist/src/utils/filesearch/result-cache.test.js +47 -0
  433. package/dist/src/utils/filesearch/result-cache.test.js.map +1 -0
  434. package/dist/src/utils/flashFallback.integration.test.d.ts +6 -0
  435. package/dist/src/utils/flashFallback.integration.test.js +118 -0
  436. package/dist/src/utils/flashFallback.integration.test.js.map +1 -0
  437. package/dist/src/utils/formatters.d.ts +6 -0
  438. package/dist/src/utils/formatters.js +16 -0
  439. package/dist/src/utils/formatters.js.map +1 -0
  440. package/dist/src/utils/generateContentResponseUtilities.d.ts +14 -0
  441. package/dist/src/utils/generateContentResponseUtilities.js +92 -0
  442. package/dist/src/utils/generateContentResponseUtilities.js.map +1 -0
  443. package/dist/src/utils/generateContentResponseUtilities.test.d.ts +6 -0
  444. package/dist/src/utils/generateContentResponseUtilities.test.js +273 -0
  445. package/dist/src/utils/generateContentResponseUtilities.test.js.map +1 -0
  446. package/dist/src/utils/getFolderStructure.d.ts +31 -0
  447. package/dist/src/utils/getFolderStructure.js +246 -0
  448. package/dist/src/utils/getFolderStructure.js.map +1 -0
  449. package/dist/src/utils/getFolderStructure.test.d.ts +6 -0
  450. package/dist/src/utils/getFolderStructure.test.js +282 -0
  451. package/dist/src/utils/getFolderStructure.test.js.map +1 -0
  452. package/dist/src/utils/gitIgnoreParser.d.ts +20 -0
  453. package/dist/src/utils/gitIgnoreParser.js +61 -0
  454. package/dist/src/utils/gitIgnoreParser.js.map +1 -0
  455. package/dist/src/utils/gitIgnoreParser.test.d.ts +6 -0
  456. package/dist/src/utils/gitIgnoreParser.test.js +154 -0
  457. package/dist/src/utils/gitIgnoreParser.test.js.map +1 -0
  458. package/dist/src/utils/gitUtils.d.ts +17 -0
  459. package/dist/src/utils/gitUtils.js +61 -0
  460. package/dist/src/utils/gitUtils.js.map +1 -0
  461. package/dist/src/utils/memoryDiscovery.d.ts +15 -0
  462. package/dist/src/utils/memoryDiscovery.js +219 -0
  463. package/dist/src/utils/memoryDiscovery.js.map +1 -0
  464. package/dist/src/utils/memoryDiscovery.test.d.ts +6 -0
  465. package/dist/src/utils/memoryDiscovery.test.js +181 -0
  466. package/dist/src/utils/memoryDiscovery.test.js.map +1 -0
  467. package/dist/src/utils/memoryImportProcessor.d.ts +42 -0
  468. package/dist/src/utils/memoryImportProcessor.js +300 -0
  469. package/dist/src/utils/memoryImportProcessor.js.map +1 -0
  470. package/dist/src/utils/memoryImportProcessor.test.d.ts +6 -0
  471. package/dist/src/utils/memoryImportProcessor.test.js +715 -0
  472. package/dist/src/utils/memoryImportProcessor.test.js.map +1 -0
  473. package/dist/src/utils/messageInspectors.d.ts +8 -0
  474. package/dist/src/utils/messageInspectors.js +16 -0
  475. package/dist/src/utils/messageInspectors.js.map +1 -0
  476. package/dist/src/utils/nextSpeakerChecker.d.ts +12 -0
  477. package/dist/src/utils/nextSpeakerChecker.js +92 -0
  478. package/dist/src/utils/nextSpeakerChecker.js.map +1 -0
  479. package/dist/src/utils/nextSpeakerChecker.test.d.ts +6 -0
  480. package/dist/src/utils/nextSpeakerChecker.test.js +168 -0
  481. package/dist/src/utils/nextSpeakerChecker.test.js.map +1 -0
  482. package/dist/src/utils/openaiLogger.d.ts +42 -0
  483. package/dist/src/utils/openaiLogger.js +123 -0
  484. package/dist/src/utils/openaiLogger.js.map +1 -0
  485. package/dist/src/utils/partUtils.d.ts +14 -0
  486. package/dist/src/utils/partUtils.js +65 -0
  487. package/dist/src/utils/partUtils.js.map +1 -0
  488. package/dist/src/utils/partUtils.test.d.ts +6 -0
  489. package/dist/src/utils/partUtils.test.js +130 -0
  490. package/dist/src/utils/partUtils.test.js.map +1 -0
  491. package/dist/src/utils/paths.d.ts +68 -0
  492. package/dist/src/utils/paths.js +170 -0
  493. package/dist/src/utils/paths.js.map +1 -0
  494. package/dist/src/utils/paths.test.d.ts +6 -0
  495. package/dist/src/utils/paths.test.js +153 -0
  496. package/dist/src/utils/paths.test.js.map +1 -0
  497. package/dist/src/utils/quotaErrorDetection.d.ts +22 -0
  498. package/dist/src/utils/quotaErrorDetection.js +65 -0
  499. package/dist/src/utils/quotaErrorDetection.js.map +1 -0
  500. package/dist/src/utils/retry.d.ts +30 -0
  501. package/dist/src/utils/retry.js +276 -0
  502. package/dist/src/utils/retry.js.map +1 -0
  503. package/dist/src/utils/retry.test.d.ts +6 -0
  504. package/dist/src/utils/retry.test.js +322 -0
  505. package/dist/src/utils/retry.test.js.map +1 -0
  506. package/dist/src/utils/safeJsonStringify.d.ts +13 -0
  507. package/dist/src/utils/safeJsonStringify.js +25 -0
  508. package/dist/src/utils/safeJsonStringify.js.map +1 -0
  509. package/dist/src/utils/safeJsonStringify.test.d.ts +6 -0
  510. package/dist/src/utils/safeJsonStringify.test.js +61 -0
  511. package/dist/src/utils/safeJsonStringify.test.js.map +1 -0
  512. package/dist/src/utils/schemaValidator.d.ts +22 -0
  513. package/dist/src/utils/schemaValidator.js +65 -0
  514. package/dist/src/utils/schemaValidator.js.map +1 -0
  515. package/dist/src/utils/secure-browser-launcher.d.ts +23 -0
  516. package/dist/src/utils/secure-browser-launcher.js +164 -0
  517. package/dist/src/utils/secure-browser-launcher.js.map +1 -0
  518. package/dist/src/utils/secure-browser-launcher.test.d.ts +6 -0
  519. package/dist/src/utils/secure-browser-launcher.test.js +149 -0
  520. package/dist/src/utils/secure-browser-launcher.test.js.map +1 -0
  521. package/dist/src/utils/session.d.ts +6 -0
  522. package/dist/src/utils/session.js +8 -0
  523. package/dist/src/utils/session.js.map +1 -0
  524. package/dist/src/utils/shell-utils.d.ts +78 -0
  525. package/dist/src/utils/shell-utils.js +306 -0
  526. package/dist/src/utils/shell-utils.js.map +1 -0
  527. package/dist/src/utils/shell-utils.test.d.ts +6 -0
  528. package/dist/src/utils/shell-utils.test.js +200 -0
  529. package/dist/src/utils/shell-utils.test.js.map +1 -0
  530. package/dist/src/utils/summarizer.d.ts +25 -0
  531. package/dist/src/utils/summarizer.js +51 -0
  532. package/dist/src/utils/summarizer.js.map +1 -0
  533. package/dist/src/utils/summarizer.test.d.ts +6 -0
  534. package/dist/src/utils/summarizer.test.js +131 -0
  535. package/dist/src/utils/summarizer.test.js.map +1 -0
  536. package/dist/src/utils/systemEncoding.d.ts +40 -0
  537. package/dist/src/utils/systemEncoding.js +149 -0
  538. package/dist/src/utils/systemEncoding.js.map +1 -0
  539. package/dist/src/utils/systemEncoding.test.d.ts +6 -0
  540. package/dist/src/utils/systemEncoding.test.js +368 -0
  541. package/dist/src/utils/systemEncoding.test.js.map +1 -0
  542. package/dist/src/utils/testUtils.d.ts +29 -0
  543. package/dist/src/utils/testUtils.js +70 -0
  544. package/dist/src/utils/testUtils.js.map +1 -0
  545. package/dist/src/utils/textUtils.d.ts +13 -0
  546. package/dist/src/utils/textUtils.js +28 -0
  547. package/dist/src/utils/textUtils.js.map +1 -0
  548. package/dist/src/utils/user_account.d.ts +9 -0
  549. package/dist/src/utils/user_account.js +99 -0
  550. package/dist/src/utils/user_account.js.map +1 -0
  551. package/dist/src/utils/user_account.test.d.ts +6 -0
  552. package/dist/src/utils/user_account.test.js +153 -0
  553. package/dist/src/utils/user_account.test.js.map +1 -0
  554. package/dist/src/utils/user_id.d.ts +11 -0
  555. package/dist/src/utils/user_id.js +49 -0
  556. package/dist/src/utils/user_id.js.map +1 -0
  557. package/dist/src/utils/user_id.test.d.ts +6 -0
  558. package/dist/src/utils/user_id.test.js +21 -0
  559. package/dist/src/utils/user_id.test.js.map +1 -0
  560. package/dist/src/utils/workspaceContext.d.ts +51 -0
  561. package/dist/src/utils/workspaceContext.js +139 -0
  562. package/dist/src/utils/workspaceContext.js.map +1 -0
  563. package/dist/src/utils/workspaceContext.test.d.ts +6 -0
  564. package/dist/src/utils/workspaceContext.test.js +209 -0
  565. package/dist/src/utils/workspaceContext.test.js.map +1 -0
  566. package/dist/tsconfig.tsbuildinfo +1 -0
  567. package/package.json +74 -0
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import * as Diff from 'diff';
7
+ export const DEFAULT_DIFF_OPTIONS = {
8
+ context: 3,
9
+ ignoreWhitespace: true,
10
+ };
11
+ export function getDiffStat(fileName, oldStr, aiStr, userStr) {
12
+ const countLines = (patch) => {
13
+ let added = 0;
14
+ let removed = 0;
15
+ patch.hunks.forEach((hunk) => {
16
+ hunk.lines.forEach((line) => {
17
+ if (line.startsWith('+')) {
18
+ added++;
19
+ }
20
+ else if (line.startsWith('-')) {
21
+ removed++;
22
+ }
23
+ });
24
+ });
25
+ return { added, removed };
26
+ };
27
+ const patch = Diff.structuredPatch(fileName, fileName, oldStr, aiStr, 'Current', 'Proposed', DEFAULT_DIFF_OPTIONS);
28
+ const { added: aiAddedLines, removed: aiRemovedLines } = countLines(patch);
29
+ const userPatch = Diff.structuredPatch(fileName, fileName, aiStr, userStr, 'Proposed', 'User', DEFAULT_DIFF_OPTIONS);
30
+ const { added: userAddedLines, removed: userRemovedLines } = countLines(userPatch);
31
+ return {
32
+ ai_added_lines: aiAddedLines,
33
+ ai_removed_lines: aiRemovedLines,
34
+ user_added_lines: userAddedLines,
35
+ user_removed_lines: userRemovedLines,
36
+ };
37
+ }
38
+ //# sourceMappingURL=diffOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diffOptions.js","sourceRoot":"","sources":["../../../src/tools/diffOptions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAG7B,MAAM,CAAC,MAAM,oBAAoB,GAAsB;IACrD,OAAO,EAAE,CAAC;IACV,gBAAgB,EAAE,IAAI;CACvB,CAAC;AAEF,MAAM,UAAU,WAAW,CACzB,QAAgB,EAChB,MAAc,EACd,KAAa,EACb,OAAe;IAEf,MAAM,UAAU,GAAG,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X-License-Identifier: Apache-2.0
5
+ */
6
+ export {};
@@ -0,0 +1,119 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { describe, expect, it } from 'vitest';
7
+ import { getDiffStat } from './diffOptions.js';
8
+ describe('getDiffStat', () => {
9
+ const fileName = 'test.txt';
10
+ it('should return 0 for all stats when there are no changes', () => {
11
+ const oldStr = 'line1\nline2\n';
12
+ const aiStr = 'line1\nline2\n';
13
+ const userStr = 'line1\nline2\n';
14
+ const diffStat = getDiffStat(fileName, oldStr, aiStr, userStr);
15
+ expect(diffStat).toEqual({
16
+ ai_added_lines: 0,
17
+ ai_removed_lines: 0,
18
+ user_added_lines: 0,
19
+ user_removed_lines: 0,
20
+ });
21
+ });
22
+ it('should correctly report AI additions', () => {
23
+ const oldStr = 'line1\nline2\n';
24
+ const aiStr = 'line1\nline2\nline3\n';
25
+ const userStr = 'line1\nline2\nline3\n';
26
+ const diffStat = getDiffStat(fileName, oldStr, aiStr, userStr);
27
+ expect(diffStat).toEqual({
28
+ ai_added_lines: 1,
29
+ ai_removed_lines: 0,
30
+ user_added_lines: 0,
31
+ user_removed_lines: 0,
32
+ });
33
+ });
34
+ it('should correctly report AI removals', () => {
35
+ const oldStr = 'line1\nline2\nline3\n';
36
+ const aiStr = 'line1\nline3\n';
37
+ const userStr = 'line1\nline3\n';
38
+ const diffStat = getDiffStat(fileName, oldStr, aiStr, userStr);
39
+ expect(diffStat).toEqual({
40
+ ai_added_lines: 0,
41
+ ai_removed_lines: 1,
42
+ user_added_lines: 0,
43
+ user_removed_lines: 0,
44
+ });
45
+ });
46
+ it('should correctly report AI modifications', () => {
47
+ const oldStr = 'line1\nline2\nline3\n';
48
+ const aiStr = 'line1\nline_two\nline3\n';
49
+ const userStr = 'line1\nline_two\nline3\n';
50
+ const diffStat = getDiffStat(fileName, oldStr, aiStr, userStr);
51
+ expect(diffStat).toEqual({
52
+ ai_added_lines: 1,
53
+ ai_removed_lines: 1,
54
+ user_added_lines: 0,
55
+ user_removed_lines: 0,
56
+ });
57
+ });
58
+ it('should correctly report user additions', () => {
59
+ const oldStr = 'line1\nline2\n';
60
+ const aiStr = 'line1\nline2\nline3\n';
61
+ const userStr = 'line1\nline2\nline3\nline4\n';
62
+ const diffStat = getDiffStat(fileName, oldStr, aiStr, userStr);
63
+ expect(diffStat).toEqual({
64
+ ai_added_lines: 1,
65
+ ai_removed_lines: 0,
66
+ user_added_lines: 1,
67
+ user_removed_lines: 0,
68
+ });
69
+ });
70
+ it('should correctly report user removals', () => {
71
+ const oldStr = 'line1\nline2\n';
72
+ const aiStr = 'line1\nline2\nline3\n';
73
+ const userStr = 'line1\nline2\n';
74
+ const diffStat = getDiffStat(fileName, oldStr, aiStr, userStr);
75
+ expect(diffStat).toEqual({
76
+ ai_added_lines: 1,
77
+ ai_removed_lines: 0,
78
+ user_added_lines: 0,
79
+ user_removed_lines: 1,
80
+ });
81
+ });
82
+ it('should correctly report user modifications', () => {
83
+ const oldStr = 'line1\nline2\n';
84
+ const aiStr = 'line1\nline2\nline3\n';
85
+ const userStr = 'line1\nline2\nline_three\n';
86
+ const diffStat = getDiffStat(fileName, oldStr, aiStr, userStr);
87
+ expect(diffStat).toEqual({
88
+ ai_added_lines: 1,
89
+ ai_removed_lines: 0,
90
+ user_added_lines: 1,
91
+ user_removed_lines: 1,
92
+ });
93
+ });
94
+ it('should handle complex changes from both AI and user', () => {
95
+ const oldStr = 'line1\nline2\nline3\nline4\n';
96
+ const aiStr = 'line_one\nline2\nline_three\nline4\n';
97
+ const userStr = 'line_one\nline_two\nline_three\nline4\nline5\n';
98
+ const diffStat = getDiffStat(fileName, oldStr, aiStr, userStr);
99
+ expect(diffStat).toEqual({
100
+ ai_added_lines: 2,
101
+ ai_removed_lines: 2,
102
+ user_added_lines: 2,
103
+ user_removed_lines: 1,
104
+ });
105
+ });
106
+ it('should report a single line modification as one addition and one removal', () => {
107
+ const oldStr = 'hello world';
108
+ const aiStr = 'hello universe';
109
+ const userStr = 'hello universe';
110
+ const diffStat = getDiffStat(fileName, oldStr, aiStr, userStr);
111
+ expect(diffStat).toEqual({
112
+ ai_added_lines: 1,
113
+ ai_removed_lines: 1,
114
+ user_added_lines: 0,
115
+ user_removed_lines: 0,
116
+ });
117
+ });
118
+ });
119
+ //# sourceMappingURL=diffOptions.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diffOptions.test.js","sourceRoot":"","sources":["../../../src/tools/diffOptions.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,MAAM,QAAQ,GAAG,UAAU,CAAC;IAE5B,EAAE,CAAC,yDAAyD,EAAE,GAAG,EAAE;QACjE,MAAM,MAAM,GAAG,gBAAgB,CAAC;QAChC,MAAM,KAAK,GAAG,gBAAgB,CAAC;QAC/B,MAAM,OAAO,GAAG,gBAAgB,CAAC;QACjC,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAC/D,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC;YACvB,cAAc,EAAE,CAAC;YACjB,gBAAgB,EAAE,CAAC;YACnB,gBAAgB,EAAE,CAAC;YACnB,kBAAkB,EAAE,CAAC;SACtB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;QAC9C,MAAM,MAAM,GAAG,gBAAgB,CAAC;QAChC,MAAM,KAAK,GAAG,uBAAuB,CAAC;QACtC,MAAM,OAAO,GAAG,uBAAuB,CAAC;QACxC,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,EAAE,MAAM,E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AAC,CAAC;IAEH,EAAE,CAAC,qDAAqD,EAAE,GAAG,EAAE;QAC7D,MAAM,MAAM,GAAG,8BAA8B,CAAC;QAC9C,MAAM,KAAK,GAAG,sCAAsC,CAAC;QACrD,MAAM,OAAO,GAAG,gDAAgD,CAAC;QACjE,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAC/D,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC;YACvB,cAAc,EAAE,CAAC;YACjB,gBAAgB,EAAE,CAAC;YACnB,gBAAgB,EAAE,CAAC;YACnB,kBAAkB,EAAE,CAAC;SACtB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0EAA0E,EAAE,GAAG,EAAE;QAClF,MAAM,MAAM,GAAG,aAAa,CAAC;QAC7B,MAAM,KAAK,GAAG,gBAAgB,CAAC;QAC/B,MAAM,OAAO,GAAG,gBAAgB,CAAC;QACjC,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAC/D,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC;YACvB,cAAc,EAAE,CAAC;YACjB,gBAAgB,EAAE,CAAC;YACnB,gBAAgB,EAAE,CAAC;YACnB,kBAAkB,EAAE,CAAC;SACtB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { BaseDeclarativeTool, ToolInvocation, ToolResult } from './tools.js';
7
+ import { Config } from '../config/config.js';
8
+ import { ModifiableDeclarativeTool, ModifyContext } from './modifiable-tool.js';
9
+ export declare function applyReplacement(currentContent: string | null, oldString: string, newString: string, isNewFile: boolean): string;
10
+ /**
11
+ * Parameters for the Edit tool
12
+ */
13
+ export interface EditToolParams {
14
+ /**
15
+ * The absolute path to the file to modify
16
+ */
17
+ file_path: string;
18
+ /**
19
+ * The text to replace
20
+ */
21
+ old_string: string;
22
+ /**
23
+ * The text to replace it with
24
+ */
25
+ new_string: string;
26
+ /**
27
+ * Number of replacements expected. Defaults to 1 if not specified.
28
+ * Use when you want to replace multiple occurrences.
29
+ */
30
+ expected_replacements?: number;
31
+ /**
32
+ * Whether the edit was modified manually by the user.
33
+ */
34
+ modified_by_user?: boolean;
35
+ /**
36
+ * Initially proposed string.
37
+ */
38
+ ai_proposed_string?: string;
39
+ }
40
+ /**
41
+ * Implementation of the Edit tool logic
42
+ */
43
+ export declare class EditTool extends BaseDeclarativeTool<EditToolParams, ToolResult> implements ModifiableDeclarativeTool<EditToolParams> {
44
+ private readonly config;
45
+ static readonly Name = "replace";
46
+ constructor(config: Config);
47
+ /**
48
+ * Validates the parameters for the Edit tool
49
+ * @param params Parameters to validate
50
+ * @returns Error message string or null if valid
51
+ */
52
+ validateToolParams(params: EditToolParams): string | null;
53
+ protected createInvocation(params: EditToolParams): ToolInvocation<EditToolParams, ToolResult>;
54
+ getModifyContext(_: AbortSignal): ModifyContext<EditToolParams>;
55
+ }
@@ -0,0 +1,398 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import * as fs from 'fs';
7
+ import * as path from 'path';
8
+ import * as Diff from 'diff';
9
+ import { BaseDeclarativeTool, Icon, ToolConfirmationOutcome, } from './tools.js';
10
+ import { ToolErrorType } from './tool-error.js';
11
+ import { Type } from '@google/genai';
12
+ import { SchemaValidator } from '../utils/schemaValidator.js';
13
+ import { makeRelative, shortenPath } from '../utils/paths.js';
14
+ import { isNodeError } from '../utils/errors.js';
15
+ import { ApprovalMode } from '../config/config.js';
16
+ import { ensureCorrectEdit } from '../utils/editCorrector.js';
17
+ import { DEFAULT_DIFF_OPTIONS, getDiffStat } from './diffOptions.js';
18
+ import { ReadFileTool } from './read-file.js';
19
+ import { IDEConnectionStatus } from '../ide/ide-client.js';
20
+ export function applyReplacement(currentContent, oldString, newString, isNewFile) {
21
+ if (isNewFile) {
22
+ return newString;
23
+ }
24
+ if (currentContent === null) {
25
+ // Should not happen if not a new file, but defensively return empty or newString if oldString is also empty
26
+ return oldString === '' ? newString : '';
27
+ }
28
+ // If oldString is empty and it's not a new file, do not modify the content.
29
+ if (oldString === '' && !isNewFile) {
30
+ return currentContent;
31
+ }
32
+ return currentContent.replaceAll(oldString, newString);
33
+ }
34
+ class EditToolInvocation {
35
+ config;
36
+ params;
37
+ constructor(config, params) {
38
+ this.config = config;
39
+ this.params = params;
40
+ }
41
+ toolLocations() {
42
+ return [{ path: this.params.file_path }];
43
+ }
44
+ /**
45
+ * Calculates the potential outcome of an edit operation.
46
+ * @param params Parameters for the edit operation
47
+ * @returns An object describing the potential edit outcome
48
+ * @throws File system errors if reading the file fails unexpectedly (e.g., permissions)
49
+ */
50
+ async calculateEdit(params, abortSignal) {
51
+ const expectedReplacements = params.expected_replacements ?? 1;
52
+ let currentContent = null;
53
+ let fileExists = false;
54
+ let isNewFile = false;
55
+ let finalNewString = params.new_string;
56
+ let finalOldString = params.old_string;
57
+ let occurrences = 0;
58
+ let error = undefined;
59
+ try {
60
+ currentContent = fs.readFileSync(params.file_path, 'utf8');
61
+ // Normalize line endings to LF for consistent processing.
62
+ currentContent = currentContent.replace(/\r\n/g, '\n');
63
+ fileExists = true;
64
+ }
65
+ catch (err) {
66
+ if (!isNodeError(err) || err.code !== 'ENOENT') {
67
+ // Rethrow unexpected FS errors (permissions, etc.)
68
+ throw err;
69
+ }
70
+ fileExists = false;
71
+ }
72
+ if (params.old_string === '' && !fileExists) {
73
+ // Creating a new file
74
+ isNewFile = true;
75
+ }
76
+ else if (!fileExists) {
77
+ // Trying to edit a nonexistent file (and old_string is not empty)
78
+ error = {
79
+ display: `File not found. Cannot apply edit. Use an empty old_string to create a new file.`,
80
+ raw: `File not found: ${params.file_path}`,
81
+ type: ToolErrorType.FILE_NOT_FOUND,
82
+ };
83
+ }
84
+ else if (currentContent !== null) {
85
+ // Editing an existing file
86
+ const correctedEdit = await ensureCorrectEdit(params.file_path, currentContent, params, this.config.getGeminiClient(), abortSignal);
87
+ finalOldString = correctedEdit.params.old_string;
88
+ finalNewString = correctedEdit.params.new_string;
89
+ occurrences = correctedEdit.occurrences;
90
+ if (params.old_string === '') {
91
+ // Error: Trying to create a file that already exists
92
+ error = {
93
+ display: `Failed to edit. Attempted to create a file that already exists.`,
94
+ raw: `File already exists, cannot create: ${params.file_path}`,
95
+ type: ToolErrorType.ATTEMPT_TO_CREATE_EXISTING_FILE,
96
+ };
97
+ }
98
+ else if (occurrences === 0) {
99
+ error = {
100
+ display: `Failed to edit, could not find the string to replace.`,
101
+ raw: `Failed to edit, 0 occurrences found for old_string in ${params.file_path}. No edits made. The exact text in old_string was not found. Ensure you're not escaping content incorrectly and check whitespace, indentation, and context. Use ${ReadFileTool.Name} tool to verify.`,
102
+ type: ToolErrorType.EDIT_NO_OCCURRENCE_FOUND,
103
+ };
104
+ }
105
+ else if (occurrences !== expectedReplacements) {
106
+ const occurrenceTerm = expectedReplacements === 1 ? 'occurrence' : 'occurrences';
107
+ error = {
108
+ display: `Failed to edit, expected ${expectedReplacements} ${occurrenceTerm} but found ${occurrences}.`,
109
+ raw: `Failed to edit, Expected ${expectedReplacements} ${occurrenceTerm} but found ${occurrences} for old_string in file: ${params.file_path}`,
110
+ type: ToolErrorType.EDIT_EXPECTED_OCCURRENCE_MISMATCH,
111
+ };
112
+ }
113
+ else if (finalOldString === finalNewString) {
114
+ error = {
115
+ display: `No changes to apply. The old_string and new_string are identical.`,
116
+ raw: `No changes to apply. The old_string and new_string are identical in file: ${params.file_path}`,
117
+ type: ToolErrorType.EDIT_NO_CHANGE,
118
+ };
119
+ }
120
+ }
121
+ else {
122
+ // Should not happen if fileExists and no exception was thrown, but defensively:
123
+ error = {
124
+ display: `Failed to read content of file.`,
125
+ raw: `Failed to read content of existing file: ${params.file_path}`,
126
+ type: ToolErrorType.READ_CONTENT_FAILURE,
127
+ };
128
+ }
129
+ const newContent = applyReplacement(currentContent, finalOldString, finalNewString, isNewFile);
130
+ return {
131
+ currentContent,
132
+ newContent,
133
+ occurrences,
134
+ error,
135
+ isNewFile,
136
+ };
137
+ }
138
+ /**
139
+ * Handles the confirmation prompt for the Edit tool in the CLI.
140
+ * It needs to calculate the diff to show the user.
141
+ */
142
+ async shouldConfirmExecute(abortSignal) {
143
+ if (this.config.getApprovalMode() === ApprovalMode.AUTO_EDIT) {
144
+ return false;
145
+ }
146
+ let editData;
147
+ try {
148
+ editData = await this.calculateEdit(this.params, abortSignal);
149
+ }
150
+ catch (error) {
151
+ const errorMsg = error instanceof Error ? error.message : String(error);
152
+ console.log(`Error preparing edit: ${errorMsg}`);
153
+ return false;
154
+ }
155
+ if (editData.error) {
156
+ console.log(`Error: ${editData.error.display}`);
157
+ return false;
158
+ }
159
+ const fileName = path.basename(this.params.file_path);
160
+ const fileDiff = Diff.createPatch(fileName, editData.currentContent ?? '', editData.newContent, 'Current', 'Proposed', DEFAULT_DIFF_OPTIONS);
161
+ const ideClient = this.config.getIdeClient();
162
+ const ideConfirmation = this.config.getIdeModeFeature() &&
163
+ this.config.getIdeMode() &&
164
+ ideClient?.getConnectionStatus().status === IDEConnectionStatus.Connected
165
+ ? ideClient.openDiff(this.params.file_path, editData.newContent)
166
+ : undefined;
167
+ const confirmationDetails = {
168
+ type: 'edit',
169
+ title: `Confirm Edit: ${shortenPath(makeRelative(this.params.file_path, this.config.getTargetDir()))}`,
170
+ fileName,
171
+ filePath: this.params.file_path,
172
+ fileDiff,
173
+ originalContent: editData.currentContent,
174
+ newContent: editData.newContent,
175
+ onConfirm: async (outcome) => {
176
+ if (outcome === ToolConfirmationOutcome.ProceedAlways) {
177
+ this.config.setApprovalMode(ApprovalMode.AUTO_EDIT);
178
+ }
179
+ if (ideConfirmation) {
180
+ const result = await ideConfirmation;
181
+ if (result.status === 'accepted' && result.content) {
182
+ // TODO(chrstn): See https://github.com/google-gemini/gemini-cli/pull/5618#discussion_r2255413084
183
+ // for info on a possible race condition where the file is modified on disk while being edited.
184
+ this.params.old_string = editData.currentContent ?? '';
185
+ this.params.new_string = result.content;
186
+ }
187
+ }
188
+ },
189
+ ideConfirmation,
190
+ };
191
+ return confirmationDetails;
192
+ }
193
+ getDescription() {
194
+ const relativePath = makeRelative(this.params.file_path, this.config.getTargetDir());
195
+ if (this.params.old_string === '') {
196
+ return `Create ${shortenPath(relativePath)}`;
197
+ }
198
+ const oldStringSnippet = this.params.old_string.split('\n')[0].substring(0, 30) +
199
+ (this.params.old_string.length > 30 ? '...' : '');
200
+ const newStringSnippet = this.params.new_string.split('\n')[0].substring(0, 30) +
201
+ (this.params.new_string.length > 30 ? '...' : '');
202
+ if (this.params.old_string === this.params.new_string) {
203
+ return `No file changes to ${shortenPath(relativePath)}`;
204
+ }
205
+ return `${shortenPath(relativePath)}: ${oldStringSnippet} => ${newStringSnippet}`;
206
+ }
207
+ /**
208
+ * Executes the edit operation with the given parameters.
209
+ * @param params Parameters for the edit operation
210
+ * @returns Result of the edit operation
211
+ */
212
+ async execute(signal) {
213
+ let editData;
214
+ try {
215
+ editData = await this.calculateEdit(this.params, signal);
216
+ }
217
+ catch (error) {
218
+ const errorMsg = error instanceof Error ? error.message : String(error);
219
+ return {
220
+ llmContent: `Error preparing edit: ${errorMsg}`,
221
+ returnDisplay: `Error preparing edit: ${errorMsg}`,
222
+ error: {
223
+ message: errorMsg,
224
+ type: ToolErrorType.EDIT_PREPARATION_FAILURE,
225
+ },
226
+ };
227
+ }
228
+ if (editData.error) {
229
+ return {
230
+ llmContent: editData.error.raw,
231
+ returnDisplay: `Error: ${editData.error.display}`,
232
+ error: {
233
+ message: editData.error.raw,
234
+ type: editData.error.type,
235
+ },
236
+ };
237
+ }
238
+ try {
239
+ this.ensureParentDirectoriesExist(this.params.file_path);
240
+ fs.writeFileSync(this.params.file_path, editData.newContent, 'utf8');
241
+ let displayResult;
242
+ if (editData.isNewFile) {
243
+ displayResult = `Created ${shortenPath(makeRelative(this.params.file_path, this.config.getTargetDir()))}`;
244
+ }
245
+ else {
246
+ // Generate diff for display, even though core logic doesn't technically need it
247
+ // The CLI wrapper will use this part of the ToolResult
248
+ const fileName = path.basename(this.params.file_path);
249
+ const fileDiff = Diff.createPatch(fileName, editData.currentContent ?? '', // Should not be null here if not isNewFile
250
+ editData.newContent, 'Current', 'Proposed', DEFAULT_DIFF_OPTIONS);
251
+ const originallyProposedContent = this.params.ai_proposed_string || this.params.new_string;
252
+ const diffStat = getDiffStat(fileName, editData.currentContent ?? '', originallyProposedContent, this.params.new_string);
253
+ displayResult = {
254
+ fileDiff,
255
+ fileName,
256
+ originalContent: editData.currentContent,
257
+ newContent: editData.newContent,
258
+ diffStat,
259
+ };
260
+ }
261
+ const llmSuccessMessageParts = [
262
+ editData.isNewFile
263
+ ? `Created new file: ${this.params.file_path} with provided content.`
264
+ : `Successfully modified file: ${this.params.file_path} (${editData.occurrences} replacements).`,
265
+ ];
266
+ if (this.params.modified_by_user) {
267
+ llmSuccessMessageParts.push(`User modified the \`new_string\` content to be: ${this.params.new_string}.`);
268
+ }
269
+ return {
270
+ llmContent: llmSuccessMessageParts.join(' '),
271
+ returnDisplay: displayResult,
272
+ };
273
+ }
274
+ catch (error) {
275
+ const errorMsg = error instanceof Error ? error.message : String(error);
276
+ return {
277
+ llmContent: `Error executing edit: ${errorMsg}`,
278
+ returnDisplay: `Error writing file: ${errorMsg}`,
279
+ error: {
280
+ message: errorMsg,
281
+ type: ToolErrorType.FILE_WRITE_FAILURE,
282
+ },
283
+ };
284
+ }
285
+ }
286
+ /**
287
+ * Creates parent directories if they don't exist
288
+ */
289
+ ensureParentDirectoriesExist(filePath) {
290
+ const dirName = path.dirname(filePath);
291
+ if (!fs.existsSync(dirName)) {
292
+ fs.mkdirSync(dirName, { recursive: true });
293
+ }
294
+ }
295
+ }
296
+ /**
297
+ * Implementation of the Edit tool logic
298
+ */
299
+ export class EditTool extends BaseDeclarativeTool {
300
+ config;
301
+ static Name = 'replace';
302
+ constructor(config) {
303
+ super(EditTool.Name, 'Edit', `Replaces text within a file. By default, replaces a single occurrence, but can replace multiple occurrences when \`expected_replacements\` is specified. This tool requires providing significant context around the change to ensure precise targeting. Always use the ${ReadFileTool.Name} tool to examine the file's current content before attempting a text replacement.
304
+
305
+ The user has the ability to modify the \`new_string\` content. If modified, this will be stated in the response.
306
+
307
+ Expectation for required parameters:
308
+ 1. \`file_path\` MUST be an absolute path; otherwise an error will be thrown.
309
+ 2. \`old_string\` MUST be the exact literal text to replace (including all whitespace, indentation, newlines, and surrounding code etc.).
310
+ 3. \`new_string\` MUST be the exact literal text to replace \`old_string\` with (also including all whitespace, indentation, newlines, and surrounding code etc.). Ensure the resulting code is correct and idiomatic.
311
+ 4. NEVER escape \`old_string\` or \`new_string\`, that would break the exact literal text requirement.
312
+ **Important:** If ANY of the above are not satisfied, the tool will fail. CRITICAL for \`old_string\`: Must uniquely identify the single instance to change. Include at least 3 lines of context BEFORE and AFTER the target text, matching whitespace and indentation precisely. If this string matches multiple locations, or does not match exactly, the tool will fail.
313
+ **Multiple replacements:** Set \`expected_replacements\` to the number of occurrences you want to replace. The tool will replace ALL occurrences that match \`old_string\` exactly. Ensure the number of replacements matches your expectation.`, Icon.Pencil, {
314
+ properties: {
315
+ file_path: {
316
+ description: "The absolute path to the file to modify. Must start with '/'.",
317
+ type: Type.STRING,
318
+ },
319
+ old_string: {
320
+ description: 'The exact literal text to replace, preferably unescaped. For single replacements (default), include at least 3 lines of context BEFORE and AFTER the target text, matching whitespace and indentation precisely. For multiple replacements, specify expected_replacements parameter. If this string is not the exact literal text (i.e. you escaped it) or does not match exactly, the tool will fail.',
321
+ type: Type.STRING,
322
+ },
323
+ new_string: {
324
+ description: 'The exact literal text to replace `old_string` with, preferably unescaped. Provide the EXACT text. Ensure the resulting code is correct and idiomatic.',
325
+ type: Type.STRING,
326
+ },
327
+ expected_replacements: {
328
+ type: Type.NUMBER,
329
+ description: 'Number of replacements expected. Defaults to 1 if not specified. Use when you want to replace multiple occurrences.',
330
+ minimum: 1,
331
+ },
332
+ },
333
+ required: ['file_path', 'old_string', 'new_string'],
334
+ type: Type.OBJECT,
335
+ });
336
+ this.config = config;
337
+ }
338
+ /**
339
+ * Validates the parameters for the Edit tool
340
+ * @param params Parameters to validate
341
+ * @returns Error message string or null if valid
342
+ */
343
+ validateToolParams(params) {
344
+ const errors = SchemaValidator.validate(this.schema.parameters, params);
345
+ if (errors) {
346
+ return errors;
347
+ }
348
+ if (!path.isAbsolute(params.file_path)) {
349
+ return `File path must be absolute: ${params.file_path}`;
350
+ }
351
+ const workspaceContext = this.config.getWorkspaceContext();
352
+ if (!workspaceContext.isPathWithinWorkspace(params.file_path)) {
353
+ const directories = workspaceContext.getDirectories();
354
+ return `File path must be within one of the workspace directories: ${directories.join(', ')}`;
355
+ }
356
+ return null;
357
+ }
358
+ createInvocation(params) {
359
+ return new EditToolInvocation(this.config, params);
360
+ }
361
+ getModifyContext(_) {
362
+ return {
363
+ getFilePath: (params) => params.file_path,
364
+ getCurrentContent: async (params) => {
365
+ try {
366
+ return fs.readFileSync(params.file_path, 'utf8');
367
+ }
368
+ catch (err) {
369
+ if (!isNodeError(err) || err.code !== 'ENOENT')
370
+ throw err;
371
+ return '';
372
+ }
373
+ },
374
+ getProposedContent: async (params) => {
375
+ try {
376
+ const currentContent = fs.readFileSync(params.file_path, 'utf8');
377
+ return applyReplacement(currentContent, params.old_string, params.new_string, params.old_string === '' && currentContent === '');
378
+ }
379
+ catch (err) {
380
+ if (!isNodeError(err) || err.code !== 'ENOENT')
381
+ throw err;
382
+ return '';
383
+ }
384
+ },
385
+ createUpdatedParams: (oldContent, modifiedProposedContent, originalParams) => {
386
+ const content = originalParams.new_string;
387
+ return {
388
+ ...originalParams,
389
+ ai_proposed_string: content,
390
+ old_string: oldContent,
391
+ new_string: modifiedProposedContent,
392
+ modified_by_user: true,
393
+ };
394
+ },
395
+ };
396
+ }
397
+ }
398
+ //# sourceMappingURL=edit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edit.js","sourceRoot":"","sources":["../../../src/tools/edit.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EACL,mBAAmB,EACnB,IAAI,EAEJ,uBAAuB,GAMxB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAU,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,MAAM,UAAU,gBAAgB,CAC9B,cAA6B,EAC7B,SAAiB,EACjB,SAAiB,EACjB,SAAkB;IAElB,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,cAAc,KAAK,IAAI,EAAE,CAAC;QAC5B,4GAA4G;QAC5G,OAAO,SAAS,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;IA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