@google/adk 2.2.0 → 2.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.
- package/dist/cjs/a2a/a2a_remote_agent.js +4 -1
- package/dist/cjs/a2a/agent_card.js +102 -26
- package/dist/cjs/a2a/agent_to_a2a.js +1 -1
- package/dist/cjs/a2a/event_converter_utils.js +5 -1
- package/dist/cjs/a2a/metadata_converter_utils.js +2 -1
- package/dist/cjs/agents/functions.js +199 -25
- package/dist/cjs/agents/instructions.js +4 -1
- package/dist/cjs/agents/invocation_context.js +26 -4
- package/dist/cjs/agents/langgraph_agent.js +152 -0
- package/dist/cjs/agents/llm_agent.js +175 -101
- package/dist/cjs/agents/processors/code_execution_request_processor.js +10 -6
- package/dist/cjs/agents/remote_agent.js +187 -0
- package/dist/cjs/artifacts/in_memory_artifact_service.js +14 -0
- package/dist/cjs/auth/auth_handler.js +37 -5
- package/dist/cjs/auth/auth_schemes.js +9 -0
- package/dist/cjs/cli/cli_eval.js +532 -0
- package/dist/cjs/cli/utils/envs.js +116 -0
- package/dist/cjs/cli/utils/evals.js +137 -0
- package/dist/cjs/cli/utils/logs.js +150 -0
- package/dist/cjs/code_executors/agent_engine_sandbox_code_executor.js +7 -2
- package/dist/cjs/code_executors/code_execution_utils.js +48 -16
- package/dist/cjs/code_executors/code_executor_context.js +6 -2
- package/dist/cjs/common.js +90 -0
- package/dist/cjs/context/summarizers/llm_summarizer.js +12 -10
- package/dist/cjs/context/token_based_context_compactor.js +2 -1
- package/dist/cjs/events/abort_events.js +135 -0
- package/dist/cjs/events/event.js +4 -2
- package/dist/cjs/events/internal_metadata.js +131 -0
- package/dist/cjs/examples/example_util.js +23 -2
- package/dist/cjs/flows/llm_flows/audio_transcriber.js +170 -0
- package/dist/cjs/index.js +97 -1
- package/dist/cjs/integrations/agent_registry/helpers.js +1 -1
- package/dist/cjs/models/gemini_llm_connection.js +16 -8
- package/dist/cjs/models/google_llm.js +13 -16
- package/dist/cjs/models/llm_response.js +9 -1
- package/dist/cjs/models/registry.js +1 -1
- package/dist/cjs/models/routed_llm.js +9 -8
- package/dist/cjs/planners/plan_re_act_planner.js +1 -1
- package/dist/cjs/plugins/debug_logging_plugin.js +653 -0
- package/dist/cjs/plugins/plugin_manager.js +1 -1
- package/dist/cjs/plugins/tool_call_integrity_plugin.js +364 -0
- package/dist/cjs/runner/in_memory_runner.js +6 -11
- package/dist/cjs/runner/runner.js +121 -35
- package/dist/cjs/sessions/db/operations.js +1 -1
- package/dist/cjs/sessions/in_memory_session_service.js +3 -1
- package/dist/cjs/sessions/state.js +8 -4
- package/dist/cjs/sessions/vertex_ai_session_service.js +34 -15
- package/dist/cjs/telemetry/tracing.js +97 -66
- package/dist/cjs/tools/agent_tool.js +44 -0
- package/dist/cjs/tools/apihub_tool/apihub_toolset.js +142 -0
- package/dist/cjs/tools/apihub_tool/clients/apihub_client.js +272 -0
- package/dist/cjs/tools/apihub_tool/clients/secret_client.js +148 -0
- package/dist/cjs/tools/apihub_tool/clients/service_account.js +48 -0
- package/dist/cjs/tools/application_integration_tool/application_integration_toolset.js +185 -0
- package/dist/cjs/tools/application_integration_tool/clients/cloud_request.js +133 -0
- package/dist/cjs/tools/application_integration_tool/clients/connections_client.js +603 -0
- package/dist/cjs/tools/application_integration_tool/clients/integration_client.js +219 -0
- package/dist/cjs/tools/crewai_tool.js +132 -0
- package/dist/cjs/tools/example_tool.js +10 -0
- package/dist/cjs/tools/function_tool.js +319 -0
- package/dist/cjs/tools/google_api_tool/google_api_tool.js +97 -0
- package/dist/cjs/tools/google_api_tool/google_api_tool_set.js +226 -0
- package/dist/cjs/tools/google_api_tool/google_api_tool_sets.js +58 -0
- package/dist/cjs/tools/google_api_tool/googleapi_to_openapi_converter.js +440 -0
- package/dist/cjs/tools/google_api_tool/index.js +64 -0
- package/dist/cjs/tools/langchain_tool.js +172 -0
- package/dist/cjs/tools/mcp/index.js +12 -0
- package/dist/cjs/tools/mcp/mcp_session_manager.js +25 -0
- package/dist/cjs/tools/openapi_tool/auth/auth_helpers.js +1 -2
- package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.js +46 -2
- package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +2 -1
- package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.js +94 -10
- package/dist/cjs/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js +14 -2
- package/dist/cjs/tools/retrieval/base_retrieval_tool.js +18 -3
- package/dist/cjs/tools/toolbox_tool.js +108 -0
- package/dist/cjs/utils/env_aware_utils.js +6 -8
- package/dist/cjs/utils/error_utils.js +11 -11
- package/dist/cjs/utils/file_extension_utils.js +11 -0
- package/dist/cjs/utils/file_utils.js +2 -24
- package/dist/cjs/utils/gemini_schema_util.js +4 -1
- package/dist/cjs/utils/json_utils.js +49 -0
- package/dist/cjs/utils/live_connection_utils.js +4 -5
- package/dist/cjs/utils/logger_node.js +7 -1
- package/dist/cjs/utils/object_notation_utils.js +6 -3
- package/dist/cjs/utils/streaming_utils.js +12 -12
- package/dist/cjs/version.js +1 -1
- package/dist/esm/a2a/a2a_remote_agent.js +4 -1
- package/dist/esm/a2a/agent_card.js +103 -27
- package/dist/esm/a2a/agent_to_a2a.js +5 -2
- package/dist/esm/a2a/event_converter_utils.js +5 -1
- package/dist/esm/a2a/metadata_converter_utils.js +2 -1
- package/dist/esm/agents/functions.js +198 -25
- package/dist/esm/agents/instructions.js +4 -1
- package/dist/esm/agents/invocation_context.js +24 -4
- package/dist/esm/agents/langgraph_agent.js +123 -0
- package/dist/esm/agents/llm_agent.js +185 -104
- package/dist/esm/agents/processors/code_execution_request_processor.js +13 -8
- package/dist/esm/agents/remote_agent.js +164 -0
- package/dist/esm/artifacts/in_memory_artifact_service.js +14 -0
- package/dist/esm/auth/auth_handler.js +37 -5
- package/dist/esm/auth/auth_schemes.js +8 -0
- package/dist/esm/cli/cli_eval.js +510 -0
- package/dist/esm/cli/utils/envs.js +78 -0
- package/dist/esm/cli/utils/evals.js +109 -0
- package/dist/esm/cli/utils/logs.js +111 -0
- package/dist/esm/code_executors/agent_engine_sandbox_code_executor.js +7 -2
- package/dist/esm/code_executors/code_execution_utils.js +46 -16
- package/dist/esm/code_executors/code_executor_context.js +5 -2
- package/dist/esm/common.js +87 -3
- package/dist/esm/context/summarizers/llm_summarizer.js +12 -10
- package/dist/esm/context/token_based_context_compactor.js +2 -1
- package/dist/esm/events/abort_events.js +110 -0
- package/dist/esm/events/event.js +4 -2
- package/dist/esm/events/internal_metadata.js +97 -0
- package/dist/esm/examples/example_util.js +21 -1
- package/dist/esm/flows/llm_flows/audio_transcriber.js +142 -0
- package/dist/esm/index.js +99 -1
- package/dist/esm/integrations/agent_registry/helpers.js +1 -1
- package/dist/esm/models/gemini_llm_connection.js +16 -8
- package/dist/esm/models/google_llm.js +14 -17
- package/dist/esm/models/llm_response.js +9 -1
- package/dist/esm/models/registry.js +1 -1
- package/dist/esm/models/routed_llm.js +9 -8
- package/dist/esm/planners/plan_re_act_planner.js +1 -1
- package/dist/esm/plugins/debug_logging_plugin.js +615 -0
- package/dist/esm/plugins/plugin_manager.js +1 -1
- package/dist/esm/plugins/tool_call_integrity_plugin.js +339 -0
- package/dist/esm/runner/in_memory_runner.js +6 -11
- package/dist/esm/runner/runner.js +124 -35
- package/dist/esm/sessions/db/operations.js +1 -1
- package/dist/esm/sessions/in_memory_session_service.js +3 -1
- package/dist/esm/sessions/state.js +8 -4
- package/dist/esm/sessions/vertex_ai_session_service.js +34 -15
- package/dist/esm/telemetry/tracing.js +97 -66
- package/dist/esm/tools/agent_tool.js +44 -0
- package/dist/esm/tools/apihub_tool/apihub_toolset.js +106 -0
- package/dist/esm/tools/apihub_tool/clients/apihub_client.js +244 -0
- package/dist/esm/tools/apihub_tool/clients/secret_client.js +132 -0
- package/dist/esm/tools/apihub_tool/clients/service_account.js +21 -0
- package/dist/esm/tools/application_integration_tool/application_integration_toolset.js +163 -0
- package/dist/esm/tools/application_integration_tool/clients/cloud_request.js +103 -0
- package/dist/esm/tools/application_integration_tool/clients/connections_client.js +561 -0
- package/dist/esm/tools/application_integration_tool/clients/integration_client.js +215 -0
- package/dist/esm/tools/crewai_tool.js +107 -0
- package/dist/esm/tools/example_tool.js +13 -1
- package/dist/esm/tools/function_tool.js +316 -0
- package/dist/esm/tools/google_api_tool/google_api_tool.js +70 -0
- package/dist/esm/tools/google_api_tool/google_api_tool_set.js +188 -0
- package/dist/esm/tools/google_api_tool/google_api_tool_sets.js +24 -0
- package/dist/esm/tools/google_api_tool/googleapi_to_openapi_converter.js +393 -0
- package/dist/esm/tools/google_api_tool/index.js +33 -0
- package/dist/esm/tools/langchain_tool.js +148 -0
- package/dist/esm/tools/mcp/index.js +6 -0
- package/dist/esm/tools/mcp/mcp_session_manager.js +25 -0
- package/dist/esm/tools/openapi_tool/auth/auth_helpers.js +1 -2
- package/dist/esm/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.js +50 -3
- package/dist/esm/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +2 -1
- package/dist/esm/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.js +94 -10
- package/dist/esm/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js +15 -2
- package/dist/esm/tools/retrieval/base_retrieval_tool.js +16 -2
- package/dist/esm/tools/toolbox_tool.js +80 -0
- package/dist/esm/utils/env_aware_utils.js +6 -8
- package/dist/esm/utils/error_utils.js +9 -10
- package/dist/esm/utils/file_extension_utils.js +11 -0
- package/dist/esm/utils/file_utils.js +2 -23
- package/dist/esm/utils/gemini_schema_util.js +4 -1
- package/dist/esm/utils/json_utils.js +21 -0
- package/dist/esm/utils/live_connection_utils.js +4 -5
- package/dist/esm/utils/logger_node.js +7 -1
- package/dist/esm/utils/object_notation_utils.js +4 -2
- package/dist/esm/utils/streaming_utils.js +11 -11
- package/dist/esm/version.js +1 -1
- package/dist/types/a2a/a2a_remote_agent.d.ts +9 -0
- package/dist/types/a2a/agent_card.d.ts +44 -1
- package/dist/types/a2a/agent_to_a2a.d.ts +9 -0
- package/dist/types/a2a/index.d.ts +1 -0
- package/dist/types/agents/functions.d.ts +33 -1
- package/dist/types/agents/invocation_context.d.ts +20 -1
- package/dist/types/agents/langgraph_agent.d.ts +153 -0
- package/dist/types/agents/remote_agent.d.ts +68 -0
- package/dist/types/auth/auth_handler.d.ts +28 -1
- package/dist/types/auth/auth_schemes.d.ts +13 -0
- package/dist/types/cli/cli_eval.d.ts +173 -0
- package/dist/types/cli/utils/envs.d.ts +23 -0
- package/dist/types/cli/utils/evals.d.ts +47 -0
- package/dist/types/cli/utils/logs.d.ts +38 -0
- package/dist/types/code_executors/code_execution_utils.d.ts +39 -0
- package/dist/types/code_executors/code_executor_context.d.ts +1 -0
- package/dist/types/common.d.ts +30 -4
- package/dist/types/events/abort_events.d.ts +43 -0
- package/dist/types/events/event.d.ts +4 -0
- package/dist/types/events/internal_metadata.d.ts +78 -0
- package/dist/types/examples/example_util.d.ts +17 -0
- package/dist/types/flows/llm_flows/audio_transcriber.d.ts +85 -0
- package/dist/types/index.d.ts +16 -1
- package/dist/types/models/gemini_llm_connection.d.ts +6 -7
- package/dist/types/models/routed_llm.d.ts +1 -1
- package/dist/types/plugins/debug_logging_plugin.d.ts +157 -0
- package/dist/types/plugins/tool_call_integrity_plugin.d.ts +116 -0
- package/dist/types/runner/in_memory_runner.d.ts +2 -1
- package/dist/types/runner/runner.d.ts +34 -0
- package/dist/types/sessions/state.d.ts +5 -1
- package/dist/types/sessions/vertex_ai_session_service.d.ts +8 -0
- package/dist/types/skills/skill.d.ts +1 -1
- package/dist/types/telemetry/tracing.d.ts +4 -2
- package/dist/types/tools/apihub_tool/apihub_toolset.d.ts +122 -0
- package/dist/types/tools/apihub_tool/clients/apihub_client.d.ts +142 -0
- package/dist/types/tools/apihub_tool/clients/secret_client.d.ts +55 -0
- package/dist/types/tools/apihub_tool/clients/service_account.d.ts +11 -0
- package/dist/types/tools/application_integration_tool/application_integration_toolset.d.ts +86 -0
- package/dist/types/tools/application_integration_tool/clients/cloud_request.d.ts +53 -0
- package/dist/types/tools/application_integration_tool/clients/connections_client.d.ts +215 -0
- package/dist/types/tools/application_integration_tool/clients/integration_client.d.ts +72 -0
- package/dist/types/tools/crewai_tool.d.ts +85 -0
- package/dist/types/tools/example_tool.d.ts +10 -0
- package/dist/types/tools/function_tool.d.ts +32 -0
- package/dist/types/tools/google_api_tool/google_api_tool.d.ts +30 -0
- package/dist/types/tools/google_api_tool/google_api_tool_set.d.ts +78 -0
- package/dist/types/tools/google_api_tool/google_api_tool_sets.d.ts +33 -0
- package/dist/types/tools/google_api_tool/googleapi_to_openapi_converter.d.ts +164 -0
- package/dist/types/tools/google_api_tool/index.d.ts +11 -0
- package/dist/types/tools/langchain_tool.d.ts +103 -0
- package/dist/types/tools/mcp/index.d.ts +3 -0
- package/dist/types/tools/mcp/mcp_session_manager.d.ts +34 -1
- package/dist/types/tools/mcp/mcp_toolset.d.ts +15 -0
- package/dist/types/tools/openapi_tool/auth/auth_helpers.d.ts +19 -0
- package/dist/types/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.d.ts +18 -1
- package/dist/types/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.d.ts +2 -1
- package/dist/types/tools/retrieval/base_retrieval_tool.d.ts +15 -0
- package/dist/types/tools/toolbox_tool.d.ts +73 -0
- package/dist/types/utils/env_aware_utils.d.ts +18 -2
- package/dist/types/utils/error_utils.d.ts +7 -0
- package/dist/types/utils/file_utils.d.ts +6 -1
- package/dist/types/utils/gemini_schema_util.d.ts +1 -2
- package/dist/types/utils/json_utils.d.ts +11 -0
- package/dist/types/utils/object_notation_utils.d.ts +7 -0
- package/dist/types/utils/streaming_utils.d.ts +11 -4
- package/dist/types/version.d.ts +1 -1
- package/dist/web/index_web.js +105 -106
- package/dist/web/index_web.js.map +4 -4
- package/package.json +8 -3
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
"use strict";
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
10
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
13
|
+
var __export = (target, all) => {
|
|
14
|
+
for (var name in all)
|
|
15
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
16
|
+
};
|
|
17
|
+
var __copyProps = (to, from, except, desc) => {
|
|
18
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
19
|
+
for (let key of __getOwnPropNames(from))
|
|
20
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
21
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
22
|
+
}
|
|
23
|
+
return to;
|
|
24
|
+
};
|
|
25
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
26
|
+
var internal_metadata_exports = {};
|
|
27
|
+
__export(internal_metadata_exports, {
|
|
28
|
+
INTERNAL_METADATA_PREFIX: () => INTERNAL_METADATA_PREFIX,
|
|
29
|
+
RESTORED_EVENT_KEY: () => RESTORED_EVENT_KEY,
|
|
30
|
+
internalMetadata: () => internalMetadata,
|
|
31
|
+
markRestored: () => markRestored,
|
|
32
|
+
publicEvent: () => publicEvent,
|
|
33
|
+
publicMetadata: () => publicMetadata,
|
|
34
|
+
publicSession: () => publicSession,
|
|
35
|
+
withoutInternalMetadata: () => withoutInternalMetadata
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(internal_metadata_exports);
|
|
38
|
+
var import_logger = require("../utils/logger.js");
|
|
39
|
+
/**
|
|
40
|
+
* @license
|
|
41
|
+
* Copyright 2026 Google LLC
|
|
42
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
43
|
+
*/
|
|
44
|
+
const INTERNAL_METADATA_PREFIX = "__adk_internal_";
|
|
45
|
+
const RESTORED_EVENT_KEY = `${INTERNAL_METADATA_PREFIX}restored_event`;
|
|
46
|
+
function isMetadataObject(value) {
|
|
47
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
48
|
+
}
|
|
49
|
+
__name(isMetadataObject, "isMetadataObject");
|
|
50
|
+
function isInternalKey(key) {
|
|
51
|
+
return key.startsWith(INTERNAL_METADATA_PREFIX);
|
|
52
|
+
}
|
|
53
|
+
__name(isInternalKey, "isInternalKey");
|
|
54
|
+
function dropInternalKeys(metadata) {
|
|
55
|
+
return Object.fromEntries(
|
|
56
|
+
Object.entries(metadata).filter(([key]) => !isInternalKey(key))
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
__name(dropInternalKeys, "dropInternalKeys");
|
|
60
|
+
function hasInternalKeys(metadata) {
|
|
61
|
+
return isMetadataObject(metadata) && Object.keys(metadata).some(isInternalKey);
|
|
62
|
+
}
|
|
63
|
+
__name(hasInternalKeys, "hasInternalKeys");
|
|
64
|
+
function withoutInternalMetadata(metadata) {
|
|
65
|
+
if (!isMetadataObject(metadata)) {
|
|
66
|
+
return metadata;
|
|
67
|
+
}
|
|
68
|
+
const kept = dropInternalKeys(metadata);
|
|
69
|
+
const dropped = Object.keys(metadata).filter(isInternalKey);
|
|
70
|
+
if (dropped.length > 0) {
|
|
71
|
+
import_logger.logger.debug(
|
|
72
|
+
`Dropping ADK-internal customMetadata keys: ${JSON.stringify(dropped.sort())}`
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
return kept;
|
|
76
|
+
}
|
|
77
|
+
__name(withoutInternalMetadata, "withoutInternalMetadata");
|
|
78
|
+
function publicMetadata(metadata) {
|
|
79
|
+
if (!isMetadataObject(metadata)) {
|
|
80
|
+
return metadata;
|
|
81
|
+
}
|
|
82
|
+
const kept = dropInternalKeys(metadata);
|
|
83
|
+
return Object.keys(kept).length > 0 ? kept : void 0;
|
|
84
|
+
}
|
|
85
|
+
__name(publicMetadata, "publicMetadata");
|
|
86
|
+
function internalMetadata(metadata) {
|
|
87
|
+
if (!isMetadataObject(metadata)) {
|
|
88
|
+
return {};
|
|
89
|
+
}
|
|
90
|
+
return Object.fromEntries(
|
|
91
|
+
Object.entries(metadata).filter(([key]) => isInternalKey(key))
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
__name(internalMetadata, "internalMetadata");
|
|
95
|
+
function markRestored(event) {
|
|
96
|
+
var _a;
|
|
97
|
+
event.customMetadata = {
|
|
98
|
+
...(_a = withoutInternalMetadata(event.customMetadata)) != null ? _a : {},
|
|
99
|
+
[RESTORED_EVENT_KEY]: true
|
|
100
|
+
};
|
|
101
|
+
return event;
|
|
102
|
+
}
|
|
103
|
+
__name(markRestored, "markRestored");
|
|
104
|
+
function publicEvent(event) {
|
|
105
|
+
if (!hasInternalKeys(event.customMetadata)) {
|
|
106
|
+
return event;
|
|
107
|
+
}
|
|
108
|
+
return { ...event, customMetadata: publicMetadata(event.customMetadata) };
|
|
109
|
+
}
|
|
110
|
+
__name(publicEvent, "publicEvent");
|
|
111
|
+
function publicSession(session) {
|
|
112
|
+
var _a;
|
|
113
|
+
const events = (_a = session.events) != null ? _a : [];
|
|
114
|
+
const publicEvents = events.map((event) => publicEvent(event));
|
|
115
|
+
if (publicEvents.every((event, i) => event === events[i])) {
|
|
116
|
+
return session;
|
|
117
|
+
}
|
|
118
|
+
return { ...session, events: publicEvents };
|
|
119
|
+
}
|
|
120
|
+
__name(publicSession, "publicSession");
|
|
121
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
122
|
+
0 && (module.exports = {
|
|
123
|
+
INTERNAL_METADATA_PREFIX,
|
|
124
|
+
RESTORED_EVENT_KEY,
|
|
125
|
+
internalMetadata,
|
|
126
|
+
markRestored,
|
|
127
|
+
publicEvent,
|
|
128
|
+
publicMetadata,
|
|
129
|
+
publicSession,
|
|
130
|
+
withoutInternalMetadata
|
|
131
|
+
});
|
|
@@ -28,9 +28,12 @@ __export(example_util_exports, {
|
|
|
28
28
|
_getLatestMessageFromUser: () => _getLatestMessageFromUser,
|
|
29
29
|
buildExampleSi: () => buildExampleSi,
|
|
30
30
|
convertExamplesToText: () => convertExamplesToText,
|
|
31
|
-
getLatestMessageFromUser: () => getLatestMessageFromUser
|
|
31
|
+
getLatestMessageFromUser: () => getLatestMessageFromUser,
|
|
32
|
+
validateExamples: () => validateExamples
|
|
32
33
|
});
|
|
33
34
|
module.exports = __toCommonJS(example_util_exports);
|
|
35
|
+
var import_zod = require("zod");
|
|
36
|
+
var import_input_validation_error = require("../errors/input_validation_error.js");
|
|
34
37
|
var import_event = require("../events/event.js");
|
|
35
38
|
var import_logger = require("../utils/logger.js");
|
|
36
39
|
var import_base_example_provider = require("./base_example_provider.js");
|
|
@@ -39,6 +42,23 @@ var import_base_example_provider = require("./base_example_provider.js");
|
|
|
39
42
|
* Copyright 2025 Google LLC
|
|
40
43
|
* SPDX-License-Identifier: Apache-2.0
|
|
41
44
|
*/
|
|
45
|
+
const contentSchema = import_zod.z.object({
|
|
46
|
+
role: import_zod.z.string().optional(),
|
|
47
|
+
parts: import_zod.z.array(import_zod.z.object({}).loose()).optional()
|
|
48
|
+
}).loose();
|
|
49
|
+
const examplesSchema = import_zod.z.array(
|
|
50
|
+
import_zod.z.object({ input: contentSchema, output: import_zod.z.array(contentSchema) })
|
|
51
|
+
);
|
|
52
|
+
function validateExamples(examples) {
|
|
53
|
+
const result = examplesSchema.safeParse(examples);
|
|
54
|
+
if (!result.success) {
|
|
55
|
+
throw new import_input_validation_error.InputValidationError(
|
|
56
|
+
`Invalid few-shot examples:
|
|
57
|
+
${import_zod.z.prettifyError(result.error)}`
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
__name(validateExamples, "validateExamples");
|
|
42
62
|
const EXAMPLES_INTRO = "<EXAMPLES>\nBegin few-shot\nThe following are examples of user queries and model responses using the available tools.\n\n";
|
|
43
63
|
const EXAMPLES_END = "End few-shot\n<EXAMPLES>";
|
|
44
64
|
const EXAMPLE_START = "EXAMPLE {}:\nBegin example\n";
|
|
@@ -130,5 +150,6 @@ __name(buildExampleSi, "buildExampleSi");
|
|
|
130
150
|
_getLatestMessageFromUser,
|
|
131
151
|
buildExampleSi,
|
|
132
152
|
convertExamplesToText,
|
|
133
|
-
getLatestMessageFromUser
|
|
153
|
+
getLatestMessageFromUser,
|
|
154
|
+
validateExamples
|
|
134
155
|
});
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
"use strict";
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
10
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
13
|
+
var __export = (target, all) => {
|
|
14
|
+
for (var name in all)
|
|
15
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
16
|
+
};
|
|
17
|
+
var __copyProps = (to, from, except, desc) => {
|
|
18
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
19
|
+
for (let key of __getOwnPropNames(from))
|
|
20
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
21
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
22
|
+
}
|
|
23
|
+
return to;
|
|
24
|
+
};
|
|
25
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
26
|
+
var audio_transcriber_exports = {};
|
|
27
|
+
__export(audio_transcriber_exports, {
|
|
28
|
+
AudioEncoding: () => AudioEncoding,
|
|
29
|
+
AudioTranscriber: () => AudioTranscriber
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(audio_transcriber_exports);
|
|
32
|
+
/**
|
|
33
|
+
* @license
|
|
34
|
+
* Copyright 2026 Google LLC
|
|
35
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
36
|
+
*/
|
|
37
|
+
var AudioEncoding = /* @__PURE__ */ ((AudioEncoding2) => {
|
|
38
|
+
AudioEncoding2[AudioEncoding2["ENCODING_UNSPECIFIED"] = 0] = "ENCODING_UNSPECIFIED";
|
|
39
|
+
AudioEncoding2[AudioEncoding2["LINEAR16"] = 1] = "LINEAR16";
|
|
40
|
+
return AudioEncoding2;
|
|
41
|
+
})(AudioEncoding || {});
|
|
42
|
+
function isSpeechClientLike(value) {
|
|
43
|
+
return typeof value === "object" && value !== null && typeof value.recognize === "function";
|
|
44
|
+
}
|
|
45
|
+
__name(isSpeechClientLike, "isSpeechClientLike");
|
|
46
|
+
function isContentEntry(data) {
|
|
47
|
+
return "parts" in data || !("data" in data) && !("mimeType" in data);
|
|
48
|
+
}
|
|
49
|
+
__name(isContentEntry, "isContentEntry");
|
|
50
|
+
function blobDataToBytes(data) {
|
|
51
|
+
if (typeof data !== "string") {
|
|
52
|
+
return data;
|
|
53
|
+
}
|
|
54
|
+
if (data.length > 0 && data.length % 4 === 0 && /^[A-Za-z0-9+/]+={0,2}$/.test(data)) {
|
|
55
|
+
const atobFn = globalThis.atob;
|
|
56
|
+
if (typeof Buffer === "undefined" && typeof atobFn === "function") {
|
|
57
|
+
const binary = atobFn(data);
|
|
58
|
+
return Uint8Array.from(binary, (char) => char.charCodeAt(0));
|
|
59
|
+
}
|
|
60
|
+
return new Uint8Array(Buffer.from(data, "base64"));
|
|
61
|
+
}
|
|
62
|
+
return new TextEncoder().encode(data);
|
|
63
|
+
}
|
|
64
|
+
__name(blobDataToBytes, "blobDataToBytes");
|
|
65
|
+
function concatBytes(first, second) {
|
|
66
|
+
const merged = new Uint8Array(first.length + second.length);
|
|
67
|
+
merged.set(first, 0);
|
|
68
|
+
merged.set(second, first.length);
|
|
69
|
+
return merged;
|
|
70
|
+
}
|
|
71
|
+
__name(concatBytes, "concatBytes");
|
|
72
|
+
const _AudioTranscriber = class _AudioTranscriber {
|
|
73
|
+
constructor(optionsOrClient) {
|
|
74
|
+
if (isSpeechClientLike(optionsOrClient)) {
|
|
75
|
+
this.client = optionsOrClient;
|
|
76
|
+
} else if (optionsOrClient == null ? void 0 : optionsOrClient.client) {
|
|
77
|
+
this.client = optionsOrClient.client;
|
|
78
|
+
} else {
|
|
79
|
+
this.client = {
|
|
80
|
+
recognize() {
|
|
81
|
+
throw new Error(
|
|
82
|
+
"SpeechClient is not configured on AudioTranscriber. Pass a SpeechClientLike implementation to new AudioTranscriber({client})."
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Bundles consecutive audio blobs from the same speaker in
|
|
90
|
+
* `invocationContext.transcriptionCache`, transcribes user audio bundles into
|
|
91
|
+
* text `Content` entries, preserves already-transcribed `Content`
|
|
92
|
+
* entries in order, clears `invocationContext.transcriptionCache`, and
|
|
93
|
+
* returns the resulting content list.
|
|
94
|
+
*
|
|
95
|
+
* @param invocationContext The invocation context holding `transcriptionCache`.
|
|
96
|
+
* @returns Ordered list of transcribed `Content` objects.
|
|
97
|
+
*/
|
|
98
|
+
async transcribeFile(invocationContext) {
|
|
99
|
+
var _a, _b, _c, _d;
|
|
100
|
+
const bundledAudio = [];
|
|
101
|
+
const transcriptionHistory = [];
|
|
102
|
+
let currentSpeaker = void 0;
|
|
103
|
+
let currentAudioData = new Uint8Array(0);
|
|
104
|
+
for (const transcriptionEntry of (_a = invocationContext.transcriptionCache) != null ? _a : []) {
|
|
105
|
+
const speaker = transcriptionEntry.role;
|
|
106
|
+
const audioData = transcriptionEntry.data;
|
|
107
|
+
if (isContentEntry(audioData)) {
|
|
108
|
+
if (currentSpeaker !== void 0) {
|
|
109
|
+
bundledAudio.push([currentSpeaker, currentAudioData]);
|
|
110
|
+
currentSpeaker = void 0;
|
|
111
|
+
currentAudioData = new Uint8Array(0);
|
|
112
|
+
}
|
|
113
|
+
bundledAudio.push([speaker, audioData]);
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
const rawData = audioData.data;
|
|
117
|
+
if (!rawData) {
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
const chunkBytes = blobDataToBytes(rawData);
|
|
121
|
+
if (chunkBytes.length === 0) {
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
if (speaker === currentSpeaker) {
|
|
125
|
+
currentAudioData = concatBytes(currentAudioData, chunkBytes);
|
|
126
|
+
} else {
|
|
127
|
+
if (currentSpeaker !== void 0) {
|
|
128
|
+
bundledAudio.push([currentSpeaker, currentAudioData]);
|
|
129
|
+
}
|
|
130
|
+
currentSpeaker = speaker;
|
|
131
|
+
currentAudioData = chunkBytes;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (currentSpeaker !== void 0) {
|
|
135
|
+
bundledAudio.push([currentSpeaker, currentAudioData]);
|
|
136
|
+
}
|
|
137
|
+
invocationContext.transcriptionCache = [];
|
|
138
|
+
for (const [speaker, data] of bundledAudio) {
|
|
139
|
+
if (ArrayBuffer.isView(data)) {
|
|
140
|
+
const audio = { content: data };
|
|
141
|
+
const config = {
|
|
142
|
+
encoding: 1 /* LINEAR16 */,
|
|
143
|
+
sampleRateHertz: 16e3,
|
|
144
|
+
languageCode: "en-US"
|
|
145
|
+
};
|
|
146
|
+
const rawResponse = await this.client.recognize({ config, audio });
|
|
147
|
+
const response = Array.isArray(rawResponse) ? rawResponse[0] : rawResponse;
|
|
148
|
+
for (const result of (_b = response.results) != null ? _b : []) {
|
|
149
|
+
const transcript = (_d = (_c = result.alternatives) == null ? void 0 : _c[0]) == null ? void 0 : _d.transcript;
|
|
150
|
+
if (transcript !== void 0 && transcript !== null) {
|
|
151
|
+
transcriptionHistory.push({
|
|
152
|
+
role: speaker ? speaker.toLowerCase() : "user",
|
|
153
|
+
parts: [{ text: transcript }]
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
} else {
|
|
158
|
+
transcriptionHistory.push(data);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return transcriptionHistory;
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
__name(_AudioTranscriber, "AudioTranscriber");
|
|
165
|
+
let AudioTranscriber = _AudioTranscriber;
|
|
166
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
167
|
+
0 && (module.exports = {
|
|
168
|
+
AudioEncoding,
|
|
169
|
+
AudioTranscriber
|
|
170
|
+
});
|
package/dist/cjs/index.js
CHANGED
|
@@ -25,59 +25,101 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
|
|
|
25
25
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
26
26
|
var index_exports = {};
|
|
27
27
|
__export(index_exports, {
|
|
28
|
+
APIHubClient: () => import_apihub_client.APIHubClient,
|
|
29
|
+
APIHubToolset: () => import_apihub_toolset.APIHubToolset,
|
|
28
30
|
AgentEngineSandboxCodeExecutor: () => import_agent_engine_sandbox_code_executor.AgentEngineSandboxCodeExecutor,
|
|
31
|
+
ApplicationIntegrationToolset: () => import_application_integration_toolset.ApplicationIntegrationToolset,
|
|
29
32
|
AuthCredentialMissingError: () => import_base_auth_credential_exchanger.AuthCredentialMissingError,
|
|
30
33
|
AutoAuthCredentialExchanger: () => import_auto_auth_credential_exchanger.AutoAuthCredentialExchanger,
|
|
31
34
|
BaseAuthCredentialExchanger: () => import_base_auth_credential_exchanger.BaseAuthCredentialExchanger,
|
|
35
|
+
CONNECTOR_BASE_SPEC: () => import_connections_client.CONNECTOR_BASE_SPEC,
|
|
32
36
|
CodeExecutionLanguage: () => import_code_execution_utils.CodeExecutionLanguage,
|
|
37
|
+
ConnectionsClient: () => import_connections_client.ConnectionsClient,
|
|
33
38
|
ContainerCodeExecutor: () => import_container_code_executor.ContainerCodeExecutor,
|
|
39
|
+
DEFAULT_CRITERIA: () => import_cli_eval.DEFAULT_CRITERIA,
|
|
34
40
|
DatabaseSessionService: () => import_database_session_service.DatabaseSessionService,
|
|
41
|
+
DebugLoggingPlugin: () => import_debug_logging_plugin.DebugLoggingPlugin,
|
|
42
|
+
EVAL_SESSION_ID_PREFIX: () => import_cli_eval.EVAL_SESSION_ID_PREFIX,
|
|
43
|
+
EvalStatus: () => import_cli_eval.EvalStatus,
|
|
35
44
|
FileArtifactService: () => import_file_artifact_service.FileArtifactService,
|
|
36
45
|
FilesRetrieval: () => import_files_retrieval.FilesRetrieval,
|
|
37
46
|
GCPSkillRegistry: () => import_gcp_skill_registry.GCPSkillRegistry,
|
|
38
47
|
GcsArtifactService: () => import_gcs_artifact_service.GcsArtifactService,
|
|
39
48
|
INTERNAL_AUTH_PREFIX: () => import_auth_helpers.INTERNAL_AUTH_PREFIX,
|
|
49
|
+
IntegrationClient: () => import_integration_client.IntegrationClient,
|
|
40
50
|
InvocationContext: () => import_invocation_context.InvocationContext,
|
|
41
51
|
LOAD_WEB_PAGE: () => import_load_web_page.LOAD_WEB_PAGE,
|
|
52
|
+
LOGGING_FORMAT: () => import_logs.LOGGING_FORMAT,
|
|
42
53
|
LoadSkillResourceTool: () => import_load_skill_resource_tool.LoadSkillResourceTool,
|
|
43
54
|
LocalEnvironment: () => import_local_environment.LocalEnvironment,
|
|
55
|
+
MISSING_EVAL_DEPENDENCIES_MESSAGE: () => import_cli_eval.MISSING_EVAL_DEPENDENCIES_MESSAGE,
|
|
44
56
|
OAuth2BearerExchanger: () => import_oauth2_exchanger.OAuth2BearerExchanger,
|
|
45
57
|
OpenAPIToolset: () => import_openapi_toolset.OpenAPIToolset,
|
|
46
58
|
OpenApiSpecParser: () => import_openapi_spec_parser.OpenApiSpecParser,
|
|
47
59
|
OperationParser: () => import_operation_parser.OperationParser,
|
|
60
|
+
RESPONSE_EVALUATION_SCORE_KEY: () => import_cli_eval.RESPONSE_EVALUATION_SCORE_KEY,
|
|
61
|
+
RESPONSE_MATCH_SCORE_KEY: () => import_cli_eval.RESPONSE_MATCH_SCORE_KEY,
|
|
48
62
|
RestApiTool: () => import_rest_api_tool.RestApiTool,
|
|
49
63
|
RunSkillInlineScriptErrorCode: () => import_run_skill_inline_script_tool.RunSkillInlineScriptErrorCode,
|
|
50
64
|
RunSkillInlineScriptTool: () => import_run_skill_inline_script_tool.RunSkillInlineScriptTool,
|
|
51
65
|
RunSkillScriptTool: () => import_run_skill_script_tool.RunSkillScriptTool,
|
|
66
|
+
SecretManagerClient: () => import_secret_client.SecretManagerClient,
|
|
52
67
|
ServiceAccountCredentialExchanger: () => import_service_account_exchanger.ServiceAccountCredentialExchanger,
|
|
53
68
|
SkillToolset: () => import_skill_toolset.SkillToolset,
|
|
69
|
+
TOOL_TRAJECTORY_SCORE_KEY: () => import_cli_eval.TOOL_TRAJECTORY_SCORE_KEY,
|
|
54
70
|
ToolAuthHandler: () => import_tool_auth_handler.ToolAuthHandler,
|
|
55
71
|
ToolContextCredentialStore: () => import_tool_auth_handler.ToolContextCredentialStore,
|
|
56
72
|
UnsafeLocalCodeExecutor: () => import_unsafe_local_code_executor.UnsafeLocalCodeExecutor,
|
|
57
73
|
VertexAiMemoryBankService: () => import_vertex_ai_memory_bank_service.VertexAiMemoryBankService,
|
|
58
74
|
VertexAiRagMemoryService: () => import_vertex_ai_rag_memory_service.VertexAiRagMemoryService,
|
|
59
75
|
VertexAiSessionService: () => import_vertex_ai_session_service.VertexAiSessionService,
|
|
76
|
+
actionRequest: () => import_connections_client.actionRequest,
|
|
77
|
+
actionResponse: () => import_connections_client.actionResponse,
|
|
78
|
+
connectorPayload: () => import_connections_client.connectorPayload,
|
|
60
79
|
createApiParameter: () => import_common.createApiParameter,
|
|
80
|
+
createOperation: () => import_connections_client.createOperation,
|
|
81
|
+
createOperationRequest: () => import_connections_client.createOperationRequest,
|
|
61
82
|
createRestApiTool: () => import_rest_api_tool.createRestApiTool,
|
|
62
83
|
createRestApiToolFromJson: () => import_rest_api_tool.createRestApiToolFromJson,
|
|
63
84
|
credentialToParam: () => import_auth_helpers.credentialToParam,
|
|
85
|
+
deleteOperation: () => import_connections_client.deleteOperation,
|
|
86
|
+
deleteOperationRequest: () => import_connections_client.deleteOperationRequest,
|
|
64
87
|
dictToAuthScheme: () => import_auth_helpers.dictToAuthScheme,
|
|
65
88
|
exchangeCredential: () => import_oauth2_exchanger.exchangeCredential,
|
|
89
|
+
executeCustomQueryRequest: () => import_connections_client.executeCustomQueryRequest,
|
|
90
|
+
generateAuthToken: () => import_oauth2_exchanger.generateAuthToken,
|
|
66
91
|
generateParamDoc: () => import_common.generateParamDoc,
|
|
67
92
|
generateReturnDoc: () => import_common.generateReturnDoc,
|
|
93
|
+
getActionOperation: () => import_connections_client.getActionOperation,
|
|
68
94
|
getArtifactServiceFromUri: () => import_registry.getArtifactServiceFromUri,
|
|
95
|
+
getEvaluationCriteriaOrDefault: () => import_cli_eval.getEvaluationCriteriaOrDefault,
|
|
96
|
+
getOperation: () => import_connections_client.getOperation,
|
|
97
|
+
getOperationRequest: () => import_connections_client.getOperationRequest,
|
|
98
|
+
getRootAgent: () => import_cli_eval.getRootAgent,
|
|
69
99
|
getSessionServiceFromUri: () => import_registry2.getSessionServiceFromUri,
|
|
70
100
|
getTypeHint: () => import_common.getTypeHint,
|
|
101
|
+
isDebugLoggingPlugin: () => import_debug_logging_plugin.isDebugLoggingPlugin,
|
|
102
|
+
listOperation: () => import_connections_client.listOperation,
|
|
103
|
+
listOperationRequest: () => import_connections_client.listOperationRequest,
|
|
71
104
|
loadAllSkillsInDir: () => import_loader.loadAllSkillsInDir,
|
|
105
|
+
loadDotenvForAgent: () => import_envs.loadDotenvForAgent,
|
|
72
106
|
loadSkillFromDir: () => import_loader.loadSkillFromDir,
|
|
73
107
|
loadSkillFromZipBuffer: () => import_loader.loadSkillFromZipBuffer,
|
|
74
108
|
loadWebPage: () => import_load_web_page.loadWebPage,
|
|
109
|
+
logToStderr: () => import_logs.logToStderr,
|
|
110
|
+
logToTmpFolder: () => import_logs.logToTmpFolder,
|
|
75
111
|
openidDictToSchemeCredential: () => import_auth_helpers.openidDictToSchemeCredential,
|
|
76
112
|
openidUrlToSchemeCredential: () => import_auth_helpers.openidUrlToSchemeCredential,
|
|
113
|
+
parseAndGetEvalsToRun: () => import_cli_eval.parseAndGetEvalsToRun,
|
|
114
|
+
runEvals: () => import_cli_eval.runEvals,
|
|
77
115
|
serviceAccountDictToSchemeCredential: () => import_auth_helpers.serviceAccountDictToSchemeCredential,
|
|
78
116
|
serviceAccountSchemeCredential: () => import_auth_helpers.serviceAccountSchemeCredential,
|
|
79
117
|
tokenToSchemeCredential: () => import_auth_helpers.tokenToSchemeCredential,
|
|
80
|
-
|
|
118
|
+
tryGetResetFunc: () => import_cli_eval.tryGetResetFunc,
|
|
119
|
+
updateOperation: () => import_connections_client.updateOperation,
|
|
120
|
+
updateOperationRequest: () => import_connections_client.updateOperationRequest,
|
|
121
|
+
validateSkillDir: () => import_loader.validateSkillDir,
|
|
122
|
+
walkToRootUntilFound: () => import_envs.walkToRootUntilFound
|
|
81
123
|
});
|
|
82
124
|
module.exports = __toCommonJS(index_exports);
|
|
83
125
|
var import_logger_node = require("./utils/logger_node.js");
|
|
@@ -94,11 +136,18 @@ __reExport(index_exports, require("./common.js"), module.exports);
|
|
|
94
136
|
var import_local_environment = require("./environment/local_environment.js");
|
|
95
137
|
var import_vertex_ai_memory_bank_service = require("./memory/vertex_ai_memory_bank_service.js");
|
|
96
138
|
var import_vertex_ai_rag_memory_service = require("./memory/vertex_ai_rag_memory_service.js");
|
|
139
|
+
var import_debug_logging_plugin = require("./plugins/debug_logging_plugin.js");
|
|
97
140
|
var import_database_session_service = require("./sessions/database_session_service.js");
|
|
98
141
|
var import_registry2 = require("./sessions/registry.js");
|
|
99
142
|
var import_vertex_ai_session_service = require("./sessions/vertex_ai_session_service.js");
|
|
100
143
|
var import_gcp_skill_registry = require("./skills/gcp_skill_registry.js");
|
|
101
144
|
var import_loader = require("./skills/loader.js");
|
|
145
|
+
var import_apihub_toolset = require("./tools/apihub_tool/apihub_toolset.js");
|
|
146
|
+
var import_apihub_client = require("./tools/apihub_tool/clients/apihub_client.js");
|
|
147
|
+
var import_secret_client = require("./tools/apihub_tool/clients/secret_client.js");
|
|
148
|
+
var import_application_integration_toolset = require("./tools/application_integration_tool/application_integration_toolset.js");
|
|
149
|
+
var import_connections_client = require("./tools/application_integration_tool/clients/connections_client.js");
|
|
150
|
+
var import_integration_client = require("./tools/application_integration_tool/clients/integration_client.js");
|
|
102
151
|
var import_load_web_page = require("./tools/load_web_page.js");
|
|
103
152
|
var import_auth_helpers = require("./tools/openapi_tool/auth/auth_helpers.js");
|
|
104
153
|
var import_auto_auth_credential_exchanger = require("./tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.js");
|
|
@@ -119,6 +168,10 @@ var import_skill_toolset = require("./tools/skill/skill_toolset.js");
|
|
|
119
168
|
__reExport(index_exports, require("./integrations/agent_registry/agent_registry.js"), module.exports);
|
|
120
169
|
__reExport(index_exports, require("./telemetry/google_cloud.js"), module.exports);
|
|
121
170
|
__reExport(index_exports, require("./telemetry/setup.js"), module.exports);
|
|
171
|
+
__reExport(index_exports, require("./tools/google_api_tool/index.js"), module.exports);
|
|
172
|
+
var import_cli_eval = require("./cli/cli_eval.js");
|
|
173
|
+
var import_envs = require("./cli/utils/envs.js");
|
|
174
|
+
var import_logs = require("./cli/utils/logs.js");
|
|
122
175
|
__reExport(index_exports, require("./tools/mcp/index.js"), module.exports);
|
|
123
176
|
/**
|
|
124
177
|
* @license
|
|
@@ -128,63 +181,106 @@ __reExport(index_exports, require("./tools/mcp/index.js"), module.exports);
|
|
|
128
181
|
(0, import_logger_node.installNodeLogger)();
|
|
129
182
|
// Annotate the CommonJS export names for ESM import in node:
|
|
130
183
|
0 && (module.exports = {
|
|
184
|
+
APIHubClient,
|
|
185
|
+
APIHubToolset,
|
|
131
186
|
AgentEngineSandboxCodeExecutor,
|
|
187
|
+
ApplicationIntegrationToolset,
|
|
132
188
|
AuthCredentialMissingError,
|
|
133
189
|
AutoAuthCredentialExchanger,
|
|
134
190
|
BaseAuthCredentialExchanger,
|
|
191
|
+
CONNECTOR_BASE_SPEC,
|
|
135
192
|
CodeExecutionLanguage,
|
|
193
|
+
ConnectionsClient,
|
|
136
194
|
ContainerCodeExecutor,
|
|
195
|
+
DEFAULT_CRITERIA,
|
|
137
196
|
DatabaseSessionService,
|
|
197
|
+
DebugLoggingPlugin,
|
|
198
|
+
EVAL_SESSION_ID_PREFIX,
|
|
199
|
+
EvalStatus,
|
|
138
200
|
FileArtifactService,
|
|
139
201
|
FilesRetrieval,
|
|
140
202
|
GCPSkillRegistry,
|
|
141
203
|
GcsArtifactService,
|
|
142
204
|
INTERNAL_AUTH_PREFIX,
|
|
205
|
+
IntegrationClient,
|
|
143
206
|
InvocationContext,
|
|
144
207
|
LOAD_WEB_PAGE,
|
|
208
|
+
LOGGING_FORMAT,
|
|
145
209
|
LoadSkillResourceTool,
|
|
146
210
|
LocalEnvironment,
|
|
211
|
+
MISSING_EVAL_DEPENDENCIES_MESSAGE,
|
|
147
212
|
OAuth2BearerExchanger,
|
|
148
213
|
OpenAPIToolset,
|
|
149
214
|
OpenApiSpecParser,
|
|
150
215
|
OperationParser,
|
|
216
|
+
RESPONSE_EVALUATION_SCORE_KEY,
|
|
217
|
+
RESPONSE_MATCH_SCORE_KEY,
|
|
151
218
|
RestApiTool,
|
|
152
219
|
RunSkillInlineScriptErrorCode,
|
|
153
220
|
RunSkillInlineScriptTool,
|
|
154
221
|
RunSkillScriptTool,
|
|
222
|
+
SecretManagerClient,
|
|
155
223
|
ServiceAccountCredentialExchanger,
|
|
156
224
|
SkillToolset,
|
|
225
|
+
TOOL_TRAJECTORY_SCORE_KEY,
|
|
157
226
|
ToolAuthHandler,
|
|
158
227
|
ToolContextCredentialStore,
|
|
159
228
|
UnsafeLocalCodeExecutor,
|
|
160
229
|
VertexAiMemoryBankService,
|
|
161
230
|
VertexAiRagMemoryService,
|
|
162
231
|
VertexAiSessionService,
|
|
232
|
+
actionRequest,
|
|
233
|
+
actionResponse,
|
|
234
|
+
connectorPayload,
|
|
163
235
|
createApiParameter,
|
|
236
|
+
createOperation,
|
|
237
|
+
createOperationRequest,
|
|
164
238
|
createRestApiTool,
|
|
165
239
|
createRestApiToolFromJson,
|
|
166
240
|
credentialToParam,
|
|
241
|
+
deleteOperation,
|
|
242
|
+
deleteOperationRequest,
|
|
167
243
|
dictToAuthScheme,
|
|
168
244
|
exchangeCredential,
|
|
245
|
+
executeCustomQueryRequest,
|
|
246
|
+
generateAuthToken,
|
|
169
247
|
generateParamDoc,
|
|
170
248
|
generateReturnDoc,
|
|
249
|
+
getActionOperation,
|
|
171
250
|
getArtifactServiceFromUri,
|
|
251
|
+
getEvaluationCriteriaOrDefault,
|
|
252
|
+
getOperation,
|
|
253
|
+
getOperationRequest,
|
|
254
|
+
getRootAgent,
|
|
172
255
|
getSessionServiceFromUri,
|
|
173
256
|
getTypeHint,
|
|
257
|
+
isDebugLoggingPlugin,
|
|
258
|
+
listOperation,
|
|
259
|
+
listOperationRequest,
|
|
174
260
|
loadAllSkillsInDir,
|
|
261
|
+
loadDotenvForAgent,
|
|
175
262
|
loadSkillFromDir,
|
|
176
263
|
loadSkillFromZipBuffer,
|
|
177
264
|
loadWebPage,
|
|
265
|
+
logToStderr,
|
|
266
|
+
logToTmpFolder,
|
|
178
267
|
openidDictToSchemeCredential,
|
|
179
268
|
openidUrlToSchemeCredential,
|
|
269
|
+
parseAndGetEvalsToRun,
|
|
270
|
+
runEvals,
|
|
180
271
|
serviceAccountDictToSchemeCredential,
|
|
181
272
|
serviceAccountSchemeCredential,
|
|
182
273
|
tokenToSchemeCredential,
|
|
274
|
+
tryGetResetFunc,
|
|
275
|
+
updateOperation,
|
|
276
|
+
updateOperationRequest,
|
|
183
277
|
validateSkillDir,
|
|
278
|
+
walkToRootUntilFound,
|
|
184
279
|
...require("./a2a/index.js"),
|
|
185
280
|
...require("./common.js"),
|
|
186
281
|
...require("./integrations/agent_registry/agent_registry.js"),
|
|
187
282
|
...require("./telemetry/google_cloud.js"),
|
|
188
283
|
...require("./telemetry/setup.js"),
|
|
284
|
+
...require("./tools/google_api_tool/index.js"),
|
|
189
285
|
...require("./tools/mcp/index.js")
|
|
190
286
|
});
|
|
@@ -37,7 +37,7 @@ module.exports = __toCommonJS(helpers_exports);
|
|
|
37
37
|
function isGoogleApi(url) {
|
|
38
38
|
try {
|
|
39
39
|
const parsed = new URL(url);
|
|
40
|
-
return parsed.hostname === "googleapis.com" || parsed.hostname.endsWith(".googleapis.com");
|
|
40
|
+
return parsed.protocol === "https:" && (parsed.hostname === "googleapis.com" || parsed.hostname.endsWith(".googleapis.com"));
|
|
41
41
|
} catch {
|
|
42
42
|
return false;
|
|
43
43
|
}
|
|
@@ -140,26 +140,34 @@ const _GeminiLlmConnection = class _GeminiLlmConnection {
|
|
|
140
140
|
this.geminiSession.sendRealtimeInput({ activityEnd: {} });
|
|
141
141
|
}
|
|
142
142
|
/**
|
|
143
|
-
*
|
|
143
|
+
* Receives the model responses for one model turn.
|
|
144
144
|
*
|
|
145
|
-
* The
|
|
146
|
-
*
|
|
145
|
+
* The generator ends after the message that completes the turn has been
|
|
146
|
+
* processed, or when the server closes the connection. Call `receive()`
|
|
147
|
+
* again to read the next turn; it continues from the next server message.
|
|
147
148
|
*
|
|
148
|
-
* @
|
|
149
|
-
* @param isThought Whether the text is a thought.
|
|
150
|
-
* @param groundingMetadata The grounding metadata to include.
|
|
151
|
-
* @returns An LlmResponse containing the full text.
|
|
149
|
+
* @returns A generator of the LlmResponses of one model turn.
|
|
152
150
|
*/
|
|
153
151
|
async *receive() {
|
|
152
|
+
var _a, _b;
|
|
154
153
|
if (!this.messageQueue) {
|
|
155
154
|
throw new Error("Message queue is not initialized.");
|
|
156
155
|
}
|
|
156
|
+
(_a = this.messageIterator) != null ? _a : this.messageIterator = this.messageQueue[Symbol.asyncIterator]();
|
|
157
157
|
const aggregator = new import_live_connection_utils.LiveResponseAggregator(this.modelVersion);
|
|
158
|
-
|
|
158
|
+
while (true) {
|
|
159
|
+
const next = await this.messageIterator.next();
|
|
160
|
+
if (next.done) {
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
const message = next.value;
|
|
159
164
|
import_logger.logger.debug("Got LLM Live message:", message);
|
|
160
165
|
for (const response of aggregator.processMessage(message)) {
|
|
161
166
|
yield response;
|
|
162
167
|
}
|
|
168
|
+
if ((_b = message.serverContent) == null ? void 0 : _b.turnComplete) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
163
171
|
}
|
|
164
172
|
for (const response of aggregator.close()) {
|
|
165
173
|
yield response;
|