@google/adk 2.4.0 → 2.5.0

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 (326) hide show
  1. package/dist/cjs/a2a/a2a_remote_agent.js +17 -2
  2. package/dist/cjs/a2a/a2a_remote_agent_utils.js +8 -4
  3. package/dist/cjs/a2a/agent_card.js +5 -81
  4. package/dist/cjs/a2a/agent_to_a2a.js +7 -0
  5. package/dist/cjs/a2a/event_converter_utils.js +10 -3
  6. package/dist/cjs/agents/agent_engine_client.js +282 -55
  7. package/dist/cjs/agents/base_agent.js +111 -68
  8. package/dist/cjs/agents/functions.js +62 -85
  9. package/dist/cjs/agents/instructions.js +7 -6
  10. package/dist/cjs/agents/invocation_context.js +2 -2
  11. package/dist/cjs/agents/llm_agent.js +105 -95
  12. package/dist/cjs/agents/processors/content_processor_utils.js +42 -15
  13. package/dist/cjs/agents/processors/content_request_processor.js +28 -11
  14. package/dist/cjs/agents/processors/context_compactor_request_processor.js +5 -1
  15. package/dist/cjs/agents/processors/instructions_llm_request_processor.js +1 -1
  16. package/dist/cjs/agents/processors/nl_planning_processor.js +2 -1
  17. package/dist/cjs/artifacts/file_artifact_service.js +1 -1
  18. package/dist/cjs/cli/cli_eval.js +884 -17
  19. package/dist/cjs/cli/utils/cleanup.js +84 -0
  20. package/dist/cjs/cli/utils/envs.js +33 -2
  21. package/dist/cjs/cli/utils/evals.js +75 -8
  22. package/dist/cjs/cli/utils/logs.js +128 -9
  23. package/dist/cjs/cli/utils/path_validation.js +83 -0
  24. package/dist/cjs/code_executors/container_code_executor.js +158 -36
  25. package/dist/cjs/common.js +50 -12
  26. package/dist/cjs/context/compaction_utils.js +19 -0
  27. package/dist/cjs/events/event.js +7 -3
  28. package/dist/cjs/features/feature_registry.js +5 -0
  29. package/dist/cjs/index.js +29 -14
  30. package/dist/cjs/models/google_llm.js +33 -2
  31. package/dist/cjs/models/interactions_utils.js +3 -0
  32. package/dist/cjs/plugins/base_plugin.js +45 -21
  33. package/dist/cjs/plugins/plugin_manager.js +27 -0
  34. package/dist/cjs/runner/runner.js +306 -189
  35. package/dist/cjs/sessions/base_session_service.js +1 -4
  36. package/dist/cjs/sessions/database_session_service.js +191 -19
  37. package/dist/cjs/sessions/db/operations.js +70 -1
  38. package/dist/cjs/sessions/db/schema.js +4 -0
  39. package/dist/cjs/sessions/in_memory_session_service.js +2 -2
  40. package/dist/cjs/sessions/vertex_ai_session_service.js +11 -3
  41. package/dist/cjs/skills/loader.js +29 -28
  42. package/dist/cjs/telemetry/api/instrumentation.js +632 -0
  43. package/dist/cjs/telemetry/api/internal/common/accumulators.js +169 -0
  44. package/dist/cjs/telemetry/api/internal/common/attributes.js +131 -0
  45. package/dist/cjs/telemetry/api/internal/common/config.js +159 -0
  46. package/dist/cjs/telemetry/api/internal/common/error.js +98 -0
  47. package/dist/cjs/telemetry/api/internal/common/finish_reason.js +63 -0
  48. package/dist/cjs/telemetry/api/internal/common/genai_messages.js +217 -0
  49. package/dist/cjs/telemetry/api/internal/common/http_exchange.js +169 -0
  50. package/dist/cjs/telemetry/api/internal/common/provider_name.js +87 -0
  51. package/dist/cjs/telemetry/api/internal/common/redaction.js +148 -0
  52. package/dist/cjs/telemetry/api/internal/common/serialization.js +58 -0
  53. package/dist/cjs/telemetry/api/internal/common/token_usage.js +118 -0
  54. package/dist/cjs/telemetry/api/internal/logs/inference.js +50 -0
  55. package/dist/cjs/telemetry/api/internal/logs/logger.js +46 -0
  56. package/dist/cjs/telemetry/api/internal/logs/mcp.js +141 -0
  57. package/dist/cjs/telemetry/api/internal/metrics/agent.js +128 -0
  58. package/dist/cjs/telemetry/api/internal/metrics/inference_start_hook.js +56 -0
  59. package/dist/cjs/telemetry/api/internal/metrics/meters.js +189 -0
  60. package/dist/cjs/telemetry/api/internal/metrics/tool.js +147 -0
  61. package/dist/cjs/telemetry/api/internal/metrics/workflow.js +132 -0
  62. package/dist/cjs/telemetry/api/internal/trace/agent.js +52 -0
  63. package/dist/cjs/telemetry/api/internal/trace/compaction.js +78 -0
  64. package/dist/cjs/telemetry/api/internal/trace/inference.js +132 -0
  65. package/dist/cjs/telemetry/api/internal/trace/live.js +52 -0
  66. package/dist/cjs/telemetry/api/internal/trace/node.js +73 -0
  67. package/dist/cjs/telemetry/api/internal/trace/propagation.js +67 -0
  68. package/dist/cjs/telemetry/api/internal/trace/tool.js +122 -0
  69. package/dist/cjs/telemetry/api/internal/trace/tracer.js +77 -0
  70. package/dist/cjs/telemetry/api/internal/trace/workflow.js +77 -0
  71. package/dist/cjs/telemetry/export/agent_engine.js +90 -0
  72. package/dist/cjs/telemetry/export/agent_runtime.js +73 -0
  73. package/dist/cjs/telemetry/export/google_cloud.js +763 -0
  74. package/dist/cjs/telemetry/export/request_driven_metric_reader.js +303 -0
  75. package/dist/cjs/telemetry/{setup.js → export/setup.js} +72 -5
  76. package/dist/cjs/tools/agent_tool.js +9 -1
  77. package/dist/cjs/tools/application_integration_tool/application_integration_toolset.js +22 -34
  78. package/dist/cjs/tools/application_integration_tool/clients/connections_client.js +60 -20
  79. package/dist/cjs/tools/application_integration_tool/clients/integration_client.js +26 -10
  80. package/dist/cjs/tools/application_integration_tool/integration_connector_tool.js +14 -23
  81. package/dist/cjs/tools/base_toolset.js +1 -1
  82. package/dist/cjs/tools/computer_use/base_computer.js +125 -0
  83. package/dist/cjs/tools/computer_use/computer_use_actions.js +502 -0
  84. package/dist/cjs/tools/computer_use/computer_use_tool.js +244 -0
  85. package/dist/cjs/tools/computer_use/computer_use_toolset.js +360 -0
  86. package/dist/cjs/tools/function_tool.js +15 -5
  87. package/dist/cjs/tools/google_api_tool/google_api_toolset.js +3 -2
  88. package/dist/cjs/tools/google_api_tool/googleapi_to_openapi_converter.js +3 -1
  89. package/dist/cjs/tools/load_artifacts_tool.js +15 -5
  90. package/dist/cjs/tools/load_memory_tool.js +2 -5
  91. package/dist/cjs/tools/mcp/mcp_session_manager.js +23 -3
  92. package/dist/cjs/tools/mcp/mcp_tool.js +7 -3
  93. package/dist/cjs/tools/mcp/mcp_toolset.js +18 -6
  94. package/dist/cjs/tools/openapi_tool/auth/auth_helpers.js +30 -29
  95. package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +2 -2
  96. package/dist/cjs/tools/openapi_tool/rest_api_tool.js +45 -14
  97. package/dist/cjs/tools/skill/load_skill_resource_tool.js +7 -0
  98. package/dist/cjs/tools/skill/load_skill_tool.js +3 -0
  99. package/dist/cjs/tools/skill/run_skill_script_tool.js +12 -2
  100. package/dist/cjs/tools/toolbox_toolset.js +47 -28
  101. package/dist/cjs/utils/async_queue.js +37 -3
  102. package/dist/cjs/utils/client_labels.js +9 -11
  103. package/dist/cjs/utils/env_aware_utils.js +13 -7
  104. package/dist/cjs/utils/error_utils.js +40 -2
  105. package/dist/cjs/utils/failover_utils.js +10 -9
  106. package/dist/cjs/utils/gemini_schema_util.js +125 -12
  107. package/dist/cjs/utils/id_provider.js +63 -0
  108. package/dist/cjs/utils/model_name.js +15 -0
  109. package/dist/cjs/utils/simple_zod_to_json.js +13 -31
  110. package/dist/cjs/utils/ssrf_guard.js +46 -16
  111. package/dist/cjs/version.js +1 -1
  112. package/dist/cjs/workflow/index.js +2 -0
  113. package/dist/cjs/workflow/node_runner.js +24 -80
  114. package/dist/cjs/workflow/nodes/parallel_worker.js +18 -7
  115. package/dist/cjs/workflow/run_llm_agent_as_node.js +19 -14
  116. package/dist/cjs/workflow/utils/retry_utils.js +2 -2
  117. package/dist/cjs/workflow/workflow.js +12 -12
  118. package/dist/esm/a2a/a2a_remote_agent.js +23 -3
  119. package/dist/esm/a2a/a2a_remote_agent_utils.js +8 -4
  120. package/dist/esm/a2a/agent_card.js +5 -83
  121. package/dist/esm/a2a/agent_to_a2a.js +7 -0
  122. package/dist/esm/a2a/event_converter_utils.js +10 -3
  123. package/dist/esm/agents/agent_engine_client.js +293 -55
  124. package/dist/esm/agents/base_agent.js +111 -72
  125. package/dist/esm/agents/functions.js +67 -89
  126. package/dist/esm/agents/instructions.js +7 -6
  127. package/dist/esm/agents/invocation_context.js +2 -2
  128. package/dist/esm/agents/llm_agent.js +111 -100
  129. package/dist/esm/agents/processors/content_processor_utils.js +42 -15
  130. package/dist/esm/agents/processors/content_request_processor.js +28 -11
  131. package/dist/esm/agents/processors/context_compactor_request_processor.js +5 -1
  132. package/dist/esm/agents/processors/instructions_llm_request_processor.js +1 -1
  133. package/dist/esm/agents/processors/nl_planning_processor.js +2 -1
  134. package/dist/esm/artifacts/file_artifact_service.js +1 -1
  135. package/dist/esm/cli/cli_eval.js +880 -17
  136. package/dist/esm/cli/utils/cleanup.js +56 -0
  137. package/dist/esm/cli/utils/envs.js +33 -2
  138. package/dist/esm/cli/utils/evals.js +74 -8
  139. package/dist/esm/cli/utils/logs.js +128 -9
  140. package/dist/esm/cli/utils/path_validation.js +45 -0
  141. package/dist/esm/code_executors/container_code_executor.js +158 -36
  142. package/dist/esm/common.js +49 -6
  143. package/dist/esm/context/compaction_utils.js +19 -0
  144. package/dist/esm/events/event.js +7 -3
  145. package/dist/esm/features/feature_registry.js +5 -0
  146. package/dist/esm/index.js +27 -15
  147. package/dist/esm/models/google_llm.js +33 -2
  148. package/dist/esm/models/interactions_utils.js +3 -0
  149. package/dist/esm/plugins/base_plugin.js +45 -21
  150. package/dist/esm/plugins/plugin_manager.js +27 -0
  151. package/dist/esm/runner/runner.js +310 -192
  152. package/dist/esm/sessions/base_session_service.js +1 -4
  153. package/dist/esm/sessions/database_session_service.js +191 -19
  154. package/dist/esm/sessions/db/operations.js +70 -1
  155. package/dist/esm/sessions/db/schema.js +4 -0
  156. package/dist/esm/sessions/in_memory_session_service.js +2 -2
  157. package/dist/esm/sessions/vertex_ai_session_service.js +11 -3
  158. package/dist/esm/skills/loader.js +29 -28
  159. package/dist/esm/telemetry/api/instrumentation.js +655 -0
  160. package/dist/esm/telemetry/api/internal/common/accumulators.js +139 -0
  161. package/dist/esm/telemetry/api/internal/common/attributes.js +94 -0
  162. package/dist/esm/telemetry/api/internal/common/config.js +128 -0
  163. package/dist/esm/telemetry/api/internal/common/error.js +69 -0
  164. package/dist/esm/telemetry/api/internal/common/finish_reason.js +35 -0
  165. package/dist/esm/telemetry/api/internal/common/genai_messages.js +188 -0
  166. package/dist/esm/telemetry/api/internal/common/http_exchange.js +142 -0
  167. package/dist/esm/telemetry/api/internal/common/provider_name.js +59 -0
  168. package/dist/esm/telemetry/api/internal/common/redaction.js +121 -0
  169. package/dist/esm/telemetry/api/internal/common/serialization.js +30 -0
  170. package/dist/esm/telemetry/api/internal/common/token_usage.js +85 -0
  171. package/dist/esm/telemetry/api/internal/logs/inference.js +23 -0
  172. package/dist/esm/telemetry/api/internal/logs/logger.js +19 -0
  173. package/dist/esm/telemetry/api/internal/logs/mcp.js +113 -0
  174. package/dist/esm/telemetry/api/internal/metrics/agent.js +107 -0
  175. package/dist/esm/telemetry/api/internal/metrics/inference_start_hook.js +29 -0
  176. package/dist/esm/telemetry/api/internal/metrics/meters.js +165 -0
  177. package/dist/esm/telemetry/api/internal/metrics/tool.js +119 -0
  178. package/dist/esm/telemetry/api/internal/metrics/workflow.js +112 -0
  179. package/dist/esm/telemetry/api/internal/trace/agent.js +25 -0
  180. package/dist/esm/telemetry/api/internal/trace/compaction.js +50 -0
  181. package/dist/esm/telemetry/api/internal/trace/inference.js +107 -0
  182. package/dist/esm/telemetry/api/internal/trace/live.js +28 -0
  183. package/dist/esm/telemetry/api/internal/trace/node.js +44 -0
  184. package/dist/esm/telemetry/api/internal/trace/propagation.js +39 -0
  185. package/dist/esm/telemetry/api/internal/trace/tool.js +96 -0
  186. package/dist/esm/telemetry/api/internal/trace/tracer.js +52 -0
  187. package/dist/esm/telemetry/api/internal/trace/workflow.js +54 -0
  188. package/dist/esm/telemetry/export/agent_engine.js +67 -0
  189. package/dist/esm/telemetry/export/agent_runtime.js +46 -0
  190. package/dist/esm/telemetry/export/google_cloud.js +733 -0
  191. package/dist/esm/telemetry/export/request_driven_metric_reader.js +276 -0
  192. package/dist/esm/telemetry/export/setup.js +160 -0
  193. package/dist/esm/tools/agent_tool.js +9 -1
  194. package/dist/esm/tools/application_integration_tool/application_integration_toolset.js +23 -35
  195. package/dist/esm/tools/application_integration_tool/clients/connections_client.js +64 -21
  196. package/dist/esm/tools/application_integration_tool/clients/integration_client.js +26 -10
  197. package/dist/esm/tools/application_integration_tool/integration_connector_tool.js +14 -23
  198. package/dist/esm/tools/base_toolset.js +1 -1
  199. package/dist/esm/tools/computer_use/base_computer.js +99 -0
  200. package/dist/esm/tools/computer_use/computer_use_actions.js +477 -0
  201. package/dist/esm/tools/computer_use/computer_use_tool.js +217 -0
  202. package/dist/esm/tools/computer_use/computer_use_toolset.js +344 -0
  203. package/dist/esm/tools/function_tool.js +15 -5
  204. package/dist/esm/tools/google_api_tool/google_api_toolset.js +3 -2
  205. package/dist/esm/tools/google_api_tool/googleapi_to_openapi_converter.js +3 -1
  206. package/dist/esm/tools/load_artifacts_tool.js +15 -5
  207. package/dist/esm/tools/load_memory_tool.js +2 -5
  208. package/dist/esm/tools/mcp/mcp_session_manager.js +23 -3
  209. package/dist/esm/tools/mcp/mcp_tool.js +7 -3
  210. package/dist/esm/tools/mcp/mcp_toolset.js +18 -6
  211. package/dist/esm/tools/openapi_tool/auth/auth_helpers.js +27 -26
  212. package/dist/esm/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +2 -2
  213. package/dist/esm/tools/openapi_tool/rest_api_tool.js +45 -14
  214. package/dist/esm/tools/skill/load_skill_resource_tool.js +7 -0
  215. package/dist/esm/tools/skill/load_skill_tool.js +3 -0
  216. package/dist/esm/tools/skill/run_skill_script_tool.js +12 -2
  217. package/dist/esm/tools/toolbox_toolset.js +47 -28
  218. package/dist/esm/utils/async_queue.js +37 -3
  219. package/dist/esm/utils/client_labels.js +9 -11
  220. package/dist/esm/utils/env_aware_utils.js +12 -7
  221. package/dist/esm/utils/error_utils.js +37 -1
  222. package/dist/esm/utils/failover_utils.js +10 -9
  223. package/dist/esm/utils/gemini_schema_util.js +124 -11
  224. package/dist/esm/utils/id_provider.js +33 -0
  225. package/dist/esm/utils/model_name.js +14 -0
  226. package/dist/esm/utils/simple_zod_to_json.js +13 -31
  227. package/dist/esm/utils/ssrf_guard.js +55 -15
  228. package/dist/esm/version.js +1 -1
  229. package/dist/esm/workflow/index.js +2 -1
  230. package/dist/esm/workflow/node_runner.js +26 -80
  231. package/dist/esm/workflow/nodes/parallel_worker.js +16 -6
  232. package/dist/esm/workflow/run_llm_agent_as_node.js +19 -14
  233. package/dist/esm/workflow/utils/retry_utils.js +2 -2
  234. package/dist/esm/workflow/workflow.js +12 -12
  235. package/dist/types/a2a/a2a_remote_agent.d.ts +6 -0
  236. package/dist/types/a2a/a2a_remote_agent_utils.d.ts +3 -2
  237. package/dist/types/agents/agent_engine_client.d.ts +121 -3
  238. package/dist/types/agents/base_agent.d.ts +2 -0
  239. package/dist/types/agents/processors/content_processor_utils.d.ts +9 -9
  240. package/dist/types/agents/run_config.d.ts +14 -0
  241. package/dist/types/cli/cli_eval.d.ts +172 -9
  242. package/dist/types/cli/utils/cleanup.d.ts +18 -0
  243. package/dist/types/cli/utils/envs.d.ts +13 -3
  244. package/dist/types/cli/utils/evals.d.ts +64 -1
  245. package/dist/types/cli/utils/logs.d.ts +19 -2
  246. package/dist/types/cli/utils/path_validation.d.ts +30 -0
  247. package/dist/types/code_executors/container_code_executor.d.ts +49 -8
  248. package/dist/types/common.d.ts +16 -9
  249. package/dist/types/context/compaction_utils.d.ts +13 -1
  250. package/dist/types/events/event.d.ts +3 -0
  251. package/dist/types/features/feature_registry.d.ts +1 -0
  252. package/dist/types/index.d.ts +9 -6
  253. package/dist/types/plugins/base_plugin.d.ts +50 -21
  254. package/dist/types/plugins/plugin_manager.d.ts +13 -0
  255. package/dist/types/runner/runner.d.ts +11 -0
  256. package/dist/types/sessions/base_session_service.d.ts +0 -2
  257. package/dist/types/sessions/db/operations.d.ts +2 -1
  258. package/dist/types/sessions/db/schema.d.ts +5 -3
  259. package/dist/types/telemetry/api/instrumentation.d.ts +259 -0
  260. package/dist/types/telemetry/api/internal/common/accumulators.d.ts +91 -0
  261. package/dist/types/telemetry/api/internal/common/attributes.d.ts +90 -0
  262. package/dist/types/telemetry/api/internal/common/config.d.ts +61 -0
  263. package/dist/types/telemetry/api/internal/common/error.d.ts +29 -0
  264. package/dist/types/telemetry/api/internal/common/finish_reason.d.ts +18 -0
  265. package/dist/types/telemetry/api/internal/common/genai_messages.d.ts +26 -0
  266. package/dist/types/telemetry/api/internal/common/http_exchange.d.ts +50 -0
  267. package/dist/types/telemetry/api/internal/common/provider_name.d.ts +16 -0
  268. package/dist/types/telemetry/api/internal/common/redaction.d.ts +14 -0
  269. package/dist/types/telemetry/api/internal/common/serialization.d.ts +18 -0
  270. package/dist/types/telemetry/api/internal/common/token_usage.d.ts +47 -0
  271. package/dist/types/telemetry/api/internal/logs/inference.d.ts +15 -0
  272. package/dist/types/telemetry/api/internal/logs/logger.d.ts +13 -0
  273. package/dist/types/telemetry/api/internal/logs/mcp.d.ts +31 -0
  274. package/dist/types/telemetry/api/internal/metrics/agent.d.ts +28 -0
  275. package/dist/types/telemetry/api/internal/metrics/inference_start_hook.d.ts +12 -0
  276. package/dist/types/telemetry/api/internal/metrics/meters.d.ts +57 -0
  277. package/dist/types/telemetry/api/internal/metrics/tool.d.ts +44 -0
  278. package/dist/types/telemetry/api/internal/metrics/workflow.d.ts +32 -0
  279. package/dist/types/telemetry/api/internal/trace/agent.d.ts +14 -0
  280. package/dist/types/telemetry/api/internal/trace/compaction.d.ts +20 -0
  281. package/dist/types/telemetry/api/internal/trace/inference.d.ts +31 -0
  282. package/dist/types/telemetry/api/internal/trace/live.d.ts +21 -0
  283. package/dist/types/telemetry/api/internal/trace/node.d.ts +22 -0
  284. package/dist/types/telemetry/api/internal/trace/propagation.d.ts +22 -0
  285. package/dist/types/telemetry/api/internal/trace/tool.d.ts +57 -0
  286. package/dist/types/telemetry/api/internal/trace/tracer.d.ts +31 -0
  287. package/dist/types/telemetry/api/internal/trace/workflow.d.ts +21 -0
  288. package/dist/types/telemetry/export/agent_engine.d.ts +23 -0
  289. package/dist/types/telemetry/export/agent_runtime.d.ts +40 -0
  290. package/dist/types/telemetry/export/google_cloud.d.ts +189 -0
  291. package/dist/types/telemetry/export/request_driven_metric_reader.d.ts +144 -0
  292. package/dist/types/telemetry/{setup.d.ts → export/setup.d.ts} +3 -0
  293. package/dist/types/tools/agent_tool.d.ts +1 -1
  294. package/dist/types/tools/application_integration_tool/clients/connections_client.d.ts +13 -4
  295. package/dist/types/tools/base_toolset.d.ts +1 -1
  296. package/dist/types/tools/computer_use/base_computer.d.ts +281 -0
  297. package/dist/types/tools/computer_use/computer_use_actions.d.ts +53 -0
  298. package/dist/types/tools/computer_use/computer_use_tool.d.ts +108 -0
  299. package/dist/types/tools/computer_use/computer_use_toolset.d.ts +132 -0
  300. package/dist/types/tools/google_api_tool/google_api_toolset.d.ts +2 -0
  301. package/dist/types/tools/load_artifacts_tool.d.ts +5 -1
  302. package/dist/types/tools/load_memory_tool.d.ts +13 -7
  303. package/dist/types/tools/mcp/mcp_session_manager.d.ts +16 -0
  304. package/dist/types/tools/openapi_tool/auth/auth_helpers.d.ts +8 -8
  305. package/dist/types/tools/openapi_tool/openapi_spec_parser/operation_parser.d.ts +7 -3
  306. package/dist/types/tools/toolbox_toolset.d.ts +15 -20
  307. package/dist/types/utils/async_queue.d.ts +14 -0
  308. package/dist/types/utils/env_aware_utils.d.ts +11 -0
  309. package/dist/types/utils/error_utils.d.ts +4 -0
  310. package/dist/types/utils/gemini_schema_util.d.ts +27 -6
  311. package/dist/types/utils/id_provider.d.ts +43 -0
  312. package/dist/types/utils/model_name.d.ts +8 -0
  313. package/dist/types/utils/ssrf_guard.d.ts +2 -0
  314. package/dist/types/version.d.ts +1 -1
  315. package/dist/types/workflow/index.d.ts +1 -1
  316. package/dist/types/workflow/nodes/parallel_worker.d.ts +8 -1
  317. package/dist/web/index_web.js +86 -88
  318. package/dist/web/index_web.js.map +4 -4
  319. package/package.json +13 -15
  320. package/dist/cjs/telemetry/google_cloud.js +0 -116
  321. package/dist/cjs/telemetry/tracing.js +0 -393
  322. package/dist/esm/telemetry/google_cloud.js +0 -99
  323. package/dist/esm/telemetry/setup.js +0 -88
  324. package/dist/esm/telemetry/tracing.js +0 -361
  325. package/dist/types/telemetry/google_cloud.d.ts +0 -9
  326. package/dist/types/telemetry/tracing.d.ts +0 -143
@@ -6,7 +6,8 @@
6
6
  import { BaseAgent } from '../agents/base_agent.js';
7
7
  import { BaseArtifactService } from '../artifacts/base_artifact_service.js';
8
8
  import { BaseSessionService } from '../sessions/base_session_service.js';
9
- import { EvaluationItem } from './utils/evals.js';
9
+ import { Session } from '../sessions/session.js';
10
+ import { EvalCase, EvalSet, EvaluationItem } from './utils/evals.js';
10
11
  /**
11
12
  * Error message when evaluation dependencies are missing.
12
13
  */
@@ -65,15 +66,38 @@ export interface InvocationEvalMetricResult {
65
66
  * Complete evaluation result for a single eval case in an evalset.
66
67
  */
67
68
  export interface EvalResult {
68
- eval_set_file: string;
69
+ /**
70
+ * @deprecated Use {@link eval_set_id} instead.
71
+ */
72
+ eval_set_file?: string;
73
+ eval_set_id: string;
69
74
  eval_id: string;
70
75
  final_eval_status: EvalStatus;
71
- eval_metric_results: Array<[EvalMetric, EvalMetricResult]>;
76
+ /**
77
+ * @deprecated Use {@link overall_eval_metric_results} instead.
78
+ */
79
+ eval_metric_results?: Array<[EvalMetric, EvalMetricResult]>;
72
80
  overall_eval_metric_results: EvalMetricResult[];
73
81
  eval_metric_result_per_invocation: InvocationEvalMetricResult[];
74
82
  session_id: string;
83
+ session_details?: Session;
75
84
  user_id?: string;
76
85
  }
86
+ /**
87
+ * Case-level evaluation result alias matching the persisted eval set schema.
88
+ */
89
+ export type EvalCaseResult = EvalResult;
90
+ /**
91
+ * Eval-set-level evaluation result persisted by {@link LocalEvalSetResultsManager}.
92
+ */
93
+ export interface EvalSetResult {
94
+ evalSetResultId: string;
95
+ evalSetResultName: string;
96
+ evalSetId: string;
97
+ evalCaseResults: RunEvalResult[];
98
+ /** Creation time in seconds since the Unix epoch, as used in result IDs. */
99
+ creationTimestamp: number;
100
+ }
77
101
  /**
78
102
  * Request payload for adding a session to an eval set (`add_session`).
79
103
  */
@@ -90,18 +114,26 @@ export interface RunEvalRequest {
90
114
  evalMetrics: EvalMetric[];
91
115
  }
92
116
  /**
93
- * Result returned for a single evaluation case by the `run_eval` endpoint.
117
+ * Result returned for a single evaluation case by the `run_eval` and
118
+ * `eval_results` endpoints.
94
119
  */
95
- export interface RunEvalResult extends EvalResult {
96
- evalSetFile: string;
120
+ export interface RunEvalResult {
121
+ /**
122
+ * @deprecated Use {@link evalSetId} instead.
123
+ */
124
+ evalSetFile?: string;
97
125
  evalSetId: string;
98
126
  evalId: string;
99
127
  finalEvalStatus: EvalStatus;
100
- evalMetricResults: Array<[EvalMetric, EvalMetricResult]>;
128
+ /**
129
+ * @deprecated Use {@link overallEvalMetricResults} instead.
130
+ */
131
+ evalMetricResults?: Array<[EvalMetric, EvalMetricResult]>;
101
132
  overallEvalMetricResults: EvalMetricResult[];
102
133
  evalMetricResultPerInvocation: InvocationEvalMetricResult[];
103
134
  userId?: string;
104
135
  sessionId: string;
136
+ sessionDetails?: Session;
105
137
  }
106
138
  /**
107
139
  * Initial session metadata for an evaluation case.
@@ -127,7 +159,7 @@ export type EvalSetItem = EvalEntry;
127
159
  * Options for running evaluations via `runEvals`.
128
160
  */
129
161
  export interface RunEvalsOptions {
130
- evalCasesByEvalSetId: Record<string, EvalEntry[] | string[]>;
162
+ evalCasesByEvalSetId: Record<string, Array<EvalEntry | EvalCase> | string[]>;
131
163
  rootAgent: BaseAgent;
132
164
  resetFunc?: () => void | Promise<void>;
133
165
  evalMetrics?: EvalMetric[];
@@ -170,4 +202,135 @@ export declare function parseAndGetEvalsToRun(evalSetFilePaths: string[]): Recor
170
202
  * Runs a collection of evaluation cases against `rootAgent` and yields an
171
203
  * `EvalResult` for each case.
172
204
  */
173
- export declare function runEvals(optionsOrMap: RunEvalsOptions | Record<string, EvalEntry[] | string[]>, rootAgentArg?: BaseAgent, resetFuncArg?: () => void | Promise<void>, evalMetricsArg?: EvalMetric[], printDetailedResultsArg?: boolean, sessionServiceArg?: BaseSessionService, artifactServiceArg?: BaseArtifactService): AsyncGenerator<EvalResult, void, void>;
205
+ export declare function runEvals(optionsOrMap: RunEvalsOptions | Record<string, Array<EvalEntry | EvalCase> | string[]>, rootAgentArg?: BaseAgent, resetFuncArg?: () => void | Promise<void>, evalMetricsArg?: EvalMetric[], printDetailedResultsArg?: boolean, sessionServiceArg?: BaseSessionService, artifactServiceArg?: BaseArtifactService): AsyncGenerator<EvalResult, void, void>;
206
+ /** Parameters for {@link createEvalSetResult}. */
207
+ export interface CreateEvalSetResultParams {
208
+ appName: string;
209
+ evalSetId: string;
210
+ evalCaseResults: ReadonlyArray<EvalCaseResult | RunEvalResult>;
211
+ /**
212
+ * Creation time in seconds since the Unix epoch. Seconds, not milliseconds,
213
+ * keep result IDs and file names in the format the ADK web UI reads.
214
+ * Defaults to the current time.
215
+ */
216
+ creationTimestamp?: number;
217
+ }
218
+ /**
219
+ * Creates a new {@link EvalSetResult} for the given application, eval set ID,
220
+ * and case results.
221
+ */
222
+ export declare function createEvalSetResult({ appName, evalSetId, evalCaseResults, creationTimestamp, }: CreateEvalSetResultParams): EvalSetResult;
223
+ /**
224
+ * Parses an {@link EvalSetResult} from JSON text. Accepts camelCase or
225
+ * snake_case keys, and both plain JSON objects and legacy double-encoded JSON
226
+ * strings.
227
+ */
228
+ export declare function parseEvalSetResultJson(evalSetResultJson: string): EvalSetResult;
229
+ /** Parameters for {@link LocalEvalSetResultsManager.saveEvalSetResult}. */
230
+ export interface SaveEvalSetResultParams {
231
+ appName: string;
232
+ evalSetId: string;
233
+ evalCaseResults: ReadonlyArray<EvalCaseResult | RunEvalResult>;
234
+ }
235
+ /**
236
+ * Manages persistence of {@link EvalSetResult} objects on the local filesystem
237
+ * under `<agentsDir>/<appName>/.adk/eval_history/`.
238
+ */
239
+ export declare class LocalEvalSetResultsManager {
240
+ private readonly agentsDir;
241
+ constructor(agentsDir: string);
242
+ /**
243
+ * Creates and saves a new {@link EvalSetResult} for `evalCaseResults`.
244
+ */
245
+ saveEvalSetResult({ appName, evalSetId, evalCaseResults, }: SaveEvalSetResultParams): EvalSetResult;
246
+ /**
247
+ * Loads an {@link EvalSetResult} by `appName` and `evalSetResultId`.
248
+ *
249
+ * @throws {NotFoundError} If the result file does not exist.
250
+ */
251
+ getEvalSetResult(appName: string, evalSetResultId: string): EvalSetResult;
252
+ /**
253
+ * Lists all saved eval set result IDs for `appName`.
254
+ */
255
+ listEvalSetResults(appName: string): string[];
256
+ private getEvalHistoryDir;
257
+ }
258
+ /**
259
+ * Normalizes an arbitrary parsed JSON object into an {@link EvalCase},
260
+ * accepting both camelCase and snake_case keys.
261
+ *
262
+ * @throws {InputValidationError} If required fields are missing or invalid.
263
+ */
264
+ export declare function normalizeEvalCase(raw: unknown): EvalCase;
265
+ /**
266
+ * Converts a legacy array of {@link EvalEntry} JSON objects into a structured
267
+ * {@link EvalSet}.
268
+ *
269
+ * @param evalSetId The identifier for the resulting eval set.
270
+ * @param evalSetInJsonFormat Array of legacy eval case objects.
271
+ * @returns The converted {@link EvalSet}.
272
+ * @throws {InputValidationError} If the input array or any entry is malformed.
273
+ */
274
+ export declare function convertEvalSetToSchema(evalSetId: string, evalSetInJsonFormat: unknown): EvalSet;
275
+ /**
276
+ * Loads an {@link EvalSet} from a file on disk, supporting both the structured
277
+ * {@link EvalSet} JSON format and the legacy {@link EvalEntry} array format.
278
+ *
279
+ * @param evalSetFilePath Path to the `.evalset.json` file.
280
+ * @param evalSetId Fallback eval set ID used when converting legacy arrays.
281
+ * @returns The parsed {@link EvalSet}.
282
+ */
283
+ export declare function loadEvalSetFromFile(evalSetFilePath: string, evalSetId: string): EvalSet;
284
+ /**
285
+ * Manages local {@link EvalSet} files on disk under
286
+ * `<agentsDir>/<appName>/<evalSetId>.evalset.json`.
287
+ */
288
+ export declare class LocalEvalSetsManager {
289
+ private readonly agentsDir;
290
+ constructor(agentsDir: string);
291
+ /**
292
+ * Loads an {@link EvalSet} identified by `appName` and `evalSetId`, or
293
+ * returns `undefined` if the file does not exist.
294
+ */
295
+ getEvalSet(appName: string, evalSetId: string): EvalSet | undefined;
296
+ /**
297
+ * Creates an empty {@link EvalSet} file for `appName` and `evalSetId`.
298
+ *
299
+ * @throws {InputValidationError} If `evalSetId` is invalid or the eval set
300
+ * already exists.
301
+ */
302
+ createEvalSet(appName: string, evalSetId: string): EvalSet;
303
+ /**
304
+ * Lists all eval set IDs stored under `appName`, sorted alphabetically.
305
+ */
306
+ listEvalSets(appName: string): string[];
307
+ /**
308
+ * Adds `evalCase` to the {@link EvalSet} identified by `appName` and
309
+ * `evalSetId`.
310
+ *
311
+ * @throws {NotFoundError} If the eval set does not exist.
312
+ * @throws {InputValidationError} If `evalCase.evalId` is invalid or already exists.
313
+ */
314
+ addEvalCase(appName: string, evalSetId: string, evalCase: EvalCase): void;
315
+ /**
316
+ * Returns a single {@link EvalCase} by `appName`, `evalSetId`, and
317
+ * `evalCaseId`, or `undefined` if not found.
318
+ */
319
+ getEvalCase(appName: string, evalSetId: string, evalCaseId: string): EvalCase | undefined;
320
+ /**
321
+ * Updates an existing {@link EvalCase} in the {@link EvalSet} identified by
322
+ * `appName` and `evalSetId`.
323
+ *
324
+ * @throws {NotFoundError} If the eval set or eval case is not found.
325
+ */
326
+ updateEvalCase(appName: string, evalSetId: string, updatedEvalCase: EvalCase): void;
327
+ /**
328
+ * Deletes an {@link EvalCase} identified by `appName`, `evalSetId`, and
329
+ * `evalCaseId`.
330
+ *
331
+ * @throws {NotFoundError} If the eval set or eval case to delete is not found.
332
+ */
333
+ deleteEvalCase(appName: string, evalSetId: string, evalCaseId: string): void;
334
+ private getEvalSetFilePath;
335
+ private writeEvalSet;
336
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { Runner } from '../../runner/runner.js';
7
+ /**
8
+ * Maximum time in milliseconds to wait for all runners to close during cleanup.
9
+ */
10
+ export declare const RUNNER_CLEANUP_TIMEOUT_MS = 30000;
11
+ /**
12
+ * Closes all provided {@link Runner} instances concurrently, waiting up to
13
+ * {@link RUNNER_CLEANUP_TIMEOUT_MS} milliseconds and logging a warning if any
14
+ * close task does not complete in time.
15
+ *
16
+ * @param runners The runner instances to close.
17
+ */
18
+ export declare function closeRunners(runners: readonly Runner[]): Promise<void>;
@@ -16,8 +16,18 @@ export declare function walkToRootUntilFound(folder: string, filename?: string):
16
16
  * Walks up from the agent directory to the root directory and loads the first
17
17
  * `.env` file found into `process.env` with override semantics.
18
18
  *
19
- * @param agentName The name or path of the agent.
20
- * @param agentParentFolder The parent directory containing the agent. Defaults to `'.'`.
21
- * @param filename The dotenv filename to search for. Defaults to `'.env'`.
19
+ * When `agentParentFolder` is given, `agentName` must be a single path segment
20
+ * that resolves inside it. When `agentParentFolder` is omitted, `agentName` may
21
+ * be a path, but it must not be `.` or contain a `..` segment. These checks
22
+ * are lexical: they do not follow symlinks.
23
+ *
24
+ * @param agentName The name of the agent, or a path to it when
25
+ * `agentParentFolder` is omitted.
26
+ * @param agentParentFolder The directory that contains the agent. Optional.
27
+ * @param filename The dotenv file name to search for. Must be a single path
28
+ * segment. Defaults to `'.env'`.
29
+ * @throws {InputValidationError} If `agentName`, `agentParentFolder` or
30
+ * `filename` is invalid, or if `agentName` resolves outside
31
+ * `agentParentFolder`.
22
32
  */
23
33
  export declare function loadDotenvForAgent(agentName: string, agentParentFolder?: string, filename?: string): void;
@@ -3,7 +3,7 @@
3
3
  * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { Part } from '@google/genai';
6
+ import { Content, FunctionCall, FunctionResponse, Part } from '@google/genai';
7
7
  import { BaseAgent } from '../../agents/base_agent.js';
8
8
  import { Session } from '../../sessions/session.js';
9
9
  /**
@@ -27,14 +27,77 @@ export interface EvaluationItem {
27
27
  expected_intermediate_agent_responses: IntermediateAgentResponseItem[];
28
28
  reference: string;
29
29
  }
30
+ /**
31
+ * Intermediate tool uses and sub-agent responses recorded during an evaluation
32
+ * invocation.
33
+ */
34
+ export interface EvalIntermediateData {
35
+ toolUses: FunctionCall[];
36
+ /**
37
+ * Expected responses for entries in {@link toolUses}, matched by `id`. When
38
+ * an eval runs, a matching response replaces the real tool call, so the
39
+ * response acts as a mock tool output.
40
+ */
41
+ toolResponses?: FunctionResponse[];
42
+ intermediateResponses: IntermediateAgentResponseItem[];
43
+ }
44
+ /**
45
+ * Represents a single user-to-agent invocation in an evaluation case.
46
+ */
47
+ export interface EvalInvocation {
48
+ invocationId?: string;
49
+ userContent: Content;
50
+ finalResponse?: Content;
51
+ intermediateData?: EvalIntermediateData;
52
+ creationTimestamp?: number;
53
+ }
54
+ /**
55
+ * Initial session metadata for an {@link EvalCase}.
56
+ */
57
+ export interface EvalSessionInput {
58
+ appName: string;
59
+ userId: string;
60
+ state: Record<string, unknown>;
61
+ }
62
+ /**
63
+ * A structured evaluation case containing a multi-turn conversation and
64
+ * optional initial session state.
65
+ */
66
+ export interface EvalCase {
67
+ evalId: string;
68
+ conversation: EvalInvocation[];
69
+ sessionInput?: EvalSessionInput;
70
+ creationTimestamp?: number;
71
+ }
72
+ /**
73
+ * A named collection of {@link EvalCase} items stored in an `.evalset.json`
74
+ * file.
75
+ */
76
+ export interface EvalSet {
77
+ evalSetId: string;
78
+ name?: string;
79
+ description?: string;
80
+ evalCases: EvalCase[];
81
+ creationTimestamp?: number;
82
+ }
30
83
  /**
31
84
  * Converts a session into a list of evaluation items suitable for saving into
32
85
  * an evalset or running through `runEvals`.
33
86
  *
87
+ * @deprecated Use {@link convertSessionToEvalInvocations} instead.
34
88
  * @param session The session whose events should be converted.
35
89
  * @returns An array of `EvaluationItem` records, one per user turn.
36
90
  */
37
91
  export declare function convertSessionToEvalFormat(session?: Session): EvaluationItem[];
92
+ /**
93
+ * Converts a session into a list of {@link EvalInvocation} items, grouping each
94
+ * user turn with its subsequent agent tool calls, intermediate responses, and
95
+ * final response.
96
+ *
97
+ * @param session The session whose events should be converted.
98
+ * @returns An array of {@link EvalInvocation} records, one per user turn.
99
+ */
100
+ export declare function convertSessionToEvalInvocations(session?: Session): EvalInvocation[];
38
101
  /**
39
102
  * Creates a state object initialized with empty strings `''` for all `{var}`
40
103
  * placeholders referenced in the instruction strings of `agent` and its
@@ -5,7 +5,10 @@
5
5
  */
6
6
  import { LogLevel } from '../../utils/logger.js';
7
7
  /**
8
- * Standard log format template for CLI log output.
8
+ * Legacy Python `logging.Formatter` template string retained for compatibility.
9
+ *
10
+ * @deprecated Unused by `adk-js` loggers. ADK CLI stderr and file loggers
11
+ * format records directly as `<ISO-8601 timestamp> - <LEVEL> - <message>`.
9
12
  */
10
13
  export declare const LOGGING_FORMAT = "%(asctime)s - %(levelname)s - %(filename)s:%(lineno)d - %(message)s";
11
14
  /**
@@ -18,11 +21,16 @@ export interface LogToTmpFolderOptions {
18
21
  subFolder?: string;
19
22
  /** Prefix for generated log files. Defaults to `'agent'`. */
20
23
  logFilePrefix?: string;
21
- /** Timestamp suffix for the log filename. Defaults to `YYYYMMDD_HHMMSS`. */
24
+ /**
25
+ * Timestamp suffix for the log filename. Defaults to `YYYYMMDD_HHMMSS_<pid>`.
26
+ * If a file with the resulting name already exists, a numeric `_<n>` suffix
27
+ * is appended; an existing file is never overwritten.
28
+ */
22
29
  logFileTimestamp?: string;
23
30
  }
24
31
  /**
25
32
  * Configures the global ADK logger to write formatted log records to `stderr`.
33
+ * Closes the log file that `logToTmpFolder` opened, if any.
26
34
  *
27
35
  * @param level The minimum `LogLevel` to emit. Defaults to `LogLevel.INFO`.
28
36
  */
@@ -32,6 +40,15 @@ export declare function setupAdkLogger(level?: LogLevel): void;
32
40
  * file in the system temporary directory and updates the `<prefix>.latest.log`
33
41
  * symlink to point to the newest file.
34
42
  *
43
+ * The log directory is restricted to the current user (mode `0o700`) and the
44
+ * log file is created with mode `0o600`. If `<tmp>/<subFolder>` is a symlink,
45
+ * is not a directory, or is owned by another user, the logs go to
46
+ * `<tmp>/<subFolder>_<uid>` instead. Records are written through the file
47
+ * descriptor opened at creation. The default timestamp includes the
48
+ * process ID. If the log filename is already taken, a numeric `_<n>` suffix is
49
+ * appended so that an existing file is never overwritten. The path of the log
50
+ * file is printed to `stderr`.
51
+ *
35
52
  * @param options Configuration options for the temporary log file.
36
53
  * @returns The absolute path to the created log file.
37
54
  */
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * Validates that a caller-supplied identifier is a safe single path segment and
8
+ * cannot traverse directories.
9
+ *
10
+ * This is a lexical check on the string only. It does not resolve symlinks and
11
+ * is not a sandbox.
12
+ *
13
+ * @param value The caller-supplied identifier. Non-string values are rejected.
14
+ * @param fieldName Human-readable field name used in error messages.
15
+ * @throws {InputValidationError} If `value` is not a non-empty string, or if it
16
+ * contains a null byte, a path separator, a drive prefix, or is `.` or `..`.
17
+ */
18
+ export declare function validatePathSegment(value: string, fieldName: string): void;
19
+ /**
20
+ * Returns whether `target` is lexically inside `baseDir` and is not `baseDir`
21
+ * itself.
22
+ *
23
+ * Both paths should already be absolute. This compares strings after
24
+ * `path.relative`. It does not follow symlinks and is not a sandbox.
25
+ *
26
+ * @param baseDir The absolute directory that must contain `target`.
27
+ * @param target The absolute path to check.
28
+ * @returns `true` if `target` is a strict descendant of `baseDir`.
29
+ */
30
+ export declare function isStrictlyInside(baseDir: string, target: string): boolean;
@@ -32,12 +32,20 @@ export interface ContainerCodeExecutorOptions {
32
32
  networkEnabled?: boolean;
33
33
  /**
34
34
  * Wall-clock timeout in seconds for a single execution. Must be greater than
35
- * 0; defaults to 300. Every execution shares one long-lived container, so an
36
- * unbounded run (e.g. a loop emitted by the model) would burn that
37
- * container's CPU for every later caller. Raise it rather than remove it for
38
- * a computation that legitimately runs longer.
35
+ * 0; defaults to 300. Each session runs in its own long-lived container, so
36
+ * an unbounded run (e.g. a loop emitted by the model) would burn that
37
+ * container's CPU for every later call in the same session. Raise it rather
38
+ * than remove it for a computation that legitimately runs longer.
39
39
  */
40
40
  timeoutSeconds?: number;
41
+ /**
42
+ * Maximum number of session containers to keep running concurrently.
43
+ * When exceeded, the least recently used idle session container is stopped
44
+ * and evicted. A container that is running code is never evicted, so the
45
+ * count can exceed the limit until that run ends. Must be a positive
46
+ * integer.
47
+ */
48
+ maxContainers?: number;
41
49
  /**
42
50
  * Injected Docker client, primarily for testing so unit tests never touch a
43
51
  * real Docker daemon. Defaults to a new client built from `baseUrl`.
@@ -65,7 +73,8 @@ export interface ContainerCodeExecutorOptions {
65
73
  * background processes persist into a later, unrelated session's execution.
66
74
  * A container is still reused across multiple calls *within* the same
67
75
  * session, so the per-call container-startup cost is paid once per session,
68
- * not once per call.
76
+ * not once per call. Set `maxContainers` to bound how many session containers
77
+ * run at once; beyond it, the least recently used idle one is stopped.
69
78
  *
70
79
  * Limitations: this executor runs a code string only. `inputFiles` and `args`
71
80
  * on the request are not copied into the container, and output files are not
@@ -78,8 +87,20 @@ export declare class ContainerCodeExecutor extends BaseCodeExecutor {
78
87
  private readonly dockerPath?;
79
88
  private readonly containerOptions;
80
89
  private readonly timeoutSeconds;
90
+ private readonly maxContainers?;
91
+ /** Started session containers, ordered from least to most recently used. */
81
92
  private readonly containers;
93
+ /** Container starts that are still in flight, keyed by session. */
82
94
  private readonly initPromises;
95
+ /**
96
+ * Number of `executeCode` calls in progress per session. A session with a
97
+ * call in progress is never evicted, so a run is not stopped midway.
98
+ */
99
+ private readonly activeExecutions;
100
+ /** Shared image build, so the image is built at most once per executor. */
101
+ private buildPromise?;
102
+ private closing;
103
+ private closePromise?;
83
104
  constructor(options?: ContainerCodeExecutorOptions);
84
105
  executeCode(params: ExecuteCodeParams): Promise<CodeExecutionResult>;
85
106
  /**
@@ -90,12 +111,32 @@ export declare class ContainerCodeExecutor extends BaseCodeExecutor {
90
111
  */
91
112
  private describeExit;
92
113
  /**
93
- * Stops and removes every session's container. Safe to call when none has
94
- * been started; provided for deterministic teardown in tests and app
114
+ * Stops and removes every session's container. Waits for container starts
115
+ * that are still in flight, so no container is left running after it
116
+ * resolves. Safe to call when none has been started, and concurrent calls
117
+ * share one teardown. Provided for deterministic teardown in tests and app
95
118
  * shutdown.
96
119
  */
97
120
  close(): Promise<void>;
98
- /** Lazily builds/starts the given session's container exactly once. */
121
+ private stopAll;
122
+ /**
123
+ * Returns the given session's container, starting it if needed. Concurrent
124
+ * calls for one session share a single in-flight start, and reuse marks the
125
+ * container as the most recently used.
126
+ */
99
127
  private ensureContainer;
128
+ /**
129
+ * Builds the image from `dockerPath` once and shares the build across every
130
+ * session. A failed build is cleared so the next call retries it.
131
+ */
132
+ private ensureImageBuilt;
100
133
  private initContainer;
134
+ /**
135
+ * Stops the least recently used idle session containers until the count is
136
+ * within `maxContainers`. A session with a call in progress is skipped, which
137
+ * includes the caller that just registered its container; if every session
138
+ * is busy, the overshoot stays until a call ends. The stop is not awaited so
139
+ * the caller is not delayed by another session's teardown.
140
+ */
141
+ private evictLeastRecentlyUsed;
101
142
  }
@@ -9,6 +9,7 @@ export { BaseAgent, isBaseAgent } from './agents/base_agent.js';
9
9
  export type { AfterAgentCallback, BaseAgentConfig, BeforeAgentCallback, SingleAgentCallback, } from './agents/base_agent.js';
10
10
  export { Context } from './agents/context.js';
11
11
  export { REQUEST_CONFIRMATION_FUNCTION_CALL_NAME, REQUEST_CREDENTIAL_FUNCTION_CALL_NAME, REQUEST_INPUT_FUNCTION_CALL_NAME, findEventByFunctionCallId, findMatchingFunctionCall, functionsExportedForTestingOnly, handleFunctionCallsLive, isToolNotFound, } from './agents/functions.js';
12
+ export { injectSessionState } from './agents/instructions.js';
12
13
  export { InvocationContext, LlmCallsLimitExceededError, isLlmCallsLimitExceededError, requireAgent, } from './agents/invocation_context.js';
13
14
  export type { InvocationContextParams, WorkflowInstructionScope, } from './agents/invocation_context.js';
14
15
  export { LangGraphAgent, getLastHumanMessages, isLangGraphAgent, } from './agents/langgraph_agent.js';
@@ -138,7 +139,9 @@ export type { AppendEventRequest, CreateSessionRequest, DeleteSessionRequest, Ge
138
139
  export { InMemorySessionService } from './sessions/in_memory_session_service.js';
139
140
  export { createSession } from './sessions/session.js';
140
141
  export type { CompositeSessionKey, Session } from './sessions/session.js';
142
+ export { StaleSessionError, isStaleSessionError, } from './sessions/stale_session_error.js';
141
143
  export { State, StateSchemaError, isStateSchemaError } from './sessions/state.js';
144
+ export type { ContentCapturingMode, ExperimentalFeature, TelemetryConfig, } from './telemetry/api/instrumentation.js';
142
145
  export { AgentTool, isAgentTool } from './tools/agent_tool.js';
143
146
  export type { AgentToolConfig } from './tools/agent_tool.js';
144
147
  export { BaseTool, isBaseTool } from './tools/base_tool.js';
@@ -146,6 +149,12 @@ export type { BaseToolParams, RunAsyncToolRequest, ToolProcessLlmRequest, } from
146
149
  export { BaseToolset, isBaseToolset } from './tools/base_toolset.js';
147
150
  export type { ToolPredicate } from './tools/base_toolset.js';
148
151
  export { BuiltInTool } from './tools/built_in_tool.js';
152
+ export { BaseComputer, ComputerEnvironment, isBaseComputer, } from './tools/computer_use/base_computer.js';
153
+ export type { ComputerState, ScrollDirection, } from './tools/computer_use/base_computer.js';
154
+ export { ComputerUseTool, isComputerUseTool, } from './tools/computer_use/computer_use_tool.js';
155
+ export type { ComputerUseFunction, ComputerUseToolOptions, } from './tools/computer_use/computer_use_tool.js';
156
+ export { ComputerUseToolset, adaptComputerUseTool, isComputerUseToolset, } from './tools/computer_use/computer_use_toolset.js';
157
+ export type { AdaptComputerUseToolParams, AdaptedComputerUseFunction, ComputerUseToolsetOptions, } from './tools/computer_use/computer_use_toolset.js';
149
158
  export { ConsolidateContextTool } from './tools/consolidate_context_tool.js';
150
159
  export { ENTERPRISE_WEB_SEARCH, EnterpriseWebSearchTool, } from './tools/enterprise_web_search_tool.js';
151
160
  export { ExampleTool } from './tools/example_tool.js';
@@ -185,6 +194,8 @@ export { getClientLabels, runWithClientLabel } from './utils/client_labels.js';
185
194
  export { toGeminiSchema } from './utils/gemini_schema_util.js';
186
195
  export type { MCPToolSchema } from './utils/gemini_schema_util.js';
187
196
  export { genaiSchemaToJsonSchema } from './utils/genai_schema_to_json.js';
197
+ export { newId, resetIdProvider, setIdProvider } from './utils/id_provider.js';
198
+ export type { IdProvider } from './utils/id_provider.js';
188
199
  export { LogLevel, getLogger, logger, resetLogger, setLogLevel, setLogger, } from './utils/logger.js';
189
200
  export type { Logger } from './utils/logger.js';
190
201
  export { isGemini2OrAbove, isGemini35LiveTranslate, isGemini3xFlashLive, isGemini3xLive, } from './utils/model_name.js';
@@ -204,19 +215,15 @@ export { SearchSkillsTool } from './tools/skill/search_skills_tool.js';
204
215
  export * from './artifacts/base_artifact_service.js';
205
216
  export * from './features/feature_registry.js';
206
217
  export * from './memory/base_memory_service.js';
207
- export * from './sessions/base_session_service.js';
218
+ export { mergeStates, trimTempDeltaState, trimTempState, } from './sessions/base_session_service.js';
208
219
  export * from './tools/base_tool.js';
209
- export { BaseNode, BranchPath, DEFAULT_ROUTE, Edge, FunctionNode, Graph, JoinNode, NodeContext, NodeReportedError, NodeSchemaValidationError, NodeStatus, NodeTimeoutError, NodeTool, ParallelWorker, RequestInput, START, ToolNode, Workflow, WorkflowNode, asRunnableRoot, commonPrefixOf, createNodeErrorEvent, createNodeState, createSubBranch, isNodeErrorEvent, isNodeReportedError, isNodeSchemaValidationError, isNodeState, isNodeTimeoutError, isRequestInput, isRunnableRoot, isWorkflow, node, normalizeRetryExceptions, prepareRetryConfig, } from './workflow/index.js';
220
+ export { BaseNode, BranchPath, DEFAULT_ROUTE, Edge, FunctionNode, Graph, JoinNode, NodeContext, NodeReportedError, NodeSchemaValidationError, NodeStatus, NodeTimeoutError, NodeTool, ParallelWorker, RequestInput, START, ToolNode, Workflow, WorkflowNode, asRunnableRoot, commonPrefixOf, createNodeErrorEvent, createNodeState, createSubBranch, isNodeErrorEvent, isNodeReportedError, isNodeSchemaValidationError, isNodeState, isNodeTimeoutError, isParallelWorker, isRequestInput, isRunnableRoot, isWorkflow, node, normalizeRetryExceptions, prepareRetryConfig, } from './workflow/index.js';
210
221
  export type { BaseNodeConfig, BuildNodeOptions, ChainElement, CreateNodeErrorEventParams, DynamicEntry, EdgeItem, ErrorClass, FunctionNodeConfig, FunctionNodeHandler, FunctionNodeResult, NodeContextOptions, NodeErrorEvent, NodeLike, NodeOptions, NodeResult, NodeState, ParallelWorkerConfig, PreparedRetryConfig, RequestInputParams, RetryConfig, RouteValue, RoutingMap, RunNodeOptions, RunnableNode, RunnableRoot, ScheduleDynamicNode, ScheduleDynamicNodeOptions, ToolNodeConfig, WorkflowConfig, } from './workflow/index.js';
211
222
  export { App, isApp, validateAppName } from './apps/app.js';
212
223
  export type { AppOptions } from './apps/app.js';
213
- export * from './artifacts/base_artifact_service.js';
214
- export * from './features/feature_registry.js';
215
- export * from './memory/base_memory_service.js';
216
- export * from './sessions/base_session_service.js';
217
- export * from './tools/base_tool.js';
218
- export { convertSessionToEvalFormat, createEmptyState, } from './cli/utils/evals.js';
219
- export type { EvaluationItem, IntermediateAgentResponseItem, ToolUseItem, } from './cli/utils/evals.js';
224
+ export { RUNNER_CLEANUP_TIMEOUT_MS, closeRunners } from './cli/utils/cleanup.js';
225
+ export { convertSessionToEvalFormat, convertSessionToEvalInvocations, createEmptyState, } from './cli/utils/evals.js';
226
+ export type { EvalCase, EvalIntermediateData, EvalInvocation, EvalSessionInput, EvalSet, EvaluationItem, IntermediateAgentResponseItem, ToolUseItem, } from './cli/utils/evals.js';
220
227
  export { buildFunctionDeclarationForLangchain, buildFunctionDeclarationForParamsForCrewai, buildFunctionDeclarationUtil, } from './tools/function_tool.js';
221
228
  export type { CallLiveToolRequest } from './tools/function_tool.js';
222
229
  export type { LoadMemoryResponse, LoadMemoryToolOptions, } from './tools/load_memory_tool.js';
@@ -24,7 +24,19 @@ export declare function isEventVisibleInIsolationScope(event: Event, currentIsol
24
24
  * Determines the baseline index to retain from active raw events,
25
25
  * ensuring we don't split between a function call and its response.
26
26
  *
27
- * @param rawEvents The active raw events to consider for compaction.
27
+ * Two checks protect a pair, mirroring the two places that can otherwise
28
+ * observe half of it:
29
+ * - Adjacent pairs: while the event before the split contains a function call
30
+ * and the event at the split contains a function response, move the split
31
+ * earlier.
32
+ * - Non-adjacent pairs: extend the retained tail back to the nearest preceding
33
+ * call for every retained response ID, following any dependencies that
34
+ * extension exposes. This matches the content builder, which pairs calls and
35
+ * responses by ID alone after filtering by scope and branch, so a call on a
36
+ * sub-agent branch answered by an unbranched user response is still kept.
37
+ *
38
+ * @param rawEvents The active raw events to consider for compaction. They are
39
+ * already filtered to the caller's isolation scope.
28
40
  * @param eventRetentionSize The minimum number of raw events to keep at the end of the session.
29
41
  * @returns The index in `rawEvents` at which to split. Events before this index will be compacted.
30
42
  */
@@ -201,6 +201,9 @@ export declare function pruneThoughts(event: Event): Event;
201
201
  export declare function isEvent(obj: unknown): obj is Event;
202
202
  /**
203
203
  * Generates a new unique ID for the event.
204
+ *
205
+ * The ID comes from the provider set with `setIdProvider`, or is 8 random
206
+ * alphanumeric characters when none is set.
204
207
  */
205
208
  export declare function createNewEventId(): string;
206
209
  /**
@@ -7,6 +7,7 @@
7
7
  * Feature names.
8
8
  */
9
9
  export declare enum FeatureName {
10
+ COMPUTER_USE = "COMPUTER_USE",
10
11
  PROGRESSIVE_SSE_STREAMING = "PROGRESSIVE_SSE_STREAMING"
11
12
  }
12
13
  /**