@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,501 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /* eslint-disable @typescript-eslint/no-explicit-any */
7
+ import { describe, it, expect, vi, beforeEach, afterEach, } from 'vitest';
8
+ import { DiscoveredMCPTool, generateValidName } from './mcp-tool.js'; // Added getStringifiedResultForDisplay
9
+ import { ToolConfirmationOutcome } from './tools.js'; // Added ToolConfirmationOutcome
10
+ // Mock @google/genai mcpToTool and CallableTool
11
+ // We only need to mock the parts of CallableTool that DiscoveredMCPTool uses.
12
+ const mockCallTool = vi.fn();
13
+ const mockToolMethod = vi.fn();
14
+ const mockCallableToolInstance = {
15
+ tool: mockToolMethod, // Not directly used by DiscoveredMCPTool instance methods
16
+ callTool: mockCallTool,
17
+ // Add other methods if DiscoveredMCPTool starts using them
18
+ };
19
+ describe('generateValidName', () => {
20
+ it('should return a valid name for a simple function', () => {
21
+ expect(generateValidName('myFunction')).toBe('myFunction');
22
+ });
23
+ it('should replace invalid characters with underscores', () => {
24
+ expect(generateValidName('invalid-name with spaces')).toBe('invalid-name_with_spaces');
25
+ });
26
+ it('should truncate long names', () => {
27
+ expect(generateValidName('x'.repeat(80))).toBe('xxxxxxxxxxxxxxxxxxxxxxxxxxxx___xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
28
+ });
29
+ it('should handle names with only invalid characters', () => {
30
+ expect(generateValidName('!@#$%^&*()')).toBe('__________');
31
+ });
32
+ it('should handle names that are exactly 63 characters long', () => {
33
+ expect(generateValidName('a'.repeat(63)).length).toBe(63);
34
+ });
35
+ it('should handle names that are exactly 64 characters long', () => {
36
+ expect(generateValidName('a'.repeat(64)).length).toBe(63);
37
+ });
38
+ it('should handle names that are longer than 64 characters', () => {
39
+ expect(generateValidName('a'.repeat(80)).length).toBe(63);
40
+ });
41
+ });
42
+ describe('DiscoveredMCPTool', () => {
43
+ const serverName = 'mock-mcp-server';
44
+ const serverToolName = 'actual-server-tool-name';
45
+ const baseDescription = 'A test MCP tool.';
46
+ const inputSchema = {
47
+ type: 'object',
48
+ properties: { param: { type: 'string' } },
49
+ required: ['param'],
50
+ };
51
+ beforeEach(() => {
52
+ mockCallTool.mockClear();
53
+ mockToolMethod.mockClear();
54
+ // Clear allowlist before each relevant test, especially for shouldConfirmExecute
55
+ DiscoveredMCPTool.allowlist.clear();
56
+ });
57
+ afterEach(() => {
58
+ vi.restoreAllMocks();
59
+ });
60
+ describe('constructor', () => {
61
+ it('should set properties correctly', () => {
62
+ const tool = new DiscoveredMCPTool(mockCallableToolInstance, serverName, serverToolName, baseDescription, inputSchema);
63
+ expect(tool.name).toBe(serverToolName);
64
+ expect(tool.schema.name).toBe(serverToolName);
65
+ expect(tool.schema.description).toBe(baseDescription);
66
+ expect(tool.schema.parameters).toBeUndefined();
67
+ expect(tool.schema.parametersJsonSchema).toEqual(inputSchema);
68
+ expect(tool.serverToolName).toBe(serverToolName);
69
+ expect(tool.timeout).toBeUndefined();
70
+ });
71
+ it('should accept and store a custom timeout', () => {
72
+ const customTimeout = 5000;
73
+ const tool = new DiscoveredMCPTool(mockCallableToolInstance, serverName, serverToolName, baseDescription, inputSchema, customTimeout);
74
+ expect(tool.timeout).toBe(customTimeout);
75
+ });
76
+ });
77
+ describe('execute', () => {
78
+ it('should call mcpTool.callTool with correct parameters and format display output', async () => {
79
+ const tool = new DiscoveredMCPTool(mockCallableToolInstance, serverName, serverToolName, baseDescription, inputSchema);
80
+ const params = { param: 'testValue' };
81
+ const mockToolSuccessResultObject = {
82
+ success: true,
83
+ details: 'executed',
84
+ };
85
+ const mockFunctionResponseContent = [
86
+ {
87
+ type: 'text',
88
+ text: JSON.stringify(mockToolSuccessResultObject),
89
+ },
90
+ ];
91
+ const mockMcpToolResponseParts = [
92
+ {
93
+ functionResponse: {
94
+ name: serverToolName,
95
+ response: { content: mockFunctionResponseContent },
96
+ },
97
+ },
98
+ ];
99
+ mockCallTool.mockResolvedValue(mockMcpToolResponseParts);
100
+ const toolResult = await tool.execute(params);
101
+ expect(mockCallTool).toHaveBeenCalledWith([
102
+ { name: serverToolName, args: params },
103
+ ]);
104
+ const stringifiedResponseContent = JSON.stringify(mockToolSuccessResultObject);
105
+ expect(toolResult.llmContent).toEqual([
106
+ { text: stringifiedResponseContent },
107
+ ]);
108
+ expect(toolResult.returnDisplay).toBe(stringifiedResponseContent);
109
+ });
110
+ it('should handle empty result from getStringifiedResultForDisplay', async () => {
111
+ const tool = new DiscoveredMCPTool(mockCallableToolInstance, serverName, serverToolName, baseDescription, inputSchema);
112
+ const params = { param: 'testValue' };
113
+ const mockMcpToolResponsePartsEmpty = [];
114
+ mockCallTool.mockResolvedValue(mockMcpToolResponsePartsEmpty);
115
+ const toolResult = await tool.execute(params);
116
+ expect(toolResult.returnDisplay).toBe('```json\n[]\n```');
117
+ expect(toolResult.llmContent).toEqual([
118
+ { text: '[Error: Could not parse tool response]' },
119
+ ]);
120
+ });
121
+ it('should propagate rejection if mcpTool.callTool rejects', async () => {
122
+ const tool = new DiscoveredMCPTool(mockCallableToolInstance, serverName, serverToolName, baseDescription, inputSchema);
123
+ const params = { param: 'failCase' };
124
+ const expectedError = new Error('MCP call failed');
125
+ mockCallTool.mockRejectedValue(expectedError);
126
+ await expect(tool.execute(params)).rejects.toThrow(expectedError);
127
+ });
128
+ it('should handle a simple text response correctly', async () => {
129
+ const tool = new DiscoveredMCPTool(mockCallableToolInstance, serverName, serverToolName, baseDescription, inputSchema);
130
+ const params = { query: 'test' };
131
+ const successMessage = 'This is a success message.';
132
+ // Simulate the response from the GenAI SDK, which wraps the MCP
133
+ // response in a functionResponse Part.
134
+ const sdkResponse = [
135
+ {
136
+ functionResponse: {
137
+ name: serverToolName,
138
+ response: {
139
+ // The `content` array contains MCP ContentBlocks.
140
+ content: [{ type: 'text', text: successMessage }],
141
+ },
142
+ },
143
+ },
144
+ ];
145
+ mockCallTool.mockResolvedValue(sdkResponse);
146
+ const toolResult = await tool.execute(params);
147
+ // 1. Assert that the llmContent sent to the scheduler is a clean Part array.
148
+ expect(toolResult.llmContent).toEqual([{ text: successMessage }]);
149
+ // 2. Assert that the display output is the simple text message.
150
+ expect(toolResult.returnDisplay).toBe(successMessage);
151
+ // 3. Verify that the underlying callTool was made correctly.
152
+ expect(mockCallTool).toHaveBeenCalledWith([
153
+ { name: serverToolName, args: params },
154
+ ]);
155
+ });
156
+ it('should handle an AudioBlock response', async () => {
157
+ const tool = new DiscoveredMCPTool(mockCallableToolInstance, serverName, serverToolName, baseDescription, inputSchema);
158
+ const params = { action: 'play' };
159
+ const sdkResponse = [
160
+ {
161
+ functionResponse: {
162
+ name: serverToolName,
163
+ response: {
164
+ content: [
165
+ {
166
+ type: 'audio',
167
+ data: 'BASE64_AUDIO_DATA',
168
+ mimeType: 'audio/mp3',
169
+ },
170
+ ],
171
+ },
172
+ },
173
+ },
174
+ ];
175
+ mockCallTool.mockResolvedValue(sdkResponse);
176
+ const toolResult = await tool.execute(params);
177
+ expect(toolResult.llmContent).toEqual([
178
+ {
179
+ text: `[Tool '${serverToolName}' provided the following audio data with mime-type: audio/mp3]`,
180
+ },
181
+ {
182
+ inlineData: {
183
+ mimeType: 'audio/mp3',
184
+ data: 'BASE64_AUDIO_DATA',
185
+ },
186
+ },
187
+ ]);
188
+ expect(toolResult.returnDisplay).toBe('[Audio: audio/mp3]');
189
+ });
190
+ it('should handle a ResourceLinkBlock response', async () => {
191
+ const tool = new DiscoveredMCPTool(mockCallableToolInstance, serverName, serverToolName, baseDescription, inputSchema);
192
+ const params = { resource: 'get' };
193
+ const sdkResponse = [
194
+ {
195
+ functionResponse: {
196
+ name: serverToolName,
197
+ response: {
198
+ content: [
199
+ {
200
+ type: 'resource_link',
201
+ uri: 'file:///path/to/thing',
202
+ name: 'resource-name',
203
+ title: 'My Resource',
204
+ },
205
+ ],
206
+ },
207
+ },
208
+ },
209
+ ];
210
+ mockCallTool.mockResolvedValue(sdkResponse);
211
+ const toolResult = await tool.execute(params);
212
+ expect(toolResult.llmContent).toEqual([
213
+ {
214
+ text: 'Resource Link: My Resource at file:///path/to/thing',
215
+ },
216
+ ]);
217
+ expect(toolResult.returnDisplay).toBe('[Link to My Resource: file:///path/to/thing]');
218
+ });
219
+ it('should handle an embedded text ResourceBlock response', async () => {
220
+ const tool = new DiscoveredMCPTool(mockCallableToolInstance, serverName, serverToolName, baseDescription, inputSchema);
221
+ const params = { resource: 'get' };
222
+ const sdkResponse = [
223
+ {
224
+ functionResponse: {
225
+ name: serverToolName,
226
+ response: {
227
+ content: [
228
+ {
229
+ type: 'resource',
230
+ resource: {
231
+ uri: 'file:///path/to/text.txt',
232
+ text: 'This is the text content.',
233
+ mimeType: 'text/plain',
234
+ },
235
+ },
236
+ ],
237
+ },
238
+ },
239
+ },
240
+ ];
241
+ mockCallTool.mockResolvedValue(sdkResponse);
242
+ const toolResult = await tool.execute(params);
243
+ expect(toolResult.llmContent).toEqual([
244
+ { text: 'This is the text content.' },
245
+ ]);
246
+ expect(toolResult.returnDisplay).toBe('This is the text content.');
247
+ });
248
+ it('should handle an embedded binary ResourceBlock response', async () => {
249
+ const tool = new DiscoveredMCPTool(mockCallableToolInstance, serverName, serverToolName, baseDescription, inputSchema);
250
+ const params = { resource: 'get' };
251
+ const sdkResponse = [
252
+ {
253
+ functionResponse: {
254
+ name: serverToolName,
255
+ response: {
256
+ content: [
257
+ {
258
+ type: 'resource',
259
+ resource: {
260
+ uri: 'file:///path/to/data.bin',
261
+ blob: 'BASE64_BINARY_DATA',
262
+ mimeType: 'application/octet-stream',
263
+ },
264
+ },
265
+ ],
266
+ },
267
+ },
268
+ },
269
+ ];
270
+ mockCallTool.mockResolvedValue(sdkResponse);
271
+ const toolResult = await tool.execute(params);
272
+ expect(toolResult.llmContent).toEqual([
273
+ {
274
+ text: `[Tool '${serverToolName}' provided the following embedded resource with mime-type: application/octet-stream]`,
275
+ },
276
+ {
277
+ inlineData: {
278
+ mimeType: 'application/octet-stream',
279
+ data: 'BASE64_BINARY_DATA',
280
+ },
281
+ },
282
+ ]);
283
+ expect(toolResult.returnDisplay).toBe('[Embedded Resource: application/octet-stream]');
284
+ });
285
+ it('should handle a mix of content block types', async () => {
286
+ const tool = new DiscoveredMCPTool(mockCallableToolInstance, serverName, serverToolName, baseDescription, inputSchema);
287
+ const params = { action: 'complex' };
288
+ const sdkResponse = [
289
+ {
290
+ functionResponse: {
291
+ name: serverToolName,
292
+ response: {
293
+ content: [
294
+ { type: 'text', text: 'First part.' },
295
+ {
296
+ type: 'image',
297
+ data: 'BASE64_IMAGE_DATA',
298
+ mimeType: 'image/jpeg',
299
+ },
300
+ { type: 'text', text: 'Second part.' },
301
+ ],
302
+ },
303
+ },
304
+ },
305
+ ];
306
+ mockCallTool.mockResolvedValue(sdkResponse);
307
+ const toolResult = await tool.execute(params);
308
+ expect(toolResult.llmContent).toEqual([
309
+ { text: 'First part.' },
310
+ {
311
+ text: `[Tool '${serverToolName}' provided the following image data with mime-type: image/jpeg]`,
312
+ },
313
+ {
314
+ inlineData: {
315
+ mimeType: 'image/jpeg',
316
+ data: 'BASE64_IMAGE_DATA',
317
+ },
318
+ },
319
+ { text: 'Second part.' },
320
+ ]);
321
+ expect(toolResult.returnDisplay).toBe('First part.\n[Image: image/jpeg]\nSecond part.');
322
+ });
323
+ it('should ignore unknown content block types', async () => {
324
+ const tool = new DiscoveredMCPTool(mockCallableToolInstance, serverName, serverToolName, baseDescription, inputSchema);
325
+ const params = { action: 'test' };
326
+ const sdkResponse = [
327
+ {
328
+ functionResponse: {
329
+ name: serverToolName,
330
+ response: {
331
+ content: [
332
+ { type: 'text', text: 'Valid part.' },
333
+ { type: 'future_block', data: 'some-data' },
334
+ ],
335
+ },
336
+ },
337
+ },
338
+ ];
339
+ mockCallTool.mockResolvedValue(sdkResponse);
340
+ const toolResult = await tool.execute(params);
341
+ expect(toolResult.llmContent).toEqual([{ text: 'Valid part.' }]);
342
+ expect(toolResult.returnDisplay).toBe('Valid part.\n[Unknown content type: future_block]');
343
+ });
344
+ it('should handle a complex mix of content block types', async () => {
345
+ const tool = new DiscoveredMCPTool(mockCallableToolInstance, serverName, serverToolName, baseDescription, inputSchema);
346
+ const params = { action: 'super-complex' };
347
+ const sdkResponse = [
348
+ {
349
+ functionResponse: {
350
+ name: serverToolName,
351
+ response: {
352
+ content: [
353
+ { type: 'text', text: 'Here is a resource.' },
354
+ {
355
+ type: 'resource_link',
356
+ uri: 'file:///path/to/resource',
357
+ name: 'resource-name',
358
+ title: 'My Resource',
359
+ },
360
+ {
361
+ type: 'resource',
362
+ resource: {
363
+ uri: 'file:///path/to/text.txt',
364
+ text: 'Embedded text content.',
365
+ mimeType: 'text/plain',
366
+ },
367
+ },
368
+ {
369
+ type: 'image',
370
+ data: 'BASE64_IMAGE_DATA',
371
+ mimeType: 'image/jpeg',
372
+ },
373
+ ],
374
+ },
375
+ },
376
+ },
377
+ ];
378
+ mockCallTool.mockResolvedValue(sdkResponse);
379
+ const toolResult = await tool.execute(params);
380
+ expect(toolResult.llmContent).toEqual([
381
+ { text: 'Here is a resource.' },
382
+ {
383
+ text: 'Resource Link: My Resource at file:///path/to/resource',
384
+ },
385
+ { text: 'Embedded text content.' },
386
+ {
387
+ text: `[Tool '${serverToolName}' provided the following image data with mime-type: image/jpeg]`,
388
+ },
389
+ {
390
+ inlineData: {
391
+ mimeType: 'image/jpeg',
392
+ data: 'BASE64_IMAGE_DATA',
393
+ },
394
+ },
395
+ ]);
396
+ expect(toolResult.returnDisplay).toBe('Here is a resource.\n[Link to My Resource: file:///path/to/resource]\nEmbedded text content.\n[Image: image/jpeg]');
397
+ });
398
+ });
399
+ describe('shouldConfirmExecute', () => {
400
+ // beforeEach is already clearing allowlist
401
+ it('should return false if trust is true', async () => {
402
+ const tool = new DiscoveredMCPTool(mockCallableToolInstance, serverName, serverToolName, baseDescription, inputSchema, undefined, true);
403
+ expect(await tool.shouldConfirmExecute({}, new AbortController().signal)).toBe(false);
404
+ });
405
+ it('should return false if server is allowlisted', async () => {
406
+ DiscoveredMCPTool.allowlist.add(serverName);
407
+ const tool = new DiscoveredMCPTool(mockCallableToolInstance, serverName, serverToolName, baseDescription, inputSchema);
408
+ expect(await tool.shouldConfirmExecute({}, new AbortController().signal)).toBe(false);
409
+ });
410
+ it('should return false if tool is allowlisted', async () => {
411
+ const toolAllowlistKey = `${serverName}.${serverToolName}`;
412
+ DiscoveredMCPTool.allowlist.add(toolAllowlistKey);
413
+ const tool = new DiscoveredMCPTool(mockCallableToolInstance, serverName, serverToolName, baseDescription, inputSchema);
414
+ expect(await tool.shouldConfirmExecute({}, new AbortController().signal)).toBe(false);
415
+ });
416
+ it('should return confirmation details if not trusted and not allowlisted', async () => {
417
+ const tool = new DiscoveredMCPTool(mockCallableToolInstance, serverName, serverToolName, baseDescription, inputSchema);
418
+ const confirmation = await tool.shouldConfirmExecute({}, new AbortController().signal);
419
+ expect(confirmation).not.toBe(false);
420
+ if (confirmation && confirmation.type === 'mcp') {
421
+ // Type guard for ToolMcpConfirmationDetails
422
+ expect(confirmation.type).toBe('mcp');
423
+ expect(confirmation.serverName).toBe(serverName);
424
+ expect(confirmation.toolName).toBe(serverToolName);
425
+ }
426
+ else if (confirmation) {
427
+ // Handle other possible confirmation types if necessary, or strengthen test if only MCP is expected
428
+ throw new Error('Confirmation was not of expected type MCP or was false');
429
+ }
430
+ else {
431
+ throw new Error('Confirmation details not in expected format or was false');
432
+ }
433
+ });
434
+ it('should add server to allowlist on ProceedAlwaysServer', async () => {
435
+ const tool = new DiscoveredMCPTool(mockCallableToolInstance, serverName, serverToolName, baseDescription, inputSchema);
436
+ const confirmation = await tool.shouldConfirmExecute({}, new AbortController().signal);
437
+ expect(confirmation).not.toBe(false);
438
+ if (confirmation &&
439
+ typeof confirmation === 'object' &&
440
+ 'onConfirm' in confirmation &&
441
+ typeof confirmation.onConfirm === 'function') {
442
+ await confirmation.onConfirm(ToolConfirmationOutcome.ProceedAlwaysServer);
443
+ expect(DiscoveredMCPTool.allowlist.has(serverName)).toBe(true);
444
+ }
445
+ else {
446
+ throw new Error('Confirmation details or onConfirm not in expected format');
447
+ }
448
+ });
449
+ it('should add tool to allowlist on ProceedAlwaysTool', async () => {
450
+ const tool = new DiscoveredMCPTool(mockCallableToolInstance, serverName, serverToolName, baseDescription, inputSchema);
451
+ const toolAllowlistKey = `${serverName}.${serverToolName}`;
452
+ const confirmation = await tool.shouldConfirmExecute({}, new AbortController().signal);
453
+ expect(confirmation).not.toBe(false);
454
+ if (confirmation &&
455
+ typeof confirmation === 'object' &&
456
+ 'onConfirm' in confirmation &&
457
+ typeof confirmation.onConfirm === 'function') {
458
+ await confirmation.onConfirm(ToolConfirmationOutcome.ProceedAlwaysTool);
459
+ expect(DiscoveredMCPTool.allowlist.has(toolAllowlistKey)).toBe(true);
460
+ }
461
+ else {
462
+ throw new Error('Confirmation details or onConfirm not in expected format');
463
+ }
464
+ });
465
+ it('should handle Cancel confirmation outcome', async () => {
466
+ const tool = new DiscoveredMCPTool(mockCallableToolInstance, serverName, serverToolName, baseDescription, inputSchema);
467
+ const confirmation = await tool.shouldConfirmExecute({}, new AbortController().signal);
468
+ expect(confirmation).not.toBe(false);
469
+ if (confirmation &&
470
+ typeof confirmation === 'object' &&
471
+ 'onConfirm' in confirmation &&
472
+ typeof confirmation.onConfirm === 'function') {
473
+ // Cancel should not add anything to allowlist
474
+ await confirmation.onConfirm(ToolConfirmationOutcome.Cancel);
475
+ expect(DiscoveredMCPTool.allowlist.has(serverName)).toBe(false);
476
+ expect(DiscoveredMCPTool.allowlist.has(`${serverName}.${serverToolName}`)).toBe(false);
477
+ }
478
+ else {
479
+ throw new Error('Confirmation details or onConfirm not in expected format');
480
+ }
481
+ });
482
+ it('should handle ProceedOnce confirmation outcome', async () => {
483
+ const tool = new DiscoveredMCPTool(mockCallableToolInstance, serverName, serverToolName, baseDescription, inputSchema);
484
+ const confirmation = await tool.shouldConfirmExecute({}, new AbortController().signal);
485
+ expect(confirmation).not.toBe(false);
486
+ if (confirmation &&
487
+ typeof confirmation === 'object' &&
488
+ 'onConfirm' in confirmation &&
489
+ typeof confirmation.onConfirm === 'function') {
490
+ // ProceedOnce should not add anything to allowlist
491
+ await confirmation.onConfirm(ToolConfirmationOutcome.ProceedOnce);
492
+ expect(DiscoveredMCPTool.allowlist.has(serverName)).toBe(false);
493
+ expect(DiscoveredMCPTool.allowlist.has(`${serverName}.${serverToolName}`)).toBe(false);
494
+ }
495
+ else {
496
+ throw new Error('Confirmation details or onConfirm not in expected format');
497
+ }
498
+ });
499
+ });
500
+ });
501
+ //# 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;AAEH,uDAAuD;AACvD,OAAO,EACL,QAAQ,EACR,EAAE,EACF,MAAM,EACN,EAAE,EACF,UAAU,EACV,SAAS,GAEV,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC,CAAC,uCAAuC;AAC7G,OAAO,EAAc,uBAAuB,EAAE,MAAM,YAAY,CAAC,CAAC,gCAAgC;AAGlG,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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AG,CACtC,GAAG,UAAU,IAAI,cAAc,EAAE,CAClC,CACF,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAChB,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,KAAK,CACb,0DAA0D,CAC3D,CAAC;YACJ,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { BaseTool, ToolResult, ToolEditConfirmationDetails } from './tools.js';
7
+ import { ModifiableDeclarativeTool, ModifyContext } from './modifiable-tool.js';
8
+ export declare const GEMINI_CONFIG_DIR = ".gemini";
9
+ export declare const DEFAULT_CONTEXT_FILENAME = "GEMINI.md";
10
+ export declare const MEMORY_SECTION_HEADER = "## Gemini Added Memories";
11
+ export declare function setGeminiMdFilename(newFilename: string | string[]): void;
12
+ export declare function getCurrentGeminiMdFilename(): string;
13
+ export declare function getAllGeminiMdFilenames(): string[];
14
+ interface SaveMemoryParams {
15
+ fact: string;
16
+ modified_by_user?: boolean;
17
+ modified_content?: string;
18
+ }
19
+ export declare class MemoryTool extends BaseTool<SaveMemoryParams, ToolResult> implements ModifiableDeclarativeTool<SaveMemoryParams> {
20
+ private static readonly allowlist;
21
+ static readonly Name: string;
22
+ constructor();
23
+ getDescription(_params: SaveMemoryParams): string;
24
+ /**
25
+ * Reads the current content of the memory file
26
+ */
27
+ private readMemoryFileContent;
28
+ /**
29
+ * Computes the new content that would result from adding a memory entry
30
+ */
31
+ private computeNewContent;
32
+ shouldConfirmExecute(params: SaveMemoryParams, _abortSignal: AbortSignal): Promise<ToolEditConfirmationDetails | false>;
33
+ static performAddMemoryEntry(text: string, memoryFilePath: string, fsAdapter: {
34
+ readFile: (path: string, encoding: 'utf-8') => Promise<string>;
35
+ writeFile: (path: string, data: string, encoding: 'utf-8') => Promise<void>;
36
+ mkdir: (path: string, options: {
37
+ recursive: boolean;
38
+ }) => Promise<string | undefined>;
39
+ }): Promise<void>;
40
+ execute(params: SaveMemoryParams, _signal: AbortSignal): Promise<ToolResult>;
41
+ getModifyContext(_abortSignal: AbortSignal): ModifyContext<SaveMemoryParams>;
42
+ }
43
+ export {};