@google/gemini-cli-core 0.0.3-preview.4

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 (669) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +310 -0
  3. package/dist/.last_build +0 -0
  4. package/dist/google-gemini-cli-core-0.3.0-preview.3.tgz +0 -0
  5. package/dist/index.d.ts +12 -0
  6. package/dist/index.js +13 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/src/__mocks__/fs/promises.d.ts +11 -0
  9. package/dist/src/__mocks__/fs/promises.js +17 -0
  10. package/dist/src/__mocks__/fs/promises.js.map +1 -0
  11. package/dist/src/code_assist/codeAssist.d.ts +10 -0
  12. package/dist/src/code_assist/codeAssist.js +19 -0
  13. package/dist/src/code_assist/codeAssist.js.map +1 -0
  14. package/dist/src/code_assist/converter.d.ts +72 -0
  15. package/dist/src/code_assist/converter.js +159 -0
  16. package/dist/src/code_assist/converter.js.map +1 -0
  17. package/dist/src/code_assist/converter.test.d.ts +6 -0
  18. package/dist/src/code_assist/converter.test.js +362 -0
  19. package/dist/src/code_assist/converter.test.js.map +1 -0
  20. package/dist/src/code_assist/oauth2.d.ts +22 -0
  21. package/dist/src/code_assist/oauth2.js +353 -0
  22. package/dist/src/code_assist/oauth2.js.map +1 -0
  23. package/dist/src/code_assist/oauth2.test.d.ts +6 -0
  24. package/dist/src/code_assist/oauth2.test.js +427 -0
  25. package/dist/src/code_assist/oauth2.test.js.map +1 -0
  26. package/dist/src/code_assist/server.d.ts +37 -0
  27. package/dist/src/code_assist/server.js +125 -0
  28. package/dist/src/code_assist/server.js.map +1 -0
  29. package/dist/src/code_assist/server.test.d.ts +6 -0
  30. package/dist/src/code_assist/server.test.js +134 -0
  31. package/dist/src/code_assist/server.test.js.map +1 -0
  32. package/dist/src/code_assist/setup.d.ts +20 -0
  33. package/dist/src/code_assist/setup.js +101 -0
  34. package/dist/src/code_assist/setup.js.map +1 -0
  35. package/dist/src/code_assist/setup.test.d.ts +6 -0
  36. package/dist/src/code_assist/setup.test.js +171 -0
  37. package/dist/src/code_assist/setup.test.js.map +1 -0
  38. package/dist/src/code_assist/types.d.ts +148 -0
  39. package/dist/src/code_assist/types.js +46 -0
  40. package/dist/src/code_assist/types.js.map +1 -0
  41. package/dist/src/config/config.d.ts +318 -0
  42. package/dist/src/config/config.js +633 -0
  43. package/dist/src/config/config.js.map +1 -0
  44. package/dist/src/config/config.test.d.ts +6 -0
  45. package/dist/src/config/config.test.js +585 -0
  46. package/dist/src/config/config.test.js.map +1 -0
  47. package/dist/src/config/flashFallback.test.d.ts +6 -0
  48. package/dist/src/config/flashFallback.test.js +87 -0
  49. package/dist/src/config/flashFallback.test.js.map +1 -0
  50. package/dist/src/config/models.d.ts +9 -0
  51. package/dist/src/config/models.js +10 -0
  52. package/dist/src/config/models.js.map +1 -0
  53. package/dist/src/config/storage.d.ts +32 -0
  54. package/dist/src/config/storage.js +90 -0
  55. package/dist/src/config/storage.js.map +1 -0
  56. package/dist/src/config/storage.test.d.ts +6 -0
  57. package/dist/src/config/storage.test.js +43 -0
  58. package/dist/src/config/storage.test.js.map +1 -0
  59. package/dist/src/core/client.d.ts +65 -0
  60. package/dist/src/core/client.js +689 -0
  61. package/dist/src/core/client.js.map +1 -0
  62. package/dist/src/core/client.test.d.ts +6 -0
  63. package/dist/src/core/client.test.js +1857 -0
  64. package/dist/src/core/client.test.js.map +1 -0
  65. package/dist/src/core/contentGenerator.d.ts +33 -0
  66. package/dist/src/core/contentGenerator.js +80 -0
  67. package/dist/src/core/contentGenerator.js.map +1 -0
  68. package/dist/src/core/contentGenerator.test.d.ts +6 -0
  69. package/dist/src/core/contentGenerator.test.js +124 -0
  70. package/dist/src/core/contentGenerator.test.js.map +1 -0
  71. package/dist/src/core/coreToolScheduler.d.ts +126 -0
  72. package/dist/src/core/coreToolScheduler.js +605 -0
  73. package/dist/src/core/coreToolScheduler.js.map +1 -0
  74. package/dist/src/core/coreToolScheduler.test.d.ts +6 -0
  75. package/dist/src/core/coreToolScheduler.test.js +923 -0
  76. package/dist/src/core/coreToolScheduler.test.js.map +1 -0
  77. package/dist/src/core/geminiChat.d.ts +122 -0
  78. package/dist/src/core/geminiChat.js +547 -0
  79. package/dist/src/core/geminiChat.js.map +1 -0
  80. package/dist/src/core/geminiChat.test.d.ts +6 -0
  81. package/dist/src/core/geminiChat.test.js +875 -0
  82. package/dist/src/core/geminiChat.test.js.map +1 -0
  83. package/dist/src/core/geminiRequest.d.ts +13 -0
  84. package/dist/src/core/geminiRequest.js +11 -0
  85. package/dist/src/core/geminiRequest.js.map +1 -0
  86. package/dist/src/core/logger.d.ts +60 -0
  87. package/dist/src/core/logger.js +360 -0
  88. package/dist/src/core/logger.js.map +1 -0
  89. package/dist/src/core/logger.test.d.ts +6 -0
  90. package/dist/src/core/logger.test.js +534 -0
  91. package/dist/src/core/logger.test.js.map +1 -0
  92. package/dist/src/core/loggingContentGenerator.d.ts +25 -0
  93. package/dist/src/core/loggingContentGenerator.js +97 -0
  94. package/dist/src/core/loggingContentGenerator.js.map +1 -0
  95. package/dist/src/core/nonInteractiveToolExecutor.d.ts +10 -0
  96. package/dist/src/core/nonInteractiveToolExecutor.js +24 -0
  97. package/dist/src/core/nonInteractiveToolExecutor.js.map +1 -0
  98. package/dist/src/core/nonInteractiveToolExecutor.test.d.ts +6 -0
  99. package/dist/src/core/nonInteractiveToolExecutor.test.js +236 -0
  100. package/dist/src/core/nonInteractiveToolExecutor.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 +236 -0
  108. package/dist/src/core/subagent.js +485 -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 +520 -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 +125 -0
  117. package/dist/src/core/turn.js +154 -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 +388 -0
  121. package/dist/src/core/turn.test.js.map +1 -0
  122. package/dist/src/generated/git-commit.d.ts +7 -0
  123. package/dist/src/generated/git-commit.js +10 -0
  124. package/dist/src/generated/git-commit.js.map +1 -0
  125. package/dist/src/ide/constants.d.ts +6 -0
  126. package/dist/src/ide/constants.js +7 -0
  127. package/dist/src/ide/constants.js.map +1 -0
  128. package/dist/src/ide/detect-ide.d.ts +25 -0
  129. package/dist/src/ide/detect-ide.js +104 -0
  130. package/dist/src/ide/detect-ide.js.map +1 -0
  131. package/dist/src/ide/detect-ide.test.d.ts +6 -0
  132. package/dist/src/ide/detect-ide.test.js +109 -0
  133. package/dist/src/ide/detect-ide.test.js.map +1 -0
  134. package/dist/src/ide/ide-client.d.ts +67 -0
  135. package/dist/src/ide/ide-client.js +418 -0
  136. package/dist/src/ide/ide-client.js.map +1 -0
  137. package/dist/src/ide/ide-client.test.d.ts +6 -0
  138. package/dist/src/ide/ide-client.test.js +155 -0
  139. package/dist/src/ide/ide-client.test.js.map +1 -0
  140. package/dist/src/ide/ide-installer.d.ts +14 -0
  141. package/dist/src/ide/ide-installer.js +107 -0
  142. package/dist/src/ide/ide-installer.js.map +1 -0
  143. package/dist/src/ide/ide-installer.test.d.ts +6 -0
  144. package/dist/src/ide/ide-installer.test.js +113 -0
  145. package/dist/src/ide/ide-installer.test.js.map +1 -0
  146. package/dist/src/ide/ideContext.d.ts +374 -0
  147. package/dist/src/ide/ideContext.js +147 -0
  148. package/dist/src/ide/ideContext.js.map +1 -0
  149. package/dist/src/ide/ideContext.test.d.ts +6 -0
  150. package/dist/src/ide/ideContext.test.js +265 -0
  151. package/dist/src/ide/ideContext.test.js.map +1 -0
  152. package/dist/src/ide/process-utils.d.ts +22 -0
  153. package/dist/src/ide/process-utils.js +153 -0
  154. package/dist/src/ide/process-utils.js.map +1 -0
  155. package/dist/src/ide/process-utils.test.d.ts +6 -0
  156. package/dist/src/ide/process-utils.test.js +72 -0
  157. package/dist/src/ide/process-utils.test.js.map +1 -0
  158. package/dist/src/index.d.ts +81 -0
  159. package/dist/src/index.js +90 -0
  160. package/dist/src/index.js.map +1 -0
  161. package/dist/src/index.test.d.ts +6 -0
  162. package/dist/src/index.test.js +12 -0
  163. package/dist/src/index.test.js.map +1 -0
  164. package/dist/src/mcp/google-auth-provider.d.ts +23 -0
  165. package/dist/src/mcp/google-auth-provider.js +72 -0
  166. package/dist/src/mcp/google-auth-provider.js.map +1 -0
  167. package/dist/src/mcp/google-auth-provider.test.d.ts +6 -0
  168. package/dist/src/mcp/google-auth-provider.test.js +89 -0
  169. package/dist/src/mcp/google-auth-provider.test.js.map +1 -0
  170. package/dist/src/mcp/oauth-provider.d.ts +146 -0
  171. package/dist/src/mcp/oauth-provider.js +601 -0
  172. package/dist/src/mcp/oauth-provider.js.map +1 -0
  173. package/dist/src/mcp/oauth-provider.test.d.ts +6 -0
  174. package/dist/src/mcp/oauth-provider.test.js +672 -0
  175. package/dist/src/mcp/oauth-provider.test.js.map +1 -0
  176. package/dist/src/mcp/oauth-token-storage.d.ts +61 -0
  177. package/dist/src/mcp/oauth-token-storage.js +148 -0
  178. package/dist/src/mcp/oauth-token-storage.js.map +1 -0
  179. package/dist/src/mcp/oauth-token-storage.test.d.ts +6 -0
  180. package/dist/src/mcp/oauth-token-storage.test.js +206 -0
  181. package/dist/src/mcp/oauth-token-storage.test.js.map +1 -0
  182. package/dist/src/mcp/oauth-utils.d.ts +119 -0
  183. package/dist/src/mcp/oauth-utils.js +235 -0
  184. package/dist/src/mcp/oauth-utils.js.map +1 -0
  185. package/dist/src/mcp/oauth-utils.test.d.ts +6 -0
  186. package/dist/src/mcp/oauth-utils.test.js +199 -0
  187. package/dist/src/mcp/oauth-utils.test.js.map +1 -0
  188. package/dist/src/mcp/token-storage/base-token-storage.d.ts +19 -0
  189. package/dist/src/mcp/token-storage/base-token-storage.js +36 -0
  190. package/dist/src/mcp/token-storage/base-token-storage.js.map +1 -0
  191. package/dist/src/mcp/token-storage/base-token-storage.test.d.ts +6 -0
  192. package/dist/src/mcp/token-storage/base-token-storage.test.js +160 -0
  193. package/dist/src/mcp/token-storage/base-token-storage.test.js.map +1 -0
  194. package/dist/src/mcp/token-storage/types.d.ts +34 -0
  195. package/dist/src/mcp/token-storage/types.js +7 -0
  196. package/dist/src/mcp/token-storage/types.js.map +1 -0
  197. package/dist/src/mocks/msw.d.ts +6 -0
  198. package/dist/src/mocks/msw.js +8 -0
  199. package/dist/src/mocks/msw.js.map +1 -0
  200. package/dist/src/prompts/mcp-prompts.d.ts +8 -0
  201. package/dist/src/prompts/mcp-prompts.js +13 -0
  202. package/dist/src/prompts/mcp-prompts.js.map +1 -0
  203. package/dist/src/prompts/prompt-registry.d.ts +34 -0
  204. package/dist/src/prompts/prompt-registry.js +63 -0
  205. package/dist/src/prompts/prompt-registry.js.map +1 -0
  206. package/dist/src/services/chatRecordingService.d.ts +150 -0
  207. package/dist/src/services/chatRecordingService.js +321 -0
  208. package/dist/src/services/chatRecordingService.js.map +1 -0
  209. package/dist/src/services/chatRecordingService.test.d.ts +6 -0
  210. package/dist/src/services/chatRecordingService.test.js +290 -0
  211. package/dist/src/services/chatRecordingService.test.js.map +1 -0
  212. package/dist/src/services/fileDiscoveryService.d.ts +35 -0
  213. package/dist/src/services/fileDiscoveryService.js +91 -0
  214. package/dist/src/services/fileDiscoveryService.js.map +1 -0
  215. package/dist/src/services/fileDiscoveryService.test.d.ts +6 -0
  216. package/dist/src/services/fileDiscoveryService.test.js +143 -0
  217. package/dist/src/services/fileDiscoveryService.test.js.map +1 -0
  218. package/dist/src/services/fileSystemService.d.ts +31 -0
  219. package/dist/src/services/fileSystemService.js +18 -0
  220. package/dist/src/services/fileSystemService.js.map +1 -0
  221. package/dist/src/services/fileSystemService.test.d.ts +6 -0
  222. package/dist/src/services/fileSystemService.test.js +41 -0
  223. package/dist/src/services/fileSystemService.test.js.map +1 -0
  224. package/dist/src/services/gitService.d.ts +23 -0
  225. package/dist/src/services/gitService.js +110 -0
  226. package/dist/src/services/gitService.js.map +1 -0
  227. package/dist/src/services/gitService.test.d.ts +6 -0
  228. package/dist/src/services/gitService.test.js +212 -0
  229. package/dist/src/services/gitService.test.js.map +1 -0
  230. package/dist/src/services/loopDetectionService.d.ts +98 -0
  231. package/dist/src/services/loopDetectionService.js +363 -0
  232. package/dist/src/services/loopDetectionService.js.map +1 -0
  233. package/dist/src/services/loopDetectionService.test.d.ts +6 -0
  234. package/dist/src/services/loopDetectionService.test.js +558 -0
  235. package/dist/src/services/loopDetectionService.test.js.map +1 -0
  236. package/dist/src/services/shellExecutionService.d.ts +68 -0
  237. package/dist/src/services/shellExecutionService.js +332 -0
  238. package/dist/src/services/shellExecutionService.js.map +1 -0
  239. package/dist/src/services/shellExecutionService.test.d.ts +6 -0
  240. package/dist/src/services/shellExecutionService.test.js +517 -0
  241. package/dist/src/services/shellExecutionService.test.js.map +1 -0
  242. package/dist/src/telemetry/clearcut-logger/clearcut-logger.d.ts +121 -0
  243. package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +773 -0
  244. package/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +1 -0
  245. package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.d.ts +17 -0
  246. package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js +407 -0
  247. package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js.map +1 -0
  248. package/dist/src/telemetry/clearcut-logger/event-metadata-key.d.ts +90 -0
  249. package/dist/src/telemetry/clearcut-logger/event-metadata-key.js +229 -0
  250. package/dist/src/telemetry/clearcut-logger/event-metadata-key.js.map +1 -0
  251. package/dist/src/telemetry/constants.d.ts +32 -0
  252. package/dist/src/telemetry/constants.js +33 -0
  253. package/dist/src/telemetry/constants.js.map +1 -0
  254. package/dist/src/telemetry/file-exporters.d.ts +29 -0
  255. package/dist/src/telemetry/file-exporters.js +62 -0
  256. package/dist/src/telemetry/file-exporters.js.map +1 -0
  257. package/dist/src/telemetry/index.d.ts +21 -0
  258. package/dist/src/telemetry/index.js +21 -0
  259. package/dist/src/telemetry/index.js.map +1 -0
  260. package/dist/src/telemetry/integration.test.circular.d.ts +6 -0
  261. package/dist/src/telemetry/integration.test.circular.js +54 -0
  262. package/dist/src/telemetry/integration.test.circular.js.map +1 -0
  263. package/dist/src/telemetry/loggers.d.ts +26 -0
  264. package/dist/src/telemetry/loggers.js +404 -0
  265. package/dist/src/telemetry/loggers.js.map +1 -0
  266. package/dist/src/telemetry/loggers.test.circular.d.ts +6 -0
  267. package/dist/src/telemetry/loggers.test.circular.js +107 -0
  268. package/dist/src/telemetry/loggers.test.circular.js.map +1 -0
  269. package/dist/src/telemetry/loggers.test.d.ts +6 -0
  270. package/dist/src/telemetry/loggers.test.js +658 -0
  271. package/dist/src/telemetry/loggers.test.js.map +1 -0
  272. package/dist/src/telemetry/metrics.d.ts +36 -0
  273. package/dist/src/telemetry/metrics.js +208 -0
  274. package/dist/src/telemetry/metrics.js.map +1 -0
  275. package/dist/src/telemetry/metrics.test.d.ts +6 -0
  276. package/dist/src/telemetry/metrics.test.js +242 -0
  277. package/dist/src/telemetry/metrics.test.js.map +1 -0
  278. package/dist/src/telemetry/sdk.d.ts +9 -0
  279. package/dist/src/telemetry/sdk.js +163 -0
  280. package/dist/src/telemetry/sdk.js.map +1 -0
  281. package/dist/src/telemetry/sdk.test.d.ts +6 -0
  282. package/dist/src/telemetry/sdk.test.js +82 -0
  283. package/dist/src/telemetry/sdk.test.js.map +1 -0
  284. package/dist/src/telemetry/telemetry-utils.d.ts +6 -0
  285. package/dist/src/telemetry/telemetry-utils.js +14 -0
  286. package/dist/src/telemetry/telemetry-utils.js.map +1 -0
  287. package/dist/src/telemetry/telemetry-utils.test.d.ts +6 -0
  288. package/dist/src/telemetry/telemetry-utils.test.js +40 -0
  289. package/dist/src/telemetry/telemetry-utils.test.js.map +1 -0
  290. package/dist/src/telemetry/telemetry.test.d.ts +6 -0
  291. package/dist/src/telemetry/telemetry.test.js +50 -0
  292. package/dist/src/telemetry/telemetry.test.js.map +1 -0
  293. package/dist/src/telemetry/tool-call-decision.d.ts +13 -0
  294. package/dist/src/telemetry/tool-call-decision.js +29 -0
  295. package/dist/src/telemetry/tool-call-decision.js.map +1 -0
  296. package/dist/src/telemetry/types.d.ts +220 -0
  297. package/dist/src/telemetry/types.js +383 -0
  298. package/dist/src/telemetry/types.js.map +1 -0
  299. package/dist/src/telemetry/uiTelemetry.d.ts +75 -0
  300. package/dist/src/telemetry/uiTelemetry.js +153 -0
  301. package/dist/src/telemetry/uiTelemetry.js.map +1 -0
  302. package/dist/src/telemetry/uiTelemetry.test.d.ts +6 -0
  303. package/dist/src/telemetry/uiTelemetry.test.js +558 -0
  304. package/dist/src/telemetry/uiTelemetry.test.js.map +1 -0
  305. package/dist/src/test-utils/config.d.ts +17 -0
  306. package/dist/src/test-utils/config.js +32 -0
  307. package/dist/src/test-utils/config.js.map +1 -0
  308. package/dist/src/test-utils/mockWorkspaceContext.d.ts +13 -0
  309. package/dist/src/test-utils/mockWorkspaceContext.js +24 -0
  310. package/dist/src/test-utils/mockWorkspaceContext.js.map +1 -0
  311. package/dist/src/test-utils/tools.d.ts +45 -0
  312. package/dist/src/test-utils/tools.js +105 -0
  313. package/dist/src/test-utils/tools.js.map +1 -0
  314. package/dist/src/tools/diffOptions.d.ts +9 -0
  315. package/dist/src/tools/diffOptions.js +38 -0
  316. package/dist/src/tools/diffOptions.js.map +1 -0
  317. package/dist/src/tools/diffOptions.test.d.ts +6 -0
  318. package/dist/src/tools/diffOptions.test.js +119 -0
  319. package/dist/src/tools/diffOptions.test.js.map +1 -0
  320. package/dist/src/tools/edit.d.ts +56 -0
  321. package/dist/src/tools/edit.js +423 -0
  322. package/dist/src/tools/edit.js.map +1 -0
  323. package/dist/src/tools/edit.test.d.ts +6 -0
  324. package/dist/src/tools/edit.test.js +713 -0
  325. package/dist/src/tools/edit.test.js.map +1 -0
  326. package/dist/src/tools/glob.d.ts +52 -0
  327. package/dist/src/tools/glob.js +236 -0
  328. package/dist/src/tools/glob.js.map +1 -0
  329. package/dist/src/tools/glob.test.d.ts +6 -0
  330. package/dist/src/tools/glob.test.js +375 -0
  331. package/dist/src/tools/glob.test.js.map +1 -0
  332. package/dist/src/tools/grep.d.ts +47 -0
  333. package/dist/src/tools/grep.js +517 -0
  334. package/dist/src/tools/grep.js.map +1 -0
  335. package/dist/src/tools/grep.test.d.ts +6 -0
  336. package/dist/src/tools/grep.test.js +295 -0
  337. package/dist/src/tools/grep.test.js.map +1 -0
  338. package/dist/src/tools/ls.d.ts +68 -0
  339. package/dist/src/tools/ls.js +227 -0
  340. package/dist/src/tools/ls.js.map +1 -0
  341. package/dist/src/tools/ls.test.d.ts +6 -0
  342. package/dist/src/tools/ls.test.js +389 -0
  343. package/dist/src/tools/ls.test.js.map +1 -0
  344. package/dist/src/tools/mcp-client-manager.d.ts +38 -0
  345. package/dist/src/tools/mcp-client-manager.js +74 -0
  346. package/dist/src/tools/mcp-client-manager.js.map +1 -0
  347. package/dist/src/tools/mcp-client-manager.test.d.ts +6 -0
  348. package/dist/src/tools/mcp-client-manager.test.js +39 -0
  349. package/dist/src/tools/mcp-client-manager.test.js.map +1 -0
  350. package/dist/src/tools/mcp-client.d.ts +199 -0
  351. package/dist/src/tools/mcp-client.js +995 -0
  352. package/dist/src/tools/mcp-client.js.map +1 -0
  353. package/dist/src/tools/mcp-client.test.d.ts +6 -0
  354. package/dist/src/tools/mcp-client.test.js +454 -0
  355. package/dist/src/tools/mcp-client.test.js.map +1 -0
  356. package/dist/src/tools/mcp-tool.d.ts +23 -0
  357. package/dist/src/tools/mcp-tool.js +240 -0
  358. package/dist/src/tools/mcp-tool.js.map +1 -0
  359. package/dist/src/tools/mcp-tool.test.d.ts +6 -0
  360. package/dist/src/tools/mcp-tool.test.js +576 -0
  361. package/dist/src/tools/mcp-tool.test.js.map +1 -0
  362. package/dist/src/tools/memoryTool.d.ts +40 -0
  363. package/dist/src/tools/memoryTool.js +296 -0
  364. package/dist/src/tools/memoryTool.js.map +1 -0
  365. package/dist/src/tools/memoryTool.test.d.ts +6 -0
  366. package/dist/src/tools/memoryTool.test.js +298 -0
  367. package/dist/src/tools/memoryTool.test.js.map +1 -0
  368. package/dist/src/tools/modifiable-tool.d.ts +32 -0
  369. package/dist/src/tools/modifiable-tool.js +88 -0
  370. package/dist/src/tools/modifiable-tool.js.map +1 -0
  371. package/dist/src/tools/modifiable-tool.test.d.ts +6 -0
  372. package/dist/src/tools/modifiable-tool.test.js +193 -0
  373. package/dist/src/tools/modifiable-tool.test.js.map +1 -0
  374. package/dist/src/tools/read-file.d.ts +35 -0
  375. package/dist/src/tools/read-file.js +127 -0
  376. package/dist/src/tools/read-file.js.map +1 -0
  377. package/dist/src/tools/read-file.test.d.ts +6 -0
  378. package/dist/src/tools/read-file.test.js +311 -0
  379. package/dist/src/tools/read-file.test.js.map +1 -0
  380. package/dist/src/tools/read-many-files.d.ts +60 -0
  381. package/dist/src/tools/read-many-files.js +414 -0
  382. package/dist/src/tools/read-many-files.js.map +1 -0
  383. package/dist/src/tools/read-many-files.test.d.ts +6 -0
  384. package/dist/src/tools/read-many-files.test.js +565 -0
  385. package/dist/src/tools/read-many-files.test.js.map +1 -0
  386. package/dist/src/tools/ripGrep.d.ts +47 -0
  387. package/dist/src/tools/ripGrep.js +368 -0
  388. package/dist/src/tools/ripGrep.js.map +1 -0
  389. package/dist/src/tools/ripGrep.test.d.ts +6 -0
  390. package/dist/src/tools/ripGrep.test.js +874 -0
  391. package/dist/src/tools/ripGrep.test.js.map +1 -0
  392. package/dist/src/tools/shell.d.ts +22 -0
  393. package/dist/src/tools/shell.js +320 -0
  394. package/dist/src/tools/shell.js.map +1 -0
  395. package/dist/src/tools/shell.test.d.ts +6 -0
  396. package/dist/src/tools/shell.test.js +336 -0
  397. package/dist/src/tools/shell.test.js.map +1 -0
  398. package/dist/src/tools/tool-error.d.ts +43 -0
  399. package/dist/src/tools/tool-error.js +58 -0
  400. package/dist/src/tools/tool-error.js.map +1 -0
  401. package/dist/src/tools/tool-registry.d.ts +86 -0
  402. package/dist/src/tools/tool-registry.js +369 -0
  403. package/dist/src/tools/tool-registry.js.map +1 -0
  404. package/dist/src/tools/tool-registry.test.d.ts +6 -0
  405. package/dist/src/tools/tool-registry.test.js +332 -0
  406. package/dist/src/tools/tool-registry.test.js.map +1 -0
  407. package/dist/src/tools/tools.d.ts +274 -0
  408. package/dist/src/tools/tools.js +250 -0
  409. package/dist/src/tools/tools.js.map +1 -0
  410. package/dist/src/tools/tools.test.d.ts +6 -0
  411. package/dist/src/tools/tools.test.js +205 -0
  412. package/dist/src/tools/tools.test.js.map +1 -0
  413. package/dist/src/tools/web-fetch.d.ts +27 -0
  414. package/dist/src/tools/web-fetch.js +243 -0
  415. package/dist/src/tools/web-fetch.js.map +1 -0
  416. package/dist/src/tools/web-fetch.test.d.ts +6 -0
  417. package/dist/src/tools/web-fetch.test.js +114 -0
  418. package/dist/src/tools/web-fetch.test.js.map +1 -0
  419. package/dist/src/tools/web-search.d.ts +49 -0
  420. package/dist/src/tools/web-search.js +137 -0
  421. package/dist/src/tools/web-search.js.map +1 -0
  422. package/dist/src/tools/web-search.test.d.ts +6 -0
  423. package/dist/src/tools/web-search.test.js +207 -0
  424. package/dist/src/tools/web-search.test.js.map +1 -0
  425. package/dist/src/tools/write-file.d.ts +52 -0
  426. package/dist/src/tools/write-file.js +314 -0
  427. package/dist/src/tools/write-file.js.map +1 -0
  428. package/dist/src/tools/write-file.test.d.ts +6 -0
  429. package/dist/src/tools/write-file.test.js +531 -0
  430. package/dist/src/tools/write-file.test.js.map +1 -0
  431. package/dist/src/utils/LruCache.d.ts +13 -0
  432. package/dist/src/utils/LruCache.js +38 -0
  433. package/dist/src/utils/LruCache.js.map +1 -0
  434. package/dist/src/utils/bfsFileSearch.d.ts +24 -0
  435. package/dist/src/utils/bfsFileSearch.js +89 -0
  436. package/dist/src/utils/bfsFileSearch.js.map +1 -0
  437. package/dist/src/utils/bfsFileSearch.test.d.ts +6 -0
  438. package/dist/src/utils/bfsFileSearch.test.js +163 -0
  439. package/dist/src/utils/bfsFileSearch.test.js.map +1 -0
  440. package/dist/src/utils/browser.d.ts +13 -0
  441. package/dist/src/utils/browser.js +50 -0
  442. package/dist/src/utils/browser.js.map +1 -0
  443. package/dist/src/utils/editCorrector.d.ts +53 -0
  444. package/dist/src/utils/editCorrector.js +545 -0
  445. package/dist/src/utils/editCorrector.js.map +1 -0
  446. package/dist/src/utils/editCorrector.test.d.ts +6 -0
  447. package/dist/src/utils/editCorrector.test.js +564 -0
  448. package/dist/src/utils/editCorrector.test.js.map +1 -0
  449. package/dist/src/utils/editor.d.ts +28 -0
  450. package/dist/src/utils/editor.js +186 -0
  451. package/dist/src/utils/editor.js.map +1 -0
  452. package/dist/src/utils/editor.test.d.ts +6 -0
  453. package/dist/src/utils/editor.test.js +445 -0
  454. package/dist/src/utils/editor.test.js.map +1 -0
  455. package/dist/src/utils/environmentContext.d.ts +21 -0
  456. package/dist/src/utils/environmentContext.js +90 -0
  457. package/dist/src/utils/environmentContext.js.map +1 -0
  458. package/dist/src/utils/environmentContext.test.d.ts +6 -0
  459. package/dist/src/utils/environmentContext.test.js +140 -0
  460. package/dist/src/utils/environmentContext.test.js.map +1 -0
  461. package/dist/src/utils/errorParsing.d.ts +8 -0
  462. package/dist/src/utils/errorParsing.js +93 -0
  463. package/dist/src/utils/errorParsing.js.map +1 -0
  464. package/dist/src/utils/errorParsing.test.d.ts +6 -0
  465. package/dist/src/utils/errorParsing.test.js +172 -0
  466. package/dist/src/utils/errorParsing.test.js.map +1 -0
  467. package/dist/src/utils/errorReporting.d.ts +14 -0
  468. package/dist/src/utils/errorReporting.js +88 -0
  469. package/dist/src/utils/errorReporting.js.map +1 -0
  470. package/dist/src/utils/errorReporting.test.d.ts +6 -0
  471. package/dist/src/utils/errorReporting.test.js +130 -0
  472. package/dist/src/utils/errorReporting.test.js.map +1 -0
  473. package/dist/src/utils/errors.d.ts +33 -0
  474. package/dist/src/utils/errors.js +86 -0
  475. package/dist/src/utils/errors.js.map +1 -0
  476. package/dist/src/utils/fetch.d.ts +11 -0
  477. package/dist/src/utils/fetch.js +51 -0
  478. package/dist/src/utils/fetch.js.map +1 -0
  479. package/dist/src/utils/fileUtils.d.ts +52 -0
  480. package/dist/src/utils/fileUtils.js +283 -0
  481. package/dist/src/utils/fileUtils.js.map +1 -0
  482. package/dist/src/utils/fileUtils.test.d.ts +6 -0
  483. package/dist/src/utils/fileUtils.test.js +364 -0
  484. package/dist/src/utils/fileUtils.test.js.map +1 -0
  485. package/dist/src/utils/filesearch/crawlCache.d.ts +25 -0
  486. package/dist/src/utils/filesearch/crawlCache.js +57 -0
  487. package/dist/src/utils/filesearch/crawlCache.js.map +1 -0
  488. package/dist/src/utils/filesearch/crawlCache.test.d.ts +6 -0
  489. package/dist/src/utils/filesearch/crawlCache.test.js +103 -0
  490. package/dist/src/utils/filesearch/crawlCache.test.js.map +1 -0
  491. package/dist/src/utils/filesearch/crawler.d.ts +15 -0
  492. package/dist/src/utils/filesearch/crawler.js +50 -0
  493. package/dist/src/utils/filesearch/crawler.js.map +1 -0
  494. package/dist/src/utils/filesearch/crawler.test.d.ts +6 -0
  495. package/dist/src/utils/filesearch/crawler.test.js +468 -0
  496. package/dist/src/utils/filesearch/crawler.test.js.map +1 -0
  497. package/dist/src/utils/filesearch/fileSearch.d.ts +38 -0
  498. package/dist/src/utils/filesearch/fileSearch.js +191 -0
  499. package/dist/src/utils/filesearch/fileSearch.js.map +1 -0
  500. package/dist/src/utils/filesearch/fileSearch.test.d.ts +6 -0
  501. package/dist/src/utils/filesearch/fileSearch.test.js +642 -0
  502. package/dist/src/utils/filesearch/fileSearch.test.js.map +1 -0
  503. package/dist/src/utils/filesearch/ignore.d.ts +42 -0
  504. package/dist/src/utils/filesearch/ignore.js +106 -0
  505. package/dist/src/utils/filesearch/ignore.js.map +1 -0
  506. package/dist/src/utils/filesearch/ignore.test.d.ts +6 -0
  507. package/dist/src/utils/filesearch/ignore.test.js +144 -0
  508. package/dist/src/utils/filesearch/ignore.test.js.map +1 -0
  509. package/dist/src/utils/filesearch/result-cache.d.ts +33 -0
  510. package/dist/src/utils/filesearch/result-cache.js +59 -0
  511. package/dist/src/utils/filesearch/result-cache.js.map +1 -0
  512. package/dist/src/utils/filesearch/result-cache.test.d.ts +6 -0
  513. package/dist/src/utils/filesearch/result-cache.test.js +46 -0
  514. package/dist/src/utils/filesearch/result-cache.test.js.map +1 -0
  515. package/dist/src/utils/flashFallback.integration.test.d.ts +6 -0
  516. package/dist/src/utils/flashFallback.integration.test.js +118 -0
  517. package/dist/src/utils/flashFallback.integration.test.js.map +1 -0
  518. package/dist/src/utils/formatters.d.ts +6 -0
  519. package/dist/src/utils/formatters.js +16 -0
  520. package/dist/src/utils/formatters.js.map +1 -0
  521. package/dist/src/utils/generateContentResponseUtilities.d.ts +13 -0
  522. package/dist/src/utils/generateContentResponseUtilities.js +80 -0
  523. package/dist/src/utils/generateContentResponseUtilities.js.map +1 -0
  524. package/dist/src/utils/generateContentResponseUtilities.test.d.ts +6 -0
  525. package/dist/src/utils/generateContentResponseUtilities.test.js +235 -0
  526. package/dist/src/utils/generateContentResponseUtilities.test.js.map +1 -0
  527. package/dist/src/utils/getFolderStructure.d.ts +31 -0
  528. package/dist/src/utils/getFolderStructure.js +246 -0
  529. package/dist/src/utils/getFolderStructure.js.map +1 -0
  530. package/dist/src/utils/getFolderStructure.test.d.ts +6 -0
  531. package/dist/src/utils/getFolderStructure.test.js +282 -0
  532. package/dist/src/utils/getFolderStructure.test.js.map +1 -0
  533. package/dist/src/utils/getPty.d.ts +19 -0
  534. package/dist/src/utils/getPty.js +23 -0
  535. package/dist/src/utils/getPty.js.map +1 -0
  536. package/dist/src/utils/gitIgnoreParser.d.ts +20 -0
  537. package/dist/src/utils/gitIgnoreParser.js +61 -0
  538. package/dist/src/utils/gitIgnoreParser.js.map +1 -0
  539. package/dist/src/utils/gitIgnoreParser.test.d.ts +6 -0
  540. package/dist/src/utils/gitIgnoreParser.test.js +154 -0
  541. package/dist/src/utils/gitIgnoreParser.test.js.map +1 -0
  542. package/dist/src/utils/gitUtils.d.ts +17 -0
  543. package/dist/src/utils/gitUtils.js +61 -0
  544. package/dist/src/utils/gitUtils.js.map +1 -0
  545. package/dist/src/utils/ignorePatterns.d.ts +103 -0
  546. package/dist/src/utils/ignorePatterns.js +220 -0
  547. package/dist/src/utils/ignorePatterns.js.map +1 -0
  548. package/dist/src/utils/ignorePatterns.test.d.ts +6 -0
  549. package/dist/src/utils/ignorePatterns.test.js +250 -0
  550. package/dist/src/utils/ignorePatterns.test.js.map +1 -0
  551. package/dist/src/utils/installationManager.d.ts +16 -0
  552. package/dist/src/utils/installationManager.js +50 -0
  553. package/dist/src/utils/installationManager.js.map +1 -0
  554. package/dist/src/utils/installationManager.test.d.ts +6 -0
  555. package/dist/src/utils/installationManager.test.js +83 -0
  556. package/dist/src/utils/installationManager.test.js.map +1 -0
  557. package/dist/src/utils/language-detection.d.ts +6 -0
  558. package/dist/src/utils/language-detection.js +101 -0
  559. package/dist/src/utils/language-detection.js.map +1 -0
  560. package/dist/src/utils/memoryDiscovery.d.ts +15 -0
  561. package/dist/src/utils/memoryDiscovery.js +253 -0
  562. package/dist/src/utils/memoryDiscovery.js.map +1 -0
  563. package/dist/src/utils/memoryDiscovery.test.d.ts +6 -0
  564. package/dist/src/utils/memoryDiscovery.test.js +219 -0
  565. package/dist/src/utils/memoryDiscovery.test.js.map +1 -0
  566. package/dist/src/utils/memoryImportProcessor.d.ts +42 -0
  567. package/dist/src/utils/memoryImportProcessor.js +296 -0
  568. package/dist/src/utils/memoryImportProcessor.js.map +1 -0
  569. package/dist/src/utils/memoryImportProcessor.test.d.ts +6 -0
  570. package/dist/src/utils/memoryImportProcessor.test.js +573 -0
  571. package/dist/src/utils/memoryImportProcessor.test.js.map +1 -0
  572. package/dist/src/utils/messageInspectors.d.ts +8 -0
  573. package/dist/src/utils/messageInspectors.js +16 -0
  574. package/dist/src/utils/messageInspectors.js.map +1 -0
  575. package/dist/src/utils/nextSpeakerChecker.d.ts +12 -0
  576. package/dist/src/utils/nextSpeakerChecker.js +91 -0
  577. package/dist/src/utils/nextSpeakerChecker.js.map +1 -0
  578. package/dist/src/utils/nextSpeakerChecker.test.d.ts +6 -0
  579. package/dist/src/utils/nextSpeakerChecker.test.js +168 -0
  580. package/dist/src/utils/nextSpeakerChecker.test.js.map +1 -0
  581. package/dist/src/utils/partUtils.d.ts +35 -0
  582. package/dist/src/utils/partUtils.js +133 -0
  583. package/dist/src/utils/partUtils.js.map +1 -0
  584. package/dist/src/utils/partUtils.test.d.ts +6 -0
  585. package/dist/src/utils/partUtils.test.js +241 -0
  586. package/dist/src/utils/partUtils.test.js.map +1 -0
  587. package/dist/src/utils/pathReader.d.ts +17 -0
  588. package/dist/src/utils/pathReader.js +92 -0
  589. package/dist/src/utils/pathReader.js.map +1 -0
  590. package/dist/src/utils/pathReader.test.d.ts +6 -0
  591. package/dist/src/utils/pathReader.test.js +363 -0
  592. package/dist/src/utils/pathReader.test.js.map +1 -0
  593. package/dist/src/utils/paths.d.ts +58 -0
  594. package/dist/src/utils/paths.js +159 -0
  595. package/dist/src/utils/paths.js.map +1 -0
  596. package/dist/src/utils/paths.test.d.ts +6 -0
  597. package/dist/src/utils/paths.test.js +225 -0
  598. package/dist/src/utils/paths.test.js.map +1 -0
  599. package/dist/src/utils/quotaErrorDetection.d.ts +18 -0
  600. package/dist/src/utils/quotaErrorDetection.js +65 -0
  601. package/dist/src/utils/quotaErrorDetection.js.map +1 -0
  602. package/dist/src/utils/retry.d.ts +30 -0
  603. package/dist/src/utils/retry.js +276 -0
  604. package/dist/src/utils/retry.js.map +1 -0
  605. package/dist/src/utils/retry.test.d.ts +6 -0
  606. package/dist/src/utils/retry.test.js +325 -0
  607. package/dist/src/utils/retry.test.js.map +1 -0
  608. package/dist/src/utils/safeJsonStringify.d.ts +13 -0
  609. package/dist/src/utils/safeJsonStringify.js +25 -0
  610. package/dist/src/utils/safeJsonStringify.js.map +1 -0
  611. package/dist/src/utils/safeJsonStringify.test.d.ts +6 -0
  612. package/dist/src/utils/safeJsonStringify.test.js +61 -0
  613. package/dist/src/utils/safeJsonStringify.test.js.map +1 -0
  614. package/dist/src/utils/schemaValidator.d.ts +15 -0
  615. package/dist/src/utils/schemaValidator.js +38 -0
  616. package/dist/src/utils/schemaValidator.js.map +1 -0
  617. package/dist/src/utils/secure-browser-launcher.d.ts +23 -0
  618. package/dist/src/utils/secure-browser-launcher.js +165 -0
  619. package/dist/src/utils/secure-browser-launcher.js.map +1 -0
  620. package/dist/src/utils/secure-browser-launcher.test.d.ts +6 -0
  621. package/dist/src/utils/secure-browser-launcher.test.js +149 -0
  622. package/dist/src/utils/secure-browser-launcher.test.js.map +1 -0
  623. package/dist/src/utils/session.d.ts +6 -0
  624. package/dist/src/utils/session.js +8 -0
  625. package/dist/src/utils/session.js.map +1 -0
  626. package/dist/src/utils/shell-utils.d.ts +117 -0
  627. package/dist/src/utils/shell-utils.js +370 -0
  628. package/dist/src/utils/shell-utils.js.map +1 -0
  629. package/dist/src/utils/shell-utils.test.d.ts +6 -0
  630. package/dist/src/utils/shell-utils.test.js +332 -0
  631. package/dist/src/utils/shell-utils.test.js.map +1 -0
  632. package/dist/src/utils/summarizer.d.ts +25 -0
  633. package/dist/src/utils/summarizer.js +51 -0
  634. package/dist/src/utils/summarizer.js.map +1 -0
  635. package/dist/src/utils/summarizer.test.d.ts +6 -0
  636. package/dist/src/utils/summarizer.test.js +131 -0
  637. package/dist/src/utils/summarizer.test.js.map +1 -0
  638. package/dist/src/utils/systemEncoding.d.ts +40 -0
  639. package/dist/src/utils/systemEncoding.js +149 -0
  640. package/dist/src/utils/systemEncoding.js.map +1 -0
  641. package/dist/src/utils/systemEncoding.test.d.ts +6 -0
  642. package/dist/src/utils/systemEncoding.test.js +368 -0
  643. package/dist/src/utils/systemEncoding.test.js.map +1 -0
  644. package/dist/src/utils/testUtils.d.ts +29 -0
  645. package/dist/src/utils/testUtils.js +70 -0
  646. package/dist/src/utils/testUtils.js.map +1 -0
  647. package/dist/src/utils/textUtils.d.ts +13 -0
  648. package/dist/src/utils/textUtils.js +28 -0
  649. package/dist/src/utils/textUtils.js.map +1 -0
  650. package/dist/src/utils/tool-utils.d.ts +19 -0
  651. package/dist/src/utils/tool-utils.js +58 -0
  652. package/dist/src/utils/tool-utils.js.map +1 -0
  653. package/dist/src/utils/tool-utils.test.d.ts +6 -0
  654. package/dist/src/utils/tool-utils.test.js +61 -0
  655. package/dist/src/utils/tool-utils.test.js.map +1 -0
  656. package/dist/src/utils/userAccountManager.d.ts +20 -0
  657. package/dist/src/utils/userAccountManager.js +114 -0
  658. package/dist/src/utils/userAccountManager.js.map +1 -0
  659. package/dist/src/utils/userAccountManager.test.d.ts +6 -0
  660. package/dist/src/utils/userAccountManager.test.js +223 -0
  661. package/dist/src/utils/userAccountManager.test.js.map +1 -0
  662. package/dist/src/utils/workspaceContext.d.ts +66 -0
  663. package/dist/src/utils/workspaceContext.js +171 -0
  664. package/dist/src/utils/workspaceContext.js.map +1 -0
  665. package/dist/src/utils/workspaceContext.test.d.ts +6 -0
  666. package/dist/src/utils/workspaceContext.test.js +318 -0
  667. package/dist/src/utils/workspaceContext.test.js.map +1 -0
  668. package/dist/tsconfig.tsbuildinfo +1 -0
  669. package/package.json +85 -0
@@ -0,0 +1,576 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
7
+ import { safeJsonStringify } from '../utils/safeJsonStringify.js';
8
+ import { DiscoveredMCPTool, generateValidName } from './mcp-tool.js'; // Added getStringifiedResultForDisplay
9
+ import { ToolConfirmationOutcome } from './tools.js'; // Added ToolConfirmationOutcome
10
+ import { ToolErrorType } from './tool-error.js';
11
+ // Mock @google/genai mcpToTool and CallableTool
12
+ // We only need to mock the parts of CallableTool that DiscoveredMCPTool uses.
13
+ const mockCallTool = vi.fn();
14
+ const mockToolMethod = vi.fn();
15
+ const mockCallableToolInstance = {
16
+ tool: mockToolMethod, // Not directly used by DiscoveredMCPTool instance methods
17
+ callTool: mockCallTool,
18
+ // Add other methods if DiscoveredMCPTool starts using them
19
+ };
20
+ describe('generateValidName', () => {
21
+ it('should return a valid name for a simple function', () => {
22
+ expect(generateValidName('myFunction')).toBe('myFunction');
23
+ });
24
+ it('should replace invalid characters with underscores', () => {
25
+ expect(generateValidName('invalid-name with spaces')).toBe('invalid-name_with_spaces');
26
+ });
27
+ it('should truncate long names', () => {
28
+ expect(generateValidName('x'.repeat(80))).toBe('xxxxxxxxxxxxxxxxxxxxxxxxxxxx___xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
29
+ });
30
+ it('should handle names with only invalid characters', () => {
31
+ expect(generateValidName('!@#$%^&*()')).toBe('__________');
32
+ });
33
+ it('should handle names that are exactly 63 characters long', () => {
34
+ expect(generateValidName('a'.repeat(63)).length).toBe(63);
35
+ });
36
+ it('should handle names that are exactly 64 characters long', () => {
37
+ expect(generateValidName('a'.repeat(64)).length).toBe(63);
38
+ });
39
+ it('should handle names that are longer than 64 characters', () => {
40
+ expect(generateValidName('a'.repeat(80)).length).toBe(63);
41
+ });
42
+ });
43
+ describe('DiscoveredMCPTool', () => {
44
+ const serverName = 'mock-mcp-server';
45
+ const serverToolName = 'actual-server-tool-name';
46
+ const baseDescription = 'A test MCP tool.';
47
+ const inputSchema = {
48
+ type: 'object',
49
+ properties: { param: { type: 'string' } },
50
+ required: ['param'],
51
+ };
52
+ let tool;
53
+ beforeEach(() => {
54
+ mockCallTool.mockClear();
55
+ mockToolMethod.mockClear();
56
+ tool = new DiscoveredMCPTool(mockCallableToolInstance, serverName, serverToolName, baseDescription, inputSchema);
57
+ // Clear allowlist before each relevant test, especially for shouldConfirmExecute
58
+ const invocation = tool.build({ param: 'mock' });
59
+ invocation.constructor.allowlist.clear();
60
+ });
61
+ afterEach(() => {
62
+ vi.restoreAllMocks();
63
+ });
64
+ describe('constructor', () => {
65
+ it('should set properties correctly', () => {
66
+ expect(tool.name).toBe(serverToolName);
67
+ expect(tool.schema.name).toBe(serverToolName);
68
+ expect(tool.schema.description).toBe(baseDescription);
69
+ expect(tool.schema.parameters).toBeUndefined();
70
+ expect(tool.schema.parametersJsonSchema).toEqual(inputSchema);
71
+ expect(tool.serverToolName).toBe(serverToolName);
72
+ expect(tool.timeout).toBeUndefined();
73
+ });
74
+ it('should accept and store a custom timeout', () => {
75
+ const customTimeout = 5000;
76
+ const toolWithTimeout = new DiscoveredMCPTool(mockCallableToolInstance, serverName, serverToolName, baseDescription, inputSchema, customTimeout);
77
+ expect(toolWithTimeout.timeout).toBe(customTimeout);
78
+ });
79
+ });
80
+ describe('execute', () => {
81
+ it('should call mcpTool.callTool with correct parameters and format display output', async () => {
82
+ const params = { param: 'testValue' };
83
+ const mockToolSuccessResultObject = {
84
+ success: true,
85
+ details: 'executed',
86
+ };
87
+ const mockFunctionResponseContent = [
88
+ {
89
+ type: 'text',
90
+ text: JSON.stringify(mockToolSuccessResultObject),
91
+ },
92
+ ];
93
+ const mockMcpToolResponseParts = [
94
+ {
95
+ functionResponse: {
96
+ name: serverToolName,
97
+ response: { content: mockFunctionResponseContent },
98
+ },
99
+ },
100
+ ];
101
+ mockCallTool.mockResolvedValue(mockMcpToolResponseParts);
102
+ const invocation = tool.build(params);
103
+ const toolResult = await invocation.execute(new AbortController().signal);
104
+ expect(mockCallTool).toHaveBeenCalledWith([
105
+ { name: serverToolName, args: params },
106
+ ]);
107
+ const stringifiedResponseContent = JSON.stringify(mockToolSuccessResultObject);
108
+ expect(toolResult.llmContent).toEqual([
109
+ { text: stringifiedResponseContent },
110
+ ]);
111
+ expect(toolResult.returnDisplay).toBe(stringifiedResponseContent);
112
+ });
113
+ it('should handle empty result from getStringifiedResultForDisplay', async () => {
114
+ const params = { param: 'testValue' };
115
+ const mockMcpToolResponsePartsEmpty = [];
116
+ mockCallTool.mockResolvedValue(mockMcpToolResponsePartsEmpty);
117
+ const invocation = tool.build(params);
118
+ const toolResult = await invocation.execute(new AbortController().signal);
119
+ expect(toolResult.returnDisplay).toBe('```json\n[]\n```');
120
+ expect(toolResult.llmContent).toEqual([
121
+ { text: '[Error: Could not parse tool response]' },
122
+ ]);
123
+ });
124
+ it('should propagate rejection if mcpTool.callTool rejects', async () => {
125
+ const params = { param: 'failCase' };
126
+ const expectedError = new Error('MCP call failed');
127
+ mockCallTool.mockRejectedValue(expectedError);
128
+ const invocation = tool.build(params);
129
+ await expect(invocation.execute(new AbortController().signal)).rejects.toThrow(expectedError);
130
+ });
131
+ it.each([
132
+ { isErrorValue: true, description: 'true (bool)' },
133
+ { isErrorValue: 'true', description: '"true" (str)' },
134
+ ])('should return a structured error if MCP tool reports an error', async ({ isErrorValue }) => {
135
+ const tool = new DiscoveredMCPTool(mockCallableToolInstance, serverName, serverToolName, baseDescription, inputSchema);
136
+ const params = { param: 'isErrorTrueCase' };
137
+ const functionCall = {
138
+ name: serverToolName,
139
+ args: params,
140
+ };
141
+ const errorResponse = { isError: isErrorValue };
142
+ const mockMcpToolResponseParts = [
143
+ {
144
+ functionResponse: {
145
+ name: serverToolName,
146
+ response: { error: errorResponse },
147
+ },
148
+ },
149
+ ];
150
+ mockCallTool.mockResolvedValue(mockMcpToolResponseParts);
151
+ const expectedErrorMessage = `MCP tool '${serverToolName}' reported tool error for function call: ${safeJsonStringify(functionCall)} with response: ${safeJsonStringify(mockMcpToolResponseParts)}`;
152
+ const invocation = tool.build(params);
153
+ const result = await invocation.execute(new AbortController().signal);
154
+ expect(result.error?.type).toBe(ToolErrorType.MCP_TOOL_ERROR);
155
+ expect(result.llmContent).toBe(expectedErrorMessage);
156
+ expect(result.returnDisplay).toContain(`Error: MCP tool '${serverToolName}' reported an error.`);
157
+ });
158
+ it.each([
159
+ { isErrorValue: false, description: 'false (bool)' },
160
+ { isErrorValue: 'false', description: '"false" (str)' },
161
+ ])('should consider a ToolResult with isError ${description} to be a success', async ({ isErrorValue }) => {
162
+ const tool = new DiscoveredMCPTool(mockCallableToolInstance, serverName, serverToolName, baseDescription, inputSchema);
163
+ const params = { param: 'isErrorFalseCase' };
164
+ const mockToolSuccessResultObject = {
165
+ success: true,
166
+ details: 'executed',
167
+ };
168
+ const mockFunctionResponseContent = [
169
+ {
170
+ type: 'text',
171
+ text: JSON.stringify(mockToolSuccessResultObject),
172
+ },
173
+ ];
174
+ const errorResponse = { isError: isErrorValue };
175
+ const mockMcpToolResponseParts = [
176
+ {
177
+ functionResponse: {
178
+ name: serverToolName,
179
+ response: {
180
+ error: errorResponse,
181
+ content: mockFunctionResponseContent,
182
+ },
183
+ },
184
+ },
185
+ ];
186
+ mockCallTool.mockResolvedValue(mockMcpToolResponseParts);
187
+ const invocation = tool.build(params);
188
+ const toolResult = await invocation.execute(new AbortController().signal);
189
+ const stringifiedResponseContent = JSON.stringify(mockToolSuccessResultObject);
190
+ expect(toolResult.llmContent).toEqual([
191
+ { text: stringifiedResponseContent },
192
+ ]);
193
+ expect(toolResult.returnDisplay).toBe(stringifiedResponseContent);
194
+ });
195
+ it('should handle a simple text response correctly', async () => {
196
+ const params = { param: 'test' };
197
+ const successMessage = 'This is a success message.';
198
+ // Simulate the response from the GenAI SDK, which wraps the MCP
199
+ // response in a functionResponse Part.
200
+ const sdkResponse = [
201
+ {
202
+ functionResponse: {
203
+ name: serverToolName,
204
+ response: {
205
+ // The `content` array contains MCP ContentBlocks.
206
+ content: [{ type: 'text', text: successMessage }],
207
+ },
208
+ },
209
+ },
210
+ ];
211
+ mockCallTool.mockResolvedValue(sdkResponse);
212
+ const invocation = tool.build(params);
213
+ const toolResult = await invocation.execute(new AbortController().signal);
214
+ // 1. Assert that the llmContent sent to the scheduler is a clean Part array.
215
+ expect(toolResult.llmContent).toEqual([{ text: successMessage }]);
216
+ // 2. Assert that the display output is the simple text message.
217
+ expect(toolResult.returnDisplay).toBe(successMessage);
218
+ // 3. Verify that the underlying callTool was made correctly.
219
+ expect(mockCallTool).toHaveBeenCalledWith([
220
+ { name: serverToolName, args: params },
221
+ ]);
222
+ });
223
+ it('should handle an AudioBlock response', async () => {
224
+ const params = { param: 'play' };
225
+ const sdkResponse = [
226
+ {
227
+ functionResponse: {
228
+ name: serverToolName,
229
+ response: {
230
+ content: [
231
+ {
232
+ type: 'audio',
233
+ data: 'BASE64_AUDIO_DATA',
234
+ mimeType: 'audio/mp3',
235
+ },
236
+ ],
237
+ },
238
+ },
239
+ },
240
+ ];
241
+ mockCallTool.mockResolvedValue(sdkResponse);
242
+ const invocation = tool.build(params);
243
+ const toolResult = await invocation.execute(new AbortController().signal);
244
+ expect(toolResult.llmContent).toEqual([
245
+ {
246
+ text: `[Tool '${serverToolName}' provided the following audio data with mime-type: audio/mp3]`,
247
+ },
248
+ {
249
+ inlineData: {
250
+ mimeType: 'audio/mp3',
251
+ data: 'BASE64_AUDIO_DATA',
252
+ },
253
+ },
254
+ ]);
255
+ expect(toolResult.returnDisplay).toBe('[Audio: audio/mp3]');
256
+ });
257
+ it('should handle a ResourceLinkBlock response', async () => {
258
+ const params = { param: 'get' };
259
+ const sdkResponse = [
260
+ {
261
+ functionResponse: {
262
+ name: serverToolName,
263
+ response: {
264
+ content: [
265
+ {
266
+ type: 'resource_link',
267
+ uri: 'file:///path/to/thing',
268
+ name: 'resource-name',
269
+ title: 'My Resource',
270
+ },
271
+ ],
272
+ },
273
+ },
274
+ },
275
+ ];
276
+ mockCallTool.mockResolvedValue(sdkResponse);
277
+ const invocation = tool.build(params);
278
+ const toolResult = await invocation.execute(new AbortController().signal);
279
+ expect(toolResult.llmContent).toEqual([
280
+ {
281
+ text: 'Resource Link: My Resource at file:///path/to/thing',
282
+ },
283
+ ]);
284
+ expect(toolResult.returnDisplay).toBe('[Link to My Resource: file:///path/to/thing]');
285
+ });
286
+ it('should handle an embedded text ResourceBlock response', async () => {
287
+ const params = { param: 'get' };
288
+ const sdkResponse = [
289
+ {
290
+ functionResponse: {
291
+ name: serverToolName,
292
+ response: {
293
+ content: [
294
+ {
295
+ type: 'resource',
296
+ resource: {
297
+ uri: 'file:///path/to/text.txt',
298
+ text: 'This is the text content.',
299
+ mimeType: 'text/plain',
300
+ },
301
+ },
302
+ ],
303
+ },
304
+ },
305
+ },
306
+ ];
307
+ mockCallTool.mockResolvedValue(sdkResponse);
308
+ const invocation = tool.build(params);
309
+ const toolResult = await invocation.execute(new AbortController().signal);
310
+ expect(toolResult.llmContent).toEqual([
311
+ { text: 'This is the text content.' },
312
+ ]);
313
+ expect(toolResult.returnDisplay).toBe('This is the text content.');
314
+ });
315
+ it('should handle an embedded binary ResourceBlock response', async () => {
316
+ const params = { param: 'get' };
317
+ const sdkResponse = [
318
+ {
319
+ functionResponse: {
320
+ name: serverToolName,
321
+ response: {
322
+ content: [
323
+ {
324
+ type: 'resource',
325
+ resource: {
326
+ uri: 'file:///path/to/data.bin',
327
+ blob: 'BASE64_BINARY_DATA',
328
+ mimeType: 'application/octet-stream',
329
+ },
330
+ },
331
+ ],
332
+ },
333
+ },
334
+ },
335
+ ];
336
+ mockCallTool.mockResolvedValue(sdkResponse);
337
+ const invocation = tool.build(params);
338
+ const toolResult = await invocation.execute(new AbortController().signal);
339
+ expect(toolResult.llmContent).toEqual([
340
+ {
341
+ text: `[Tool '${serverToolName}' provided the following embedded resource with mime-type: application/octet-stream]`,
342
+ },
343
+ {
344
+ inlineData: {
345
+ mimeType: 'application/octet-stream',
346
+ data: 'BASE64_BINARY_DATA',
347
+ },
348
+ },
349
+ ]);
350
+ expect(toolResult.returnDisplay).toBe('[Embedded Resource: application/octet-stream]');
351
+ });
352
+ it('should handle a mix of content block types', async () => {
353
+ const params = { param: 'complex' };
354
+ const sdkResponse = [
355
+ {
356
+ functionResponse: {
357
+ name: serverToolName,
358
+ response: {
359
+ content: [
360
+ { type: 'text', text: 'First part.' },
361
+ {
362
+ type: 'image',
363
+ data: 'BASE64_IMAGE_DATA',
364
+ mimeType: 'image/jpeg',
365
+ },
366
+ { type: 'text', text: 'Second part.' },
367
+ ],
368
+ },
369
+ },
370
+ },
371
+ ];
372
+ mockCallTool.mockResolvedValue(sdkResponse);
373
+ const invocation = tool.build(params);
374
+ const toolResult = await invocation.execute(new AbortController().signal);
375
+ expect(toolResult.llmContent).toEqual([
376
+ { text: 'First part.' },
377
+ {
378
+ text: `[Tool '${serverToolName}' provided the following image data with mime-type: image/jpeg]`,
379
+ },
380
+ {
381
+ inlineData: {
382
+ mimeType: 'image/jpeg',
383
+ data: 'BASE64_IMAGE_DATA',
384
+ },
385
+ },
386
+ { text: 'Second part.' },
387
+ ]);
388
+ expect(toolResult.returnDisplay).toBe('First part.\n[Image: image/jpeg]\nSecond part.');
389
+ });
390
+ it('should ignore unknown content block types', async () => {
391
+ const params = { param: 'test' };
392
+ const sdkResponse = [
393
+ {
394
+ functionResponse: {
395
+ name: serverToolName,
396
+ response: {
397
+ content: [
398
+ { type: 'text', text: 'Valid part.' },
399
+ { type: 'future_block', data: 'some-data' },
400
+ ],
401
+ },
402
+ },
403
+ },
404
+ ];
405
+ mockCallTool.mockResolvedValue(sdkResponse);
406
+ const invocation = tool.build(params);
407
+ const toolResult = await invocation.execute(new AbortController().signal);
408
+ expect(toolResult.llmContent).toEqual([{ text: 'Valid part.' }]);
409
+ expect(toolResult.returnDisplay).toBe('Valid part.\n[Unknown content type: future_block]');
410
+ });
411
+ it('should handle a complex mix of content block types', async () => {
412
+ const params = { param: 'super-complex' };
413
+ const sdkResponse = [
414
+ {
415
+ functionResponse: {
416
+ name: serverToolName,
417
+ response: {
418
+ content: [
419
+ { type: 'text', text: 'Here is a resource.' },
420
+ {
421
+ type: 'resource_link',
422
+ uri: 'file:///path/to/resource',
423
+ name: 'resource-name',
424
+ title: 'My Resource',
425
+ },
426
+ {
427
+ type: 'resource',
428
+ resource: {
429
+ uri: 'file:///path/to/text.txt',
430
+ text: 'Embedded text content.',
431
+ mimeType: 'text/plain',
432
+ },
433
+ },
434
+ {
435
+ type: 'image',
436
+ data: 'BASE64_IMAGE_DATA',
437
+ mimeType: 'image/jpeg',
438
+ },
439
+ ],
440
+ },
441
+ },
442
+ },
443
+ ];
444
+ mockCallTool.mockResolvedValue(sdkResponse);
445
+ const invocation = tool.build(params);
446
+ const toolResult = await invocation.execute(new AbortController().signal);
447
+ expect(toolResult.llmContent).toEqual([
448
+ { text: 'Here is a resource.' },
449
+ {
450
+ text: 'Resource Link: My Resource at file:///path/to/resource',
451
+ },
452
+ { text: 'Embedded text content.' },
453
+ {
454
+ text: `[Tool '${serverToolName}' provided the following image data with mime-type: image/jpeg]`,
455
+ },
456
+ {
457
+ inlineData: {
458
+ mimeType: 'image/jpeg',
459
+ data: 'BASE64_IMAGE_DATA',
460
+ },
461
+ },
462
+ ]);
463
+ expect(toolResult.returnDisplay).toBe('Here is a resource.\n[Link to My Resource: file:///path/to/resource]\nEmbedded text content.\n[Image: image/jpeg]');
464
+ });
465
+ });
466
+ describe('shouldConfirmExecute', () => {
467
+ it('should return false if trust is true', async () => {
468
+ const trustedTool = new DiscoveredMCPTool(mockCallableToolInstance, serverName, serverToolName, baseDescription, inputSchema, undefined, true);
469
+ const invocation = trustedTool.build({ param: 'mock' });
470
+ expect(await invocation.shouldConfirmExecute(new AbortController().signal)).toBe(false);
471
+ });
472
+ it('should return false if server is allowlisted', async () => {
473
+ const invocation = tool.build({ param: 'mock' });
474
+ invocation.constructor.allowlist.add(serverName);
475
+ expect(await invocation.shouldConfirmExecute(new AbortController().signal)).toBe(false);
476
+ });
477
+ it('should return false if tool is allowlisted', async () => {
478
+ const toolAllowlistKey = `${serverName}.${serverToolName}`;
479
+ const invocation = tool.build({ param: 'mock' });
480
+ invocation.constructor.allowlist.add(toolAllowlistKey);
481
+ expect(await invocation.shouldConfirmExecute(new AbortController().signal)).toBe(false);
482
+ });
483
+ it('should return confirmation details if not trusted and not allowlisted', async () => {
484
+ const invocation = tool.build({ param: 'mock' });
485
+ const confirmation = await invocation.shouldConfirmExecute(new AbortController().signal);
486
+ expect(confirmation).not.toBe(false);
487
+ if (confirmation && confirmation.type === 'mcp') {
488
+ // Type guard for ToolMcpConfirmationDetails
489
+ expect(confirmation.type).toBe('mcp');
490
+ expect(confirmation.serverName).toBe(serverName);
491
+ expect(confirmation.toolName).toBe(serverToolName);
492
+ }
493
+ else if (confirmation) {
494
+ // Handle other possible confirmation types if necessary, or strengthen test if only MCP is expected
495
+ throw new Error('Confirmation was not of expected type MCP or was false');
496
+ }
497
+ else {
498
+ throw new Error('Confirmation details not in expected format or was false');
499
+ }
500
+ });
501
+ it('should add server to allowlist on ProceedAlwaysServer', async () => {
502
+ const invocation = tool.build({ param: 'mock' });
503
+ const confirmation = await invocation.shouldConfirmExecute(new AbortController().signal);
504
+ expect(confirmation).not.toBe(false);
505
+ if (confirmation &&
506
+ typeof confirmation === 'object' &&
507
+ 'onConfirm' in confirmation &&
508
+ typeof confirmation.onConfirm === 'function') {
509
+ await confirmation.onConfirm(ToolConfirmationOutcome.ProceedAlwaysServer);
510
+ expect(invocation.constructor.allowlist.has(serverName)).toBe(true);
511
+ }
512
+ else {
513
+ throw new Error('Confirmation details or onConfirm not in expected format');
514
+ }
515
+ });
516
+ it('should add tool to allowlist on ProceedAlwaysTool', async () => {
517
+ const toolAllowlistKey = `${serverName}.${serverToolName}`;
518
+ const invocation = tool.build({ param: 'mock' });
519
+ const confirmation = await invocation.shouldConfirmExecute(new AbortController().signal);
520
+ expect(confirmation).not.toBe(false);
521
+ if (confirmation &&
522
+ typeof confirmation === 'object' &&
523
+ 'onConfirm' in confirmation &&
524
+ typeof confirmation.onConfirm === 'function') {
525
+ await confirmation.onConfirm(ToolConfirmationOutcome.ProceedAlwaysTool);
526
+ expect(invocation.constructor.allowlist.has(toolAllowlistKey)).toBe(true);
527
+ }
528
+ else {
529
+ throw new Error('Confirmation details or onConfirm not in expected format');
530
+ }
531
+ });
532
+ it('should handle Cancel confirmation outcome', async () => {
533
+ const invocation = tool.build({ param: 'mock' });
534
+ const confirmation = await invocation.shouldConfirmExecute(new AbortController().signal);
535
+ expect(confirmation).not.toBe(false);
536
+ if (confirmation &&
537
+ typeof confirmation === 'object' &&
538
+ 'onConfirm' in confirmation &&
539
+ typeof confirmation.onConfirm === 'function') {
540
+ // Cancel should not add anything to allowlist
541
+ await confirmation.onConfirm(ToolConfirmationOutcome.Cancel);
542
+ expect(invocation.constructor.allowlist.has(serverName)).toBe(false);
543
+ expect(invocation.constructor.allowlist.has(`${serverName}.${serverToolName}`)).toBe(false);
544
+ }
545
+ else {
546
+ throw new Error('Confirmation details or onConfirm not in expected format');
547
+ }
548
+ });
549
+ it('should handle ProceedOnce confirmation outcome', async () => {
550
+ const invocation = tool.build({ param: 'mock' });
551
+ const confirmation = await invocation.shouldConfirmExecute(new AbortController().signal);
552
+ expect(confirmation).not.toBe(false);
553
+ if (confirmation &&
554
+ typeof confirmation === 'object' &&
555
+ 'onConfirm' in confirmation &&
556
+ typeof confirmation.onConfirm === 'function') {
557
+ // ProceedOnce should not add anything to allowlist
558
+ await confirmation.onConfirm(ToolConfirmationOutcome.ProceedOnce);
559
+ expect(invocation.constructor.allowlist.has(serverName)).toBe(false);
560
+ expect(invocation.constructor.allowlist.has(`${serverName}.${serverToolName}`)).toBe(false);
561
+ }
562
+ else {
563
+ throw new Error('Confirmation details or onConfirm not in expected format');
564
+ }
565
+ });
566
+ });
567
+ describe('DiscoveredMCPToolInvocation', () => {
568
+ it('should return the stringified params from getDescription', () => {
569
+ const params = { param: 'testValue', param2: 'anotherOne' };
570
+ const invocation = tool.build(params);
571
+ const description = invocation.getDescription();
572
+ expect(description).toBe('{"param":"testValue","param2":"anotherOne"}');
573
+ });
574
+ });
575
+ });
576
+ //# sourceMappingURL=mcp-tool.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-tool.test.js","sourceRoot":"","sources":["../../../src/tools/mcp-tool.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC,CAAC,uCAAuC;AAE7G,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC,CAAC,gCAAgC;AAEtF,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,gDAAgD;AAChD,8EAA8E;AAC9E,MAAM,YAAY,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;AAC7B,MAAM,cAAc,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;AAE/B,MAAM,wBAAwB,GAAyB;IACrD,IAAI,EAAE,cAAqB,EAAE,0DAA0D;IACvF,QAAQ,EAAE,YAAmB;IAC7B,2DAA2D;CAC5D,CAAC;AAEF,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE;QAC1D,MAAM,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,oDAAoD,EAAE,GAAG,EAAE;QAC5D,MAAM,CAAC,iBAAiB,CAAC,0BAA0B,CAAC,CAAC,CAAC,IAAI,CACxD,0BAA0B,CAC3B,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,EA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K,CAAC,CAAC;YAChB,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,KAAK,CACb,0DAA0D,CAC3D,CAAC;YACJ,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;QAC3C,EAAE,CAAC,0DAA0D,EAAE,GAAG,EAAE;YAClE,MAAM,MAAM,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC;YAC5D,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACtC,MAAM,WAAW,GAAG,UAAU,CAAC,cAAc,EAAE,CAAC;YAChD,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,6CAA6C,CAAC,CAAC;QAC1E,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { ToolEditConfirmationDetails, ToolResult } from './tools.js';
7
+ import { BaseDeclarativeTool, BaseToolInvocation } from './tools.js';
8
+ import type { ModifiableDeclarativeTool, ModifyContext } from './modifiable-tool.js';
9
+ export declare const GEMINI_CONFIG_DIR = ".gemini";
10
+ export declare const DEFAULT_CONTEXT_FILENAME = "GEMINI.md";
11
+ export declare const MEMORY_SECTION_HEADER = "## Gemini Added Memories";
12
+ export declare function setGeminiMdFilename(newFilename: string | string[]): void;
13
+ export declare function getCurrentGeminiMdFilename(): string;
14
+ export declare function getAllGeminiMdFilenames(): string[];
15
+ interface SaveMemoryParams {
16
+ fact: string;
17
+ modified_by_user?: boolean;
18
+ modified_content?: string;
19
+ }
20
+ declare class MemoryToolInvocation extends BaseToolInvocation<SaveMemoryParams, ToolResult> {
21
+ private static readonly allowlist;
22
+ getDescription(): string;
23
+ shouldConfirmExecute(_abortSignal: AbortSignal): Promise<ToolEditConfirmationDetails | false>;
24
+ execute(_signal: AbortSignal): Promise<ToolResult>;
25
+ }
26
+ export declare class MemoryTool extends BaseDeclarativeTool<SaveMemoryParams, ToolResult> implements ModifiableDeclarativeTool<SaveMemoryParams> {
27
+ static readonly Name: string;
28
+ constructor();
29
+ protected validateToolParamValues(params: SaveMemoryParams): string | null;
30
+ protected createInvocation(params: SaveMemoryParams): MemoryToolInvocation;
31
+ static performAddMemoryEntry(text: string, memoryFilePath: string, fsAdapter: {
32
+ readFile: (path: string, encoding: 'utf-8') => Promise<string>;
33
+ writeFile: (path: string, data: string, encoding: 'utf-8') => Promise<void>;
34
+ mkdir: (path: string, options: {
35
+ recursive: boolean;
36
+ }) => Promise<string | undefined>;
37
+ }): Promise<void>;
38
+ getModifyContext(_abortSignal: AbortSignal): ModifyContext<SaveMemoryParams>;
39
+ }
40
+ export {};