@google/adk 1.2.0 → 1.4.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.
- package/dist/cjs/agents/active_streaming_tool.js +6 -1
- package/dist/cjs/agents/base_agent.js +19 -1
- package/dist/cjs/agents/context.js +1 -11
- package/dist/cjs/agents/functions.js +35 -16
- package/dist/cjs/agents/instructions.js +99 -33
- package/dist/cjs/agents/invocation_context.js +2 -6
- package/dist/cjs/agents/llm_agent.js +60 -11
- package/dist/cjs/agents/processors/agent_transfer_llm_request_processor.js +7 -0
- package/dist/cjs/agents/processors/basic_llm_request_processor.js +8 -1
- package/dist/cjs/agents/processors/code_execution_request_processor.js +0 -3
- package/dist/cjs/agents/processors/content_processor_utils.js +51 -25
- package/dist/cjs/agents/processors/content_request_processor.js +7 -0
- package/dist/cjs/agents/processors/context_compactor_request_processor.js +16 -2
- package/dist/cjs/agents/processors/identity_llm_request_processor.js +7 -0
- package/dist/cjs/agents/processors/instructions_llm_request_processor.js +5 -0
- package/dist/cjs/agents/processors/interactions_request_processor.js +63 -0
- package/dist/cjs/agents/processors/request_confirmation_llm_request_processor.js +9 -1
- package/dist/cjs/agents/processors/tool_filter_request_processor.js +7 -1
- package/dist/cjs/apps/app.js +79 -0
- package/dist/cjs/apps/resumability_config.js +44 -0
- package/dist/cjs/artifacts/file_artifact_service.js +14 -1
- package/dist/cjs/artifacts/gcs_artifact_service.js +57 -15
- package/dist/cjs/artifacts/in_memory_artifact_service.js +5 -1
- package/dist/cjs/artifacts/scoped_artifact_service.js +101 -0
- package/dist/cjs/artifacts/session_artifact_service.js +27 -0
- package/dist/cjs/auth/auth_preprocessor.js +12 -10
- package/dist/cjs/auth/oauth2/oauth2_discovery.js +17 -5
- package/dist/cjs/auth/oauth2/oauth2_utils.js +12 -1
- package/dist/cjs/code_executors/code_executor_context.js +7 -7
- package/dist/cjs/common.js +86 -0
- package/dist/cjs/context/agent_controlled_context_compactor.js +109 -0
- package/dist/cjs/context/summarizers/llm_summarizer.js +11 -0
- package/dist/cjs/context/token_based_context_compactor.js +43 -11
- package/dist/cjs/context/trajectory_thought_pruning_compactor.js +71 -0
- package/dist/cjs/events/event.js +25 -1
- package/dist/cjs/integrations/agent_registry/agent_registry_mcp_toolset.js +21 -2
- package/dist/cjs/models/gemini_llm_connection.js +62 -19
- package/dist/cjs/models/google_llm.js +51 -18
- package/dist/cjs/models/interactions_utils.js +732 -0
- package/dist/cjs/plugins/base_plugin.js +1 -0
- package/dist/cjs/plugins/security_plugin.js +16 -0
- package/dist/cjs/runner/in_memory_runner.js +13 -2
- package/dist/cjs/runner/runner.js +93 -72
- package/dist/cjs/sessions/base_session_service.js +19 -3
- package/dist/cjs/sessions/database_session_service.js +26 -9
- package/dist/cjs/sessions/db/schema.js +45 -10
- package/dist/cjs/sessions/in_memory_session_service.js +2 -1
- package/dist/cjs/sessions/vertex_ai_session_service.js +21 -5
- package/dist/cjs/skills/gcp_skill_registry.js +104 -0
- package/dist/cjs/skills/loader.js +67 -2
- package/dist/cjs/skills/skill_registry.js +27 -0
- package/dist/cjs/tools/base_toolset.js +1 -1
- package/dist/cjs/tools/consolidate_context_tool.js +79 -0
- package/dist/cjs/tools/forwarding_artifact_service.js +16 -28
- package/dist/cjs/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js +232 -0
- package/dist/cjs/tools/openapi_tool/openapi_spec_parser/operation_parser.js +224 -0
- package/dist/cjs/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js +117 -0
- package/dist/cjs/tools/openapi_tool/openapi_toolset.js +133 -0
- package/dist/cjs/tools/openapi_tool/rest_api_tool.js +256 -0
- package/dist/cjs/tools/skill/load_skill_resource_tool.js +25 -3
- package/dist/cjs/tools/skill/load_skill_tool.js +12 -1
- package/dist/cjs/tools/skill/run_skill_script_tool.js +12 -1
- package/dist/cjs/tools/skill/search_skills_tool.js +108 -0
- package/dist/cjs/tools/skill/skill_toolset.js +40 -5
- package/dist/cjs/utils/async_hooks_shim.js +52 -0
- package/dist/cjs/utils/async_queue.js +88 -0
- package/dist/cjs/utils/case_utils.js +53 -0
- package/dist/cjs/utils/client_labels.js +41 -3
- package/dist/cjs/utils/env_aware_utils.js +14 -1
- package/dist/cjs/utils/live_connection_utils.js +284 -0
- package/dist/cjs/utils/model_name.js +9 -0
- package/dist/cjs/utils/streaming_utils.js +18 -11
- package/dist/cjs/utils/task.js +62 -0
- package/dist/cjs/version.js +1 -1
- package/dist/esm/agents/active_streaming_tool.js +6 -1
- package/dist/esm/agents/base_agent.js +19 -1
- package/dist/esm/agents/context.js +1 -11
- package/dist/esm/agents/functions.js +36 -15
- package/dist/esm/agents/instructions.js +99 -33
- package/dist/esm/agents/invocation_context.js +2 -6
- package/dist/esm/agents/llm_agent.js +61 -11
- package/dist/esm/agents/processors/agent_transfer_llm_request_processor.js +7 -0
- package/dist/esm/agents/processors/basic_llm_request_processor.js +8 -1
- package/dist/esm/agents/processors/code_execution_request_processor.js +0 -3
- package/dist/esm/agents/processors/content_processor_utils.js +48 -24
- package/dist/esm/agents/processors/content_request_processor.js +7 -0
- package/dist/esm/agents/processors/context_compactor_request_processor.js +16 -2
- package/dist/esm/agents/processors/identity_llm_request_processor.js +7 -0
- package/dist/esm/agents/processors/instructions_llm_request_processor.js +5 -0
- package/dist/esm/agents/processors/interactions_request_processor.js +34 -0
- package/dist/esm/agents/processors/request_confirmation_llm_request_processor.js +9 -1
- package/dist/esm/agents/processors/tool_filter_request_processor.js +7 -1
- package/dist/esm/apps/app.js +49 -0
- package/dist/esm/apps/resumability_config.js +16 -0
- package/dist/esm/artifacts/file_artifact_service.js +14 -1
- package/dist/esm/artifacts/gcs_artifact_service.js +57 -15
- package/dist/esm/artifacts/in_memory_artifact_service.js +5 -1
- package/dist/esm/artifacts/scoped_artifact_service.js +73 -0
- package/dist/esm/artifacts/session_artifact_service.js +7 -0
- package/dist/esm/auth/auth_preprocessor.js +12 -10
- package/dist/esm/auth/oauth2/oauth2_discovery.js +14 -4
- package/dist/esm/auth/oauth2/oauth2_utils.js +12 -1
- package/dist/esm/code_executors/code_executor_context.js +7 -7
- package/dist/esm/common.js +75 -3
- package/dist/esm/context/agent_controlled_context_compactor.js +81 -0
- package/dist/esm/context/summarizers/llm_summarizer.js +11 -0
- package/dist/esm/context/token_based_context_compactor.js +43 -11
- package/dist/esm/context/trajectory_thought_pruning_compactor.js +43 -0
- package/dist/esm/events/event.js +23 -1
- package/dist/esm/integrations/agent_registry/agent_registry_mcp_toolset.js +21 -2
- package/dist/esm/models/gemini_llm_connection.js +62 -19
- package/dist/esm/models/google_llm.js +49 -17
- package/dist/esm/models/interactions_utils.js +697 -0
- package/dist/esm/plugins/base_plugin.js +1 -0
- package/dist/esm/plugins/security_plugin.js +16 -0
- package/dist/esm/runner/in_memory_runner.js +13 -2
- package/dist/esm/runner/runner.js +91 -73
- package/dist/esm/sessions/base_session_service.js +17 -2
- package/dist/esm/sessions/database_session_service.js +26 -9
- package/dist/esm/sessions/db/schema.js +44 -10
- package/dist/esm/sessions/in_memory_session_service.js +4 -2
- package/dist/esm/sessions/vertex_ai_session_service.js +21 -5
- package/dist/esm/skills/gcp_skill_registry.js +78 -0
- package/dist/esm/skills/loader.js +66 -2
- package/dist/esm/skills/skill_registry.js +7 -0
- package/dist/esm/tools/base_toolset.js +1 -1
- package/dist/esm/tools/consolidate_context_tool.js +51 -0
- package/dist/esm/tools/forwarding_artifact_service.js +16 -28
- package/dist/esm/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js +206 -0
- package/dist/esm/tools/openapi_tool/openapi_spec_parser/operation_parser.js +198 -0
- package/dist/esm/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js +91 -0
- package/dist/esm/tools/openapi_tool/openapi_toolset.js +97 -0
- package/dist/esm/tools/openapi_tool/rest_api_tool.js +229 -0
- package/dist/esm/tools/skill/load_skill_resource_tool.js +25 -3
- package/dist/esm/tools/skill/load_skill_tool.js +12 -1
- package/dist/esm/tools/skill/run_skill_script_tool.js +12 -1
- package/dist/esm/tools/skill/search_skills_tool.js +82 -0
- package/dist/esm/tools/skill/skill_toolset.js +40 -5
- package/dist/esm/utils/async_hooks_shim.js +24 -0
- package/dist/esm/utils/async_queue.js +60 -0
- package/dist/esm/utils/case_utils.js +25 -0
- package/dist/esm/utils/client_labels.js +38 -2
- package/dist/esm/utils/env_aware_utils.js +14 -1
- package/dist/esm/utils/live_connection_utils.js +256 -0
- package/dist/esm/utils/model_name.js +8 -0
- package/dist/esm/utils/streaming_utils.js +18 -11
- package/dist/esm/utils/task.js +34 -0
- package/dist/esm/version.js +1 -1
- package/dist/types/a2a/a2a_remote_agent_utils.d.ts +29 -4
- package/dist/types/a2a/event_converter_utils.d.ts +14 -1
- package/dist/types/a2a/metadata_converter_utils.d.ts +18 -0
- package/dist/types/a2a/part_converter_utils.d.ts +51 -6
- package/dist/types/agents/active_streaming_tool.d.ts +3 -4
- package/dist/types/agents/functions.d.ts +12 -9
- package/dist/types/agents/invocation_context.d.ts +7 -12
- package/dist/types/agents/llm_agent.d.ts +14 -0
- package/dist/types/agents/processors/agent_transfer_llm_request_processor.d.ts +14 -0
- package/dist/types/agents/processors/basic_llm_request_processor.d.ts +7 -0
- package/dist/types/agents/processors/content_processor_utils.d.ts +34 -0
- package/dist/types/agents/processors/content_request_processor.d.ts +16 -0
- package/dist/types/agents/processors/context_compactor_request_processor.d.ts +12 -0
- package/dist/types/agents/processors/identity_llm_request_processor.d.ts +7 -0
- package/dist/types/agents/processors/interactions_request_processor.d.ts +17 -0
- package/dist/types/agents/processors/request_confirmation_llm_request_processor.d.ts +9 -1
- package/dist/types/agents/processors/tool_filter_request_processor.d.ts +12 -1
- package/dist/types/apps/app.d.ts +52 -0
- package/dist/types/apps/resumability_config.d.ts +27 -0
- package/dist/types/artifacts/base_artifact_service.d.ts +6 -36
- package/dist/types/artifacts/gcs_artifact_service.d.ts +2 -1
- package/dist/types/artifacts/scoped_artifact_service.d.ts +25 -0
- package/dist/types/artifacts/session_artifact_service.d.ts +25 -0
- package/dist/types/auth/oauth2/oauth2_discovery.d.ts +11 -0
- package/dist/types/common.d.ts +35 -4
- package/dist/types/context/agent_controlled_context_compactor.d.ts +24 -0
- package/dist/types/context/base_context_compactor.d.ts +3 -0
- package/dist/types/context/summarizers/llm_summarizer.d.ts +17 -0
- package/dist/types/context/token_based_context_compactor.d.ts +6 -1
- package/dist/types/context/trajectory_thought_pruning_compactor.d.ts +27 -0
- package/dist/types/events/event.d.ts +8 -0
- package/dist/types/events/event_actions.d.ts +1 -2
- package/dist/types/integrations/agent_registry/agent_registry_mcp_toolset.d.ts +21 -2
- package/dist/types/models/base_llm_connection.d.ts +10 -0
- package/dist/types/models/gemini_llm_connection.d.ts +15 -4
- package/dist/types/models/google_llm.d.ts +15 -1
- package/dist/types/models/interactions_utils.d.ts +92 -0
- package/dist/types/models/llm_request.d.ts +4 -0
- package/dist/types/models/llm_response.d.ts +14 -1
- package/dist/types/plugins/base_plugin.d.ts +2 -1
- package/dist/types/plugins/security_plugin.d.ts +30 -0
- package/dist/types/runner/in_memory_runner.d.ts +7 -1
- package/dist/types/runner/runner.d.ts +43 -9
- package/dist/types/sessions/base_session_service.d.ts +7 -16
- package/dist/types/sessions/db/schema.d.ts +1 -0
- package/dist/types/sessions/session.d.ts +11 -0
- package/dist/types/sessions/vertex_ai_session_service.d.ts +9 -1
- package/dist/types/skills/gcp_skill_registry.d.ts +24 -0
- package/dist/types/skills/loader.d.ts +7 -0
- package/dist/types/skills/skill.d.ts +1 -1
- package/dist/types/skills/skill_registry.d.ts +29 -0
- package/dist/types/tools/consolidate_context_tool.d.ts +19 -0
- package/dist/types/tools/forwarding_artifact_service.d.ts +3 -2
- package/dist/types/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.d.ts +34 -0
- package/dist/types/tools/openapi_tool/openapi_spec_parser/operation_parser.d.ts +59 -0
- package/dist/types/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.d.ts +23 -0
- package/dist/types/tools/openapi_tool/openapi_toolset.d.ts +27 -0
- package/dist/types/tools/openapi_tool/rest_api_tool.d.ts +50 -0
- package/dist/types/tools/skill/load_skill_resource_tool.d.ts +1 -1
- package/dist/types/tools/skill/search_skills_tool.d.ts +14 -0
- package/dist/types/tools/skill/skill_toolset.d.ts +5 -0
- package/dist/types/utils/async_hooks_shim.d.ts +10 -0
- package/dist/types/utils/async_queue.d.ts +18 -0
- package/dist/types/utils/case_utils.d.ts +12 -0
- package/dist/types/utils/client_labels.d.ts +10 -0
- package/dist/types/utils/env_aware_utils.d.ts +3 -3
- package/dist/types/utils/live_connection_utils.d.ts +30 -0
- package/dist/types/utils/model_name.d.ts +7 -0
- package/dist/types/utils/streaming_utils.d.ts +0 -1
- package/dist/types/utils/task.d.ts +24 -0
- package/dist/types/version.d.ts +1 -1
- package/dist/web/agents/active_streaming_tool.js +6 -1
- package/dist/web/agents/base_agent.js +31 -1
- package/dist/web/agents/context.js +1 -11
- package/dist/web/agents/functions.js +36 -15
- package/dist/web/agents/instructions.js +99 -33
- package/dist/web/agents/invocation_context.js +2 -6
- package/dist/web/agents/llm_agent.js +61 -11
- package/dist/web/agents/processors/agent_transfer_llm_request_processor.js +7 -0
- package/dist/web/agents/processors/basic_llm_request_processor.js +8 -1
- package/dist/web/agents/processors/code_execution_request_processor.js +0 -3
- package/dist/web/agents/processors/content_processor_utils.js +66 -24
- package/dist/web/agents/processors/content_request_processor.js +7 -0
- package/dist/web/agents/processors/context_compactor_request_processor.js +16 -2
- package/dist/web/agents/processors/identity_llm_request_processor.js +7 -0
- package/dist/web/agents/processors/instructions_llm_request_processor.js +5 -0
- package/dist/web/agents/processors/interactions_request_processor.js +52 -0
- package/dist/web/agents/processors/request_confirmation_llm_request_processor.js +9 -1
- package/dist/web/agents/processors/tool_filter_request_processor.js +7 -1
- package/dist/web/apps/app.js +49 -0
- package/dist/web/apps/resumability_config.js +31 -0
- package/dist/web/artifacts/file_artifact_service.js +14 -1
- package/dist/web/artifacts/gcs_artifact_service.js +55 -15
- package/dist/web/artifacts/in_memory_artifact_service.js +5 -1
- package/dist/web/artifacts/scoped_artifact_service.js +86 -0
- package/dist/web/artifacts/session_artifact_service.js +7 -0
- package/dist/web/auth/auth_preprocessor.js +12 -10
- package/dist/web/auth/oauth2/oauth2_discovery.js +14 -4
- package/dist/web/auth/oauth2/oauth2_utils.js +12 -1
- package/dist/web/code_executors/code_executor_context.js +7 -7
- package/dist/web/common.js +75 -3
- package/dist/web/context/agent_controlled_context_compactor.js +81 -0
- package/dist/web/context/summarizers/llm_summarizer.js +11 -0
- package/dist/web/context/token_based_context_compactor.js +43 -11
- package/dist/web/context/trajectory_thought_pruning_compactor.js +43 -0
- package/dist/web/events/event.js +21 -1
- package/dist/web/integrations/agent_registry/agent_registry_mcp_toolset.js +21 -2
- package/dist/web/models/gemini_llm_connection.js +75 -19
- package/dist/web/models/google_llm.js +80 -17
- package/dist/web/models/interactions_utils.js +728 -0
- package/dist/web/plugins/base_plugin.js +1 -0
- package/dist/web/plugins/security_plugin.js +16 -0
- package/dist/web/runner/in_memory_runner.js +13 -2
- package/dist/web/runner/runner.js +111 -75
- package/dist/web/sessions/base_session_service.js +17 -2
- package/dist/web/sessions/database_session_service.js +26 -9
- package/dist/web/sessions/db/schema.js +44 -10
- package/dist/web/sessions/in_memory_session_service.js +4 -2
- package/dist/web/sessions/vertex_ai_session_service.js +21 -5
- package/dist/web/skills/gcp_skill_registry.js +78 -0
- package/dist/web/skills/loader.js +66 -2
- package/dist/web/skills/skill_registry.js +7 -0
- package/dist/web/tools/base_toolset.js +1 -1
- package/dist/web/tools/consolidate_context_tool.js +51 -0
- package/dist/web/tools/forwarding_artifact_service.js +16 -28
- package/dist/web/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js +221 -0
- package/dist/web/tools/openapi_tool/openapi_spec_parser/operation_parser.js +198 -0
- package/dist/web/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js +91 -0
- package/dist/web/tools/openapi_tool/openapi_toolset.js +97 -0
- package/dist/web/tools/openapi_tool/rest_api_tool.js +229 -0
- package/dist/web/tools/skill/load_skill_resource_tool.js +25 -3
- package/dist/web/tools/skill/load_skill_tool.js +12 -1
- package/dist/web/tools/skill/run_skill_script_tool.js +12 -1
- package/dist/web/tools/skill/search_skills_tool.js +82 -0
- package/dist/web/tools/skill/skill_toolset.js +40 -5
- package/dist/web/utils/async_hooks_shim.js +24 -0
- package/dist/web/utils/async_queue.js +60 -0
- package/dist/web/utils/case_utils.js +25 -0
- package/dist/web/utils/client_labels.js +38 -2
- package/dist/web/utils/env_aware_utils.js +14 -1
- package/dist/web/utils/live_connection_utils.js +254 -0
- package/dist/web/utils/model_name.js +8 -0
- package/dist/web/utils/streaming_utils.js +18 -11
- package/dist/web/utils/task.js +34 -0
- package/dist/web/version.js +1 -1
- package/package.json +4 -2
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { FunctionDeclaration } from '@google/genai';
|
|
7
|
+
import { OpenAPIV3 } from 'openapi-types';
|
|
8
|
+
import { ReadonlyContext } from '../../agents/readonly_context.js';
|
|
9
|
+
import { AuthCredential } from '../../auth/auth_credential.js';
|
|
10
|
+
import { BaseTool, RunAsyncToolRequest } from '../base_tool.js';
|
|
11
|
+
import { ApiParameter } from './openapi_spec_parser/operation_parser.js';
|
|
12
|
+
import { OperationEndpoint } from './openapi_spec_parser/openapi_spec_parser.js';
|
|
13
|
+
export declare class RestApiTool extends BaseTool {
|
|
14
|
+
private readonly endpoint;
|
|
15
|
+
private readonly operation;
|
|
16
|
+
private authScheme?;
|
|
17
|
+
private authCredential?;
|
|
18
|
+
private operationParser;
|
|
19
|
+
private headerProvider?;
|
|
20
|
+
private credentialKey?;
|
|
21
|
+
constructor(name: string, description: string, endpoint: OperationEndpoint, operation: OpenAPIV3.OperationObject, authScheme?: OpenAPIV3.SecuritySchemeObject | undefined, authCredential?: AuthCredential | undefined, options?: {
|
|
22
|
+
preservePropertyNames?: boolean;
|
|
23
|
+
headerProvider?: (context: ReadonlyContext) => Record<string, string>;
|
|
24
|
+
credentialKey?: string;
|
|
25
|
+
});
|
|
26
|
+
configureAuthScheme(authScheme: OpenAPIV3.SecuritySchemeObject): void;
|
|
27
|
+
configureAuthCredential(authCredential: AuthCredential): void;
|
|
28
|
+
configureCredentialKey(credentialKey: string): void;
|
|
29
|
+
_getDeclaration(): FunctionDeclaration;
|
|
30
|
+
runAsync(request: RunAsyncToolRequest): Promise<unknown>;
|
|
31
|
+
}
|
|
32
|
+
export interface PreparedParams {
|
|
33
|
+
url: string;
|
|
34
|
+
headers: Record<string, string>;
|
|
35
|
+
body: unknown;
|
|
36
|
+
bodyData: Record<string, unknown>;
|
|
37
|
+
}
|
|
38
|
+
export declare function prepareRequestParams(endpoint: OperationEndpoint, parameters: ApiParameter[], args: Record<string, unknown>): PreparedParams;
|
|
39
|
+
export declare function prepareRequestBody(requestBody: OpenAPIV3.RequestBodyObject | OpenAPIV3.ReferenceObject | undefined, body: unknown, bodyData: Record<string, unknown>, headers: Record<string, string>): unknown;
|
|
40
|
+
export declare function createRestApiTool(parsed: {
|
|
41
|
+
name: string;
|
|
42
|
+
description: string;
|
|
43
|
+
endpoint: OperationEndpoint;
|
|
44
|
+
operation: OpenAPIV3.OperationObject;
|
|
45
|
+
authScheme?: OpenAPIV3.SecuritySchemeObject;
|
|
46
|
+
}, options?: {
|
|
47
|
+
preservePropertyNames?: boolean;
|
|
48
|
+
headerProvider?: (context: ReadonlyContext) => Record<string, string>;
|
|
49
|
+
credentialKey?: string;
|
|
50
|
+
}): RestApiTool;
|
|
@@ -10,6 +10,6 @@ export declare class LoadSkillResourceTool extends BaseTool {
|
|
|
10
10
|
private toolset;
|
|
11
11
|
constructor(toolset: SkillToolset);
|
|
12
12
|
_getDeclaration(): FunctionDeclaration;
|
|
13
|
-
runAsync({ args }: RunAsyncToolRequest): Promise<unknown>;
|
|
13
|
+
runAsync({ args, toolContext, }: RunAsyncToolRequest): Promise<unknown>;
|
|
14
14
|
processLlmRequest(request: ToolProcessLlmRequest): Promise<void>;
|
|
15
15
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { FunctionDeclaration } from '@google/genai';
|
|
7
|
+
import { BaseTool, RunAsyncToolRequest } from '../base_tool.js';
|
|
8
|
+
import { SkillToolset } from './skill_toolset.js';
|
|
9
|
+
export declare class SearchSkillsTool extends BaseTool {
|
|
10
|
+
private toolset;
|
|
11
|
+
constructor(toolset: SkillToolset);
|
|
12
|
+
_getDeclaration(): FunctionDeclaration;
|
|
13
|
+
runAsync({ args }: RunAsyncToolRequest): Promise<unknown>;
|
|
14
|
+
}
|
|
@@ -8,6 +8,7 @@ import { ReadonlyContext } from '../../agents/readonly_context.js';
|
|
|
8
8
|
import { BaseCodeExecutor } from '../../code_executors/base_code_executor.js';
|
|
9
9
|
import { LlmRequest } from '../../models/llm_request.js';
|
|
10
10
|
import { Skill } from '../../skills/skill.js';
|
|
11
|
+
import { SkillRegistry } from '../../skills/skill_registry.js';
|
|
11
12
|
import { BaseTool } from '../base_tool.js';
|
|
12
13
|
import { BaseToolset } from '../base_toolset.js';
|
|
13
14
|
export declare class SkillToolset extends BaseToolset {
|
|
@@ -15,14 +16,18 @@ export declare class SkillToolset extends BaseToolset {
|
|
|
15
16
|
private tools;
|
|
16
17
|
additionalTools: Array<BaseTool | BaseToolset>;
|
|
17
18
|
codeExecutor?: BaseCodeExecutor;
|
|
19
|
+
registry?: SkillRegistry;
|
|
18
20
|
private toolCache;
|
|
21
|
+
private fetchedSkillCache;
|
|
19
22
|
constructor(skills: Record<string, Skill> | Skill[], options?: {
|
|
20
23
|
codeExecutor?: BaseCodeExecutor;
|
|
21
24
|
additionalTools?: Array<BaseTool | BaseToolset>;
|
|
25
|
+
registry?: SkillRegistry;
|
|
22
26
|
});
|
|
23
27
|
getTools(context?: ReadonlyContext): Promise<BaseTool[]>;
|
|
24
28
|
close(): Promise<void>;
|
|
25
29
|
getSkill(name: string): Skill | undefined;
|
|
30
|
+
getOrFetchSkill(name: string, invocationId?: string): Promise<Skill | undefined>;
|
|
26
31
|
processLlmRequest(toolContext: Context, llmRequest: LlmRequest): Promise<void>;
|
|
27
32
|
private resolveAdditionalTools;
|
|
28
33
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* A generic, async-safe queue that implements AsyncIterable.
|
|
8
|
+
*/
|
|
9
|
+
export declare class AsyncQueue<T> implements AsyncIterable<T> {
|
|
10
|
+
private queue;
|
|
11
|
+
private resolvers;
|
|
12
|
+
private closed;
|
|
13
|
+
private errorVal?;
|
|
14
|
+
push(value: T): void;
|
|
15
|
+
error(err: unknown): void;
|
|
16
|
+
close(): void;
|
|
17
|
+
[Symbol.asyncIterator](): AsyncIterator<T>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Recursively converts snake_case keys of an object to camelCase.
|
|
8
|
+
*
|
|
9
|
+
* @param val The value to convert.
|
|
10
|
+
* @returns The converted value.
|
|
11
|
+
*/
|
|
12
|
+
export declare function camelCaseKeys(val: unknown): unknown;
|
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
export declare function parseUserAgent(userAgent: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* Runs the given callback within a context that has the specified client label.
|
|
9
|
+
* All LLM calls made within this callback will include the client label in their tracking headers.
|
|
10
|
+
*
|
|
11
|
+
* @param clientLabel The custom client label to apply.
|
|
12
|
+
* @param callback The callback function to execute.
|
|
13
|
+
* @return The result of the callback.
|
|
14
|
+
*/
|
|
15
|
+
export declare function runWithClientLabel<R>(clientLabel: string, callback: () => R): R;
|
|
6
16
|
/**
|
|
7
17
|
* Returns the current list of client labels that can be added to HTTP Headers.
|
|
8
18
|
*/
|
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
export declare function isBrowser(): boolean;
|
|
10
10
|
export declare function randomUUID(): string;
|
|
11
11
|
/**
|
|
12
|
-
* Encodes the given string to base64.
|
|
12
|
+
* Encodes the given string or Uint8Array to base64.
|
|
13
13
|
*
|
|
14
|
-
* @param data The
|
|
14
|
+
* @param data The data to encode.
|
|
15
15
|
* @return The base64-encoded string.
|
|
16
16
|
*/
|
|
17
|
-
export declare function base64Encode(data: string): string;
|
|
17
|
+
export declare function base64Encode(data: string | Uint8Array): string;
|
|
18
18
|
/**
|
|
19
19
|
* Decodes the given base64 string to a string.
|
|
20
20
|
*
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { LiveServerMessage } from '@google/genai';
|
|
7
|
+
import { LlmResponse } from '../models/llm_response.js';
|
|
8
|
+
/**
|
|
9
|
+
* Aggregator and mapper for Gemini Live WebSocket server messages.
|
|
10
|
+
*
|
|
11
|
+
* Translates incoming raw WebSocket server messages (push stream) into unified
|
|
12
|
+
* agent-consumable LlmResponse objects (pull stream), managing transcription buffers,
|
|
13
|
+
* grounding metadata, text segments, and tool calls.
|
|
14
|
+
*/
|
|
15
|
+
export declare class LiveResponseAggregator {
|
|
16
|
+
private readonly modelVersion?;
|
|
17
|
+
private text;
|
|
18
|
+
private isThought;
|
|
19
|
+
private toolCallParts;
|
|
20
|
+
private pendingGroundingMetadata;
|
|
21
|
+
private inputTranscriptionText;
|
|
22
|
+
private outputTranscriptionText;
|
|
23
|
+
constructor(modelVersion?: string | undefined);
|
|
24
|
+
processMessage(message: LiveServerMessage): Generator<LlmResponse, void, void>;
|
|
25
|
+
/**
|
|
26
|
+
* Flushes any remaining aggregated components when the connection is closed.
|
|
27
|
+
*/
|
|
28
|
+
close(): Generator<LlmResponse, void, void>;
|
|
29
|
+
private buildFullTextResponse;
|
|
30
|
+
}
|
|
@@ -32,6 +32,13 @@ export declare function isGemini1Model(modelString: string): boolean;
|
|
|
32
32
|
* @return true if it's a Gemini 2.x model, false otherwise.
|
|
33
33
|
*/
|
|
34
34
|
export declare function isGemini2OrAbove(modelString: string): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Check if the model is a Gemini 3.x Flash Live model.
|
|
37
|
+
*
|
|
38
|
+
* @param modelString Either a simple model name or path-based model name
|
|
39
|
+
* @return true if it's a Gemini 3.x Flash Live model, false otherwise.
|
|
40
|
+
*/
|
|
41
|
+
export declare function isGemini3xFlashLive(modelString: string | undefined): boolean;
|
|
35
42
|
/**
|
|
36
43
|
* Returns True when Gemini model-id validation should be bypassed.
|
|
37
44
|
*/
|
|
@@ -19,7 +19,6 @@ export declare class StreamingResponseAggregator {
|
|
|
19
19
|
private response?;
|
|
20
20
|
private finishReason?;
|
|
21
21
|
private lastThoughtSignature;
|
|
22
|
-
private sawFunctionCall;
|
|
23
22
|
private readonly strategy;
|
|
24
23
|
constructor(isProgressiveMode?: boolean);
|
|
25
24
|
processResponse(response: GenerateContentResponse): AsyncGenerator<LlmResponse, void, void>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
export type TaskExecutable<T = void> = (abortSignal: AbortSignal) => Promise<T>;
|
|
7
|
+
/**
|
|
8
|
+
* Represents a runtime task wrapping a promise, allowing status check and cancellation.
|
|
9
|
+
*/
|
|
10
|
+
export declare class Task<T = void> {
|
|
11
|
+
executable: TaskExecutable<T>;
|
|
12
|
+
private isDone;
|
|
13
|
+
private abortController;
|
|
14
|
+
promise: Promise<T>;
|
|
15
|
+
constructor(executable: TaskExecutable<T>);
|
|
16
|
+
/**
|
|
17
|
+
* Cancels the task execution.
|
|
18
|
+
*/
|
|
19
|
+
cancel(): void;
|
|
20
|
+
/**
|
|
21
|
+
* Returns true if the task has completed (either resolved or rejected).
|
|
22
|
+
*/
|
|
23
|
+
done(): boolean;
|
|
24
|
+
}
|
package/dist/types/version.d.ts
CHANGED
|
@@ -5,9 +5,14 @@ const require = topLevelCreateRequire(import.meta.url);
|
|
|
5
5
|
* Copyright 2025 Google LLC
|
|
6
6
|
* SPDX-License-Identifier: Apache-2.0
|
|
7
7
|
*/
|
|
8
|
+
import { Task } from "../utils/task.js";
|
|
8
9
|
class ActiveStreamingTool {
|
|
9
10
|
constructor(params = {}) {
|
|
10
|
-
|
|
11
|
+
if (params.task instanceof Promise) {
|
|
12
|
+
this.task = new Task(() => params.task);
|
|
13
|
+
} else {
|
|
14
|
+
this.task = params.task;
|
|
15
|
+
}
|
|
11
16
|
this.stream = params.stream;
|
|
12
17
|
}
|
|
13
18
|
}
|
|
@@ -184,10 +184,40 @@ class BaseAgent {
|
|
|
184
184
|
this,
|
|
185
185
|
function() {
|
|
186
186
|
return __asyncGenerator(this, null, function* () {
|
|
187
|
+
var _a2, _b;
|
|
188
|
+
const context2 = this.createInvocationContext(parentContext);
|
|
189
|
+
const beforeAgentCallbackEvent = yield new __await(this.handleBeforeAgentCallback(context2));
|
|
190
|
+
if (beforeAgentCallbackEvent) {
|
|
191
|
+
yield beforeAgentCallbackEvent;
|
|
192
|
+
}
|
|
193
|
+
if (context2.endInvocation || ((_a2 = parentContext.abortSignal) == null ? void 0 : _a2.aborted)) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
try {
|
|
197
|
+
for (var iter = __forAwait(this.runLiveImpl(context2)), more, temp, error; more = !(temp = yield new __await(iter.next())).done; more = false) {
|
|
198
|
+
const event = temp.value;
|
|
199
|
+
yield event;
|
|
200
|
+
}
|
|
201
|
+
} catch (temp) {
|
|
202
|
+
error = [temp];
|
|
203
|
+
} finally {
|
|
204
|
+
try {
|
|
205
|
+
more && (temp = iter.return) && (yield new __await(temp.call(iter)));
|
|
206
|
+
} finally {
|
|
207
|
+
if (error)
|
|
208
|
+
throw error[0];
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
if (context2.endInvocation || ((_b = parentContext.abortSignal) == null ? void 0 : _b.aborted)) {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
const afterAgentCallbackEvent = yield new __await(this.handleAfterAgentCallback(context2));
|
|
215
|
+
if (afterAgentCallbackEvent) {
|
|
216
|
+
yield afterAgentCallbackEvent;
|
|
217
|
+
}
|
|
187
218
|
});
|
|
188
219
|
}
|
|
189
220
|
));
|
|
190
|
-
throw new Error("Live mode is not implemented yet.");
|
|
191
221
|
} finally {
|
|
192
222
|
span.end();
|
|
193
223
|
}
|
|
@@ -56,9 +56,6 @@ class Context extends ReadonlyContext {
|
|
|
56
56
|
throw new Error("Artifact service is not initialized.");
|
|
57
57
|
}
|
|
58
58
|
return this.invocationContext.artifactService.loadArtifact({
|
|
59
|
-
appName: this.invocationContext.appName,
|
|
60
|
-
userId: this.invocationContext.userId,
|
|
61
|
-
sessionId: this.invocationContext.session.id,
|
|
62
59
|
filename,
|
|
63
60
|
version
|
|
64
61
|
});
|
|
@@ -75,9 +72,6 @@ class Context extends ReadonlyContext {
|
|
|
75
72
|
throw new Error("Artifact service is not initialized.");
|
|
76
73
|
}
|
|
77
74
|
const version = await this.invocationContext.artifactService.saveArtifact({
|
|
78
|
-
appName: this.invocationContext.appName,
|
|
79
|
-
userId: this.invocationContext.userId,
|
|
80
|
-
sessionId: this.invocationContext.session.id,
|
|
81
75
|
filename,
|
|
82
76
|
artifact
|
|
83
77
|
});
|
|
@@ -110,11 +104,7 @@ class Context extends ReadonlyContext {
|
|
|
110
104
|
if (!this.invocationContext.artifactService) {
|
|
111
105
|
throw new Error("Artifact service is not initialized.");
|
|
112
106
|
}
|
|
113
|
-
return this.invocationContext.artifactService.listArtifactKeys(
|
|
114
|
-
appName: this.invocationContext.session.appName,
|
|
115
|
-
userId: this.invocationContext.session.userId,
|
|
116
|
-
sessionId: this.invocationContext.session.id
|
|
117
|
-
});
|
|
107
|
+
return this.invocationContext.artifactService.listArtifactKeys();
|
|
118
108
|
}
|
|
119
109
|
/**
|
|
120
110
|
* Searches the memory of the current user.
|
|
@@ -7,7 +7,11 @@ const require = topLevelCreateRequire(import.meta.url);
|
|
|
7
7
|
*/
|
|
8
8
|
import { createUserContent } from "@google/genai";
|
|
9
9
|
import { isEmpty } from "lodash-es";
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
createEvent,
|
|
12
|
+
getFunctionCalls,
|
|
13
|
+
getFunctionResponses
|
|
14
|
+
} from "../events/event.js";
|
|
11
15
|
import { mergeEventActions } from "../events/event_actions.js";
|
|
12
16
|
import { randomUUID } from "../utils/env_aware_utils.js";
|
|
13
17
|
import { logger } from "../utils/logger.js";
|
|
@@ -39,18 +43,6 @@ function populateClientFunctionCallId(modelResponseEvent) {
|
|
|
39
43
|
}
|
|
40
44
|
}
|
|
41
45
|
}
|
|
42
|
-
function removeClientFunctionCallId(content) {
|
|
43
|
-
if (content && content.parts) {
|
|
44
|
-
for (const part of content.parts) {
|
|
45
|
-
if (part.functionCall && part.functionCall.id && part.functionCall.id.startsWith(AF_FUNCTION_CALL_ID_PREFIX)) {
|
|
46
|
-
part.functionCall.id = void 0;
|
|
47
|
-
}
|
|
48
|
-
if (part.functionResponse && part.functionResponse.id && part.functionResponse.id.startsWith(AF_FUNCTION_CALL_ID_PREFIX)) {
|
|
49
|
-
part.functionResponse.id = void 0;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
46
|
function getLongRunningFunctionCalls(functionCalls, toolsDict) {
|
|
55
47
|
const longRunningToolIds = /* @__PURE__ */ new Set();
|
|
56
48
|
for (const functionCall of functionCalls) {
|
|
@@ -393,9 +385,39 @@ function mergeParallelFunctionResponseEvents(functionResponseEvents) {
|
|
|
393
385
|
timestamp: baseEvent.timestamp
|
|
394
386
|
});
|
|
395
387
|
}
|
|
388
|
+
function findEventByFunctionCallId(events, functionCallId, endIndex = events.length) {
|
|
389
|
+
for (let i = endIndex - 1; i >= 0; i--) {
|
|
390
|
+
const event = events[i];
|
|
391
|
+
const functionCalls = getFunctionCalls(event);
|
|
392
|
+
for (const functionCall of functionCalls) {
|
|
393
|
+
if (functionCall.id === functionCallId) {
|
|
394
|
+
return event;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
return void 0;
|
|
399
|
+
}
|
|
400
|
+
function findMatchingFunctionCall(events) {
|
|
401
|
+
if (!events.length) {
|
|
402
|
+
return void 0;
|
|
403
|
+
}
|
|
404
|
+
const lastEvent = events[events.length - 1];
|
|
405
|
+
const functionResponses = getFunctionResponses(lastEvent);
|
|
406
|
+
if (!functionResponses.length || !functionResponses[0].id) {
|
|
407
|
+
return void 0;
|
|
408
|
+
}
|
|
409
|
+
return findEventByFunctionCallId(
|
|
410
|
+
events,
|
|
411
|
+
functionResponses[0].id,
|
|
412
|
+
events.length - 1
|
|
413
|
+
);
|
|
414
|
+
}
|
|
396
415
|
export {
|
|
416
|
+
AF_FUNCTION_CALL_ID_PREFIX,
|
|
397
417
|
REQUEST_CONFIRMATION_FUNCTION_CALL_NAME,
|
|
398
418
|
REQUEST_EUC_FUNCTION_CALL_NAME,
|
|
419
|
+
findEventByFunctionCallId,
|
|
420
|
+
findMatchingFunctionCall,
|
|
399
421
|
functionsExportedForTestingOnly,
|
|
400
422
|
generateAuthEvent,
|
|
401
423
|
generateClientFunctionCallId,
|
|
@@ -404,6 +426,5 @@ export {
|
|
|
404
426
|
handleFunctionCallList,
|
|
405
427
|
handleFunctionCallsAsync,
|
|
406
428
|
mergeParallelFunctionResponseEvents,
|
|
407
|
-
populateClientFunctionCallId
|
|
408
|
-
removeClientFunctionCallId
|
|
429
|
+
populateClientFunctionCallId
|
|
409
430
|
};
|