@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
@@ -20,22 +20,28 @@ export interface LoadMemoryToolOptions {
20
20
  /**
21
21
  * Response returned by {@link LoadMemoryTool}.
22
22
  *
23
- * When {@link LoadMemoryToolOptions.textOnlyContent} is enabled, entries contain
24
- * string content instead of a `Content` object.
23
+ * By default, `memories` contains complete {@link MemoryEntry} objects.
24
+ * When {@link LoadMemoryToolOptions.textOnlyContent} is `true`, each entry
25
+ * contains a flattened `string` in `content` alongside `author` and
26
+ * `timestamp`.
25
27
  */
26
- export interface LoadMemoryResponse {
27
- memories: MemoryEntry[];
28
+ export interface LoadMemoryResponse<T = MemoryEntry> {
29
+ memories: T[];
28
30
  }
29
31
  /**
30
- * A tool that loads the memory for the current user.
32
+ * A tool that loads memory entries for the current user.
31
33
  *
32
- * NOTE: Currently this tool only uses text part from the memory.
34
+ * By default, returns complete {@link MemoryEntry} objects.
33
35
  */
34
36
  export declare class LoadMemoryTool extends BaseTool {
35
37
  private readonly textOnlyContent;
36
38
  constructor(options?: LoadMemoryToolOptions);
37
39
  _getDeclaration(): FunctionDeclaration | undefined;
38
- runAsync({ args, toolContext, }: RunAsyncToolRequest): Promise<unknown>;
40
+ runAsync({ args, toolContext }: RunAsyncToolRequest): Promise<LoadMemoryResponse<MemoryEntry | {
41
+ content: string;
42
+ author?: string;
43
+ timestamp?: string;
44
+ }>>;
39
45
  processLlmRequest(request: ToolProcessLlmRequest): Promise<void>;
40
46
  }
41
47
  /**
@@ -7,6 +7,7 @@ import type { Client } from '@modelcontextprotocol/sdk/client/index.js';
7
7
  import type { SSEClientTransportOptions } from '@modelcontextprotocol/sdk/client/sse.js';
8
8
  import type { StdioServerParameters } from '@modelcontextprotocol/sdk/client/stdio.js';
9
9
  import type { StreamableHTTPClientTransportOptions } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
10
+ import type { RequestOptions } from '@modelcontextprotocol/sdk/shared/protocol.js';
10
11
  /**
11
12
  * Defines the parameters for establishing a connection to an MCP server using
12
13
  * standard input/output (stdio). This is typically used for running MCP servers
@@ -15,6 +16,10 @@ import type { StreamableHTTPClientTransportOptions } from '@modelcontextprotocol
15
16
  export interface StdioConnectionParams {
16
17
  type: 'StdioConnectionParams';
17
18
  serverParams: StdioServerParameters;
19
+ /**
20
+ * Request timeout in seconds for stdio MCP operations. When unset, the MCP
21
+ * SDK applies its own default request timeout.
22
+ */
18
23
  timeout?: number;
19
24
  }
20
25
  /**
@@ -94,6 +99,17 @@ export declare class MCPSessionManager {
94
99
  private readonly connectionParams;
95
100
  private readonly activeSessions;
96
101
  constructor(connectionParams: MCPConnectionParams);
102
+ /**
103
+ * Builds per-request options for MCP client operations.
104
+ *
105
+ * For a stdio connection with a configured `timeout`, the timeout is
106
+ * converted from seconds to milliseconds. Otherwise the MCP SDK applies its
107
+ * own default request timeout.
108
+ *
109
+ * @param signal Optional abort signal to attach to the request.
110
+ * @return The request options for the MCP SDK client.
111
+ */
112
+ getRequestOptions(signal?: AbortSignal): RequestOptions;
97
113
  createSession(): Promise<Client>;
98
114
  closeSession(client: Client): Promise<void>;
99
115
  getActiveSessions(): Client[];
@@ -86,7 +86,7 @@ export declare function tokenToSchemeCredential(tokenType: 'apikey' | 'oauth2Tok
86
86
  * @param scopes The scopes to request.
87
87
  * @returns A `[scheme, credential]` pair.
88
88
  */
89
- export declare function serviceAccountDictToSchemeCredential(config: Record<string, unknown>, scopes: string[]): [AuthScheme, AuthCredential];
89
+ export declare function serviceAccountRecordToSchemeCredential(config: Record<string, unknown>, scopes: string[]): [AuthScheme, AuthCredential];
90
90
  /**
91
91
  * Creates a bearer scheme and a service-account credential from an already
92
92
  * built `ServiceAccount`.
@@ -99,16 +99,16 @@ export declare function serviceAccountSchemeCredential(config: ServiceAccount):
99
99
  * Builds an OpenID Connect scheme and credential from a configuration object
100
100
  * and a client-secret object.
101
101
  *
102
- * @param configDict An OpenID Connect configuration. Snake_case keys, as a
102
+ * @param configRecord An OpenID Connect configuration. Snake_case keys, as a
103
103
  * discovery document delivers them, are accepted and normalized.
104
104
  * @param scopes The scopes to request.
105
- * @param credentialDict The Google OAuth client secret. Its keys stay
105
+ * @param credentialRecord The Google OAuth client secret. Its keys stay
106
106
  * snake_case, because it is an on-disk wire format. A `{web: {…}}` or
107
107
  * `{installed: {…}}` wrapper is unwrapped.
108
108
  * @returns A `[scheme, credential]` pair.
109
109
  * @throws Error When the configuration or the client secret is incomplete.
110
110
  */
111
- export declare function openidDictToSchemeCredential(configDict: Record<string, unknown>, scopes: string[], credentialDict: Record<string, unknown>): [OpenIdConnectWithConfig, AuthCredential];
111
+ export declare function openidRecordToSchemeCredential(configRecord: Record<string, unknown>, scopes: string[], credentialRecord: Record<string, unknown>): [OpenIdConnectWithConfig, AuthCredential];
112
112
  /**
113
113
  * Fetches an OpenID Connect discovery document and pairs it with a client
114
114
  * secret.
@@ -118,12 +118,12 @@ export declare function openidDictToSchemeCredential(configDict: Record<string,
118
118
  *
119
119
  * @param openidUrl The OpenID Connect discovery URL.
120
120
  * @param scopes The scopes to request.
121
- * @param credentialDict The Google OAuth client secret, keyed snake_case.
121
+ * @param credentialRecord The Google OAuth client secret, keyed snake_case.
122
122
  * @returns A `[scheme, credential]` pair.
123
123
  * @throws Error When the request fails, the body is not a JSON object, or the
124
124
  * configuration is incomplete.
125
125
  */
126
- export declare function openidUrlToSchemeCredential(openidUrl: string, scopes: string[], credentialDict: Record<string, unknown>): Promise<[OpenIdConnectWithConfig, AuthCredential]>;
126
+ export declare function openidUrlToSchemeCredential(openidUrl: string, scopes: string[], credentialRecord: Record<string, unknown>): Promise<[OpenIdConnectWithConfig, AuthCredential]>;
127
127
  /**
128
128
  * Converts a scheme and credential into the tool parameter that carries the
129
129
  * credential, plus the value to send for it.
@@ -144,7 +144,7 @@ export declare function credentialToParam(authScheme: AuthScheme, authCredential
144
144
  * `AuthScheme`.
145
145
  *
146
146
  * @example
147
- * const scheme = dictToAuthScheme({
147
+ * const scheme = recordToAuthScheme({
148
148
  * type: 'apiKey',
149
149
  * in: 'header',
150
150
  * name: 'X-API-Key',
@@ -155,4 +155,4 @@ export declare function credentialToParam(authScheme: AuthScheme, authCredential
155
155
  * @throws Error When `type` is missing or unrecognised, or the rest of the
156
156
  * object does not match the shape that type requires.
157
157
  */
158
- export declare function dictToAuthScheme(data: Record<string, unknown>): AuthScheme;
158
+ export declare function recordToAuthScheme(data: Record<string, unknown>): AuthScheme;
@@ -104,6 +104,9 @@ export declare class OperationParser {
104
104
  /**
105
105
  * Gets the Python-style type hint of the return value.
106
106
  *
107
+ * @deprecated Legacy Python type-hint helper retained for compatibility. In
108
+ * `adk-js`, tool declarations pass the JSON schema from
109
+ * {@link OperationParser.getJsonSchema} directly to the model.
107
110
  * @returns A type name such as `str`, or `Any` when the operation declares
108
111
  * no typed 2xx response.
109
112
  */
@@ -112,9 +115,10 @@ export declare class OperationParser {
112
115
  * Generates a Python-style docstring describing the operation, every
113
116
  * parameter and the return value.
114
117
  *
115
- * The type names inside it are Python's, because the artifact is a docstring
116
- * in adk-python's format and the same text reaches the model in both SDKs.
117
- *
118
+ * @deprecated Legacy Python docstring helper retained for compatibility. In
119
+ * `adk-js`, tool declarations use {@link OperationParser.getDescription}
120
+ * and {@link OperationParser.getJsonSchema} rather than sending a Python
121
+ * docstring to the model.
118
122
  * @returns The generated docstring.
119
123
  */
120
124
  getPydocString(): string;
@@ -33,12 +33,12 @@ export interface ToolboxToolLike {
33
33
  */
34
34
  export interface ToolboxLoadOptions {
35
35
  /**
36
- * Mapping of authentication service names to callables that return the
36
+ * Mapping of authentication service names to functions that return the
37
37
  * corresponding authentication token.
38
38
  */
39
39
  authTokenGetters?: Record<string, () => string | Promise<string>>;
40
40
  /**
41
- * Mapping of parameter names to bind to fixed values or callables that
41
+ * Mapping of parameter names to bind to fixed values or functions that
42
42
  * produce values as needed.
43
43
  */
44
44
  boundParams?: Record<string, unknown>;
@@ -49,21 +49,13 @@ export interface ToolboxLoadOptions {
49
49
  */
50
50
  export interface ToolboxToolsetClientLike {
51
51
  /**
52
- * Loads a single tool by name (camelCase convention).
52
+ * Loads a single tool by name.
53
53
  */
54
- loadTool?: (toolName: string, options?: ToolboxLoadOptions) => BaseTool | ToolboxToolLike | ((...args: never[]) => unknown) | Promise<BaseTool | ToolboxToolLike | ((...args: never[]) => unknown)>;
54
+ loadTool?: (toolName: string, authTokenGetters?: Record<string, () => string | Promise<string>>, boundParams?: Record<string, unknown>) => BaseTool | ToolboxToolLike | ((...args: never[]) => unknown) | Promise<BaseTool | ToolboxToolLike | ((...args: never[]) => unknown)>;
55
55
  /**
56
- * Loads a single tool by name (snake_case convention).
56
+ * Loads a toolset by name.
57
57
  */
58
- load_tool?: (toolName: string, options?: ToolboxLoadOptions) => BaseTool | ToolboxToolLike | ((...args: never[]) => unknown) | Promise<BaseTool | ToolboxToolLike | ((...args: never[]) => unknown)>;
59
- /**
60
- * Loads a toolset by name (camelCase convention).
61
- */
62
- loadToolset?: (toolsetName: string, options?: ToolboxLoadOptions) => Array<BaseTool | ToolboxToolLike | ((...args: never[]) => unknown)> | Promise<Array<BaseTool | ToolboxToolLike | ((...args: never[]) => unknown)>>;
63
- /**
64
- * Loads a toolset by name (snake_case convention).
65
- */
66
- load_toolset?: (toolsetName: string, options?: ToolboxLoadOptions) => Array<BaseTool | ToolboxToolLike | ((...args: never[]) => unknown)> | Promise<Array<BaseTool | ToolboxToolLike | ((...args: never[]) => unknown)>>;
58
+ loadToolset?: (toolsetName: string, authTokenGetters?: Record<string, () => string | Promise<string>>, boundParams?: Record<string, unknown>) => Array<BaseTool | ToolboxToolLike | ((...args: never[]) => unknown)> | Promise<Array<BaseTool | ToolboxToolLike | ((...args: never[]) => unknown)>>;
67
59
  /**
68
60
  * Closes the underlying client resources.
69
61
  */
@@ -74,9 +66,9 @@ export interface ToolboxToolsetClientLike {
74
66
  */
75
67
  export interface ToolboxToolsetOptions {
76
68
  /**
77
- * The URL of the Toolbox server.
69
+ * The URL of the Toolbox server. Required when `client` is not provided.
78
70
  */
79
- serverUrl: string;
71
+ serverUrl?: string;
80
72
  /**
81
73
  * The name of the Toolbox toolset to load.
82
74
  */
@@ -86,12 +78,12 @@ export interface ToolboxToolsetOptions {
86
78
  */
87
79
  toolNames?: readonly string[];
88
80
  /**
89
- * Mapping of authentication service names to callables that return the
81
+ * Mapping of authentication service names to functions that return the
90
82
  * corresponding authentication token.
91
83
  */
92
84
  authTokenGetters?: Record<string, () => string | Promise<string>>;
93
85
  /**
94
- * Mapping of parameter names to bind to fixed values or callables that
86
+ * Mapping of parameter names to bind to fixed values or functions that
95
87
  * produce values as needed.
96
88
  */
97
89
  boundParams?: Record<string, unknown>;
@@ -121,9 +113,9 @@ export declare class ToolboxToolset extends BaseToolset {
121
113
  /** A unique symbol to identify ADK ToolboxToolset class. */
122
114
  readonly [TOOLBOX_TOOLSET_SIGNATURE_SYMBOL] = true;
123
115
  /**
124
- * The URL of the Toolbox server.
116
+ * The URL of the Toolbox server, if configured.
125
117
  */
126
- readonly serverUrl: string;
118
+ readonly serverUrl?: string;
127
119
  /**
128
120
  * The name of the Toolbox toolset to load, if configured.
129
121
  */
@@ -145,6 +137,9 @@ export declare class ToolboxToolset extends BaseToolset {
145
137
  */
146
138
  readonly toolboxClient: ToolboxToolsetClientLike;
147
139
  constructor(options: ToolboxToolsetOptions);
140
+ /**
141
+ * @deprecated Use `new ToolboxToolset({serverUrl, ...options})` instead.
142
+ */
148
143
  constructor(serverUrl: string, options: Omit<ToolboxToolsetOptions, 'serverUrl'>);
149
144
  /**
150
145
  * Loads the configured toolset and/or individual tools from the Toolbox
@@ -18,12 +18,16 @@
18
18
  * queue, so a later `close()` can't discard the error.
19
19
  * - {@link push} after close/fail is ignored (the producer has already
20
20
  * signalled completion).
21
+ * - {@link pushAndWait} resolves once the consumer has finished with the item:
22
+ * when it asks for the next one, or when the queue closes or fails.
21
23
  */
22
24
  export declare class AsyncQueue<T> implements AsyncIterable<T> {
23
25
  private queue;
24
26
  private resolvers;
25
27
  private closed;
26
28
  private failure?;
29
+ /** Releases the producer of the item the consumer currently holds. */
30
+ private deliveredAck?;
27
31
  /** Whether the queue has been closed or failed. */
28
32
  get isClosed(): boolean;
29
33
  /** Number of items buffered and not yet consumed. */
@@ -33,6 +37,16 @@ export declare class AsyncQueue<T> implements AsyncIterable<T> {
33
37
  * immediately; otherwise the value is buffered. No-op once closed/failed.
34
38
  */
35
39
  push(value: T): void;
40
+ /**
41
+ * Enqueues a value like {@link push}, and resolves once the consumer has
42
+ * finished with it: when it asks for the next item, or when the queue closes
43
+ * or fails. Resolves at once if the queue is already closed.
44
+ */
45
+ pushAndWait(value: T): Promise<void>;
46
+ private enqueue;
47
+ /** Releases every producer still waiting in {@link pushAndWait}. */
48
+ private releaseAll;
49
+ private releaseDelivered;
36
50
  /**
37
51
  * Signals that production failed. Buffered items are still delivered first;
38
52
  * once the buffer drains, the consumer's next `next()` rejects with `error`.
@@ -68,6 +68,17 @@ export declare function base64Decode(data: string): string;
68
68
  * @return True if the string is base64-encoded, false otherwise.
69
69
  */
70
70
  export declare function isBase64Encoded(data: string): boolean;
71
+ /**
72
+ * Gets the value of the given environment variable.
73
+ *
74
+ * Browsers have no `process` global, and there even `process?.env` throws a
75
+ * ReferenceError, so this checks `typeof process` first and treats every
76
+ * variable as unset.
77
+ *
78
+ * @param envVar The environment variable to get the value of.
79
+ * @return The value of the environment variable, or undefined if it is unset.
80
+ */
81
+ export declare function getEnvVar(envVar: string): string | undefined;
71
82
  /**
72
83
  * Gets the boolean value of the given environment variable.
73
84
  *
@@ -3,6 +3,10 @@
3
3
  * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /** Normalizes a plugin notification without changing the caller's thrown value. */
7
+ export declare function toError(error: unknown): Error;
8
+ /** Recognizes cancellation within 32 cause levels, only after signal abort. */
9
+ export declare function isInvocationCancellation(error: unknown, signal?: AbortSignal): boolean;
6
10
  /**
7
11
  * Returns the plain, non-recursive message for a single thrown value.
8
12
  *
@@ -9,15 +9,32 @@ export type MCPToolSchema = {
9
9
  properties?: Record<string, unknown>;
10
10
  required?: string[];
11
11
  };
12
- export declare function toGeminiSchema(mcpSchema?: MCPToolSchema): Schema | undefined;
13
12
  /**
14
- * Normalizes a JSON Schema `type` value into a single non-null type name and a
15
- * `nullable` flag.
13
+ * Copies the constraint keywords a genai `Schema` declares from a JSON Schema
14
+ * node onto a `Schema` node, in the encoding the genai dialect expects.
15
+ *
16
+ * This is the one place that decides which constraints survive a conversion, so
17
+ * that both converters apply the same rules: `toGeminiSchema` for a JSON Schema
18
+ * (an MCP tool schema, or a serialized Zod response) and `zodObjectToSchema`
19
+ * for a Zod object. Without this, every nested `minItems`/`minLength`/`minimum`
20
+ * is silently dropped and the model is told an unconstrained schema.
21
+ *
22
+ * - `minItems`/`maxItems`, `minLength`/`maxLength` and
23
+ * `minProperties`/`maxProperties` are counts and lengths, which the genai
24
+ * `Schema` stores as strings.
25
+ * - `minimum`/`maximum` stay numbers, as `Schema` declares them.
26
+ * - `pattern` is already a string in both dialects, and survives unless it
27
+ * merely restates an `email`/`uuid` format.
16
28
  *
17
- * When `type` is an array containing multiple non-null types, the first
18
- * non-null entry is selected as the primary Gemini schema type.
29
+ * Every other JSON Schema keyword (`title`, `default`, `example`,
30
+ * `exclusiveMinimum`, ...) and any unsupported `format` has no `Schema` field
31
+ * the backend accepts, so it is still dropped.
32
+ *
33
+ * @param source The JSON Schema node to read the constraints from.
34
+ * @param target The `Schema` node to write them to; may be `source` itself.
19
35
  */
20
- export declare function normalizeJsonSchemaType(jsonSchemaType?: unknown): [string | undefined, boolean];
36
+ export declare function copySchemaConstraints(source: Record<string, unknown>, target: Record<string, unknown>): void;
37
+ export declare function toGeminiSchema(mcpSchema?: MCPToolSchema): Schema | undefined;
21
38
  /**
22
39
  * Converts an OpenAPI schema to a Gemini `Schema`.
23
40
  *
@@ -26,6 +43,10 @@ export declare function normalizeJsonSchemaType(jsonSchemaType?: unknown): [stri
26
43
  * it likes, so a key the Gemini `Schema` does not declare is dropped instead of
27
44
  * being forwarded to a backend that rejects it.
28
45
  *
46
+ * `oneOf` branches are folded into `anyOf`. A `{type: 'null'}` branch is
47
+ * removed and marks the schema `nullable`. When only one branch remains, it is
48
+ * merged into the parent schema instead of being kept as a one-item `anyOf`.
49
+ *
29
50
  * @param openApiSchema The OpenAPI schema, which may be any value.
30
51
  * @returns The converted schema, or `undefined` when there is no input.
31
52
  * @throws {TypeError} If the input is neither an object nor nullish.
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * Returns a new unique ID string.
8
+ */
9
+ export type IdProvider = () => string;
10
+ /**
11
+ * Sets the function used to generate event, invocation, session and
12
+ * function-call IDs. Without a provider, every ID keeps its default format.
13
+ *
14
+ * Useful when random IDs are not unique, e.g. runtimes restored from one
15
+ * memory snapshot share RNG state. Like adk-python's `set_id_provider`, but
16
+ * global instead of scoped to an async context.
17
+ *
18
+ * Each value must be a non-empty string that no other runtime produces.
19
+ * Session IDs come from it too, so the values should also be hard to guess.
20
+ *
21
+ * @param provider A function that returns a unique ID string.
22
+ */
23
+ export declare function setIdProvider(provider: IdProvider): void;
24
+ /**
25
+ * Removes the provider set with `setIdProvider`, so IDs go back to their
26
+ * default formats.
27
+ */
28
+ export declare function resetIdProvider(): void;
29
+ /**
30
+ * Returns a new unique ID from the provider set with `setIdProvider`, or a
31
+ * random v4 UUID when none is set.
32
+ */
33
+ export declare function newId(): string;
34
+ /**
35
+ * Returns a new unique ID from the provider set with `setIdProvider`, or from
36
+ * `fallback` when none is set.
37
+ *
38
+ * Internal to the framework: not part of the public API. For IDs whose default
39
+ * is not a random v4 UUID, such as event IDs.
40
+ *
41
+ * @param fallback A function that returns the default ID.
42
+ */
43
+ export declare function newIdOr(fallback: IdProvider): string;
@@ -18,6 +18,14 @@ export declare function extractModelName(modelString: string): string;
18
18
  * @return true if it's a Gemini model, false otherwise.
19
19
  */
20
20
  export declare function isGeminiModel(modelString: string): boolean;
21
+ /**
22
+ * Returns the major version of a `gemini-*` model.
23
+ *
24
+ * @param modelString Either a simple model name or path-based model name.
25
+ * @return The major version, or `undefined` when the model is not a Gemini
26
+ * model or its version is not numeric (for example `gemini-flash-latest`).
27
+ */
28
+ export declare function getGeminiMajorVersion(modelString: string | undefined): number | undefined;
21
29
  /**
22
30
  * Check if the model is a Gemini 1.x model using regex patterns.
23
31
  *
@@ -24,6 +24,8 @@ export declare function isNonGlobalAddress(address: string): boolean;
24
24
  * embeds a link-local IPv4. Unparseable input fails closed (blocked).
25
25
  */
26
26
  export declare function isLinkLocalAddress(address: string): boolean;
27
+ /** Returns `true` when `address` is an IPv4 or IPv6 literal (without brackets). */
28
+ export declare function isIpAddress(address: string): boolean;
27
29
  /**
28
30
  * Resolves `hostname` to a de-duplicated list of IP addresses. IP literals are
29
31
  * returned as-is; hostnames are resolved via DNS. Throws when resolution yields
@@ -3,4 +3,4 @@
3
3
  * Copyright 2025 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- export declare const version = "2.4.0";
6
+ export declare const version = "2.5.0";
@@ -21,7 +21,7 @@ export { FunctionNode } from './nodes/function_node.js';
21
21
  export type { FunctionNodeConfig, FunctionNodeHandler, FunctionNodeResult, } from './nodes/function_node.js';
22
22
  export { JoinNode } from './nodes/join_node.js';
23
23
  export { NodeTool } from './nodes/node_tool.js';
24
- export { ParallelWorker } from './nodes/parallel_worker.js';
24
+ export { ParallelWorker, isParallelWorker } from './nodes/parallel_worker.js';
25
25
  export type { ParallelWorkerConfig } from './nodes/parallel_worker.js';
26
26
  export { ToolNode } from './nodes/tool_node.js';
27
27
  export type { ToolNodeConfig } from './nodes/tool_node.js';
@@ -6,6 +6,7 @@
6
6
  import { BaseNode } from '../base_node.js';
7
7
  import { RunnableNode } from '../graph.js';
8
8
  import { NodeContext } from '../node_context.js';
9
+ declare const PARALLEL_WORKER_SIGNATURE_SYMBOL: unique symbol;
9
10
  /** Options for a {@link ParallelWorker}. */
10
11
  export interface ParallelWorkerConfig {
11
12
  /**
@@ -48,8 +49,14 @@ export interface ParallelWorkerConfig {
48
49
  * `ctx.runNode` has no way to forward a signal into a child run.
49
50
  */
50
51
  export declare class ParallelWorker extends BaseNode {
52
+ readonly [PARALLEL_WORKER_SIGNATURE_SYMBOL] = true;
51
53
  readonly maxParallelWorkers?: number;
52
- private readonly inner;
54
+ readonly inner: BaseNode;
53
55
  constructor(inner: RunnableNode, config?: ParallelWorkerConfig);
54
56
  protected runImpl(ctx: NodeContext, input: unknown): AsyncGenerator<unknown, void, void>;
55
57
  }
58
+ /**
59
+ * Type guard to check if an object is an instance of {@link ParallelWorker}.
60
+ */
61
+ export declare function isParallelWorker(value: unknown): value is ParallelWorker;
62
+ export {};