@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,118 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { GenerateContentResponse, Content, GenerateContentConfig, SendMessageParameters, Tool } from '@google/genai';
7
+ import { ContentGenerator } from './contentGenerator.js';
8
+ import { Config } from '../config/config.js';
9
+ import { StructuredError } from './turn.js';
10
+ /**
11
+ * Chat session that enables sending messages to the model with previous
12
+ * conversation context.
13
+ *
14
+ * @remarks
15
+ * The session maintains all the turns between user and model.
16
+ */
17
+ export declare class GeminiChat {
18
+ private readonly config;
19
+ private readonly contentGenerator;
20
+ private readonly generationConfig;
21
+ private history;
22
+ private sendPromise;
23
+ constructor(config: Config, contentGenerator: ContentGenerator, generationConfig?: GenerateContentConfig, history?: Content[]);
24
+ /**
25
+ * Handles falling back to Flash model when persistent 429 errors occur for OAuth users.
26
+ * Uses a fallback handler if provided by the config; otherwise, returns null.
27
+ */
28
+ private handleFlashFallback;
29
+ setSystemInstruction(sysInstr: string): void;
30
+ /**
31
+ * Sends a message to the model and returns the response.
32
+ *
33
+ * @remarks
34
+ * This method will wait for the previous message to be processed before
35
+ * sending the next message.
36
+ *
37
+ * @see {@link Chat#sendMessageStream} for streaming method.
38
+ * @param params - parameters for sending messages within a chat session.
39
+ * @returns The model's response.
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * const chat = ai.chats.create({model: 'gemini-2.0-flash'});
44
+ * const response = await chat.sendMessage({
45
+ * message: 'Why is the sky blue?'
46
+ * });
47
+ * console.log(response.text);
48
+ * ```
49
+ */
50
+ sendMessage(params: SendMessageParameters, prompt_id: string): Promise<GenerateContentResponse>;
51
+ /**
52
+ * Sends a message to the model and returns the response in chunks.
53
+ *
54
+ * @remarks
55
+ * This method will wait for the previous message to be processed before
56
+ * sending the next message.
57
+ *
58
+ * @see {@link Chat#sendMessage} for non-streaming method.
59
+ * @param params - parameters for sending the message.
60
+ * @return The model's response.
61
+ *
62
+ * @example
63
+ * ```ts
64
+ * const chat = ai.chats.create({model: 'gemini-2.0-flash'});
65
+ * const response = await chat.sendMessageStream({
66
+ * message: 'Why is the sky blue?'
67
+ * });
68
+ * for await (const chunk of response) {
69
+ * console.log(chunk.text);
70
+ * }
71
+ * ```
72
+ */
73
+ sendMessageStream(params: SendMessageParameters, prompt_id: string): Promise<AsyncGenerator<GenerateContentResponse>>;
74
+ /**
75
+ * Returns the chat history.
76
+ *
77
+ * @remarks
78
+ * The history is a list of contents alternating between user and model.
79
+ *
80
+ * There are two types of history:
81
+ * - The `curated history` contains only the valid turns between user and
82
+ * model, which will be included in the subsequent requests sent to the model.
83
+ * - The `comprehensive history` contains all turns, including invalid or
84
+ * empty model outputs, providing a complete record of the history.
85
+ *
86
+ * The history is updated after receiving the response from the model,
87
+ * for streaming response, it means receiving the last chunk of the response.
88
+ *
89
+ * The `comprehensive history` is returned by default. To get the `curated
90
+ * history`, set the `curated` parameter to `true`.
91
+ *
92
+ * @param curated - whether to return the curated history or the comprehensive
93
+ * history.
94
+ * @return History contents alternating between user and model for the entire
95
+ * chat session.
96
+ */
97
+ getHistory(curated?: boolean): Content[];
98
+ /**
99
+ * Clears the chat history.
100
+ */
101
+ clearHistory(): void;
102
+ /**
103
+ * Adds a new entry to the chat history.
104
+ *
105
+ * @param content - The content to add to the history.
106
+ */
107
+ addHistory(content: Content): void;
108
+ setHistory(history: Content[]): void;
109
+ setTools(tools: Tool[]): void;
110
+ maybeIncludeSchemaDepthContext(error: StructuredError): Promise<void>;
111
+ private processStreamResponse;
112
+ private recordHistory;
113
+ private isTextContent;
114
+ private isThoughtContent;
115
+ }
116
+ /** Visible for Testing */
117
+ export declare function isSchemaDepthError(errorMessage: string): boolean;
118
+ export declare function isInvalidArgumentError(errorMessage: string): boolean;
@@ -0,0 +1,509 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ // DISCLAIMER: This is a copied version of https://github.com/googleapis/js-genai/blob/main/src/chats.ts with the intention of working around a key bug
7
+ // where function responses are not treated as "valid" responses: https://b.corp.google.com/issues/420354090
8
+ import { createUserContent, } from '@google/genai';
9
+ import { retryWithBackoff } from '../utils/retry.js';
10
+ import { isFunctionResponse } from '../utils/messageInspectors.js';
11
+ import { AuthType } from './contentGenerator.js';
12
+ import { DEFAULT_GEMINI_FLASH_MODEL } from '../config/models.js';
13
+ import { hasCycleInSchema } from '../tools/tools.js';
14
+ /**
15
+ * Returns true if the response is valid, false otherwise.
16
+ */
17
+ function isValidResponse(response) {
18
+ if (response.candidates === undefined || response.candidates.length === 0) {
19
+ return false;
20
+ }
21
+ const content = response.candidates[0]?.content;
22
+ if (content === undefined) {
23
+ return false;
24
+ }
25
+ return isValidContent(content);
26
+ }
27
+ function isValidContent(content) {
28
+ if (content.parts === undefined || content.parts.length === 0) {
29
+ return false;
30
+ }
31
+ for (const part of content.parts) {
32
+ if (part === undefined || Object.keys(part).length === 0) {
33
+ return false;
34
+ }
35
+ if (!part.thought && part.text !== undefined && part.text === '') {
36
+ return false;
37
+ }
38
+ }
39
+ return true;
40
+ }
41
+ /**
42
+ * Validates the history contains the correct roles.
43
+ *
44
+ * @throws Error if the history does not start with a user turn.
45
+ * @throws Error if the history contains an invalid role.
46
+ */
47
+ function validateHistory(history) {
48
+ for (const content of history) {
49
+ if (content.role !== 'user' && content.role !== 'model') {
50
+ throw new Error(`Role must be user or model, but got ${content.role}.`);
51
+ }
52
+ }
53
+ }
54
+ /**
55
+ * Extracts the curated (valid) history from a comprehensive history.
56
+ *
57
+ * @remarks
58
+ * The model may sometimes generate invalid or empty contents(e.g., due to safety
59
+ * filters or recitation). Extracting valid turns from the history
60
+ * ensures that subsequent requests could be accepted by the model.
61
+ */
62
+ function extractCuratedHistory(comprehensiveHistory) {
63
+ if (comprehensiveHistory === undefined || comprehensiveHistory.length === 0) {
64
+ return [];
65
+ }
66
+ const curatedHistory = [];
67
+ const length = comprehensiveHistory.length;
68
+ let i = 0;
69
+ while (i < length) {
70
+ if (comprehensiveHistory[i].role === 'user') {
71
+ curatedHistory.push(comprehensiveHistory[i]);
72
+ i++;
73
+ }
74
+ else {
75
+ const modelOutput = [];
76
+ let isValid = true;
77
+ while (i < length && comprehensiveHistory[i].role === 'model') {
78
+ modelOutput.push(comprehensiveHistory[i]);
79
+ if (isValid && !isValidContent(comprehensiveHistory[i])) {
80
+ isValid = false;
81
+ }
82
+ i++;
83
+ }
84
+ if (isValid) {
85
+ curatedHistory.push(...modelOutput);
86
+ }
87
+ else {
88
+ // Remove the last user input when model content is invalid.
89
+ curatedHistory.pop();
90
+ }
91
+ }
92
+ }
93
+ return curatedHistory;
94
+ }
95
+ /**
96
+ * Chat session that enables sending messages to the model with previous
97
+ * conversation context.
98
+ *
99
+ * @remarks
100
+ * The session maintains all the turns between user and model.
101
+ */
102
+ export class GeminiChat {
103
+ config;
104
+ contentGenerator;
105
+ generationConfig;
106
+ history;
107
+ // A promise to represent the current state of the message being sent to the
108
+ // model.
109
+ sendPromise = Promise.resolve();
110
+ constructor(config, contentGenerator, generationConfig = {}, history = []) {
111
+ this.config = config;
112
+ this.contentGenerator = contentGenerator;
113
+ this.generationConfig = generationConfig;
114
+ this.history = history;
115
+ validateHistory(history);
116
+ }
117
+ /**
118
+ * Handles falling back to Flash model when persistent 429 errors occur for OAuth users.
119
+ * Uses a fallback handler if provided by the config; otherwise, returns null.
120
+ */
121
+ async handleFlashFallback(authType, error) {
122
+ // Only handle fallback for OAuth users
123
+ if (authType !== AuthType.LOGIN_WITH_GOOGLE) {
124
+ return null;
125
+ }
126
+ const currentModel = this.config.getModel();
127
+ const fallbackModel = DEFAULT_GEMINI_FLASH_MODEL;
128
+ // Don't fallback if already using Flash model
129
+ if (currentModel === fallbackModel) {
130
+ return null;
131
+ }
132
+ // Check if config has a fallback handler (set by CLI package)
133
+ const fallbackHandler = this.config.flashFallbackHandler;
134
+ if (typeof fallbackHandler === 'function') {
135
+ try {
136
+ const accepted = await fallbackHandler(currentModel, fallbackModel, error);
137
+ if (accepted !== false && accepted !== null) {
138
+ this.config.setModel(fallbackModel);
139
+ this.config.setFallbackMode(true);
140
+ return fallbackModel;
141
+ }
142
+ // Check if the model was switched manually in the handler
143
+ if (this.config.getModel() === fallbackModel) {
144
+ return null; // Model was switched but don't continue with current prompt
145
+ }
146
+ }
147
+ catch (error) {
148
+ console.warn('Flash fallback handler failed:', error);
149
+ }
150
+ }
151
+ return null;
152
+ }
153
+ setSystemInstruction(sysInstr) {
154
+ this.generationConfig.systemInstruction = sysInstr;
155
+ }
156
+ /**
157
+ * Sends a message to the model and returns the response.
158
+ *
159
+ * @remarks
160
+ * This method will wait for the previous message to be processed before
161
+ * sending the next message.
162
+ *
163
+ * @see {@link Chat#sendMessageStream} for streaming method.
164
+ * @param params - parameters for sending messages within a chat session.
165
+ * @returns The model's response.
166
+ *
167
+ * @example
168
+ * ```ts
169
+ * const chat = ai.chats.create({model: 'gemini-2.0-flash'});
170
+ * const response = await chat.sendMessage({
171
+ * message: 'Why is the sky blue?'
172
+ * });
173
+ * console.log(response.text);
174
+ * ```
175
+ */
176
+ async sendMessage(params, prompt_id) {
177
+ await this.sendPromise;
178
+ const userContent = createUserContent(params.message);
179
+ const requestContents = this.getHistory(true).concat(userContent);
180
+ let response;
181
+ try {
182
+ const apiCall = () => {
183
+ const modelToUse = this.config.getModel() || DEFAULT_GEMINI_FLASH_MODEL;
184
+ // Prevent Flash model calls immediately after quota error
185
+ if (this.config.getQuotaErrorOccurred() &&
186
+ modelToUse === DEFAULT_GEMINI_FLASH_MODEL) {
187
+ throw new Error('Please submit a new query to continue with the Flash model.');
188
+ }
189
+ return this.contentGenerator.generateContent({
190
+ model: modelToUse,
191
+ contents: requestContents,
192
+ config: { ...this.generationConfig, ...params.config },
193
+ }, prompt_id);
194
+ };
195
+ response = await retryWithBackoff(apiCall, {
196
+ shouldRetry: (error) => {
197
+ // Check for known error messages and codes.
198
+ if (error instanceof Error && error.message) {
199
+ if (isSchemaDepthError(error.message))
200
+ return false;
201
+ if (error.message.includes('429'))
202
+ return true;
203
+ if (error.message.match(/5\d{2}/))
204
+ return true;
205
+ }
206
+ return false; // Don't retry other errors by default
207
+ },
208
+ onPersistent429: async (authType, error) => await this.handleFlashFallback(authType, error),
209
+ authType: this.config.getContentGeneratorConfig()?.authType,
210
+ });
211
+ this.sendPromise = (async () => {
212
+ const outputContent = response.candidates?.[0]?.content;
213
+ // Because the AFC input contains the entire curated chat history in
214
+ // addition to the new user input, we need to truncate the AFC history
215
+ // to deduplicate the existing chat history.
216
+ const fullAutomaticFunctionCallingHistory = response.automaticFunctionCallingHistory;
217
+ const index = this.getHistory(true).length;
218
+ let automaticFunctionCallingHistory = [];
219
+ if (fullAutomaticFunctionCallingHistory != null) {
220
+ automaticFunctionCallingHistory =
221
+ fullAutomaticFunctionCallingHistory.slice(index) ?? [];
222
+ }
223
+ const modelOutput = outputContent ? [outputContent] : [];
224
+ this.recordHistory(userContent, modelOutput, automaticFunctionCallingHistory);
225
+ })();
226
+ await this.sendPromise.catch(() => {
227
+ // Resets sendPromise to avoid subsequent calls failing
228
+ this.sendPromise = Promise.resolve();
229
+ });
230
+ return response;
231
+ }
232
+ catch (error) {
233
+ this.sendPromise = Promise.resolve();
234
+ throw error;
235
+ }
236
+ }
237
+ /**
238
+ * Sends a message to the model and returns the response in chunks.
239
+ *
240
+ * @remarks
241
+ * This method will wait for the previous message to be processed before
242
+ * sending the next message.
243
+ *
244
+ * @see {@link Chat#sendMessage} for non-streaming method.
245
+ * @param params - parameters for sending the message.
246
+ * @return The model's response.
247
+ *
248
+ * @example
249
+ * ```ts
250
+ * const chat = ai.chats.create({model: 'gemini-2.0-flash'});
251
+ * const response = await chat.sendMessageStream({
252
+ * message: 'Why is the sky blue?'
253
+ * });
254
+ * for await (const chunk of response) {
255
+ * console.log(chunk.text);
256
+ * }
257
+ * ```
258
+ */
259
+ async sendMessageStream(params, prompt_id) {
260
+ await this.sendPromise;
261
+ const userContent = createUserContent(params.message);
262
+ const requestContents = this.getHistory(true).concat(userContent);
263
+ try {
264
+ const apiCall = () => {
265
+ const modelToUse = this.config.getModel();
266
+ // Prevent Flash model calls immediately after quota error
267
+ if (this.config.getQuotaErrorOccurred() &&
268
+ modelToUse === DEFAULT_GEMINI_FLASH_MODEL) {
269
+ throw new Error('Please submit a new query to continue with the Flash model.');
270
+ }
271
+ return this.contentGenerator.generateContentStream({
272
+ model: modelToUse,
273
+ contents: requestContents,
274
+ config: { ...this.generationConfig, ...params.config },
275
+ }, prompt_id);
276
+ };
277
+ // Note: Retrying streams can be complex. If generateContentStream itself doesn't handle retries
278
+ // for transient issues internally before yielding the async generator, this retry will re-initiate
279
+ // the stream. For simple 429/500 errors on initial call, this is fine.
280
+ // If errors occur mid-stream, this setup won't resume the stream; it will restart it.
281
+ const streamResponse = await retryWithBackoff(apiCall, {
282
+ shouldRetry: (error) => {
283
+ // Check for known error messages and codes.
284
+ if (error instanceof Error && error.message) {
285
+ if (isSchemaDepthError(error.message))
286
+ return false;
287
+ if (error.message.includes('429'))
288
+ return true;
289
+ if (error.message.match(/5\d{2}/))
290
+ return true;
291
+ }
292
+ return false; // Don't retry other errors by default
293
+ },
294
+ onPersistent429: async (authType, error) => await this.handleFlashFallback(authType, error),
295
+ authType: this.config.getContentGeneratorConfig()?.authType,
296
+ });
297
+ // Resolve the internal tracking of send completion promise - `sendPromise`
298
+ // for both success and failure response. The actual failure is still
299
+ // propagated by the `await streamResponse`.
300
+ this.sendPromise = Promise.resolve(streamResponse)
301
+ .then(() => undefined)
302
+ .catch(() => undefined);
303
+ const result = this.processStreamResponse(streamResponse, userContent);
304
+ return result;
305
+ }
306
+ catch (error) {
307
+ this.sendPromise = Promise.resolve();
308
+ throw error;
309
+ }
310
+ }
311
+ /**
312
+ * Returns the chat history.
313
+ *
314
+ * @remarks
315
+ * The history is a list of contents alternating between user and model.
316
+ *
317
+ * There are two types of history:
318
+ * - The `curated history` contains only the valid turns between user and
319
+ * model, which will be included in the subsequent requests sent to the model.
320
+ * - The `comprehensive history` contains all turns, including invalid or
321
+ * empty model outputs, providing a complete record of the history.
322
+ *
323
+ * The history is updated after receiving the response from the model,
324
+ * for streaming response, it means receiving the last chunk of the response.
325
+ *
326
+ * The `comprehensive history` is returned by default. To get the `curated
327
+ * history`, set the `curated` parameter to `true`.
328
+ *
329
+ * @param curated - whether to return the curated history or the comprehensive
330
+ * history.
331
+ * @return History contents alternating between user and model for the entire
332
+ * chat session.
333
+ */
334
+ getHistory(curated = false) {
335
+ const history = curated
336
+ ? extractCuratedHistory(this.history)
337
+ : this.history;
338
+ // Deep copy the history to avoid mutating the history outside of the
339
+ // chat session.
340
+ return structuredClone(history);
341
+ }
342
+ /**
343
+ * Clears the chat history.
344
+ */
345
+ clearHistory() {
346
+ this.history = [];
347
+ }
348
+ /**
349
+ * Adds a new entry to the chat history.
350
+ *
351
+ * @param content - The content to add to the history.
352
+ */
353
+ addHistory(content) {
354
+ this.history.push(content);
355
+ }
356
+ setHistory(history) {
357
+ this.history = history;
358
+ }
359
+ setTools(tools) {
360
+ this.generationConfig.tools = tools;
361
+ }
362
+ async maybeIncludeSchemaDepthContext(error) {
363
+ // Check for potentially problematic cyclic tools with cyclic schemas
364
+ // and include a recommendation to remove potentially problematic tools.
365
+ if (isSchemaDepthError(error.message) ||
366
+ isInvalidArgumentError(error.message)) {
367
+ const tools = (await this.config.getToolRegistry()).getAllTools();
368
+ const cyclicSchemaTools = [];
369
+ for (const tool of tools) {
370
+ if ((tool.schema.parametersJsonSchema &&
371
+ hasCycleInSchema(tool.schema.parametersJsonSchema)) ||
372
+ (tool.schema.parameters && hasCycleInSchema(tool.schema.parameters))) {
373
+ cyclicSchemaTools.push(tool.displayName);
374
+ }
375
+ }
376
+ if (cyclicSchemaTools.length > 0) {
377
+ const extraDetails = `\n\nThis error was probably caused by cyclic schema references in one of the following tools, try disabling them with excludeTools:\n\n - ` +
378
+ cyclicSchemaTools.join(`\n - `) +
379
+ `\n`;
380
+ error.message += extraDetails;
381
+ }
382
+ }
383
+ }
384
+ async *processStreamResponse(streamResponse, inputContent) {
385
+ const outputContent = [];
386
+ const chunks = [];
387
+ let errorOccurred = false;
388
+ try {
389
+ for await (const chunk of streamResponse) {
390
+ if (isValidResponse(chunk)) {
391
+ chunks.push(chunk);
392
+ const content = chunk.candidates?.[0]?.content;
393
+ if (content !== undefined) {
394
+ if (this.isThoughtContent(content)) {
395
+ yield chunk;
396
+ continue;
397
+ }
398
+ outputContent.push(content);
399
+ }
400
+ }
401
+ yield chunk;
402
+ }
403
+ }
404
+ catch (error) {
405
+ errorOccurred = true;
406
+ throw error;
407
+ }
408
+ if (!errorOccurred) {
409
+ const allParts = [];
410
+ for (const content of outputContent) {
411
+ if (content.parts) {
412
+ allParts.push(...content.parts);
413
+ }
414
+ }
415
+ }
416
+ this.recordHistory(inputContent, outputContent);
417
+ }
418
+ recordHistory(userInput, modelOutput, automaticFunctionCallingHistory) {
419
+ const nonThoughtModelOutput = modelOutput.filter((content) => !this.isThoughtContent(content));
420
+ let outputContents = [];
421
+ if (nonThoughtModelOutput.length > 0 &&
422
+ nonThoughtModelOutput.every((content) => content.role !== undefined)) {
423
+ outputContents = nonThoughtModelOutput;
424
+ }
425
+ else if (nonThoughtModelOutput.length === 0 && modelOutput.length > 0) {
426
+ // This case handles when the model returns only a thought.
427
+ // We don't want to add an empty model response in this case.
428
+ }
429
+ else {
430
+ // When not a function response appends an empty content when model returns empty response, so that the
431
+ // history is always alternating between user and model.
432
+ // Workaround for: https://b.corp.google.com/issues/420354090
433
+ if (!isFunctionResponse(userInput)) {
434
+ outputContents.push({
435
+ role: 'model',
436
+ parts: [],
437
+ });
438
+ }
439
+ }
440
+ if (automaticFunctionCallingHistory &&
441
+ automaticFunctionCallingHistory.length > 0) {
442
+ this.history.push(...extractCuratedHistory(automaticFunctionCallingHistory));
443
+ }
444
+ else {
445
+ this.history.push(userInput);
446
+ }
447
+ // Consolidate adjacent model roles in outputContents
448
+ const consolidatedOutputContents = [];
449
+ for (const content of outputContents) {
450
+ if (this.isThoughtContent(content)) {
451
+ continue;
452
+ }
453
+ const lastContent = consolidatedOutputContents[consolidatedOutputContents.length - 1];
454
+ if (this.isTextContent(lastContent) && this.isTextContent(content)) {
455
+ // If both current and last are text, combine their text into the lastContent's first part
456
+ // and append any other parts from the current content.
457
+ lastContent.parts[0].text += content.parts[0].text || '';
458
+ if (content.parts.length > 1) {
459
+ lastContent.parts.push(...content.parts.slice(1));
460
+ }
461
+ }
462
+ else {
463
+ consolidatedOutputContents.push(content);
464
+ }
465
+ }
466
+ if (consolidatedOutputContents.length > 0) {
467
+ const lastHistoryEntry = this.history[this.history.length - 1];
468
+ const canMergeWithLastHistory = !automaticFunctionCallingHistory ||
469
+ automaticFunctionCallingHistory.length === 0;
470
+ if (canMergeWithLastHistory &&
471
+ this.isTextContent(lastHistoryEntry) &&
472
+ this.isTextContent(consolidatedOutputContents[0])) {
473
+ // If both current and last are text, combine their text into the lastHistoryEntry's first part
474
+ // and append any other parts from the current content.
475
+ lastHistoryEntry.parts[0].text +=
476
+ consolidatedOutputContents[0].parts[0].text || '';
477
+ if (consolidatedOutputContents[0].parts.length > 1) {
478
+ lastHistoryEntry.parts.push(...consolidatedOutputContents[0].parts.slice(1));
479
+ }
480
+ consolidatedOutputContents.shift(); // Remove the first element as it's merged
481
+ }
482
+ this.history.push(...consolidatedOutputContents);
483
+ }
484
+ }
485
+ isTextContent(content) {
486
+ return !!(content &&
487
+ content.role === 'model' &&
488
+ content.parts &&
489
+ content.parts.length > 0 &&
490
+ typeof content.parts[0].text === 'string' &&
491
+ content.parts[0].text !== '');
492
+ }
493
+ isThoughtContent(content) {
494
+ return !!(content &&
495
+ content.role === 'model' &&
496
+ content.parts &&
497
+ content.parts.length > 0 &&
498
+ typeof content.parts[0].thought === 'boolean' &&
499
+ content.parts[0].thought === true);
500
+ }
501
+ }
502
+ /** Visible for Testing */
503
+ export function isSchemaDepthError(errorMessage) {
504
+ return errorMessage.includes('maximum schema depth exceeded');
505
+ }
506
+ export function isInvalidArgumentError(errorMessage) {
507
+ return errorMessage.includes('Request contains an invalid argument');
508
+ }
509
+ //# sourceMappingURL=geminiChat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geminiChat.js","sourceRoot":"","sources":["../../../src/core/geminiChat.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,uJAAuJ;AACvJ,4GAA4G;AAE5G,OAAO,EAKL,iBAAiB,GAGlB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAoB,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAGrD;;GAEG;AACH,SAAS,eAAe,CAAC,QAAiC;IACxD,IAAI,QAAQ,CAAC,UAAU,KAAK,SAAS,IAAI,QAAQ,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1E,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC;IAChD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,cAAc,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC;AAED,SAAS,cAAc,CAAC,OAAgB;IACtC,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9D,OAAO,KAAK,CAAC;IACf,CAAC;IACD,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QACjC,IAAI,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