@vybestack/llxprt-code-core 0.1.19-beta → 0.1.19

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 (540) hide show
  1. package/README.md +49 -2
  2. package/dist/index.d.ts +6 -0
  3. package/dist/index.js +6 -0
  4. package/dist/index.js.map +1 -1
  5. package/dist/src/auth/anthropic-device-flow.d.ts +53 -0
  6. package/dist/src/auth/anthropic-device-flow.js +208 -0
  7. package/dist/src/auth/anthropic-device-flow.js.map +1 -0
  8. package/dist/src/auth/precedence.d.ts +55 -0
  9. package/dist/src/auth/precedence.js +211 -0
  10. package/dist/src/auth/precedence.js.map +1 -0
  11. package/dist/src/auth/qwen-device-flow.d.ts +45 -0
  12. package/dist/src/auth/qwen-device-flow.js +179 -0
  13. package/dist/src/auth/qwen-device-flow.js.map +1 -0
  14. package/dist/src/auth/token-store.d.ts +66 -0
  15. package/dist/src/auth/token-store.js +151 -0
  16. package/dist/src/auth/token-store.js.map +1 -0
  17. package/dist/src/auth/types.d.ts +130 -0
  18. package/dist/src/auth/types.js +60 -0
  19. package/dist/src/auth/types.js.map +1 -0
  20. package/dist/src/code_assist/converter.d.ts +2 -2
  21. package/dist/src/code_assist/converter.js +1 -1
  22. package/dist/src/code_assist/converter.js.map +1 -1
  23. package/dist/src/config/config.d.ts +7 -1
  24. package/dist/src/config/config.js +46 -5
  25. package/dist/src/config/config.js.map +1 -1
  26. package/dist/src/config/endpoints.d.ts +60 -0
  27. package/dist/src/config/endpoints.js +126 -0
  28. package/dist/src/config/endpoints.js.map +1 -0
  29. package/dist/src/config/profileManager.d.ts +14 -4
  30. package/dist/src/config/profileManager.js +90 -11
  31. package/dist/src/config/profileManager.js.map +1 -1
  32. package/dist/src/core/client.d.ts +5 -2
  33. package/dist/src/core/client.js +164 -44
  34. package/dist/src/core/client.js.map +1 -1
  35. package/dist/src/core/contentGenerator.d.ts +4 -1
  36. package/dist/src/core/contentGenerator.js +3 -0
  37. package/dist/src/core/contentGenerator.js.map +1 -1
  38. package/dist/src/core/loggingContentGenerator.d.ts +5 -0
  39. package/dist/src/core/loggingContentGenerator.js +9 -1
  40. package/dist/src/core/loggingContentGenerator.js.map +1 -1
  41. package/dist/src/core/subagent.js +12 -10
  42. package/dist/src/core/subagent.js.map +1 -1
  43. package/dist/src/ide/detect-ide.d.ts +10 -2
  44. package/dist/src/ide/detect-ide.js +48 -5
  45. package/dist/src/ide/detect-ide.js.map +1 -1
  46. package/dist/src/ide/ide-client.js +22 -15
  47. package/dist/src/ide/ide-client.js.map +1 -1
  48. package/dist/src/index.d.ts +10 -1
  49. package/dist/src/index.js +10 -1
  50. package/dist/src/index.js.map +1 -1
  51. package/dist/src/prompt-config/defaults/core-defaults.d.ts +1 -1
  52. package/dist/src/prompt-config/defaults/core-defaults.js +21 -326
  53. package/dist/src/prompt-config/defaults/core-defaults.js.map +1 -1
  54. package/dist/src/prompt-config/defaults/core.md +1 -1
  55. package/dist/src/prompt-config/defaults/provider-defaults.d.ts +1 -1
  56. package/dist/src/prompt-config/defaults/provider-defaults.js +16 -19
  57. package/dist/src/prompt-config/defaults/provider-defaults.js.map +1 -1
  58. package/dist/src/prompt-config/defaults/providers/gemini/models/gemini-2.5-flash/core.md +273 -10
  59. package/dist/src/prompt-config/defaults/providers/gemini/models/gemini-2.5-flash/gemini-2-5-flash/core.md +278 -0
  60. package/dist/src/prompt-config/defaults/tool-defaults.d.ts +1 -1
  61. package/dist/src/prompt-config/defaults/tool-defaults.js +27 -75
  62. package/dist/src/prompt-config/defaults/tool-defaults.js.map +1 -1
  63. package/dist/src/prompt-config/defaults/tools/read-file.md +1 -1
  64. package/dist/src/providers/BaseProvider.d.ts +149 -0
  65. package/dist/src/providers/BaseProvider.js +315 -0
  66. package/dist/src/providers/BaseProvider.js.map +1 -0
  67. package/dist/src/providers/IProvider.d.ts +1 -0
  68. package/dist/src/providers/LoggingProviderWrapper.d.ts +1 -0
  69. package/dist/src/providers/LoggingProviderWrapper.js +3 -0
  70. package/dist/src/providers/LoggingProviderWrapper.js.map +1 -1
  71. package/dist/src/providers/ProviderManager.d.ts +0 -1
  72. package/dist/src/providers/ProviderManager.js +23 -14
  73. package/dist/src/providers/ProviderManager.js.map +1 -1
  74. package/dist/src/providers/anthropic/AnthropicProvider.d.ts +20 -6
  75. package/dist/src/providers/anthropic/AnthropicProvider.js +173 -27
  76. package/dist/src/providers/anthropic/AnthropicProvider.js.map +1 -1
  77. package/dist/src/providers/gemini/GeminiProvider.d.ts +20 -7
  78. package/dist/src/providers/gemini/GeminiProvider.js +182 -147
  79. package/dist/src/providers/gemini/GeminiProvider.js.map +1 -1
  80. package/dist/src/providers/openai/OpenAIProvider.d.ts +53 -6
  81. package/dist/src/providers/openai/OpenAIProvider.js +373 -40
  82. package/dist/src/providers/openai/OpenAIProvider.js.map +1 -1
  83. package/dist/src/providers/openai/RESPONSES_API_MODELS.d.ts +1 -1
  84. package/dist/src/providers/openai/RESPONSES_API_MODELS.js +1 -0
  85. package/dist/src/providers/openai/RESPONSES_API_MODELS.js.map +1 -1
  86. package/dist/src/providers/openai/syntheticToolResponses.d.ts +52 -0
  87. package/dist/src/providers/openai/syntheticToolResponses.js +129 -0
  88. package/dist/src/providers/openai/syntheticToolResponses.js.map +1 -0
  89. package/dist/src/services/loopDetectionService.js +4 -5
  90. package/dist/src/services/loopDetectionService.js.map +1 -1
  91. package/dist/src/settings/SettingsService.d.ts +32 -0
  92. package/dist/src/settings/SettingsService.js +204 -0
  93. package/dist/src/settings/SettingsService.js.map +1 -0
  94. package/dist/src/settings/settingsServiceInstance.d.ts +12 -0
  95. package/dist/src/settings/settingsServiceInstance.js +24 -0
  96. package/dist/src/settings/settingsServiceInstance.js.map +1 -0
  97. package/dist/src/settings/types.d.ts +141 -0
  98. package/dist/src/settings/types.js +5 -0
  99. package/dist/src/settings/types.js.map +1 -0
  100. package/dist/src/tools/edit.js +6 -7
  101. package/dist/src/tools/edit.js.map +1 -1
  102. package/dist/src/tools/glob.js +7 -8
  103. package/dist/src/tools/glob.js.map +1 -1
  104. package/dist/src/tools/grep.js +6 -7
  105. package/dist/src/tools/grep.js.map +1 -1
  106. package/dist/src/tools/ls.js +9 -10
  107. package/dist/src/tools/ls.js.map +1 -1
  108. package/dist/src/tools/mcp-tool.d.ts +3 -8
  109. package/dist/src/tools/mcp-tool.js +5 -18
  110. package/dist/src/tools/mcp-tool.js.map +1 -1
  111. package/dist/src/tools/memoryTool.js +4 -5
  112. package/dist/src/tools/memoryTool.js.map +1 -1
  113. package/dist/src/tools/read-file.js +5 -6
  114. package/dist/src/tools/read-file.js.map +1 -1
  115. package/dist/src/tools/read-many-files.js +17 -18
  116. package/dist/src/tools/read-many-files.js.map +1 -1
  117. package/dist/src/tools/shell.js +8 -9
  118. package/dist/src/tools/shell.js.map +1 -1
  119. package/dist/src/tools/tool-registry.d.ts +1 -15
  120. package/dist/src/tools/tool-registry.js +4 -72
  121. package/dist/src/tools/tool-registry.js.map +1 -1
  122. package/dist/src/tools/tools.d.ts +6 -6
  123. package/dist/src/tools/tools.js +2 -2
  124. package/dist/src/tools/tools.js.map +1 -1
  125. package/dist/src/tools/web-fetch.js +3 -4
  126. package/dist/src/tools/web-fetch.js.map +1 -1
  127. package/dist/src/tools/web-search.js +3 -4
  128. package/dist/src/tools/web-search.js.map +1 -1
  129. package/dist/src/tools/write-file.js +4 -5
  130. package/dist/src/tools/write-file.js.map +1 -1
  131. package/dist/src/utils/editCorrector.js +8 -9
  132. package/dist/src/utils/editCorrector.js.map +1 -1
  133. package/dist/src/utils/nextSpeakerChecker.js +3 -4
  134. package/dist/src/utils/nextSpeakerChecker.js.map +1 -1
  135. package/dist/src/utils/schemaValidator.d.ts +1 -9
  136. package/dist/src/utils/schemaValidator.js +1 -109
  137. package/dist/src/utils/schemaValidator.js.map +1 -1
  138. package/package.json +4 -2
  139. package/dist/src/code_assist/converter.test.d.ts +0 -6
  140. package/dist/src/code_assist/converter.test.js +0 -279
  141. package/dist/src/code_assist/converter.test.js.map +0 -1
  142. package/dist/src/code_assist/oauth2.test.d.ts +0 -6
  143. package/dist/src/code_assist/oauth2.test.js +0 -370
  144. package/dist/src/code_assist/oauth2.test.js.map +0 -1
  145. package/dist/src/code_assist/server.test.d.ts +0 -6
  146. package/dist/src/code_assist/server.test.js +0 -134
  147. package/dist/src/code_assist/server.test.js.map +0 -1
  148. package/dist/src/code_assist/setup.test.d.ts +0 -6
  149. package/dist/src/code_assist/setup.test.js +0 -65
  150. package/dist/src/code_assist/setup.test.js.map +0 -1
  151. package/dist/src/config/config.alwaysAllow.test.d.ts +0 -6
  152. package/dist/src/config/config.alwaysAllow.test.js +0 -84
  153. package/dist/src/config/config.alwaysAllow.test.js.map +0 -1
  154. package/dist/src/config/config.ephemeral.test.d.ts +0 -6
  155. package/dist/src/config/config.ephemeral.test.js +0 -152
  156. package/dist/src/config/config.ephemeral.test.js.map +0 -1
  157. package/dist/src/config/config.test.d.ts +0 -6
  158. package/dist/src/config/config.test.js +0 -369
  159. package/dist/src/config/config.test.js.map +0 -1
  160. package/dist/src/config/flashFallback.test.d.ts +0 -6
  161. package/dist/src/config/flashFallback.test.js +0 -91
  162. package/dist/src/config/flashFallback.test.js.map +0 -1
  163. package/dist/src/core/client.test.d.ts +0 -6
  164. package/dist/src/core/client.test.js +0 -1322
  165. package/dist/src/core/client.test.js.map +0 -1
  166. package/dist/src/core/contentGenerator.test.d.ts +0 -6
  167. package/dist/src/core/contentGenerator.test.js +0 -103
  168. package/dist/src/core/contentGenerator.test.js.map +0 -1
  169. package/dist/src/core/coreToolScheduler.test.d.ts +0 -6
  170. package/dist/src/core/coreToolScheduler.test.js +0 -637
  171. package/dist/src/core/coreToolScheduler.test.js.map +0 -1
  172. package/dist/src/core/geminiChat.test.d.ts +0 -6
  173. package/dist/src/core/geminiChat.test.js +0 -425
  174. package/dist/src/core/geminiChat.test.js.map +0 -1
  175. package/dist/src/core/googleGenAIWrapper.test.d.ts +0 -6
  176. package/dist/src/core/googleGenAIWrapper.test.js +0 -104
  177. package/dist/src/core/googleGenAIWrapper.test.js.map +0 -1
  178. package/dist/src/core/logger.test.d.ts +0 -6
  179. package/dist/src/core/logger.test.js +0 -467
  180. package/dist/src/core/logger.test.js.map +0 -1
  181. package/dist/src/core/nonInteractiveToolExecutor.test.d.ts +0 -6
  182. package/dist/src/core/nonInteractiveToolExecutor.test.js +0 -165
  183. package/dist/src/core/nonInteractiveToolExecutor.test.js.map +0 -1
  184. package/dist/src/core/prompts-async.test.d.ts +0 -6
  185. package/dist/src/core/prompts-async.test.js +0 -115
  186. package/dist/src/core/prompts-async.test.js.map +0 -1
  187. package/dist/src/core/prompts.test.d.ts +0 -6
  188. package/dist/src/core/prompts.test.js +0 -68
  189. package/dist/src/core/prompts.test.js.map +0 -1
  190. package/dist/src/core/subagent.test.d.ts +0 -6
  191. package/dist/src/core/subagent.test.js +0 -519
  192. package/dist/src/core/subagent.test.js.map +0 -1
  193. package/dist/src/core/tokenLimits.test.d.ts +0 -6
  194. package/dist/src/core/tokenLimits.test.js +0 -66
  195. package/dist/src/core/tokenLimits.test.js.map +0 -1
  196. package/dist/src/core/turn.test.d.ts +0 -6
  197. package/dist/src/core/turn.test.js +0 -366
  198. package/dist/src/core/turn.test.js.map +0 -1
  199. package/dist/src/hooks/tool-render-suppression-hook.test.d.ts +0 -6
  200. package/dist/src/hooks/tool-render-suppression-hook.test.js +0 -59
  201. package/dist/src/hooks/tool-render-suppression-hook.test.js.map +0 -1
  202. package/dist/src/ide/ide-installer.test.d.ts +0 -6
  203. package/dist/src/ide/ide-installer.test.js +0 -55
  204. package/dist/src/ide/ide-installer.test.js.map +0 -1
  205. package/dist/src/ide/ideContext.test.d.ts +0 -6
  206. package/dist/src/ide/ideContext.test.js +0 -265
  207. package/dist/src/ide/ideContext.test.js.map +0 -1
  208. package/dist/src/index.test.d.ts +0 -6
  209. package/dist/src/index.test.js +0 -12
  210. package/dist/src/index.test.js.map +0 -1
  211. package/dist/src/integration-tests/todo-system.test.d.ts +0 -6
  212. package/dist/src/integration-tests/todo-system.test.js +0 -46
  213. package/dist/src/integration-tests/todo-system.test.js.map +0 -1
  214. package/dist/src/mcp/google-auth-provider.test.d.ts +0 -6
  215. package/dist/src/mcp/google-auth-provider.test.js +0 -54
  216. package/dist/src/mcp/google-auth-provider.test.js.map +0 -1
  217. package/dist/src/mcp/oauth-provider.test.d.ts +0 -6
  218. package/dist/src/mcp/oauth-provider.test.js +0 -602
  219. package/dist/src/mcp/oauth-provider.test.js.map +0 -1
  220. package/dist/src/mcp/oauth-token-storage.test.d.ts +0 -6
  221. package/dist/src/mcp/oauth-token-storage.test.js +0 -205
  222. package/dist/src/mcp/oauth-token-storage.test.js.map +0 -1
  223. package/dist/src/mcp/oauth-utils.test.d.ts +0 -6
  224. package/dist/src/mcp/oauth-utils.test.js +0 -144
  225. package/dist/src/mcp/oauth-utils.test.js.map +0 -1
  226. package/dist/src/parsers/TextToolCallParser.multibyte.test.d.ts +0 -1
  227. package/dist/src/parsers/TextToolCallParser.multibyte.test.js +0 -42
  228. package/dist/src/parsers/TextToolCallParser.multibyte.test.js.map +0 -1
  229. package/dist/src/parsers/TextToolCallParser.test.d.ts +0 -1
  230. package/dist/src/parsers/TextToolCallParser.test.js +0 -225
  231. package/dist/src/parsers/TextToolCallParser.test.js.map +0 -1
  232. package/dist/src/prompt-config/TemplateEngine.test.d.ts +0 -1
  233. package/dist/src/prompt-config/TemplateEngine.test.js +0 -494
  234. package/dist/src/prompt-config/TemplateEngine.test.js.map +0 -1
  235. package/dist/src/prompt-config/prompt-cache.test.d.ts +0 -6
  236. package/dist/src/prompt-config/prompt-cache.test.js +0 -437
  237. package/dist/src/prompt-config/prompt-cache.test.js.map +0 -1
  238. package/dist/src/prompt-config/prompt-installer.test.d.ts +0 -7
  239. package/dist/src/prompt-config/prompt-installer.test.js +0 -503
  240. package/dist/src/prompt-config/prompt-installer.test.js.map +0 -1
  241. package/dist/src/prompt-config/prompt-loader.test.d.ts +0 -5
  242. package/dist/src/prompt-config/prompt-loader.test.js +0 -413
  243. package/dist/src/prompt-config/prompt-loader.test.js.map +0 -1
  244. package/dist/src/prompt-config/prompt-resolver.test.d.ts +0 -1
  245. package/dist/src/prompt-config/prompt-resolver.test.js +0 -529
  246. package/dist/src/prompt-config/prompt-resolver.test.js.map +0 -1
  247. package/dist/src/prompt-config/prompt-service.test.d.ts +0 -1
  248. package/dist/src/prompt-config/prompt-service.test.js +0 -811
  249. package/dist/src/prompt-config/prompt-service.test.js.map +0 -1
  250. package/dist/src/providers/ProviderManager.gemini-switch.test.d.ts +0 -6
  251. package/dist/src/providers/ProviderManager.gemini-switch.test.js +0 -57
  252. package/dist/src/providers/ProviderManager.gemini-switch.test.js.map +0 -1
  253. package/dist/src/providers/ProviderManager.test.d.ts +0 -6
  254. package/dist/src/providers/ProviderManager.test.js +0 -284
  255. package/dist/src/providers/ProviderManager.test.js.map +0 -1
  256. package/dist/src/providers/adapters/GeminiCompatibleWrapper.test.d.ts +0 -6
  257. package/dist/src/providers/adapters/GeminiCompatibleWrapper.test.js +0 -273
  258. package/dist/src/providers/adapters/GeminiCompatibleWrapper.test.js.map +0 -1
  259. package/dist/src/providers/anthropic/AnthropicProvider.modelParams.test.d.ts +0 -1
  260. package/dist/src/providers/anthropic/AnthropicProvider.modelParams.test.js +0 -48
  261. package/dist/src/providers/anthropic/AnthropicProvider.modelParams.test.js.map +0 -1
  262. package/dist/src/providers/anthropic/AnthropicProvider.test.d.ts +0 -1
  263. package/dist/src/providers/anthropic/AnthropicProvider.test.js +0 -487
  264. package/dist/src/providers/anthropic/AnthropicProvider.test.js.map +0 -1
  265. package/dist/src/providers/gemini/GeminiProvider.integration.test.d.ts +0 -6
  266. package/dist/src/providers/gemini/GeminiProvider.integration.test.js +0 -126
  267. package/dist/src/providers/gemini/GeminiProvider.integration.test.js.map +0 -1
  268. package/dist/src/providers/gemini/GeminiProvider.test.d.ts +0 -6
  269. package/dist/src/providers/gemini/GeminiProvider.test.js +0 -136
  270. package/dist/src/providers/gemini/GeminiProvider.test.js.map +0 -1
  271. package/dist/src/providers/integration/multi-provider.integration.test.d.ts +0 -6
  272. package/dist/src/providers/integration/multi-provider.integration.test.js +0 -292
  273. package/dist/src/providers/integration/multi-provider.integration.test.js.map +0 -1
  274. package/dist/src/providers/openai/ConversationCache.accumTokens.test.d.ts +0 -1
  275. package/dist/src/providers/openai/ConversationCache.accumTokens.test.js +0 -97
  276. package/dist/src/providers/openai/ConversationCache.accumTokens.test.js.map +0 -1
  277. package/dist/src/providers/openai/ConversationCache.test.d.ts +0 -1
  278. package/dist/src/providers/openai/ConversationCache.test.js +0 -113
  279. package/dist/src/providers/openai/ConversationCache.test.js.map +0 -1
  280. package/dist/src/providers/openai/OpenAIProvider.callResponses.stateless.test.d.ts +0 -1
  281. package/dist/src/providers/openai/OpenAIProvider.callResponses.stateless.test.js +0 -189
  282. package/dist/src/providers/openai/OpenAIProvider.callResponses.stateless.test.js.map +0 -1
  283. package/dist/src/providers/openai/OpenAIProvider.integration.test.d.ts +0 -6
  284. package/dist/src/providers/openai/OpenAIProvider.integration.test.js +0 -125
  285. package/dist/src/providers/openai/OpenAIProvider.integration.test.js.map +0 -1
  286. package/dist/src/providers/openai/OpenAIProvider.responses.test.d.ts +0 -1
  287. package/dist/src/providers/openai/OpenAIProvider.responses.test.js +0 -350
  288. package/dist/src/providers/openai/OpenAIProvider.responses.test.js.map +0 -1
  289. package/dist/src/providers/openai/OpenAIProvider.responsesIntegration.test.d.ts +0 -1
  290. package/dist/src/providers/openai/OpenAIProvider.responsesIntegration.test.js +0 -213
  291. package/dist/src/providers/openai/OpenAIProvider.responsesIntegration.test.js.map +0 -1
  292. package/dist/src/providers/openai/OpenAIProvider.shouldUseResponses.test.d.ts +0 -1
  293. package/dist/src/providers/openai/OpenAIProvider.shouldUseResponses.test.js +0 -59
  294. package/dist/src/providers/openai/OpenAIProvider.shouldUseResponses.test.js.map +0 -1
  295. package/dist/src/providers/openai/OpenAIProvider.stateful.integration.test.d.ts +0 -6
  296. package/dist/src/providers/openai/OpenAIProvider.stateful.integration.test.js +0 -105
  297. package/dist/src/providers/openai/OpenAIProvider.stateful.integration.test.js.map +0 -1
  298. package/dist/src/providers/openai/OpenAIProvider.switch.test.d.ts +0 -1
  299. package/dist/src/providers/openai/OpenAIProvider.switch.test.js +0 -256
  300. package/dist/src/providers/openai/OpenAIProvider.switch.test.js.map +0 -1
  301. package/dist/src/providers/openai/OpenAIProvider.test.d.ts +0 -16
  302. package/dist/src/providers/openai/OpenAIProvider.test.js +0 -620
  303. package/dist/src/providers/openai/OpenAIProvider.test.js.map +0 -1
  304. package/dist/src/providers/openai/ResponsesContextTrim.integration.test.d.ts +0 -1
  305. package/dist/src/providers/openai/ResponsesContextTrim.integration.test.js +0 -210
  306. package/dist/src/providers/openai/ResponsesContextTrim.integration.test.js.map +0 -1
  307. package/dist/src/providers/openai/__tests__/formatArrayResponse.test.d.ts +0 -1
  308. package/dist/src/providers/openai/__tests__/formatArrayResponse.test.js +0 -65
  309. package/dist/src/providers/openai/__tests__/formatArrayResponse.test.js.map +0 -1
  310. package/dist/src/providers/openai/buildResponsesRequest.stripToolCalls.test.d.ts +0 -1
  311. package/dist/src/providers/openai/buildResponsesRequest.stripToolCalls.test.js +0 -129
  312. package/dist/src/providers/openai/buildResponsesRequest.stripToolCalls.test.js.map +0 -1
  313. package/dist/src/providers/openai/buildResponsesRequest.test.d.ts +0 -1
  314. package/dist/src/providers/openai/buildResponsesRequest.test.js +0 -406
  315. package/dist/src/providers/openai/buildResponsesRequest.test.js.map +0 -1
  316. package/dist/src/providers/openai/buildResponsesRequest.undefined.test.d.ts +0 -1
  317. package/dist/src/providers/openai/buildResponsesRequest.undefined.test.js +0 -50
  318. package/dist/src/providers/openai/buildResponsesRequest.undefined.test.js.map +0 -1
  319. package/dist/src/providers/openai/estimateRemoteTokens.test.d.ts +0 -1
  320. package/dist/src/providers/openai/estimateRemoteTokens.test.js +0 -125
  321. package/dist/src/providers/openai/estimateRemoteTokens.test.js.map +0 -1
  322. package/dist/src/providers/openai/parseResponsesStream.responsesToolCalls.test.d.ts +0 -1
  323. package/dist/src/providers/openai/parseResponsesStream.responsesToolCalls.test.js +0 -192
  324. package/dist/src/providers/openai/parseResponsesStream.responsesToolCalls.test.js.map +0 -1
  325. package/dist/src/providers/openai/parseResponsesStream.test.d.ts +0 -1
  326. package/dist/src/providers/openai/parseResponsesStream.test.js +0 -151
  327. package/dist/src/providers/openai/parseResponsesStream.test.js.map +0 -1
  328. package/dist/src/services/fileDiscoveryService.test.d.ts +0 -6
  329. package/dist/src/services/fileDiscoveryService.test.js +0 -143
  330. package/dist/src/services/fileDiscoveryService.test.js.map +0 -1
  331. package/dist/src/services/gitService.test.d.ts +0 -6
  332. package/dist/src/services/gitService.test.js +0 -209
  333. package/dist/src/services/gitService.test.js.map +0 -1
  334. package/dist/src/services/loopDetectionService.test.d.ts +0 -6
  335. package/dist/src/services/loopDetectionService.test.js +0 -484
  336. package/dist/src/services/loopDetectionService.test.js.map +0 -1
  337. package/dist/src/services/shellExecutionService.multibyte.test.d.ts +0 -6
  338. package/dist/src/services/shellExecutionService.multibyte.test.js +0 -72
  339. package/dist/src/services/shellExecutionService.multibyte.test.js.map +0 -1
  340. package/dist/src/services/shellExecutionService.test.d.ts +0 -6
  341. package/dist/src/services/shellExecutionService.test.js +0 -272
  342. package/dist/src/services/shellExecutionService.test.js.map +0 -1
  343. package/dist/src/services/shellExecutionService.windows.multibyte.test.d.ts +0 -6
  344. package/dist/src/services/shellExecutionService.windows.multibyte.test.js +0 -98
  345. package/dist/src/services/shellExecutionService.windows.multibyte.test.js.map +0 -1
  346. package/dist/src/services/shellExecutionService.windows.test.d.ts +0 -6
  347. package/dist/src/services/shellExecutionService.windows.test.js +0 -79
  348. package/dist/src/services/shellExecutionService.windows.test.js.map +0 -1
  349. package/dist/src/services/tool-call-tracker-service.test.d.ts +0 -6
  350. package/dist/src/services/tool-call-tracker-service.test.js +0 -99
  351. package/dist/src/services/tool-call-tracker-service.test.js.map +0 -1
  352. package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.d.ts +0 -6
  353. package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js +0 -187
  354. package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js.map +0 -1
  355. package/dist/src/telemetry/loggers.test.d.ts +0 -6
  356. package/dist/src/telemetry/loggers.test.js +0 -573
  357. package/dist/src/telemetry/loggers.test.js.map +0 -1
  358. package/dist/src/telemetry/metrics.test.d.ts +0 -6
  359. package/dist/src/telemetry/metrics.test.js +0 -212
  360. package/dist/src/telemetry/metrics.test.js.map +0 -1
  361. package/dist/src/telemetry/telemetry.test.d.ts +0 -6
  362. package/dist/src/telemetry/telemetry.test.js +0 -54
  363. package/dist/src/telemetry/telemetry.test.js.map +0 -1
  364. package/dist/src/telemetry/uiTelemetry.test.d.ts +0 -6
  365. package/dist/src/telemetry/uiTelemetry.test.js +0 -518
  366. package/dist/src/telemetry/uiTelemetry.test.js.map +0 -1
  367. package/dist/src/tools/ToolFormatter.test.d.ts +0 -16
  368. package/dist/src/tools/ToolFormatter.test.js +0 -349
  369. package/dist/src/tools/ToolFormatter.test.js.map +0 -1
  370. package/dist/src/tools/ToolFormatter.toResponsesTool.test.d.ts +0 -1
  371. package/dist/src/tools/ToolFormatter.toResponsesTool.test.js +0 -241
  372. package/dist/src/tools/ToolFormatter.toResponsesTool.test.js.map +0 -1
  373. package/dist/src/tools/diffOptions.test.d.ts +0 -6
  374. package/dist/src/tools/diffOptions.test.js +0 -119
  375. package/dist/src/tools/diffOptions.test.js.map +0 -1
  376. package/dist/src/tools/edit.test.d.ts +0 -6
  377. package/dist/src/tools/edit.test.js +0 -689
  378. package/dist/src/tools/edit.test.js.map +0 -1
  379. package/dist/src/tools/glob.test.d.ts +0 -6
  380. package/dist/src/tools/glob.test.js +0 -332
  381. package/dist/src/tools/glob.test.js.map +0 -1
  382. package/dist/src/tools/grep.test.d.ts +0 -6
  383. package/dist/src/tools/grep.test.js +0 -272
  384. package/dist/src/tools/grep.test.js.map +0 -1
  385. package/dist/src/tools/ls.test.d.ts +0 -6
  386. package/dist/src/tools/ls.test.js +0 -357
  387. package/dist/src/tools/ls.test.js.map +0 -1
  388. package/dist/src/tools/mcp-client.test.d.ts +0 -6
  389. package/dist/src/tools/mcp-client.test.js +0 -617
  390. package/dist/src/tools/mcp-client.test.js.map +0 -1
  391. package/dist/src/tools/mcp-tool.test.d.ts +0 -6
  392. package/dist/src/tools/mcp-tool.test.js +0 -501
  393. package/dist/src/tools/mcp-tool.test.js.map +0 -1
  394. package/dist/src/tools/memoryTool.test.d.ts +0 -6
  395. package/dist/src/tools/memoryTool.test.js +0 -266
  396. package/dist/src/tools/memoryTool.test.js.map +0 -1
  397. package/dist/src/tools/modifiable-tool.test.d.ts +0 -6
  398. package/dist/src/tools/modifiable-tool.test.js +0 -193
  399. package/dist/src/tools/modifiable-tool.test.js.map +0 -1
  400. package/dist/src/tools/read-file.test.d.ts +0 -6
  401. package/dist/src/tools/read-file.test.js +0 -319
  402. package/dist/src/tools/read-file.test.js.map +0 -1
  403. package/dist/src/tools/read-many-files.test.d.ts +0 -6
  404. package/dist/src/tools/read-many-files.test.js +0 -644
  405. package/dist/src/tools/read-many-files.test.js.map +0 -1
  406. package/dist/src/tools/shell.multibyte.test.d.ts +0 -6
  407. package/dist/src/tools/shell.multibyte.test.js +0 -75
  408. package/dist/src/tools/shell.multibyte.test.js.map +0 -1
  409. package/dist/src/tools/shell.test.d.ts +0 -6
  410. package/dist/src/tools/shell.test.js +0 -367
  411. package/dist/src/tools/shell.test.js.map +0 -1
  412. package/dist/src/tools/todo-pause.spec.d.ts +0 -6
  413. package/dist/src/tools/todo-pause.spec.js +0 -287
  414. package/dist/src/tools/todo-pause.spec.js.map +0 -1
  415. package/dist/src/tools/todo-read.test.d.ts +0 -6
  416. package/dist/src/tools/todo-read.test.js +0 -162
  417. package/dist/src/tools/todo-read.test.js.map +0 -1
  418. package/dist/src/tools/todo-schemas.test.d.ts +0 -6
  419. package/dist/src/tools/todo-schemas.test.js +0 -341
  420. package/dist/src/tools/todo-schemas.test.js.map +0 -1
  421. package/dist/src/tools/todo-store.test.d.ts +0 -6
  422. package/dist/src/tools/todo-store.test.js +0 -169
  423. package/dist/src/tools/todo-store.test.js.map +0 -1
  424. package/dist/src/tools/todo-write.test.d.ts +0 -6
  425. package/dist/src/tools/todo-write.test.js +0 -226
  426. package/dist/src/tools/todo-write.test.js.map +0 -1
  427. package/dist/src/tools/tool-registry.test.d.ts +0 -6
  428. package/dist/src/tools/tool-registry.test.js +0 -468
  429. package/dist/src/tools/tool-registry.test.js.map +0 -1
  430. package/dist/src/tools/tools.test.d.ts +0 -6
  431. package/dist/src/tools/tools.test.js +0 -117
  432. package/dist/src/tools/tools.test.js.map +0 -1
  433. package/dist/src/tools/web-fetch.integration.test.d.ts +0 -6
  434. package/dist/src/tools/web-fetch.integration.test.js +0 -532
  435. package/dist/src/tools/web-fetch.integration.test.js.map +0 -1
  436. package/dist/src/tools/web-search.test.d.ts +0 -6
  437. package/dist/src/tools/web-search.test.js +0 -230
  438. package/dist/src/tools/web-search.test.js.map +0 -1
  439. package/dist/src/tools/write-file.test.d.ts +0 -6
  440. package/dist/src/tools/write-file.test.js +0 -465
  441. package/dist/src/tools/write-file.test.js.map +0 -1
  442. package/dist/src/utils/bfsFileSearch.test.d.ts +0 -6
  443. package/dist/src/utils/bfsFileSearch.test.js +0 -191
  444. package/dist/src/utils/bfsFileSearch.test.js.map +0 -1
  445. package/dist/src/utils/editCorrector.test.d.ts +0 -6
  446. package/dist/src/utils/editCorrector.test.js +0 -564
  447. package/dist/src/utils/editCorrector.test.js.map +0 -1
  448. package/dist/src/utils/editor.test.d.ts +0 -6
  449. package/dist/src/utils/editor.test.js +0 -445
  450. package/dist/src/utils/editor.test.js.map +0 -1
  451. package/dist/src/utils/environmentContext.test.d.ts +0 -6
  452. package/dist/src/utils/environmentContext.test.js +0 -139
  453. package/dist/src/utils/environmentContext.test.js.map +0 -1
  454. package/dist/src/utils/errorReporting.test.d.ts +0 -6
  455. package/dist/src/utils/errorReporting.test.js +0 -130
  456. package/dist/src/utils/errorReporting.test.js.map +0 -1
  457. package/dist/src/utils/fileUtils.test.d.ts +0 -6
  458. package/dist/src/utils/fileUtils.test.js +0 -363
  459. package/dist/src/utils/fileUtils.test.js.map +0 -1
  460. package/dist/src/utils/filesearch/crawlCache.test.d.ts +0 -6
  461. package/dist/src/utils/filesearch/crawlCache.test.js +0 -103
  462. package/dist/src/utils/filesearch/crawlCache.test.js.map +0 -1
  463. package/dist/src/utils/filesearch/fileSearch.test.d.ts +0 -6
  464. package/dist/src/utils/filesearch/fileSearch.test.js +0 -654
  465. package/dist/src/utils/filesearch/fileSearch.test.js.map +0 -1
  466. package/dist/src/utils/filesearch/ignore.test.d.ts +0 -6
  467. package/dist/src/utils/filesearch/ignore.test.js +0 -57
  468. package/dist/src/utils/filesearch/ignore.test.js.map +0 -1
  469. package/dist/src/utils/filesearch/result-cache.test.d.ts +0 -6
  470. package/dist/src/utils/filesearch/result-cache.test.js +0 -47
  471. package/dist/src/utils/filesearch/result-cache.test.js.map +0 -1
  472. package/dist/src/utils/flashFallback.integration.test.d.ts +0 -6
  473. package/dist/src/utils/flashFallback.integration.test.js +0 -120
  474. package/dist/src/utils/flashFallback.integration.test.js.map +0 -1
  475. package/dist/src/utils/generateContentResponseUtilities.test.d.ts +0 -6
  476. package/dist/src/utils/generateContentResponseUtilities.test.js +0 -273
  477. package/dist/src/utils/generateContentResponseUtilities.test.js.map +0 -1
  478. package/dist/src/utils/getFolderStructure.test.d.ts +0 -6
  479. package/dist/src/utils/getFolderStructure.test.js +0 -282
  480. package/dist/src/utils/getFolderStructure.test.js.map +0 -1
  481. package/dist/src/utils/gitIgnoreParser.test.d.ts +0 -6
  482. package/dist/src/utils/gitIgnoreParser.test.js +0 -154
  483. package/dist/src/utils/gitIgnoreParser.test.js.map +0 -1
  484. package/dist/src/utils/memoryDiscovery.test.d.ts +0 -6
  485. package/dist/src/utils/memoryDiscovery.test.js +0 -181
  486. package/dist/src/utils/memoryDiscovery.test.js.map +0 -1
  487. package/dist/src/utils/memoryImportProcessor.test.d.ts +0 -6
  488. package/dist/src/utils/memoryImportProcessor.test.js +0 -715
  489. package/dist/src/utils/memoryImportProcessor.test.js.map +0 -1
  490. package/dist/src/utils/nextSpeakerChecker.test.d.ts +0 -6
  491. package/dist/src/utils/nextSpeakerChecker.test.js +0 -172
  492. package/dist/src/utils/nextSpeakerChecker.test.js.map +0 -1
  493. package/dist/src/utils/partUtils.test.d.ts +0 -6
  494. package/dist/src/utils/partUtils.test.js +0 -130
  495. package/dist/src/utils/partUtils.test.js.map +0 -1
  496. package/dist/src/utils/paths.test.d.ts +0 -6
  497. package/dist/src/utils/paths.test.js +0 -153
  498. package/dist/src/utils/paths.test.js.map +0 -1
  499. package/dist/src/utils/retry.test.d.ts +0 -6
  500. package/dist/src/utils/retry.test.js +0 -322
  501. package/dist/src/utils/retry.test.js.map +0 -1
  502. package/dist/src/utils/safeJsonStringify.test.d.ts +0 -6
  503. package/dist/src/utils/safeJsonStringify.test.js +0 -61
  504. package/dist/src/utils/safeJsonStringify.test.js.map +0 -1
  505. package/dist/src/utils/sanitization.test.d.ts +0 -6
  506. package/dist/src/utils/sanitization.test.js +0 -81
  507. package/dist/src/utils/sanitization.test.js.map +0 -1
  508. package/dist/src/utils/schemaValidator.test.d.ts +0 -6
  509. package/dist/src/utils/schemaValidator.test.js +0 -146
  510. package/dist/src/utils/schemaValidator.test.js.map +0 -1
  511. package/dist/src/utils/secure-browser-launcher.test.d.ts +0 -6
  512. package/dist/src/utils/secure-browser-launcher.test.js +0 -149
  513. package/dist/src/utils/secure-browser-launcher.test.js.map +0 -1
  514. package/dist/src/utils/shell-utils.shellReplacement.test.d.ts +0 -6
  515. package/dist/src/utils/shell-utils.shellReplacement.test.js +0 -149
  516. package/dist/src/utils/shell-utils.shellReplacement.test.js.map +0 -1
  517. package/dist/src/utils/shell-utils.test.d.ts +0 -6
  518. package/dist/src/utils/shell-utils.test.js +0 -200
  519. package/dist/src/utils/shell-utils.test.js.map +0 -1
  520. package/dist/src/utils/summarizer.test.d.ts +0 -6
  521. package/dist/src/utils/summarizer.test.js +0 -131
  522. package/dist/src/utils/summarizer.test.js.map +0 -1
  523. package/dist/src/utils/systemEncoding.test.d.ts +0 -6
  524. package/dist/src/utils/systemEncoding.test.js +0 -368
  525. package/dist/src/utils/systemEncoding.test.js.map +0 -1
  526. package/dist/src/utils/toolOutputLimiter.test.d.ts +0 -6
  527. package/dist/src/utils/toolOutputLimiter.test.js +0 -164
  528. package/dist/src/utils/toolOutputLimiter.test.js.map +0 -1
  529. package/dist/src/utils/unicodeUtils.test.d.ts +0 -6
  530. package/dist/src/utils/unicodeUtils.test.js +0 -120
  531. package/dist/src/utils/unicodeUtils.test.js.map +0 -1
  532. package/dist/src/utils/user_account.test.d.ts +0 -6
  533. package/dist/src/utils/user_account.test.js +0 -153
  534. package/dist/src/utils/user_account.test.js.map +0 -1
  535. package/dist/src/utils/user_id.test.d.ts +0 -6
  536. package/dist/src/utils/user_id.test.js +0 -21
  537. package/dist/src/utils/user_id.test.js.map +0 -1
  538. package/dist/src/utils/workspaceContext.test.d.ts +0 -6
  539. package/dist/src/utils/workspaceContext.test.js +0 -209
  540. package/dist/src/utils/workspaceContext.test.js.map +0 -1
@@ -1,519 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest';
7
- import { ContextState, SubAgentScope, SubagentTerminateMode, } from './subagent.js';
8
- import { Config } from '../config/config.js';
9
- import { GeminiChat } from './geminiChat.js';
10
- import { createContentGenerator, AuthType } from './contentGenerator.js';
11
- import { getEnvironmentContext } from '../utils/environmentContext.js';
12
- import { executeToolCall } from './nonInteractiveToolExecutor.js';
13
- import { DEFAULT_GEMINI_MODEL } from '../config/models.js';
14
- import { Type, } from '@google/genai';
15
- import { ToolErrorType } from '../tools/tool-error.js';
16
- vi.mock('./geminiChat.js');
17
- vi.mock('./contentGenerator.js');
18
- vi.mock('../utils/environmentContext.js');
19
- vi.mock('./nonInteractiveToolExecutor.js');
20
- vi.mock('../ide/ide-client.js');
21
- async function createMockConfig(toolRegistryMocks = {}) {
22
- const configParams = {
23
- sessionId: 'test-session',
24
- model: DEFAULT_GEMINI_MODEL,
25
- targetDir: '.',
26
- debugMode: false,
27
- cwd: process.cwd(),
28
- };
29
- const config = new Config(configParams);
30
- await config.initialize();
31
- await config.refreshAuth(AuthType.USE_PROVIDER);
32
- // Mock getContentGeneratorConfig to return a valid config
33
- vi.spyOn(config, 'getContentGeneratorConfig').mockReturnValue({
34
- model: DEFAULT_GEMINI_MODEL,
35
- authType: AuthType.USE_PROVIDER,
36
- });
37
- // Mock ToolRegistry
38
- const mockToolRegistry = {
39
- getTool: vi.fn(),
40
- getFunctionDeclarationsFiltered: vi.fn().mockReturnValue([]),
41
- ...toolRegistryMocks,
42
- };
43
- vi.spyOn(config, 'getToolRegistry').mockResolvedValue(mockToolRegistry);
44
- return { config, toolRegistry: mockToolRegistry };
45
- }
46
- // Helper to simulate LLM responses (sequence of tool calls over multiple turns)
47
- const createMockStream = (functionCallsList) => {
48
- let index = 0;
49
- return vi.fn().mockImplementation(() => {
50
- const response = functionCallsList[index] || 'stop';
51
- index++;
52
- return (async function* () {
53
- if (response === 'stop') {
54
- // When stopping, the model might return text, but the subagent logic primarily cares about the absence of functionCalls.
55
- yield { text: 'Done.' };
56
- }
57
- else if (response.length > 0) {
58
- yield { functionCalls: response };
59
- }
60
- else {
61
- yield { text: 'Done.' }; // Handle empty array also as stop
62
- }
63
- })();
64
- });
65
- };
66
- describe('subagent.ts', () => {
67
- describe('ContextState', () => {
68
- it('should set and get values correctly', () => {
69
- const context = new ContextState();
70
- context.set('key1', 'value1');
71
- context.set('key2', 123);
72
- expect(context.get('key1')).toBe('value1');
73
- expect(context.get('key2')).toBe(123);
74
- expect(context.get_keys()).toEqual(['key1', 'key2']);
75
- });
76
- it('should return undefined for missing keys', () => {
77
- const context = new ContextState();
78
- expect(context.get('missing')).toBeUndefined();
79
- });
80
- });
81
- describe('SubAgentScope', () => {
82
- let mockSendMessageStream;
83
- const defaultModelConfig = {
84
- model: 'gemini-1.5-flash-latest',
85
- temp: 0.5, // Specific temp to test override
86
- top_p: 1,
87
- };
88
- const defaultRunConfig = {
89
- max_time_minutes: 5,
90
- max_turns: 10,
91
- };
92
- beforeEach(async () => {
93
- vi.clearAllMocks();
94
- vi.mocked(getEnvironmentContext).mockResolvedValue([
95
- { text: 'Env Context' },
96
- ]);
97
- vi.mocked(createContentGenerator).mockResolvedValue({
98
- getGenerativeModel: vi.fn(),
99
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
100
- });
101
- mockSendMessageStream = vi.fn();
102
- // We mock the implementation of the constructor.
103
- vi.mocked(GeminiChat).mockImplementation(() => ({
104
- sendMessageStream: mockSendMessageStream,
105
- }));
106
- });
107
- afterEach(() => {
108
- vi.restoreAllMocks();
109
- });
110
- // Helper to safely access generationConfig from mock calls
111
- const getGenerationConfigFromMock = (callIndex = 0) => {
112
- const callArgs = vi.mocked(GeminiChat).mock.calls[callIndex];
113
- const generationConfig = callArgs?.[2];
114
- // Ensure it's defined before proceeding
115
- expect(generationConfig).toBeDefined();
116
- if (!generationConfig)
117
- throw new Error('generationConfig is undefined');
118
- return generationConfig;
119
- };
120
- describe('create (Tool Validation)', () => {
121
- const promptConfig = { systemPrompt: 'Test prompt' };
122
- it('should create a SubAgentScope successfully with minimal config', async () => {
123
- const { config } = await createMockConfig();
124
- const scope = await SubAgentScope.create('test-agent', config, promptConfig, defaultModelConfig, defaultRunConfig);
125
- expect(scope).toBeInstanceOf(SubAgentScope);
126
- });
127
- it('should throw an error if a tool requires confirmation', async () => {
128
- const mockTool = {
129
- schema: { parameters: { type: Type.OBJECT, properties: {} } },
130
- build: vi.fn().mockReturnValue({
131
- shouldConfirmExecute: vi.fn().mockResolvedValue({
132
- type: 'exec',
133
- title: 'Confirm',
134
- command: 'rm -rf /',
135
- }),
136
- }),
137
- };
138
- const { config } = await createMockConfig({
139
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
140
- getTool: vi.fn().mockReturnValue(mockTool),
141
- });
142
- const toolConfig = { tools: ['risky_tool'] };
143
- await expect(SubAgentScope.create('test-agent', config, promptConfig, defaultModelConfig, defaultRunConfig, toolConfig)).rejects.toThrow('Tool "risky_tool" requires user confirmation and cannot be used in a non-interactive subagent.');
144
- });
145
- it('should succeed if tools do not require confirmation', async () => {
146
- const mockTool = {
147
- schema: { parameters: { type: Type.OBJECT, properties: {} } },
148
- build: vi.fn().mockReturnValue({
149
- shouldConfirmExecute: vi.fn().mockResolvedValue(null),
150
- }),
151
- };
152
- const { config } = await createMockConfig({
153
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
154
- getTool: vi.fn().mockReturnValue(mockTool),
155
- });
156
- const toolConfig = { tools: ['safe_tool'] };
157
- const scope = await SubAgentScope.create('test-agent', config, promptConfig, defaultModelConfig, defaultRunConfig, toolConfig);
158
- expect(scope).toBeInstanceOf(SubAgentScope);
159
- });
160
- it('should skip interactivity check and warn for tools with required parameters', async () => {
161
- const consoleWarnSpy = vi
162
- .spyOn(console, 'warn')
163
- .mockImplementation(() => { });
164
- const mockToolWithParams = {
165
- schema: {
166
- parameters: {
167
- type: Type.OBJECT,
168
- properties: {
169
- path: { type: Type.STRING },
170
- },
171
- required: ['path'],
172
- },
173
- },
174
- // build should not be called, but we mock it to be safe
175
- build: vi.fn(),
176
- };
177
- const { config } = await createMockConfig({
178
- getTool: vi.fn().mockReturnValue(mockToolWithParams),
179
- });
180
- const toolConfig = { tools: ['tool_with_params'] };
181
- // The creation should succeed without throwing
182
- const scope = await SubAgentScope.create('test-agent', config, promptConfig, defaultModelConfig, defaultRunConfig, toolConfig);
183
- expect(scope).toBeInstanceOf(SubAgentScope);
184
- // Check that the warning was logged
185
- expect(consoleWarnSpy).toHaveBeenCalledWith('Cannot check tool "tool_with_params" for interactivity because it requires parameters. Assuming it is safe for non-interactive use.');
186
- // Ensure build was never called
187
- expect(mockToolWithParams.build).not.toHaveBeenCalled();
188
- consoleWarnSpy.mockRestore();
189
- });
190
- });
191
- describe('runNonInteractive - Initialization and Prompting', () => {
192
- it('should correctly template the system prompt and initialize GeminiChat', async () => {
193
- const { config } = await createMockConfig();
194
- vi.mocked(GeminiChat).mockClear();
195
- const promptConfig = {
196
- systemPrompt: 'Hello ${name}, your task is ${task}.',
197
- };
198
- const context = new ContextState();
199
- context.set('name', 'Agent');
200
- context.set('task', 'Testing');
201
- // Model stops immediately
202
- mockSendMessageStream.mockImplementation(createMockStream(['stop']));
203
- const scope = await SubAgentScope.create('test-agent', config, promptConfig, defaultModelConfig, defaultRunConfig);
204
- await scope.runNonInteractive(context);
205
- // Check if GeminiChat was initialized correctly by the subagent
206
- expect(GeminiChat).toHaveBeenCalledTimes(1);
207
- const callArgs = vi.mocked(GeminiChat).mock.calls[0];
208
- // Check Generation Config
209
- const generationConfig = getGenerationConfigFromMock();
210
- // Check temperature override
211
- expect(generationConfig.temperature).toBe(defaultModelConfig.temp);
212
- expect(generationConfig.systemInstruction).toContain('Hello Agent, your task is Testing.');
213
- expect(generationConfig.systemInstruction).toContain('Important Rules:');
214
- // Check History (should include environment context)
215
- const history = callArgs[3];
216
- expect(history).toEqual([
217
- { role: 'user', parts: [{ text: 'Env Context' }] },
218
- {
219
- role: 'model',
220
- parts: [{ text: 'Got it. Thanks for the context!' }],
221
- },
222
- ]);
223
- });
224
- it('should include output instructions in the system prompt when outputs are defined', async () => {
225
- const { config } = await createMockConfig();
226
- vi.mocked(GeminiChat).mockClear();
227
- const promptConfig = { systemPrompt: 'Do the task.' };
228
- const outputConfig = {
229
- outputs: {
230
- result1: 'The first result',
231
- },
232
- };
233
- const context = new ContextState();
234
- // Model stops immediately
235
- mockSendMessageStream.mockImplementation(createMockStream(['stop']));
236
- const scope = await SubAgentScope.create('test-agent', config, promptConfig, defaultModelConfig, defaultRunConfig, undefined, // ToolConfig
237
- outputConfig);
238
- await scope.runNonInteractive(context);
239
- const generationConfig = getGenerationConfigFromMock();
240
- const systemInstruction = generationConfig.systemInstruction;
241
- expect(systemInstruction).toContain('Do the task.');
242
- expect(systemInstruction).toContain('you MUST emit the required output variables');
243
- expect(systemInstruction).toContain("Use 'self.emitvalue' to emit the 'result1' key");
244
- });
245
- it('should use initialMessages instead of systemPrompt if provided', async () => {
246
- const { config } = await createMockConfig();
247
- vi.mocked(GeminiChat).mockClear();
248
- const initialMessages = [
249
- { role: 'user', parts: [{ text: 'Hi' }] },
250
- ];
251
- const promptConfig = { initialMessages };
252
- const context = new ContextState();
253
- // Model stops immediately
254
- mockSendMessageStream.mockImplementation(createMockStream(['stop']));
255
- const scope = await SubAgentScope.create('test-agent', config, promptConfig, defaultModelConfig, defaultRunConfig);
256
- await scope.runNonInteractive(context);
257
- const callArgs = vi.mocked(GeminiChat).mock.calls[0];
258
- const generationConfig = getGenerationConfigFromMock();
259
- const history = callArgs[3];
260
- expect(generationConfig.systemInstruction).toBeUndefined();
261
- expect(history).toEqual([
262
- { role: 'user', parts: [{ text: 'Env Context' }] },
263
- {
264
- role: 'model',
265
- parts: [{ text: 'Got it. Thanks for the context!' }],
266
- },
267
- ...initialMessages,
268
- ]);
269
- });
270
- it('should throw an error if template variables are missing', async () => {
271
- const { config } = await createMockConfig();
272
- const promptConfig = {
273
- systemPrompt: 'Hello ${name}, you are missing ${missing}.',
274
- };
275
- const context = new ContextState();
276
- context.set('name', 'Agent');
277
- // 'missing' is not set
278
- const scope = await SubAgentScope.create('test-agent', config, promptConfig, defaultModelConfig, defaultRunConfig);
279
- // The error from templating causes the runNonInteractive to reject and the terminate_reason to be ERROR.
280
- await expect(scope.runNonInteractive(context)).rejects.toThrow('Missing context values for the following keys: missing');
281
- expect(scope.output.terminate_reason).toBe(SubagentTerminateMode.ERROR);
282
- });
283
- it('should validate that systemPrompt and initialMessages are mutually exclusive', async () => {
284
- const { config } = await createMockConfig();
285
- const promptConfig = {
286
- systemPrompt: 'System',
287
- initialMessages: [{ role: 'user', parts: [{ text: 'Hi' }] }],
288
- };
289
- const context = new ContextState();
290
- const agent = await SubAgentScope.create('TestAgent', config, promptConfig, defaultModelConfig, defaultRunConfig);
291
- await expect(agent.runNonInteractive(context)).rejects.toThrow('PromptConfig cannot have both `systemPrompt` and `initialMessages` defined.');
292
- expect(agent.output.terminate_reason).toBe(SubagentTerminateMode.ERROR);
293
- });
294
- });
295
- describe('runNonInteractive - Execution and Tool Use', () => {
296
- const promptConfig = { systemPrompt: 'Execute task.' };
297
- it('should terminate with GOAL if no outputs are expected and model stops', async () => {
298
- const { config } = await createMockConfig();
299
- // Model stops immediately
300
- mockSendMessageStream.mockImplementation(createMockStream(['stop']));
301
- const scope = await SubAgentScope.create('test-agent', config, promptConfig, defaultModelConfig, defaultRunConfig);
302
- await scope.runNonInteractive(new ContextState());
303
- expect(scope.output.terminate_reason).toBe(SubagentTerminateMode.GOAL);
304
- expect(scope.output.emitted_vars).toEqual({});
305
- expect(mockSendMessageStream).toHaveBeenCalledTimes(1);
306
- // Check the initial message
307
- expect(mockSendMessageStream.mock.calls[0][0].message).toEqual([
308
- { text: 'Get Started!' },
309
- ]);
310
- });
311
- it('should handle self.emitvalue and terminate with GOAL when outputs are met', async () => {
312
- const { config } = await createMockConfig();
313
- const outputConfig = {
314
- outputs: { result: 'The final result' },
315
- };
316
- // Turn 1: Model responds with emitvalue call
317
- // Turn 2: Model stops after receiving the tool response
318
- mockSendMessageStream.mockImplementation(createMockStream([
319
- [
320
- {
321
- name: 'self.emitvalue',
322
- args: {
323
- emit_variable_name: 'result',
324
- emit_variable_value: 'Success!',
325
- },
326
- },
327
- ],
328
- 'stop',
329
- ]));
330
- const scope = await SubAgentScope.create('test-agent', config, promptConfig, defaultModelConfig, defaultRunConfig, undefined, outputConfig);
331
- await scope.runNonInteractive(new ContextState());
332
- expect(scope.output.terminate_reason).toBe(SubagentTerminateMode.GOAL);
333
- expect(scope.output.emitted_vars).toEqual({ result: 'Success!' });
334
- expect(mockSendMessageStream).toHaveBeenCalledTimes(2);
335
- // Check the tool response sent back in the second call
336
- const secondCallArgs = mockSendMessageStream.mock.calls[1][0];
337
- expect(secondCallArgs.message).toEqual([
338
- { text: 'Emitted variable result successfully' },
339
- ]);
340
- });
341
- it('should execute external tools and provide the response to the model', async () => {
342
- const listFilesToolDef = {
343
- name: 'list_files',
344
- description: 'Lists files',
345
- parameters: { type: Type.OBJECT, properties: {} },
346
- };
347
- const { config, toolRegistry } = await createMockConfig({
348
- getFunctionDeclarationsFiltered: vi
349
- .fn()
350
- .mockReturnValue([listFilesToolDef]),
351
- });
352
- const toolConfig = { tools: ['list_files'] };
353
- // Turn 1: Model calls the external tool
354
- // Turn 2: Model stops
355
- mockSendMessageStream.mockImplementation(createMockStream([
356
- [
357
- {
358
- id: 'call_1',
359
- name: 'list_files',
360
- args: { path: '.' },
361
- },
362
- ],
363
- 'stop',
364
- ]));
365
- // Mock the tool execution result
366
- vi.mocked(executeToolCall).mockResolvedValue({
367
- callId: 'call_1',
368
- responseParts: 'file1.txt\nfile2.ts',
369
- resultDisplay: 'Listed 2 files',
370
- error: undefined,
371
- errorType: undefined, // Or ToolErrorType.NONE if available and appropriate
372
- });
373
- const scope = await SubAgentScope.create('test-agent', config, promptConfig, defaultModelConfig, defaultRunConfig, toolConfig);
374
- await scope.runNonInteractive(new ContextState());
375
- // Check tool execution
376
- expect(executeToolCall).toHaveBeenCalledWith(config, expect.objectContaining({ name: 'list_files', args: { path: '.' } }), toolRegistry, expect.any(AbortSignal));
377
- // Check the response sent back to the model
378
- const secondCallArgs = mockSendMessageStream.mock.calls[1][0];
379
- expect(secondCallArgs.message).toEqual([
380
- { text: 'file1.txt\nfile2.ts' },
381
- ]);
382
- expect(scope.output.terminate_reason).toBe(SubagentTerminateMode.GOAL);
383
- });
384
- it('should provide specific tool error responses to the model', async () => {
385
- const { config } = await createMockConfig();
386
- const toolConfig = { tools: ['failing_tool'] };
387
- // Turn 1: Model calls the failing tool
388
- // Turn 2: Model stops after receiving the error response
389
- mockSendMessageStream.mockImplementation(createMockStream([
390
- [
391
- {
392
- id: 'call_fail',
393
- name: 'failing_tool',
394
- args: {},
395
- },
396
- ],
397
- 'stop',
398
- ]));
399
- // Mock the tool execution failure.
400
- vi.mocked(executeToolCall).mockResolvedValue({
401
- callId: 'call_fail',
402
- responseParts: 'ERROR: Tool failed catastrophically', // This should be sent to the model
403
- resultDisplay: 'Tool failed catastrophically',
404
- error: new Error('Failure'),
405
- errorType: ToolErrorType.INVALID_TOOL_PARAMS,
406
- });
407
- const scope = await SubAgentScope.create('test-agent', config, promptConfig, defaultModelConfig, defaultRunConfig, toolConfig);
408
- await scope.runNonInteractive(new ContextState());
409
- // The agent should send the specific error message from responseParts.
410
- const secondCallArgs = mockSendMessageStream.mock.calls[1][0];
411
- expect(secondCallArgs.message).toEqual([
412
- {
413
- text: 'ERROR: Tool failed catastrophically',
414
- },
415
- ]);
416
- });
417
- it('should nudge the model if it stops before emitting all required variables', async () => {
418
- const { config } = await createMockConfig();
419
- const outputConfig = {
420
- outputs: { required_var: 'Must be present' },
421
- };
422
- // Turn 1: Model stops prematurely
423
- // Turn 2: Model responds to the nudge and emits the variable
424
- // Turn 3: Model stops
425
- mockSendMessageStream.mockImplementation(createMockStream([
426
- 'stop',
427
- [
428
- {
429
- name: 'self.emitvalue',
430
- args: {
431
- emit_variable_name: 'required_var',
432
- emit_variable_value: 'Here it is',
433
- },
434
- },
435
- ],
436
- 'stop',
437
- ]));
438
- const scope = await SubAgentScope.create('test-agent', config, promptConfig, defaultModelConfig, defaultRunConfig, undefined, outputConfig);
439
- await scope.runNonInteractive(new ContextState());
440
- // Check the nudge message sent in Turn 2
441
- const secondCallArgs = mockSendMessageStream.mock.calls[1][0];
442
- // We check that the message contains the required variable name and the nudge phrasing.
443
- expect(secondCallArgs.message[0].text).toContain('required_var');
444
- expect(secondCallArgs.message[0].text).toContain('You have stopped calling tools');
445
- expect(scope.output.terminate_reason).toBe(SubagentTerminateMode.GOAL);
446
- expect(scope.output.emitted_vars).toEqual({
447
- required_var: 'Here it is',
448
- });
449
- expect(mockSendMessageStream).toHaveBeenCalledTimes(3);
450
- });
451
- });
452
- describe('runNonInteractive - Termination and Recovery', () => {
453
- const promptConfig = { systemPrompt: 'Execute task.' };
454
- it('should terminate with MAX_TURNS if the limit is reached', async () => {
455
- const { config } = await createMockConfig();
456
- const runConfig = { ...defaultRunConfig, max_turns: 2 };
457
- // Model keeps looping by calling emitvalue repeatedly
458
- mockSendMessageStream.mockImplementation(createMockStream([
459
- [
460
- {
461
- name: 'self.emitvalue',
462
- args: { emit_variable_name: 'loop', emit_variable_value: 'v1' },
463
- },
464
- ],
465
- [
466
- {
467
- name: 'self.emitvalue',
468
- args: { emit_variable_name: 'loop', emit_variable_value: 'v2' },
469
- },
470
- ],
471
- // This turn should not happen
472
- [
473
- {
474
- name: 'self.emitvalue',
475
- args: { emit_variable_name: 'loop', emit_variable_value: 'v3' },
476
- },
477
- ],
478
- ]));
479
- const scope = await SubAgentScope.create('test-agent', config, promptConfig, defaultModelConfig, runConfig);
480
- await scope.runNonInteractive(new ContextState());
481
- expect(mockSendMessageStream).toHaveBeenCalledTimes(2);
482
- expect(scope.output.terminate_reason).toBe(SubagentTerminateMode.MAX_TURNS);
483
- });
484
- it('should terminate with TIMEOUT if the time limit is reached during an LLM call', async () => {
485
- // Use fake timers to reliably test timeouts
486
- vi.useFakeTimers();
487
- const { config } = await createMockConfig();
488
- const runConfig = { max_time_minutes: 5, max_turns: 100 };
489
- // We need to control the resolution of the sendMessageStream promise to advance the timer during execution.
490
- let resolveStream;
491
- const streamPromise = new Promise((resolve) => {
492
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
493
- resolveStream = resolve;
494
- });
495
- // The LLM call will hang until we resolve the promise.
496
- mockSendMessageStream.mockReturnValue(streamPromise);
497
- const scope = await SubAgentScope.create('test-agent', config, promptConfig, defaultModelConfig, runConfig);
498
- const runPromise = scope.runNonInteractive(new ContextState());
499
- // Advance time beyond the limit (6 minutes) while the agent is awaiting the LLM response.
500
- await vi.advanceTimersByTimeAsync(6 * 60 * 1000);
501
- // Now resolve the stream. The model returns 'stop'.
502
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
503
- resolveStream(createMockStream(['stop'])());
504
- await runPromise;
505
- expect(scope.output.terminate_reason).toBe(SubagentTerminateMode.TIMEOUT);
506
- expect(mockSendMessageStream).toHaveBeenCalledTimes(1);
507
- vi.useRealTimers();
508
- });
509
- it('should terminate with ERROR if the model call throws', async () => {
510
- const { config } = await createMockConfig();
511
- mockSendMessageStream.mockRejectedValue(new Error('API Failure'));
512
- const scope = await SubAgentScope.create('test-agent', config, promptConfig, defaultModelConfig, defaultRunConfig);
513
- await expect(scope.runNonInteractive(new ContextState())).rejects.toThrow('API Failure');
514
- expect(scope.output.terminate_reason).toBe(SubagentTerminateMode.ERROR);
515
- });
516
- });
517
- });
518
- });
519
- //# sourceMappingURL=subagent.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"subagent.test.js","sourceRoot":"","sources":["../../../src/core/subagent.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAQ,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC/E,OAAO,EACL,YAAY,EACZ,aAAa,EACb,qBAAqB,GAMtB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAoB,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAA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EH,EAAE,CAAC,sDAAsD,EAAE,KAAK,IAAI,EAAE;gBACpE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,gBAAgB,EAAE,CAAC;gBAC5C,qBAAqB,CAAC,iBAAiB,CAAC,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;gBAElE,MAAM,KAAK,GAAG,MAAM,aAAa,CAAC,MAAM,CACtC,YAAY,EACZ,MAAM,EACN,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,CACjB,CAAC;gBAEF,MAAM,MAAM,CACV,KAAK,CAAC,iBAAiB,CAAC,IAAI,YAAY,EAAE,CAAC,CAC5C,CAAC,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;gBACjC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;YAC1E,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,6 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- export {};
@@ -1,66 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import { describe, it, expect } from 'vitest';
7
- import { tokenLimit, DEFAULT_TOKEN_LIMIT } from './tokenLimits.js';
8
- describe('tokenLimit', () => {
9
- describe('Gemini models', () => {
10
- it('should return correct limit for gemini-1.5-pro', () => {
11
- expect(tokenLimit('gemini-1.5-pro')).toBe(2_097_152);
12
- });
13
- it('should return correct limit for gemini-1.5-flash', () => {
14
- expect(tokenLimit('gemini-1.5-flash')).toBe(1_048_576);
15
- });
16
- it('should return correct limit for gemini-2.0-flash', () => {
17
- expect(tokenLimit('gemini-2.0-flash')).toBe(1_048_576);
18
- });
19
- });
20
- describe('OpenAI models', () => {
21
- it('should return correct limit for o3', () => {
22
- expect(tokenLimit('o3')).toBe(200_000);
23
- });
24
- it('should return correct limit for o3-mini', () => {
25
- expect(tokenLimit('o3-mini')).toBe(200_000);
26
- });
27
- it('should return correct limit for o4-mini', () => {
28
- expect(tokenLimit('o4-mini')).toBe(128_000);
29
- });
30
- it('should return correct limit for gpt-4.1', () => {
31
- expect(tokenLimit('gpt-4.1')).toBe(1_000_000);
32
- });
33
- it('should return correct limit for gpt-4o', () => {
34
- expect(tokenLimit('gpt-4o')).toBe(128_000);
35
- });
36
- it('should return correct limit for gpt-4o-mini', () => {
37
- expect(tokenLimit('gpt-4o-mini')).toBe(128_000);
38
- });
39
- it('should return correct limit for o1', () => {
40
- expect(tokenLimit('o1')).toBe(200_000);
41
- });
42
- it('should return correct limit for o1-mini', () => {
43
- expect(tokenLimit('o1-mini')).toBe(200_000);
44
- });
45
- });
46
- describe('Default behavior', () => {
47
- it('should return default limit for unknown models', () => {
48
- expect(tokenLimit('unknown-model')).toBe(DEFAULT_TOKEN_LIMIT);
49
- });
50
- it('should return default limit for empty string', () => {
51
- expect(tokenLimit('')).toBe(DEFAULT_TOKEN_LIMIT);
52
- });
53
- });
54
- describe('Provider-prefixed models', () => {
55
- it('should handle OpenAI provider prefix', () => {
56
- expect(tokenLimit('openai:gpt-4o')).toBe(128_000);
57
- expect(tokenLimit('openai:gpt-4o-mini')).toBe(128_000);
58
- expect(tokenLimit('openai:o1')).toBe(200_000);
59
- });
60
- it('should handle Gemini provider prefix', () => {
61
- expect(tokenLimit('gemini:gemini-1.5-pro')).toBe(2_097_152);
62
- expect(tokenLimit('gemini:gemini-1.5-flash')).toBe(1_048_576);
63
- });
64
- });
65
- });
66
- //# sourceMappingURL=tokenLimits.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tokenLimits.test.js","sourceRoot":"","sources":["../../../src/core/tokenLimits.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE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