@google/adk 1.2.0 → 1.3.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 (190) hide show
  1. package/dist/cjs/agents/base_agent.js +19 -1
  2. package/dist/cjs/agents/instructions.js +81 -33
  3. package/dist/cjs/agents/invocation_context.js +0 -1
  4. package/dist/cjs/agents/llm_agent.js +52 -5
  5. package/dist/cjs/agents/processors/agent_transfer_llm_request_processor.js +7 -0
  6. package/dist/cjs/agents/processors/basic_llm_request_processor.js +8 -1
  7. package/dist/cjs/agents/processors/content_processor_utils.js +37 -24
  8. package/dist/cjs/agents/processors/content_request_processor.js +7 -0
  9. package/dist/cjs/agents/processors/context_compactor_request_processor.js +12 -0
  10. package/dist/cjs/agents/processors/identity_llm_request_processor.js +7 -0
  11. package/dist/cjs/agents/processors/instructions_llm_request_processor.js +5 -0
  12. package/dist/cjs/agents/processors/request_confirmation_llm_request_processor.js +9 -1
  13. package/dist/cjs/agents/processors/tool_filter_request_processor.js +7 -1
  14. package/dist/cjs/auth/auth_preprocessor.js +12 -10
  15. package/dist/cjs/auth/oauth2/oauth2_discovery.js +1 -1
  16. package/dist/cjs/code_executors/code_executor_context.js +7 -7
  17. package/dist/cjs/common.js +39 -0
  18. package/dist/cjs/context/summarizers/llm_summarizer.js +11 -0
  19. package/dist/cjs/context/token_based_context_compactor.js +1 -1
  20. package/dist/cjs/events/event.js +1 -1
  21. package/dist/cjs/integrations/agent_registry/agent_registry_mcp_toolset.js +21 -2
  22. package/dist/cjs/models/gemini_llm_connection.js +62 -19
  23. package/dist/cjs/models/google_llm.js +26 -8
  24. package/dist/cjs/plugins/security_plugin.js +16 -0
  25. package/dist/cjs/sessions/base_session_service.js +13 -2
  26. package/dist/cjs/sessions/database_session_service.js +2 -2
  27. package/dist/cjs/sessions/db/schema.js +45 -10
  28. package/dist/cjs/sessions/in_memory_session_service.js +2 -1
  29. package/dist/cjs/sessions/vertex_ai_session_service.js +2 -1
  30. package/dist/cjs/skills/gcp_skill_registry.js +104 -0
  31. package/dist/cjs/skills/loader.js +65 -0
  32. package/dist/cjs/skills/skill_registry.js +27 -0
  33. package/dist/cjs/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js +232 -0
  34. package/dist/cjs/tools/openapi_tool/openapi_spec_parser/operation_parser.js +224 -0
  35. package/dist/cjs/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js +127 -0
  36. package/dist/cjs/tools/openapi_tool/openapi_toolset.js +133 -0
  37. package/dist/cjs/tools/openapi_tool/rest_api_tool.js +256 -0
  38. package/dist/cjs/tools/skill/load_skill_resource_tool.js +25 -3
  39. package/dist/cjs/tools/skill/load_skill_tool.js +12 -1
  40. package/dist/cjs/tools/skill/run_skill_script_tool.js +12 -1
  41. package/dist/cjs/tools/skill/search_skills_tool.js +108 -0
  42. package/dist/cjs/tools/skill/skill_toolset.js +40 -5
  43. package/dist/cjs/utils/async_queue.js +88 -0
  44. package/dist/cjs/utils/case_utils.js +53 -0
  45. package/dist/cjs/utils/env_aware_utils.js +4 -0
  46. package/dist/cjs/utils/live_connection_utils.js +284 -0
  47. package/dist/cjs/utils/model_name.js +9 -0
  48. package/dist/cjs/utils/streaming_utils.js +9 -8
  49. package/dist/cjs/version.js +1 -1
  50. package/dist/esm/agents/base_agent.js +19 -1
  51. package/dist/esm/agents/instructions.js +81 -33
  52. package/dist/esm/agents/invocation_context.js +0 -1
  53. package/dist/esm/agents/llm_agent.js +53 -5
  54. package/dist/esm/agents/processors/agent_transfer_llm_request_processor.js +7 -0
  55. package/dist/esm/agents/processors/basic_llm_request_processor.js +8 -1
  56. package/dist/esm/agents/processors/content_processor_utils.js +35 -23
  57. package/dist/esm/agents/processors/content_request_processor.js +7 -0
  58. package/dist/esm/agents/processors/context_compactor_request_processor.js +12 -0
  59. package/dist/esm/agents/processors/identity_llm_request_processor.js +7 -0
  60. package/dist/esm/agents/processors/instructions_llm_request_processor.js +5 -0
  61. package/dist/esm/agents/processors/request_confirmation_llm_request_processor.js +9 -1
  62. package/dist/esm/agents/processors/tool_filter_request_processor.js +7 -1
  63. package/dist/esm/auth/auth_preprocessor.js +12 -10
  64. package/dist/esm/auth/oauth2/oauth2_discovery.js +1 -1
  65. package/dist/esm/code_executors/code_executor_context.js +7 -7
  66. package/dist/esm/common.js +33 -1
  67. package/dist/esm/context/summarizers/llm_summarizer.js +11 -0
  68. package/dist/esm/context/token_based_context_compactor.js +1 -1
  69. package/dist/esm/events/event.js +1 -1
  70. package/dist/esm/integrations/agent_registry/agent_registry_mcp_toolset.js +21 -2
  71. package/dist/esm/models/gemini_llm_connection.js +62 -19
  72. package/dist/esm/models/google_llm.js +26 -8
  73. package/dist/esm/plugins/security_plugin.js +16 -0
  74. package/dist/esm/sessions/base_session_service.js +11 -1
  75. package/dist/esm/sessions/database_session_service.js +2 -2
  76. package/dist/esm/sessions/db/schema.js +44 -10
  77. package/dist/esm/sessions/in_memory_session_service.js +4 -2
  78. package/dist/esm/sessions/vertex_ai_session_service.js +4 -2
  79. package/dist/esm/skills/gcp_skill_registry.js +78 -0
  80. package/dist/esm/skills/loader.js +64 -0
  81. package/dist/esm/skills/skill_registry.js +7 -0
  82. package/dist/esm/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js +206 -0
  83. package/dist/esm/tools/openapi_tool/openapi_spec_parser/operation_parser.js +198 -0
  84. package/dist/esm/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js +101 -0
  85. package/dist/esm/tools/openapi_tool/openapi_toolset.js +97 -0
  86. package/dist/esm/tools/openapi_tool/rest_api_tool.js +229 -0
  87. package/dist/esm/tools/skill/load_skill_resource_tool.js +25 -3
  88. package/dist/esm/tools/skill/load_skill_tool.js +12 -1
  89. package/dist/esm/tools/skill/run_skill_script_tool.js +12 -1
  90. package/dist/esm/tools/skill/search_skills_tool.js +82 -0
  91. package/dist/esm/tools/skill/skill_toolset.js +40 -5
  92. package/dist/esm/utils/async_queue.js +60 -0
  93. package/dist/esm/utils/case_utils.js +25 -0
  94. package/dist/esm/utils/env_aware_utils.js +4 -0
  95. package/dist/esm/utils/live_connection_utils.js +256 -0
  96. package/dist/esm/utils/model_name.js +8 -0
  97. package/dist/esm/utils/streaming_utils.js +9 -8
  98. package/dist/esm/version.js +1 -1
  99. package/dist/types/a2a/a2a_remote_agent_utils.d.ts +29 -4
  100. package/dist/types/a2a/event_converter_utils.d.ts +14 -1
  101. package/dist/types/a2a/metadata_converter_utils.d.ts +18 -0
  102. package/dist/types/a2a/part_converter_utils.d.ts +51 -6
  103. package/dist/types/agents/invocation_context.d.ts +0 -9
  104. package/dist/types/agents/llm_agent.d.ts +14 -0
  105. package/dist/types/agents/processors/agent_transfer_llm_request_processor.d.ts +14 -0
  106. package/dist/types/agents/processors/basic_llm_request_processor.d.ts +7 -0
  107. package/dist/types/agents/processors/content_processor_utils.d.ts +26 -0
  108. package/dist/types/agents/processors/content_request_processor.d.ts +16 -0
  109. package/dist/types/agents/processors/context_compactor_request_processor.d.ts +12 -0
  110. package/dist/types/agents/processors/identity_llm_request_processor.d.ts +7 -0
  111. package/dist/types/agents/processors/request_confirmation_llm_request_processor.d.ts +9 -1
  112. package/dist/types/agents/processors/tool_filter_request_processor.d.ts +12 -1
  113. package/dist/types/common.d.ts +15 -1
  114. package/dist/types/context/summarizers/llm_summarizer.d.ts +17 -0
  115. package/dist/types/events/event_actions.d.ts +1 -2
  116. package/dist/types/integrations/agent_registry/agent_registry_mcp_toolset.d.ts +21 -2
  117. package/dist/types/models/base_llm_connection.d.ts +10 -0
  118. package/dist/types/models/gemini_llm_connection.d.ts +15 -4
  119. package/dist/types/models/llm_response.d.ts +10 -1
  120. package/dist/types/plugins/security_plugin.d.ts +30 -0
  121. package/dist/types/sessions/base_session_service.d.ts +4 -0
  122. package/dist/types/sessions/db/schema.d.ts +1 -0
  123. package/dist/types/skills/gcp_skill_registry.d.ts +24 -0
  124. package/dist/types/skills/loader.d.ts +7 -0
  125. package/dist/types/skills/skill.d.ts +1 -1
  126. package/dist/types/skills/skill_registry.d.ts +29 -0
  127. package/dist/types/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.d.ts +34 -0
  128. package/dist/types/tools/openapi_tool/openapi_spec_parser/operation_parser.d.ts +59 -0
  129. package/dist/types/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.d.ts +23 -0
  130. package/dist/types/tools/openapi_tool/openapi_toolset.d.ts +27 -0
  131. package/dist/types/tools/openapi_tool/rest_api_tool.d.ts +50 -0
  132. package/dist/types/tools/skill/load_skill_resource_tool.d.ts +1 -1
  133. package/dist/types/tools/skill/search_skills_tool.d.ts +14 -0
  134. package/dist/types/tools/skill/skill_toolset.d.ts +5 -0
  135. package/dist/types/utils/async_queue.d.ts +18 -0
  136. package/dist/types/utils/case_utils.d.ts +12 -0
  137. package/dist/types/utils/live_connection_utils.d.ts +30 -0
  138. package/dist/types/utils/model_name.d.ts +7 -0
  139. package/dist/types/utils/streaming_utils.d.ts +0 -1
  140. package/dist/types/version.d.ts +1 -1
  141. package/dist/web/agents/base_agent.js +31 -1
  142. package/dist/web/agents/instructions.js +81 -33
  143. package/dist/web/agents/invocation_context.js +0 -1
  144. package/dist/web/agents/llm_agent.js +53 -5
  145. package/dist/web/agents/processors/agent_transfer_llm_request_processor.js +7 -0
  146. package/dist/web/agents/processors/basic_llm_request_processor.js +8 -1
  147. package/dist/web/agents/processors/content_processor_utils.js +53 -23
  148. package/dist/web/agents/processors/content_request_processor.js +7 -0
  149. package/dist/web/agents/processors/context_compactor_request_processor.js +12 -0
  150. package/dist/web/agents/processors/identity_llm_request_processor.js +7 -0
  151. package/dist/web/agents/processors/instructions_llm_request_processor.js +5 -0
  152. package/dist/web/agents/processors/request_confirmation_llm_request_processor.js +9 -1
  153. package/dist/web/agents/processors/tool_filter_request_processor.js +7 -1
  154. package/dist/web/auth/auth_preprocessor.js +12 -10
  155. package/dist/web/auth/oauth2/oauth2_discovery.js +1 -1
  156. package/dist/web/code_executors/code_executor_context.js +7 -7
  157. package/dist/web/common.js +33 -1
  158. package/dist/web/context/summarizers/llm_summarizer.js +11 -0
  159. package/dist/web/context/token_based_context_compactor.js +1 -1
  160. package/dist/web/events/event.js +1 -1
  161. package/dist/web/integrations/agent_registry/agent_registry_mcp_toolset.js +21 -2
  162. package/dist/web/models/gemini_llm_connection.js +75 -19
  163. package/dist/web/models/google_llm.js +26 -8
  164. package/dist/web/plugins/security_plugin.js +16 -0
  165. package/dist/web/sessions/base_session_service.js +11 -1
  166. package/dist/web/sessions/database_session_service.js +2 -2
  167. package/dist/web/sessions/db/schema.js +44 -10
  168. package/dist/web/sessions/in_memory_session_service.js +4 -2
  169. package/dist/web/sessions/vertex_ai_session_service.js +4 -2
  170. package/dist/web/skills/gcp_skill_registry.js +78 -0
  171. package/dist/web/skills/loader.js +64 -0
  172. package/dist/web/skills/skill_registry.js +7 -0
  173. package/dist/web/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js +221 -0
  174. package/dist/web/tools/openapi_tool/openapi_spec_parser/operation_parser.js +198 -0
  175. package/dist/web/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js +101 -0
  176. package/dist/web/tools/openapi_tool/openapi_toolset.js +97 -0
  177. package/dist/web/tools/openapi_tool/rest_api_tool.js +229 -0
  178. package/dist/web/tools/skill/load_skill_resource_tool.js +25 -3
  179. package/dist/web/tools/skill/load_skill_tool.js +12 -1
  180. package/dist/web/tools/skill/run_skill_script_tool.js +12 -1
  181. package/dist/web/tools/skill/search_skills_tool.js +82 -0
  182. package/dist/web/tools/skill/skill_toolset.js +40 -5
  183. package/dist/web/utils/async_queue.js +60 -0
  184. package/dist/web/utils/case_utils.js +25 -0
  185. package/dist/web/utils/env_aware_utils.js +4 -0
  186. package/dist/web/utils/live_connection_utils.js +254 -0
  187. package/dist/web/utils/model_name.js +8 -0
  188. package/dist/web/utils/streaming_utils.js +9 -8
  189. package/dist/web/version.js +1 -1
  190. package/package.json +3 -1
@@ -97,7 +97,7 @@ class CodeExecutorContext {
97
97
  * @return A list of input files in the code executor context.
98
98
  */
99
99
  getInputFiles() {
100
- if (!(INPUT_FILE_KEY in this.sessionState)) {
100
+ if (!this.sessionState.has(INPUT_FILE_KEY)) {
101
101
  return [];
102
102
  }
103
103
  return this.sessionState.get(INPUT_FILE_KEY);
@@ -107,13 +107,13 @@ class CodeExecutorContext {
107
107
  * @param inputFiles The input files to add to the session state.
108
108
  */
109
109
  addInputFiles(inputFiles) {
110
- if (!(INPUT_FILE_KEY in this.sessionState)) {
110
+ if (!this.sessionState.has(INPUT_FILE_KEY)) {
111
111
  this.sessionState.set(INPUT_FILE_KEY, []);
112
112
  }
113
113
  this.sessionState.get(INPUT_FILE_KEY).push(...inputFiles);
114
114
  }
115
115
  clearInputFiles() {
116
- if (INPUT_FILE_KEY in this.sessionState) {
116
+ if (this.sessionState.has(INPUT_FILE_KEY)) {
117
117
  this.sessionState.set(INPUT_FILE_KEY, []);
118
118
  }
119
119
  if (PROCESSED_FILE_NAMES_KEY in this.context) {
@@ -126,7 +126,7 @@ class CodeExecutorContext {
126
126
  * @return The error count for the given invocation ID.
127
127
  */
128
128
  getErrorCount(invocationId) {
129
- if (!(ERROR_COUNT_KEY in this.sessionState)) {
129
+ if (!this.sessionState.has(ERROR_COUNT_KEY)) {
130
130
  return 0;
131
131
  }
132
132
  return this.sessionState.get(ERROR_COUNT_KEY)[invocationId] || 0;
@@ -136,7 +136,7 @@ class CodeExecutorContext {
136
136
  * @param invocationId The invocation ID to increment the error count for.
137
137
  */
138
138
  incrementErrorCount(invocationId) {
139
- if (!(ERROR_COUNT_KEY in this.sessionState)) {
139
+ if (!this.sessionState.has(ERROR_COUNT_KEY)) {
140
140
  this.sessionState.set(ERROR_COUNT_KEY, {});
141
141
  }
142
142
  this.sessionState.get(ERROR_COUNT_KEY)[invocationId] = this.getErrorCount(invocationId) + 1;
@@ -146,7 +146,7 @@ class CodeExecutorContext {
146
146
  * @param invocationId The invocation ID to reset the error count for.
147
147
  */
148
148
  resetErrorCount(invocationId) {
149
- if (!(ERROR_COUNT_KEY in this.sessionState)) {
149
+ if (!this.sessionState.has(ERROR_COUNT_KEY)) {
150
150
  return;
151
151
  }
152
152
  const errorCounts = this.sessionState.get(ERROR_COUNT_KEY);
@@ -168,7 +168,7 @@ class CodeExecutorContext {
168
168
  resultStdout,
169
169
  resultStderr
170
170
  }) {
171
- if (!(CODE_EXECUTION_RESULTS_KEY in this.sessionState)) {
171
+ if (!this.sessionState.has(CODE_EXECUTION_RESULTS_KEY)) {
172
172
  this.sessionState.set(CODE_EXECUTION_RESULTS_KEY, {});
173
173
  }
174
174
  const codeExecutionResults = this.sessionState.get(
@@ -25,6 +25,7 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
25
25
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
26
26
  var common_exports = {};
27
27
  __export(common_exports, {
28
+ AUTH_PREPROCESSOR: () => import_auth_preprocessor.AUTH_PREPROCESSOR,
28
29
  ActiveStreamingTool: () => import_active_streaming_tool.ActiveStreamingTool,
29
30
  Agent: () => import_llm_agent.LlmAgent,
30
31
  AgentTool: () => import_agent_tool.AgentTool,
@@ -32,6 +33,7 @@ __export(common_exports, {
32
33
  ApigeeLlm: () => import_apigee_llm.ApigeeLlm,
33
34
  AuthCredentialTypes: () => import_auth_credential.AuthCredentialTypes,
34
35
  AuthHandler: () => import_auth_handler.AuthHandler,
36
+ AuthPreprocessor: () => import_auth_preprocessor.AuthPreprocessor,
35
37
  AuthProviderRegistry: () => import_auth_provider_registry.AuthProviderRegistry,
36
38
  BaseAgent: () => import_base_agent.BaseAgent,
37
39
  BaseCodeExecutor: () => import_base_code_executor.BaseCodeExecutor,
@@ -57,6 +59,7 @@ __export(common_exports, {
57
59
  ExitLoopTool: () => import_exit_loop_tool.ExitLoopTool,
58
60
  FileContentEncoding: () => import_code_execution_utils.FileContentEncoding,
59
61
  FunctionTool: () => import_function_tool.FunctionTool,
62
+ GCPSkillRegistry: () => import_gcp_skill_registry.GCPSkillRegistry,
60
63
  GOOGLE_MAPS_GROUNDING: () => import_google_maps_grounding_tool.GOOGLE_MAPS_GROUNDING,
61
64
  GOOGLE_SEARCH: () => import_google_search_tool.GOOGLE_SEARCH,
62
65
  Gemini: () => import_google_llm.Gemini,
@@ -88,6 +91,9 @@ __export(common_exports, {
88
91
  OAuth2CredentialExchanger: () => import_oauth2_credential_exchanger.OAuth2CredentialExchanger,
89
92
  OAuth2DiscoveryManager: () => import_oauth2_discovery.OAuth2DiscoveryManager,
90
93
  OAuthGrantType: () => import_auth_schemes.OAuthGrantType,
94
+ OpenAPIToolset: () => import_openapi_toolset.OpenAPIToolset,
95
+ OpenApiSpecParser: () => import_openapi_spec_parser.OpenApiSpecParser,
96
+ OperationParser: () => import_operation_parser.OperationParser,
91
97
  PRELOAD_MEMORY: () => import_preload_memory_tool.PRELOAD_MEMORY,
92
98
  ParallelAgent: () => import_parallel_agent.ParallelAgent,
93
99
  PluginManager: () => import_plugin_manager.PluginManager,
@@ -95,9 +101,11 @@ __export(common_exports, {
95
101
  PreloadMemoryTool: () => import_preload_memory_tool.PreloadMemoryTool,
96
102
  REQUEST_CONFIRMATION_FUNCTION_CALL_NAME: () => import_security_plugin.REQUEST_CONFIRMATION_FUNCTION_CALL_NAME,
97
103
  ReadonlyContext: () => import_readonly_context.ReadonlyContext,
104
+ RestApiTool: () => import_rest_api_tool.RestApiTool,
98
105
  RoutedAgent: () => import_routed_agent.RoutedAgent,
99
106
  RoutedLlm: () => import_routed_llm.RoutedLlm,
100
107
  Runner: () => import_runner.Runner,
108
+ SearchSkillsTool: () => import_search_skills_tool.SearchSkillsTool,
101
109
  SecurityPlugin: () => import_security_plugin.SecurityPlugin,
102
110
  SequentialAgent: () => import_sequential_agent.SequentialAgent,
103
111
  SessionStateCredentialService: () => import_session_state_credential_service.SessionStateCredentialService,
@@ -105,6 +113,7 @@ __export(common_exports, {
105
113
  State: () => import_state.State,
106
114
  StreamingMode: () => import_run_config.StreamingMode,
107
115
  TokenBasedContextCompactor: () => import_token_based_context_compactor.TokenBasedContextCompactor,
116
+ ToolAuthHandler: () => import_tool_auth_handler.ToolAuthHandler,
108
117
  ToolConfirmation: () => import_tool_confirmation.ToolConfirmation,
109
118
  TruncatingContextCompactor: () => import_truncating_context_compactor.TruncatingContextCompactor,
110
119
  URL_CONTEXT: () => import_url_context_tool.URL_CONTEXT,
@@ -114,6 +123,7 @@ __export(common_exports, {
114
123
  VertexRagRetrievalTool: () => import_vertex_rag_retrieval_tool.VertexRagRetrievalTool,
115
124
  createEvent: () => import_event.createEvent,
116
125
  createEventActions: () => import_event_actions.createEventActions,
126
+ createRestApiTool: () => import_rest_api_tool.createRestApiTool,
117
127
  createSession: () => import_session.createSession,
118
128
  functionsExportedForTestingOnly: () => import_functions.functionsExportedForTestingOnly,
119
129
  geminiInitParams: () => import_google_llm.geminiInitParams,
@@ -132,16 +142,21 @@ __export(common_exports, {
132
142
  isFinalResponse: () => import_event.isFinalResponse,
133
143
  isFunctionTool: () => import_function_tool.isFunctionTool,
134
144
  isGemini2OrAbove: () => import_model_name.isGemini2OrAbove,
145
+ isGemini3xFlashLive: () => import_model_name.isGemini3xFlashLive,
135
146
  isLlmAgent: () => import_llm_agent.isLlmAgent,
136
147
  isLoopAgent: () => import_loop_agent.isLoopAgent,
137
148
  isParallelAgent: () => import_parallel_agent.isParallelAgent,
138
149
  isRoutedAgent: () => import_routed_agent.isRoutedAgent,
139
150
  isRunner: () => import_runner.isRunner,
140
151
  isSequentialAgent: () => import_sequential_agent.isSequentialAgent,
152
+ loadAllSkillsInDir: () => import_loader.loadAllSkillsInDir,
153
+ loadSkillFromDir: () => import_loader.loadSkillFromDir,
154
+ loadSkillFromZipBuffer: () => import_loader.loadSkillFromZipBuffer,
141
155
  setLogLevel: () => import_logger.setLogLevel,
142
156
  setLogger: () => import_logger.setLogger,
143
157
  stringifyContent: () => import_event.stringifyContent,
144
158
  toStructuredEvents: () => import_structured_events.toStructuredEvents,
159
+ validateSkillDir: () => import_loader.validateSkillDir,
145
160
  version: () => import_version.version,
146
161
  zodObjectToSchema: () => import_simple_zod_to_json.zodObjectToSchema
147
162
  });
@@ -166,6 +181,7 @@ var import_sequential_agent = require("./agents/sequential_agent.js");
166
181
  var import_in_memory_artifact_service = require("./artifacts/in_memory_artifact_service.js");
167
182
  var import_auth_credential = require("./auth/auth_credential.js");
168
183
  var import_auth_handler = require("./auth/auth_handler.js");
184
+ var import_auth_preprocessor = require("./auth/auth_preprocessor.js");
169
185
  var import_auth_provider_registry = require("./auth/auth_provider_registry.js");
170
186
  var import_auth_schemes = require("./auth/auth_schemes.js");
171
187
  var import_in_memory_credential_service = require("./auth/credential_service/in_memory_credential_service.js");
@@ -222,10 +238,18 @@ var import_model_name = require("./utils/model_name.js");
222
238
  var import_simple_zod_to_json = require("./utils/simple_zod_to_json.js");
223
239
  var import_variant_utils = require("./utils/variant_utils.js");
224
240
  var import_version = require("./version.js");
241
+ var import_gcp_skill_registry = require("./skills/gcp_skill_registry.js");
242
+ var import_loader = require("./skills/loader.js");
225
243
  var import_list_skills_tool = require("./tools/skill/list_skills_tool.js");
226
244
  var import_load_skill_resource_tool = require("./tools/skill/load_skill_resource_tool.js");
227
245
  var import_load_skill_tool = require("./tools/skill/load_skill_tool.js");
246
+ var import_search_skills_tool = require("./tools/skill/search_skills_tool.js");
228
247
  var import_skill_toolset = require("./tools/skill/skill_toolset.js");
248
+ var import_openapi_spec_parser = require("./tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js");
249
+ var import_operation_parser = require("./tools/openapi_tool/openapi_spec_parser/operation_parser.js");
250
+ var import_tool_auth_handler = require("./tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js");
251
+ var import_openapi_toolset = require("./tools/openapi_tool/openapi_toolset.js");
252
+ var import_rest_api_tool = require("./tools/openapi_tool/rest_api_tool.js");
229
253
  __reExport(common_exports, require("./artifacts/base_artifact_service.js"), module.exports);
230
254
  __reExport(common_exports, require("./features/feature_registry.js"), module.exports);
231
255
  __reExport(common_exports, require("./memory/base_memory_service.js"), module.exports);
@@ -238,6 +262,7 @@ __reExport(common_exports, require("./tools/base_tool.js"), module.exports);
238
262
  */
239
263
  // Annotate the CommonJS export names for ESM import in node:
240
264
  0 && (module.exports = {
265
+ AUTH_PREPROCESSOR,
241
266
  ActiveStreamingTool,
242
267
  Agent,
243
268
  AgentTool,
@@ -245,6 +270,7 @@ __reExport(common_exports, require("./tools/base_tool.js"), module.exports);
245
270
  ApigeeLlm,
246
271
  AuthCredentialTypes,
247
272
  AuthHandler,
273
+ AuthPreprocessor,
248
274
  AuthProviderRegistry,
249
275
  BaseAgent,
250
276
  BaseCodeExecutor,
@@ -270,6 +296,7 @@ __reExport(common_exports, require("./tools/base_tool.js"), module.exports);
270
296
  ExitLoopTool,
271
297
  FileContentEncoding,
272
298
  FunctionTool,
299
+ GCPSkillRegistry,
273
300
  GOOGLE_MAPS_GROUNDING,
274
301
  GOOGLE_SEARCH,
275
302
  Gemini,
@@ -301,6 +328,9 @@ __reExport(common_exports, require("./tools/base_tool.js"), module.exports);
301
328
  OAuth2CredentialExchanger,
302
329
  OAuth2DiscoveryManager,
303
330
  OAuthGrantType,
331
+ OpenAPIToolset,
332
+ OpenApiSpecParser,
333
+ OperationParser,
304
334
  PRELOAD_MEMORY,
305
335
  ParallelAgent,
306
336
  PluginManager,
@@ -308,9 +338,11 @@ __reExport(common_exports, require("./tools/base_tool.js"), module.exports);
308
338
  PreloadMemoryTool,
309
339
  REQUEST_CONFIRMATION_FUNCTION_CALL_NAME,
310
340
  ReadonlyContext,
341
+ RestApiTool,
311
342
  RoutedAgent,
312
343
  RoutedLlm,
313
344
  Runner,
345
+ SearchSkillsTool,
314
346
  SecurityPlugin,
315
347
  SequentialAgent,
316
348
  SessionStateCredentialService,
@@ -318,6 +350,7 @@ __reExport(common_exports, require("./tools/base_tool.js"), module.exports);
318
350
  State,
319
351
  StreamingMode,
320
352
  TokenBasedContextCompactor,
353
+ ToolAuthHandler,
321
354
  ToolConfirmation,
322
355
  TruncatingContextCompactor,
323
356
  URL_CONTEXT,
@@ -327,6 +360,7 @@ __reExport(common_exports, require("./tools/base_tool.js"), module.exports);
327
360
  VertexRagRetrievalTool,
328
361
  createEvent,
329
362
  createEventActions,
363
+ createRestApiTool,
330
364
  createSession,
331
365
  functionsExportedForTestingOnly,
332
366
  geminiInitParams,
@@ -345,16 +379,21 @@ __reExport(common_exports, require("./tools/base_tool.js"), module.exports);
345
379
  isFinalResponse,
346
380
  isFunctionTool,
347
381
  isGemini2OrAbove,
382
+ isGemini3xFlashLive,
348
383
  isLlmAgent,
349
384
  isLoopAgent,
350
385
  isParallelAgent,
351
386
  isRoutedAgent,
352
387
  isRunner,
353
388
  isSequentialAgent,
389
+ loadAllSkillsInDir,
390
+ loadSkillFromDir,
391
+ loadSkillFromZipBuffer,
354
392
  setLogLevel,
355
393
  setLogger,
356
394
  stringifyContent,
357
395
  toStructuredEvents,
396
+ validateSkillDir,
358
397
  version,
359
398
  zodObjectToSchema,
360
399
  ...require("./artifacts/base_artifact_service.js"),
@@ -36,10 +36,21 @@ var import_event = require("../../events/event.js");
36
36
  */
37
37
  const DEFAULT_PROMPT = "The following is a conversation history between a user and an AI agent. Please summarize the conversation, focusing on key information and decisions made, as well as any unresolved questions or tasks. The summary should be concise and capture the essence of the interaction.";
38
38
  class LlmSummarizer {
39
+ /**
40
+ * @param options - Configuration specifying the LLM and optional prompt.
41
+ */
39
42
  constructor(options) {
40
43
  this.llm = options.llm;
41
44
  this.prompt = options.prompt || DEFAULT_PROMPT;
42
45
  }
46
+ /**
47
+ * Summarizes a list of events into a single {@link CompactedEvent} using the
48
+ * configured LLM.
49
+ *
50
+ * @param events - The events to summarize. Must be non-empty.
51
+ * @returns A promise resolving to the compacted representation.
52
+ * @throws {Error} If `events` is empty or the LLM returns no content.
53
+ */
43
54
  async summarize(events) {
44
55
  var _a, _b, _c, _d, _e, _f;
45
56
  if (events.length === 0) {
@@ -102,7 +102,7 @@ class TokenBasedContextCompactor {
102
102
  compactedEvent.actions = {
103
103
  stateDelta: {},
104
104
  artifactDelta: {},
105
- requestedAuthConfigs: [],
105
+ requestedAuthConfigs: {},
106
106
  requestedToolConfirmations: {}
107
107
  };
108
108
  }
@@ -55,7 +55,7 @@ function createEvent(params = {}) {
55
55
  };
56
56
  }
57
57
  function isFinalResponse(event) {
58
- if (event.actions.skipSummarization || event.longRunningToolIds && event.longRunningToolIds.length > 0) {
58
+ if (event.actions.skipSummarization || event.longRunningToolIds && event.longRunningToolIds.length > 0 || event.actions.requestedAuthConfigs && Object.keys(event.actions.requestedAuthConfigs).length > 0) {
59
59
  return true;
60
60
  }
61
61
  return getFunctionCalls(event).length === 0 && getFunctionResponses(event).length === 0 && !event.partial && !hasTrailingCodeExecutionResult(event);
@@ -37,6 +37,19 @@ var import_types2 = require("./types.js");
37
37
  * SPDX-License-Identifier: Apache-2.0
38
38
  */
39
39
  class AgentRegistrySingleMCPToolset extends import_base_toolset.BaseToolset {
40
+ /**
41
+ * @param options - Configuration for the MCP toolset.
42
+ * @param options.destinationResourceId - Telemetry identifier injected as
43
+ * `gcp.mcp.server.destination.id` into each resolved tool's custom metadata.
44
+ * @param options.connectionParams - HTTP connection parameters for the MCP server.
45
+ * @param options.toolFilter - Optional predicate or list of tool names to include.
46
+ * When omitted, all tools from the server are returned.
47
+ * @param options.prefix - Optional prefix prepended to each tool name (e.g. `myServer_toolName`).
48
+ * @param options.headerProvider - Optional async function called immediately before each
49
+ * {@link getTools} invocation to supply or refresh request headers (e.g. GCP auth tokens).
50
+ * @param options.authScheme - Optional auth scheme forwarded to each resolved tool.
51
+ * @param options.authCredential - Optional credential forwarded to each resolved tool.
52
+ */
40
53
  constructor(options) {
41
54
  super(options.toolFilter || [], options.prefix);
42
55
  this.destinationResourceId = options.destinationResourceId;
@@ -46,8 +59,14 @@ class AgentRegistrySingleMCPToolset extends import_base_toolset.BaseToolset {
46
59
  this.authCredential = options.authCredential;
47
60
  }
48
61
  /**
49
- * Connects to the underlying MCP server, retrieves tool definitions, prefixes tool names,
50
- * and injects destination telemetry metadata.
62
+ * Connects to the underlying MCP server, retrieves tool definitions, prefixes
63
+ * tool names, and injects destination telemetry metadata into each tool.
64
+ *
65
+ * The `headerProvider`, if configured, is invoked immediately before the
66
+ * connection is established so that tokens are always fresh.
67
+ *
68
+ * @param context - Optional readonly agent context passed to the header provider.
69
+ * @returns The resolved and optionally filtered list of {@link MCPTool} instances.
51
70
  */
52
71
  async getTools(context) {
53
72
  var _a, _b, _c;
@@ -27,15 +27,19 @@ __export(gemini_llm_connection_exports, {
27
27
  GeminiLlmConnection: () => GeminiLlmConnection
28
28
  });
29
29
  module.exports = __toCommonJS(gemini_llm_connection_exports);
30
+ var import_live_connection_utils = require("../utils/live_connection_utils.js");
30
31
  var import_logger = require("../utils/logger.js");
32
+ var import_model_name = require("../utils/model_name.js");
31
33
  /**
32
34
  * @license
33
- * Copyright 2025 Google LLC
35
+ * Copyright 2026 Google LLC
34
36
  * SPDX-License-Identifier: Apache-2.0
35
37
  */
36
38
  class GeminiLlmConnection {
37
- constructor(geminiSession) {
39
+ constructor(geminiSession, modelVersion, messageQueue) {
38
40
  this.geminiSession = geminiSession;
41
+ this.modelVersion = modelVersion;
42
+ this.messageQueue = messageQueue;
39
43
  }
40
44
  /**
41
45
  * Sends the conversation history to the gemini model.
@@ -54,9 +58,10 @@ class GeminiLlmConnection {
54
58
  }
55
59
  );
56
60
  if (contents.length > 0) {
61
+ const isGemini3x = (0, import_model_name.isGemini3xFlashLive)(this.modelVersion);
57
62
  this.geminiSession.sendClientContent({
58
63
  turns: contents,
59
- turnComplete: contents[contents.length - 1].role === "user"
64
+ turnComplete: isGemini3x ? true : contents[contents.length - 1].role === "user"
60
65
  });
61
66
  } else {
62
67
  import_logger.logger.info("no content is sent");
@@ -83,10 +88,16 @@ class GeminiLlmConnection {
83
88
  });
84
89
  } else {
85
90
  import_logger.logger.debug("Sending LLM new content", content);
86
- this.geminiSession.sendClientContent({
87
- turns: [content],
88
- turnComplete: true
89
- });
91
+ const isGemini3x = (0, import_model_name.isGemini3xFlashLive)(this.modelVersion);
92
+ if (isGemini3x && content.parts.length === 1 && content.parts[0].text) {
93
+ import_logger.logger.debug("Using sendRealtimeInput for Gemini 3.x text input");
94
+ this.geminiSession.sendRealtimeInput({ text: content.parts[0].text });
95
+ } else {
96
+ this.geminiSession.sendClientContent({
97
+ turns: [content],
98
+ turnComplete: true
99
+ });
100
+ }
90
101
  }
91
102
  }
92
103
  /**
@@ -95,8 +106,36 @@ class GeminiLlmConnection {
95
106
  * @param blob The blob to send to the model.
96
107
  */
97
108
  async sendRealtime(blob) {
109
+ var _a, _b, _c;
98
110
  import_logger.logger.debug("Sending LLM Blob:", blob);
99
- this.geminiSession.sendRealtimeInput({ media: blob });
111
+ const isGemini3x = (0, import_model_name.isGemini3xFlashLive)(this.modelVersion);
112
+ const isNativeAudio = (_a = this.modelVersion) == null ? void 0 : _a.includes("native-audio");
113
+ if (isGemini3x || isNativeAudio) {
114
+ if ((_b = blob.mimeType) == null ? void 0 : _b.startsWith("audio/")) {
115
+ this.geminiSession.sendRealtimeInput({ audio: blob });
116
+ } else if ((_c = blob.mimeType) == null ? void 0 : _c.startsWith("image/")) {
117
+ this.geminiSession.sendRealtimeInput({ video: blob });
118
+ } else {
119
+ import_logger.logger.warn(
120
+ "Blob not sent. Unknown or empty mime type for sendRealtimeInput:",
121
+ blob.mimeType
122
+ );
123
+ }
124
+ } else {
125
+ this.geminiSession.sendRealtimeInput({ media: blob });
126
+ }
127
+ }
128
+ /**
129
+ * Sends an activity start signal to the model.
130
+ */
131
+ async sendActivityStart() {
132
+ this.geminiSession.sendRealtimeInput({ activityStart: {} });
133
+ }
134
+ /**
135
+ * Sends an activity end signal to the model.
136
+ */
137
+ async sendActivityEnd() {
138
+ this.geminiSession.sendRealtimeInput({ activityEnd: {} });
100
139
  }
101
140
  /**
102
141
  * Builds a full text response.
@@ -105,20 +144,24 @@ class GeminiLlmConnection {
105
144
  * partial.
106
145
  *
107
146
  * @param text The text to be included in the response.
147
+ * @param isThought Whether the text is a thought.
148
+ * @param groundingMetadata The grounding metadata to include.
108
149
  * @returns An LlmResponse containing the full text.
109
150
  */
110
- buildFullTextResponse(text) {
111
- return {
112
- content: {
113
- role: "model",
114
- parts: [{ text }]
115
- }
116
- };
117
- }
118
- // TODO(b/425992518): GenAI SDK inconsistent API, missing methods.
119
- // eslint-disable-next-line require-yield
120
151
  async *receive() {
121
- throw new Error("Not Implemented.");
152
+ if (!this.messageQueue) {
153
+ throw new Error("Message queue is not initialized.");
154
+ }
155
+ const aggregator = new import_live_connection_utils.LiveResponseAggregator(this.modelVersion);
156
+ for await (const message of this.messageQueue) {
157
+ import_logger.logger.debug("Got LLM Live message:", message);
158
+ for (const response of aggregator.processMessage(message)) {
159
+ yield response;
160
+ }
161
+ }
162
+ for (const response of aggregator.close()) {
163
+ yield response;
164
+ }
122
165
  }
123
166
  /**
124
167
  * Closes the llm server connection.
@@ -32,6 +32,7 @@ var import_genai = require("@google/genai");
32
32
  var import_env_aware_utils = require("../utils/env_aware_utils.js");
33
33
  var import_logger = require("../utils/logger.js");
34
34
  var import_variant_utils = require("../utils/variant_utils.js");
35
+ var import_async_queue = require("../utils/async_queue.js");
35
36
  var import_streaming_utils = require("../utils/streaming_utils.js");
36
37
  var import_base_llm = require("./base_llm.js");
37
38
  var import_gemini_llm_connection = require("./gemini_llm_connection.js");
@@ -168,10 +169,19 @@ class Gemini extends import_base_llm.BaseLlm {
168
169
  }
169
170
  get liveApiClient() {
170
171
  if (!this._liveApiClient) {
171
- this._liveApiClient = new import_genai.GoogleGenAI({
172
- apiKey: this.apiKey,
173
- httpOptions: this.getLiveHttpOptions()
174
- });
172
+ if (this.vertexai) {
173
+ this._liveApiClient = new import_genai.GoogleGenAI({
174
+ vertexai: this.vertexai,
175
+ project: this.project,
176
+ location: this.location || "global",
177
+ httpOptions: this.getLiveHttpOptions()
178
+ });
179
+ } else {
180
+ this._liveApiClient = new import_genai.GoogleGenAI({
181
+ apiKey: this.apiKey,
182
+ httpOptions: this.getLiveHttpOptions()
183
+ });
184
+ }
175
185
  }
176
186
  return this._liveApiClient;
177
187
  }
@@ -203,16 +213,24 @@ class Gemini extends import_base_llm.BaseLlm {
203
213
  };
204
214
  }
205
215
  llmRequest.liveConnectConfig.tools = (_c = llmRequest.config) == null ? void 0 : _c.tools;
216
+ const modelVersion = (_d = llmRequest.model) != null ? _d : this.model;
217
+ const messageQueue = new import_async_queue.AsyncQueue();
206
218
  const liveSession = await this.liveApiClient.live.connect({
207
- model: (_d = llmRequest.model) != null ? _d : this.model,
219
+ model: modelVersion,
208
220
  config: llmRequest.liveConnectConfig,
209
221
  callbacks: {
210
- // TODO - b/425992518: GenAI SDK inconsistent API, missing methods.
211
- onmessage: () => {
222
+ onmessage: (message) => {
223
+ messageQueue.push(message);
224
+ },
225
+ onerror: (error) => {
226
+ messageQueue.error(error);
227
+ },
228
+ onclose: () => {
229
+ messageQueue.close();
212
230
  }
213
231
  }
214
232
  });
215
- return new import_gemini_llm_connection.GeminiLlmConnection(liveSession);
233
+ return new import_gemini_llm_connection.GeminiLlmConnection(liveSession, modelVersion, messageQueue);
216
234
  }
217
235
  preprocessRequest(llmRequest) {
218
236
  if (this.apiBackend === import_variant_utils.GoogleLLMVariant.GEMINI_API) {
@@ -47,6 +47,11 @@ var PolicyOutcome = /* @__PURE__ */ ((PolicyOutcome2) => {
47
47
  return PolicyOutcome2;
48
48
  })(PolicyOutcome || {});
49
49
  class InMemoryPolicyEngine {
50
+ /**
51
+ * Always returns {@link PolicyOutcome.ALLOW} for every tool call.
52
+ *
53
+ * @returns A promise resolving to an ALLOW result.
54
+ */
50
55
  async evaluate() {
51
56
  return Promise.resolve({
52
57
  outcome: "ALLOW" /* ALLOW */,
@@ -55,11 +60,22 @@ class InMemoryPolicyEngine {
55
60
  }
56
61
  }
57
62
  class SecurityPlugin extends import_base_plugin.BasePlugin {
63
+ /**
64
+ * @param params - Optional configuration. Defaults to {@link InMemoryPolicyEngine}
65
+ * when no policy engine is provided.
66
+ */
58
67
  constructor(params) {
59
68
  var _a;
60
69
  super("security_plugin");
61
70
  this.policyEngine = (_a = params == null ? void 0 : params.policyEngine) != null ? _a : new InMemoryPolicyEngine();
62
71
  }
72
+ /**
73
+ * Intercepts tool calls, evaluating them against the policy engine before
74
+ * execution and handling confirmation flows for calls that require it.
75
+ *
76
+ * @returns A partial or error response object if the call is blocked or
77
+ * awaiting confirmation, or `undefined` to allow execution to proceed.
78
+ */
63
79
  async beforeToolCallback({
64
80
  tool,
65
81
  toolArgs,
@@ -26,7 +26,8 @@ var base_session_service_exports = {};
26
26
  __export(base_session_service_exports, {
27
27
  BaseSessionService: () => BaseSessionService,
28
28
  mergeStates: () => mergeStates,
29
- trimTempDeltaState: () => trimTempDeltaState
29
+ trimTempDeltaState: () => trimTempDeltaState,
30
+ trimTempState: () => trimTempState
30
31
  });
31
32
  module.exports = __toCommonJS(base_session_service_exports);
32
33
  var import_lodash_es = require("lodash-es");
@@ -103,6 +104,15 @@ function trimTempDeltaState(event) {
103
104
  event.actions.stateDelta = filteredStateDelta;
104
105
  return event;
105
106
  }
107
+ function trimTempState(state) {
108
+ const filteredState = {};
109
+ for (const [key, value] of Object.entries(state)) {
110
+ if (!key.startsWith(import_state.State.TEMP_PREFIX)) {
111
+ filteredState[key] = value;
112
+ }
113
+ }
114
+ return filteredState;
115
+ }
106
116
  function mergeStates(appState = {}, userState = {}, sessionState = {}) {
107
117
  const merged = (0, import_lodash_es.cloneDeep)(sessionState);
108
118
  for (const [k, v] of Object.entries(appState)) {
@@ -117,5 +127,6 @@ function mergeStates(appState = {}, userState = {}, sessionState = {}) {
117
127
  0 && (module.exports = {
118
128
  BaseSessionService,
119
129
  mergeStates,
120
- trimTempDeltaState
130
+ trimTempDeltaState,
131
+ trimTempState
121
132
  });
@@ -119,7 +119,7 @@ class DatabaseSessionService extends import_base_session_service.BaseSessionServ
119
119
  appStateDelta[key.replace(import_state.State.APP_PREFIX, "")] = value;
120
120
  } else if (key.startsWith(import_state.State.USER_PREFIX)) {
121
121
  userStateDelta[key.replace(import_state.State.USER_PREFIX, "")] = value;
122
- } else {
122
+ } else if (!key.startsWith(import_state.State.TEMP_PREFIX)) {
123
123
  sessionState[key] = value;
124
124
  }
125
125
  }
@@ -368,7 +368,7 @@ class DatabaseSessionService extends import_base_session_service.BaseSessionServ
368
368
  appDelta[key.replace(import_state.State.APP_PREFIX, "")] = value;
369
369
  } else if (key.startsWith(import_state.State.USER_PREFIX)) {
370
370
  userDelta[key.replace(import_state.State.USER_PREFIX, "")] = value;
371
- } else {
371
+ } else if (!key.startsWith(import_state.State.TEMP_PREFIX)) {
372
372
  sessionDelta[key] = value;
373
373
  }
374
374
  }