@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
@@ -34,3 +34,29 @@ export declare function getContents(events: Event[], agentName: string, currentB
34
34
  * needed for proper tool execution while excluding conversation history.
35
35
  */
36
36
  export declare function getCurrentTurnContents(events: Event[], agentName: string, currentBranch?: string): Content[];
37
+ /**
38
+ * Merges a list of function_response events into one event.
39
+ *
40
+ * The key goal is to ensure:
41
+ * 1. function_call and function_response are always of the same number.
42
+ * 2. The function_call and function_response are consecutively in the content.
43
+ *
44
+ * @param events: A list of function_response events.
45
+ *
46
+ * NOTE:
47
+ * function_response_events must fulfill these requirements:
48
+ * 1. The list is in increasing order of timestamp;
49
+ * 2. the first event is the initial function_response event;
50
+ * 3. all later events should contain at least one function_response part that
51
+ * related to the function_call event. Caveat: This implementation doesn't
52
+ * support when a parallel function_call event contains async function_call of
53
+ * the same name.
54
+ *
55
+ * @returns
56
+ * A merged event, that is
57
+ * 1. All later function_response will replace function_response part in
58
+ * the initial function_response event.
59
+ * 2. All non-function_response parts will be appended to the part list of
60
+ * the initial function_response event.
61
+ */
62
+ export declare function mergeFunctionResponseEvents(events: Event[]): Event;
@@ -7,7 +7,23 @@ import { Event } from '../../events/event.js';
7
7
  import { LlmRequest } from '../../models/llm_request.js';
8
8
  import { InvocationContext } from '../invocation_context.js';
9
9
  import { BaseLlmRequestProcessor } from './base_llm_processor.js';
10
+ /**
11
+ * Populates {@link LlmRequest.contents} from the session event history.
12
+ *
13
+ * When a {@link CompactedEvent} exists in the session, only the most recent
14
+ * compacted event and the raw events that follow it are included, eliding
15
+ * earlier history. The extent of context included depends on the agent's
16
+ * `includeContents` setting: `'default'` sends the full visible history while
17
+ * any other value sends only the current-turn context.
18
+ */
10
19
  export declare class ContentRequestProcessor implements BaseLlmRequestProcessor {
20
+ /**
21
+ * Fills {@link LlmRequest.contents} based on the session event history and
22
+ * agent configuration.
23
+ *
24
+ * @param invocationContext - The current invocation context.
25
+ * @param llmRequest - The request whose contents field will be populated.
26
+ */
11
27
  runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event, void, void>;
12
28
  }
13
29
  export declare const CONTENT_REQUEST_PROCESSOR: ContentRequestProcessor;
@@ -17,6 +17,18 @@ import { BaseLlmRequestProcessor } from './base_llm_processor.js';
17
17
  */
18
18
  export declare class ContextCompactorRequestProcessor implements BaseLlmRequestProcessor {
19
19
  private compactors;
20
+ /**
21
+ * @param compactors - Ordered list of compactors to evaluate; the first one
22
+ * that reports it should compact will perform the compaction.
23
+ */
20
24
  constructor(compactors: BaseContextCompactor[]);
25
+ /**
26
+ * Evaluates compactors in priority order. The first compactor that indicates
27
+ * it should compact will compact the session history, fire plugin hooks, and
28
+ * yield any newly generated events. Iteration stops after one compaction.
29
+ *
30
+ * @param invocationContext - The current invocation context.
31
+ * @param _llmRequest - Unused; present to satisfy the {@link BaseLlmRequestProcessor} interface.
32
+ */
21
33
  runAsync(invocationContext: InvocationContext, _llmRequest: LlmRequest): AsyncGenerator<Event, void, void>;
22
34
  }
@@ -12,6 +12,13 @@ import { BaseLlmRequestProcessor } from './base_llm_processor.js';
12
12
  * informing the model of the agent's name and description.
13
13
  */
14
14
  export declare class IdentityLlmRequestProcessor extends BaseLlmRequestProcessor {
15
+ /**
16
+ * Appends agent name and description as identity instructions to the system
17
+ * prompt of the request.
18
+ *
19
+ * @param invocationContext - The current invocation context.
20
+ * @param llmRequest - The request object to append instructions to.
21
+ */
15
22
  runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event, void, undefined>;
16
23
  }
17
24
  export declare const IDENTITY_LLM_REQUEST_PROCESSOR: IdentityLlmRequestProcessor;
@@ -12,7 +12,15 @@ import { BaseLlmRequestProcessor } from './base_llm_processor.js';
12
12
  * corresponding tools before the next LLM turn.
13
13
  */
14
14
  export declare class RequestConfirmationLlmRequestProcessor extends BaseLlmRequestProcessor {
15
- /** Handles tool confirmation information to build the LLM request. */
15
+ /**
16
+ * Resumes tool calls that were paused for user confirmation, re-invoking
17
+ * them with the confirmed or denied decision before the next LLM turn.
18
+ *
19
+ * @param invocationContext - The current invocation context, including the
20
+ * session event history used to locate pending confirmation responses.
21
+ * @yields Function response events for tools that have been confirmed and
22
+ * are ready to resume.
23
+ */
16
24
  runAsync(invocationContext: InvocationContext): AsyncGenerator<Event, void, void>;
17
25
  }
18
26
  export declare const REQUEST_CONFIRMATION_LLM_REQUEST_PROCESSOR: RequestConfirmationLlmRequestProcessor;
@@ -7,8 +7,19 @@ import { Event } from '../../events/event.js';
7
7
  import { LlmRequest } from '../../models/llm_request.js';
8
8
  import { InvocationContext } from '../invocation_context.js';
9
9
  import { BaseLlmRequestProcessor } from './base_llm_processor.js';
10
+ /**
11
+ * Filters the set of tools on the {@link LlmRequest} by delegating to the
12
+ * active plugin manager's `beforeToolSelection` hook. If no plugin restricts
13
+ * the tool set, the request is left unchanged.
14
+ */
10
15
  export declare class ToolFilterRequestProcessor extends BaseLlmRequestProcessor {
11
- /** Filters the set of tools on the request based on plugins. */
16
+ /**
17
+ * Invokes plugin-based tool filtering and updates {@link LlmRequest.allowedTools}
18
+ * with the reduced tool set if any plugin returns a filtered result.
19
+ *
20
+ * @param invocationContext - The current invocation context.
21
+ * @param llmRequest - The request whose allowed tools may be restricted.
22
+ */
12
23
  runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event, void, void>;
13
24
  }
14
25
  export declare const TOOL_FILTER_REQUEST_PROCESSOR: ToolFilterRequestProcessor;
@@ -34,6 +34,7 @@ export { InMemoryArtifactService } from './artifacts/in_memory_artifact_service.
34
34
  export { AuthCredentialTypes } from './auth/auth_credential.js';
35
35
  export type { AuthCredential, HttpAuth, HttpCredentials, OAuth2Auth, ServiceAccount, ServiceAccountCredential, } from './auth/auth_credential.js';
36
36
  export { AuthHandler } from './auth/auth_handler.js';
37
+ export { AUTH_PREPROCESSOR, AuthPreprocessor } from './auth/auth_preprocessor.js';
37
38
  export { AuthProviderRegistry } from './auth/auth_provider_registry.js';
38
39
  export { OAuthGrantType } from './auth/auth_schemes.js';
39
40
  export type { AuthScheme, OpenIdConnectWithConfig } from './auth/auth_schemes.js';
@@ -123,15 +124,28 @@ export type { DataStoreParams, SearchEngineParams, VertexAISearchConfig, VertexA
123
124
  export { VertexRagRetrievalTool } from './tools/vertex_rag_retrieval_tool.js';
124
125
  export { LogLevel, getLogger, setLogLevel, setLogger } from './utils/logger.js';
125
126
  export type { Logger } from './utils/logger.js';
126
- export { isGemini2OrAbove } from './utils/model_name.js';
127
+ export { isGemini2OrAbove, isGemini3xFlashLive } from './utils/model_name.js';
127
128
  export { zodObjectToSchema } from './utils/simple_zod_to_json.js';
128
129
  export { GoogleLLMVariant } from './utils/variant_utils.js';
129
130
  export { version } from './version.js';
131
+ export { GCPSkillRegistry } from './skills/gcp_skill_registry.js';
132
+ export type { GCPSkillRegistryOptions } from './skills/gcp_skill_registry.js';
133
+ export { loadAllSkillsInDir, loadSkillFromDir, loadSkillFromZipBuffer, validateSkillDir, } from './skills/loader.js';
130
134
  export type { Frontmatter, Resources, Script, Skill } from './skills/skill.js';
135
+ export type { SkillRegistry } from './skills/skill_registry.js';
131
136
  export { ListSkillsTool } from './tools/skill/list_skills_tool.js';
132
137
  export { LoadSkillResourceTool } from './tools/skill/load_skill_resource_tool.js';
133
138
  export { LoadSkillTool } from './tools/skill/load_skill_tool.js';
139
+ export { SearchSkillsTool } from './tools/skill/search_skills_tool.js';
134
140
  export { SkillToolset } from './tools/skill/skill_toolset.js';
141
+ export { OpenApiSpecParser } from './tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js';
142
+ export type { OperationEndpoint, ParsedOperation, } from './tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js';
143
+ export { OperationParser } from './tools/openapi_tool/openapi_spec_parser/operation_parser.js';
144
+ export type { ApiParameter } from './tools/openapi_tool/openapi_spec_parser/operation_parser.js';
145
+ export { ToolAuthHandler } from './tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js';
146
+ export type { AuthPreparationResult } from './tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js';
147
+ export { OpenAPIToolset } from './tools/openapi_tool/openapi_toolset.js';
148
+ export { RestApiTool, createRestApiTool, } from './tools/openapi_tool/rest_api_tool.js';
135
149
  export * from './artifacts/base_artifact_service.js';
136
150
  export * from './features/feature_registry.js';
137
151
  export * from './memory/base_memory_service.js';
@@ -7,8 +7,14 @@ import { CompactedEvent } from '../../events/compacted_event.js';
7
7
  import { Event } from '../../events/event.js';
8
8
  import { BaseLlm } from '../../models/base_llm.js';
9
9
  import { BaseSummarizer } from './base_summarizer.js';
10
+ /** Options for constructing an {@link LlmSummarizer}. */
10
11
  export interface LlmSummarizerOptions {
12
+ /** The LLM instance used to generate the summary. */
11
13
  llm: BaseLlm;
14
+ /**
15
+ * Optional system prompt prepended to the formatted events. Defaults to a
16
+ * built-in summarization prompt when omitted.
17
+ */
12
18
  prompt?: string;
13
19
  }
14
20
  /**
@@ -18,6 +24,17 @@ export interface LlmSummarizerOptions {
18
24
  export declare class LlmSummarizer implements BaseSummarizer {
19
25
  private readonly llm;
20
26
  private readonly prompt;
27
+ /**
28
+ * @param options - Configuration specifying the LLM and optional prompt.
29
+ */
21
30
  constructor(options: LlmSummarizerOptions);
31
+ /**
32
+ * Summarizes a list of events into a single {@link CompactedEvent} using the
33
+ * configured LLM.
34
+ *
35
+ * @param events - The events to summarize. Must be non-empty.
36
+ * @returns A promise resolving to the compacted representation.
37
+ * @throws {Error} If `events` is empty or the LLM returns no content.
38
+ */
22
39
  summarize(events: Event[]): Promise<CompactedEvent>;
23
40
  }
@@ -3,8 +3,8 @@
3
3
  * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ import { AuthConfig } from '../auth/auth_tool.js';
6
7
  import { ToolConfirmation } from '../tools/tool_confirmation.js';
7
- type AuthConfig = any;
8
8
  /**
9
9
  * Represents the actions attached to an event.
10
10
  */
@@ -89,4 +89,3 @@ export declare function createEventActions(state?: Partial<EventActions>): Event
89
89
  * @returns A new {@link EventActions} containing the merged result.
90
90
  */
91
91
  export declare function mergeEventActions(sources: Array<Partial<EventActions>>, target?: EventActions): EventActions;
92
- export {};
@@ -25,6 +25,19 @@ export declare class AgentRegistrySingleMCPToolset extends BaseToolset {
25
25
  readonly headerProvider?: (context?: ReadonlyContext) => Promise<Record<string, string>> | Record<string, string>;
26
26
  readonly authScheme?: AuthScheme;
27
27
  readonly authCredential?: AuthCredential;
28
+ /**
29
+ * @param options - Configuration for the MCP toolset.
30
+ * @param options.destinationResourceId - Telemetry identifier injected as
31
+ * `gcp.mcp.server.destination.id` into each resolved tool's custom metadata.
32
+ * @param options.connectionParams - HTTP connection parameters for the MCP server.
33
+ * @param options.toolFilter - Optional predicate or list of tool names to include.
34
+ * When omitted, all tools from the server are returned.
35
+ * @param options.prefix - Optional prefix prepended to each tool name (e.g. `myServer_toolName`).
36
+ * @param options.headerProvider - Optional async function called immediately before each
37
+ * {@link getTools} invocation to supply or refresh request headers (e.g. GCP auth tokens).
38
+ * @param options.authScheme - Optional auth scheme forwarded to each resolved tool.
39
+ * @param options.authCredential - Optional credential forwarded to each resolved tool.
40
+ */
28
41
  constructor(options: {
29
42
  destinationResourceId?: string;
30
43
  connectionParams: StreamableHTTPConnectionParams;
@@ -35,8 +48,14 @@ export declare class AgentRegistrySingleMCPToolset extends BaseToolset {
35
48
  authCredential?: AuthCredential;
36
49
  });
37
50
  /**
38
- * Connects to the underlying MCP server, retrieves tool definitions, prefixes tool names,
39
- * and injects destination telemetry metadata.
51
+ * Connects to the underlying MCP server, retrieves tool definitions, prefixes
52
+ * tool names, and injects destination telemetry metadata into each tool.
53
+ *
54
+ * The `headerProvider`, if configured, is invoked immediately before the
55
+ * connection is established so that tokens are always fresh.
56
+ *
57
+ * @param context - Optional readonly agent context passed to the header provider.
58
+ * @returns The resolved and optionally filtered list of {@link MCPTool} instances.
40
59
  */
41
60
  getTools(context?: ReadonlyContext): Promise<BaseTool[]>;
42
61
  close(): Promise<void>;
@@ -38,6 +38,16 @@ export interface BaseLlmConnection {
38
38
  * @param blob The blob to send to the model.
39
39
  */
40
40
  sendRealtime(blob: Blob): Promise<void>;
41
+ /**
42
+ * Optionally signals the start of user activity (e.g. user begins speaking)
43
+ * for models that support manual activity boundaries.
44
+ */
45
+ sendActivityStart?(): Promise<void>;
46
+ /**
47
+ * Optionally signals the end of user activity (e.g. user finishes speaking)
48
+ * for models that support manual activity boundaries.
49
+ */
50
+ sendActivityEnd?(): Promise<void>;
41
51
  /**
42
52
  * Receives the model response using the llm server connection.
43
53
  *
@@ -1,15 +1,17 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2025 Google LLC
3
+ * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { Blob, Content, Session } from '@google/genai';
6
+ import { Blob, Content, LiveServerMessage, Session } from '@google/genai';
7
7
  import { BaseLlmConnection } from './base_llm_connection.js';
8
8
  import { LlmResponse } from './llm_response.js';
9
9
  /** The Gemini model connection. */
10
10
  export declare class GeminiLlmConnection implements BaseLlmConnection {
11
11
  private readonly geminiSession;
12
- constructor(geminiSession: Session);
12
+ private readonly modelVersion?;
13
+ private readonly messageQueue?;
14
+ constructor(geminiSession: Session, modelVersion?: string | undefined, messageQueue?: AsyncIterable<LiveServerMessage> | undefined);
13
15
  /**
14
16
  * Sends the conversation history to the gemini model.
15
17
  *
@@ -36,6 +38,14 @@ export declare class GeminiLlmConnection implements BaseLlmConnection {
36
38
  * @param blob The blob to send to the model.
37
39
  */
38
40
  sendRealtime(blob: Blob): Promise<void>;
41
+ /**
42
+ * Sends an activity start signal to the model.
43
+ */
44
+ sendActivityStart(): Promise<void>;
45
+ /**
46
+ * Sends an activity end signal to the model.
47
+ */
48
+ sendActivityEnd(): Promise<void>;
39
49
  /**
40
50
  * Builds a full text response.
41
51
  *
@@ -43,9 +53,10 @@ export declare class GeminiLlmConnection implements BaseLlmConnection {
43
53
  * partial.
44
54
  *
45
55
  * @param text The text to be included in the response.
56
+ * @param isThought Whether the text is a thought.
57
+ * @param groundingMetadata The grounding metadata to include.
46
58
  * @returns An LlmResponse containing the full text.
47
59
  */
48
- private buildFullTextResponse;
49
60
  receive(): AsyncGenerator<LlmResponse, void, void>;
50
61
  /**
51
62
  * Closes the llm server connection.
@@ -3,7 +3,7 @@
3
3
  * Copyright 2025 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { CitationMetadata, Content, FinishReason, GenerateContentResponse, GenerateContentResponseUsageMetadata, GroundingMetadata, LiveServerSessionResumptionUpdate, Transcription } from '@google/genai';
6
+ import { CitationMetadata, Content, FinishReason, GenerateContentResponse, GenerateContentResponseUsageMetadata, GroundingMetadata, LiveServerGoAway, LiveServerSessionResumptionUpdate, Transcription } from '@google/genai';
7
7
  /**
8
8
  * LLM response class that provides the first candidate response from the
9
9
  * model if available. Otherwise, returns error code and message.
@@ -64,6 +64,11 @@ export interface LlmResponse {
64
64
  * The session resumption update of the LlmResponse
65
65
  */
66
66
  liveSessionResumptionUpdate?: LiveServerSessionResumptionUpdate;
67
+ /**
68
+ * Server-side signal that the live connection will be closed soon. The
69
+ * caller should reconnect using the latest session resumption handle.
70
+ */
71
+ goAway?: LiveServerGoAway;
67
72
  /**
68
73
  * Audio transcription of user input.
69
74
  */
@@ -72,6 +77,10 @@ export interface LlmResponse {
72
77
  * Audio transcription of model output.
73
78
  */
74
79
  outputTranscription?: Transcription;
80
+ /** The model version used to generate the response. */
81
+ modelVersion?: string;
82
+ /** The session ID of the Live session. */
83
+ liveSessionId?: string;
75
84
  }
76
85
  /**
77
86
  * Creates an LlmResponse from a GenerateContentResponse.
@@ -17,18 +17,37 @@ export declare enum PolicyOutcome {
17
17
  CONFIRM = "CONFIRM",
18
18
  ALLOW = "ALLOW"
19
19
  }
20
+ /** The result returned by a policy engine after evaluating a tool call. */
20
21
  export interface PolicyCheckResult {
22
+ /** The policy decision: `ALLOW`, `DENY`, or `CONFIRM`. */
21
23
  outcome: string;
24
+ /** Optional human-readable explanation of the decision. */
22
25
  reason?: string;
23
26
  }
27
+ /** Context passed to a policy engine when evaluating a tool call. */
24
28
  export interface ToolCallPolicyContext {
29
+ /** The tool being invoked. */
25
30
  tool: BaseTool;
31
+ /** The arguments supplied to the tool call. */
26
32
  toolArgs: Record<string, unknown>;
27
33
  }
34
+ /** Interface for policy engines that gate tool call execution. */
28
35
  export interface BasePolicyEngine {
36
+ /**
37
+ * Evaluates whether a tool call should be allowed, denied, or confirmed.
38
+ *
39
+ * @param context - The tool and its arguments to evaluate.
40
+ * @returns A promise resolving to the policy decision.
41
+ */
29
42
  evaluate(context: ToolCallPolicyContext): Promise<PolicyCheckResult>;
30
43
  }
44
+ /** In-memory policy engine that permits all tool calls. Intended for prototyping. */
31
45
  export declare class InMemoryPolicyEngine implements BasePolicyEngine {
46
+ /**
47
+ * Always returns {@link PolicyOutcome.ALLOW} for every tool call.
48
+ *
49
+ * @returns A promise resolving to an ALLOW result.
50
+ */
32
51
  evaluate(): Promise<PolicyCheckResult>;
33
52
  }
34
53
  /**
@@ -36,9 +55,20 @@ export declare class InMemoryPolicyEngine implements BasePolicyEngine {
36
55
  */
37
56
  export declare class SecurityPlugin extends BasePlugin {
38
57
  private readonly policyEngine;
58
+ /**
59
+ * @param params - Optional configuration. Defaults to {@link InMemoryPolicyEngine}
60
+ * when no policy engine is provided.
61
+ */
39
62
  constructor(params?: {
40
63
  policyEngine?: BasePolicyEngine;
41
64
  });
65
+ /**
66
+ * Intercepts tool calls, evaluating them against the policy engine before
67
+ * execution and handling confirmation flows for calls that require it.
68
+ *
69
+ * @returns A partial or error response object if the call is blocked or
70
+ * awaiting confirmation, or `undefined` to allow execution to proceed.
71
+ */
42
72
  beforeToolCallback({ tool, toolArgs, toolContext, }: {
43
73
  tool: BaseTool;
44
74
  toolArgs: {
@@ -156,6 +156,10 @@ export declare abstract class BaseSessionService {
156
156
  * Removes temporary state delta keys from the event.
157
157
  */
158
158
  export declare function trimTempDeltaState(event: Event): Event;
159
+ /**
160
+ * Removes temporary state keys from the state.
161
+ */
162
+ export declare function trimTempState(state: Record<string, unknown>): Record<string, unknown>;
159
163
  /**
160
164
  * Merges app state, user state, and session state.
161
165
  *
@@ -7,6 +7,7 @@ import { PrimaryKey } from '@mikro-orm/core';
7
7
  import { Event } from '../../events/event.js';
8
8
  export declare const SCHEMA_VERSION_KEY = "schema_version";
9
9
  export declare const SCHEMA_VERSION_1_JSON = "1";
10
+ export declare const STORAGE_KEY_COLUMN_LENGTH = 191;
10
11
  export declare class StorageMetadata {
11
12
  key: string;
12
13
  value: string;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { Client } from '@google-cloud/vertexai';
7
+ import { Frontmatter, Skill } from './skill.js';
8
+ import { SkillRegistry } from './skill_registry.js';
9
+ export interface GCPSkillRegistryOptions {
10
+ projectId?: string;
11
+ location?: string;
12
+ client?: Client;
13
+ }
14
+ /**
15
+ * GCP implementation of SkillRegistry using GCP Skill Registry API.
16
+ */
17
+ export declare class GCPSkillRegistry implements SkillRegistry {
18
+ private readonly projectId?;
19
+ private readonly location?;
20
+ private readonly client;
21
+ constructor(options?: GCPSkillRegistryOptions);
22
+ getSkill(name: string): Promise<Skill>;
23
+ searchSkills(query: string): Promise<Frontmatter[]>;
24
+ }
@@ -36,3 +36,10 @@ export declare function validateSkillDir(skillDir: string): Promise<string[]>;
36
36
  * @returns A promise that resolves to a map of skill names to their corresponding Skill objects.
37
37
  */
38
38
  export declare function loadAllSkillsInDir(skillsBasePath: string): Promise<Record<string, Skill>>;
39
+ /**
40
+ * Loads a complete skill directly from in-memory zip file buffer.
41
+ *
42
+ * @param zipBuffer - The raw Buffer of the zip file containing the skill.
43
+ * @returns A Skill object with all components loaded.
44
+ */
45
+ export declare function loadSkillFromZipBuffer(zipBuffer: Buffer): Skill;
@@ -8,7 +8,7 @@ export declare const SNAKE_OR_KEBAB_NAME_PATTERN: RegExp;
8
8
  /**
9
9
  * Schema and Type for Skill Frontmatter metadata.
10
10
  */
11
- export declare const FrontmatterSchema: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodObject<{
11
+ export declare const FrontmatterSchema: z.ZodPreprocess<z.ZodObject<{
12
12
  name: z.ZodString;
13
13
  description: z.ZodString;
14
14
  license: z.ZodOptional<z.ZodString>;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { Frontmatter, Skill } from './skill.js';
7
+ /**
8
+ * Interface for a skill registry.
9
+ */
10
+ export interface SkillRegistry {
11
+ /**
12
+ * Fetches a skill from the registry.
13
+ *
14
+ * @param name The name of the skill.
15
+ * @returns A Promise resolving to a Skill object.
16
+ */
17
+ getSkill(name: string): Promise<Skill>;
18
+ /**
19
+ * Searches for skills in the registry.
20
+ *
21
+ * @param query The search query.
22
+ * @returns A Promise resolving to a list of Frontmatter objects for discovery.
23
+ */
24
+ searchSkills(query: string): Promise<Frontmatter[]>;
25
+ /**
26
+ * Returns the description for the search_skills tool.
27
+ */
28
+ searchToolDescription?(): string | undefined;
29
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { OpenAPIV3 } from 'openapi-types';
7
+ import { ApiParameter } from './operation_parser.js';
8
+ export interface OperationEndpoint {
9
+ baseUrl: string;
10
+ path: string;
11
+ method: string;
12
+ }
13
+ export interface ParsedOperation {
14
+ name: string;
15
+ description: string;
16
+ endpoint: OperationEndpoint;
17
+ operation: OpenAPIV3.OperationObject;
18
+ parameters: ApiParameter[];
19
+ returnValue?: ApiParameter;
20
+ authScheme?: OpenAPIV3.SecuritySchemeObject;
21
+ }
22
+ export declare class OpenApiSpecParser {
23
+ private preservePropertyNames;
24
+ constructor(options?: {
25
+ preservePropertyNames?: boolean;
26
+ });
27
+ /**
28
+ * Parses an OpenAPI specification document and extracts a list of operations.
29
+ *
30
+ * @param openapiSpec The OpenAPI V3 document to parse.
31
+ * @returns An array of parsed operations.
32
+ */
33
+ parse(openapiSpec: OpenAPIV3.Document): ParsedOperation[];
34
+ }
@@ -0,0 +1,59 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { OpenAPIV3 } from 'openapi-types';
7
+ export interface ApiParameter {
8
+ originalName: string;
9
+ paramLocation: string;
10
+ paramSchema: OpenAPIV3.SchemaObject;
11
+ description?: string;
12
+ name: string;
13
+ required: boolean;
14
+ }
15
+ /**
16
+ * Parses an OpenAPI OperationObject and extracts its parameters, request body, and return value.
17
+ *
18
+ * It maps OpenAPI parameters and request bodies into a flat list of `ApiParameter` objects
19
+ * that are compatible with Gemini's tool function declarations.
20
+ */
21
+ export declare class OperationParser {
22
+ private readonly operation;
23
+ private params;
24
+ private returnValue?;
25
+ private preservePropertyNames;
26
+ constructor(operation: OpenAPIV3.OperationObject, options?: {
27
+ preservePropertyNames?: boolean;
28
+ });
29
+ private getParamName;
30
+ private processOperationParameters;
31
+ private processRequestBody;
32
+ private processReturnValue;
33
+ private dedupeParamNames;
34
+ /**
35
+ * Gets the list of parsed parameters extracted from the OpenAPI operation.
36
+ *
37
+ * @returns An array of parsed parameters.
38
+ */
39
+ getParameters(): ApiParameter[];
40
+ /**
41
+ * Generates a JSON schema representing the arguments of the tool function call.
42
+ *
43
+ * @returns A JSON Schema object.
44
+ */
45
+ getJsonSchema(): Record<string, unknown>;
46
+ /**
47
+ * Gets a valid tool function name derived from the operation's operationId.
48
+ *
49
+ * @throws {Error} If the operation does not have an operationId.
50
+ * @returns A string representing the function name.
51
+ */
52
+ getFunctionName(): string;
53
+ /**
54
+ * Gets the description of the tool, derived from the operation's description or summary.
55
+ *
56
+ * @returns A string representing the description.
57
+ */
58
+ getDescription(): string;
59
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { OpenAPIV3 } from 'openapi-types';
7
+ import { Context } from '../../../agents/context.js';
8
+ import { AuthCredential } from '../../../auth/auth_credential.js';
9
+ export interface AuthPreparationResult {
10
+ state: 'pending' | 'done';
11
+ authCredential?: AuthCredential;
12
+ }
13
+ export declare class ToolAuthHandler {
14
+ private readonly context;
15
+ private readonly authScheme?;
16
+ private readonly authCredential?;
17
+ private readonly credentialKey?;
18
+ constructor(context: Context, authScheme?: OpenAPIV3.SecuritySchemeObject | undefined, authCredential?: AuthCredential | undefined, credentialKey?: string | undefined);
19
+ static fromToolContext(context: Context, authScheme?: OpenAPIV3.SecuritySchemeObject, authCredential?: AuthCredential, options?: {
20
+ credentialKey?: string;
21
+ }): ToolAuthHandler;
22
+ prepareAuthCredentials(): Promise<AuthPreparationResult>;
23
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { OpenAPIV3 } from 'openapi-types';
7
+ import { ReadonlyContext } from '../../agents/readonly_context.js';
8
+ import { AuthCredential } from '../../auth/auth_credential.js';
9
+ import { BaseTool } from '../base_tool.js';
10
+ import { BaseToolset, ToolPredicate } from '../base_toolset.js';
11
+ export declare class OpenAPIToolset extends BaseToolset {
12
+ private tools;
13
+ constructor(options?: {
14
+ specDict?: OpenAPIV3.Document;
15
+ specStr?: string;
16
+ specType?: 'json' | 'yaml';
17
+ toolFilter?: ToolPredicate | string[];
18
+ prefix?: string;
19
+ preservePropertyNames?: boolean;
20
+ authScheme?: OpenAPIV3.SecuritySchemeObject;
21
+ authCredential?: AuthCredential;
22
+ credentialKey?: string;
23
+ headerProvider?: (context: ReadonlyContext) => Record<string, string>;
24
+ });
25
+ getTools(context?: ReadonlyContext): Promise<BaseTool[]>;
26
+ close(): Promise<void>;
27
+ }