@google/adk 0.2.5 → 0.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/a2a/part_converter_utils.js +210 -0
- package/dist/cjs/agents/active_streaming_tool.js +1 -1
- package/dist/cjs/agents/base_agent.js +46 -24
- package/dist/cjs/agents/base_llm_processor.js +1 -1
- package/dist/cjs/agents/callback_context.js +5 -2
- package/dist/cjs/agents/content_processor_utils.js +16 -8
- package/dist/cjs/agents/functions.js +81 -30
- package/dist/cjs/agents/instructions.js +1 -1
- package/dist/cjs/agents/invocation_context.js +1 -1
- package/dist/cjs/agents/live_request_queue.js +1 -1
- package/dist/cjs/agents/llm_agent.js +106 -62
- package/dist/cjs/agents/loop_agent.js +3 -2
- package/dist/cjs/agents/parallel_agent.js +4 -5
- package/dist/cjs/agents/readonly_context.js +13 -1
- package/dist/cjs/agents/run_config.js +2 -1
- package/dist/cjs/agents/sequential_agent.js +1 -1
- package/dist/cjs/agents/transcription_entry.js +1 -1
- package/dist/cjs/artifacts/base_artifact_service.js +1 -1
- package/dist/cjs/artifacts/file_artifact_service.js +491 -0
- package/dist/cjs/artifacts/gcs_artifact_service.js +145 -58
- package/dist/cjs/artifacts/in_memory_artifact_service.js +72 -10
- package/dist/cjs/artifacts/registry.js +55 -0
- package/dist/cjs/auth/auth_credential.js +1 -1
- package/dist/cjs/auth/auth_handler.js +4 -2
- package/dist/cjs/auth/auth_schemes.js +1 -1
- package/dist/cjs/auth/auth_tool.js +1 -1
- package/dist/cjs/auth/credential_service/base_credential_service.js +1 -1
- package/dist/cjs/auth/credential_service/in_memory_credential_service.js +1 -1
- package/dist/cjs/auth/exchanger/base_credential_exchanger.js +1 -1
- package/dist/cjs/auth/exchanger/credential_exchanger_registry.js +1 -1
- package/dist/cjs/code_executors/base_code_executor.js +4 -2
- package/dist/cjs/code_executors/built_in_code_executor.js +8 -4
- package/dist/cjs/code_executors/code_execution_utils.js +1 -1
- package/dist/cjs/code_executors/code_executor_context.js +6 -6
- package/dist/cjs/common.js +18 -1
- package/dist/cjs/events/event.js +34 -7
- package/dist/cjs/events/event_actions.js +2 -2
- package/dist/cjs/events/structured_events.js +105 -0
- package/dist/cjs/examples/base_example_provider.js +1 -1
- package/dist/cjs/examples/example.js +1 -1
- package/dist/cjs/examples/example_util.js +1 -1
- package/dist/cjs/index.js +54 -83
- package/dist/cjs/index_web.js +1 -1
- package/dist/cjs/memory/base_memory_service.js +1 -1
- package/dist/cjs/memory/in_memory_memory_service.js +4 -2
- package/dist/cjs/memory/memory_entry.js +1 -1
- package/dist/cjs/models/apigee_llm.js +182 -0
- package/dist/cjs/models/base_llm.js +9 -5
- package/dist/cjs/models/base_llm_connection.js +1 -1
- package/dist/cjs/models/gemini_llm_connection.js +2 -1
- package/dist/cjs/models/google_llm.js +73 -54
- package/dist/cjs/models/llm_request.js +1 -1
- package/dist/cjs/models/llm_response.js +1 -1
- package/dist/cjs/models/registry.js +3 -1
- package/dist/cjs/plugins/base_plugin.js +13 -1
- package/dist/cjs/plugins/logging_plugin.js +51 -14
- package/dist/cjs/plugins/plugin_manager.js +57 -25
- package/dist/cjs/plugins/security_plugin.js +2 -2
- package/dist/cjs/runner/in_memory_runner.js +1 -1
- package/dist/cjs/runner/runner.js +142 -96
- package/dist/cjs/sessions/base_session_service.js +53 -3
- package/dist/cjs/sessions/database_session_service.js +364 -0
- package/dist/cjs/sessions/db/operations.js +114 -0
- package/dist/cjs/sessions/db/schema.js +204 -0
- package/dist/cjs/sessions/in_memory_session_service.js +60 -34
- package/dist/cjs/sessions/registry.js +49 -0
- package/dist/cjs/sessions/session.js +1 -1
- package/dist/cjs/sessions/state.js +1 -1
- package/dist/cjs/telemetry/google_cloud.js +8 -10
- package/dist/cjs/telemetry/setup.js +16 -8
- package/dist/cjs/telemetry/tracing.js +38 -16
- package/dist/cjs/tools/agent_tool.js +9 -5
- package/dist/cjs/tools/base_tool.js +5 -3
- package/dist/cjs/tools/base_toolset.js +1 -1
- package/dist/cjs/tools/forwarding_artifact_service.js +18 -2
- package/dist/cjs/tools/function_tool.js +2 -3
- package/dist/cjs/tools/google_search_tool.js +2 -3
- package/dist/cjs/tools/long_running_tool.js +1 -1
- package/dist/cjs/tools/mcp/mcp_session_manager.js +17 -11
- package/dist/cjs/tools/mcp/mcp_tool.js +2 -4
- package/dist/cjs/tools/mcp/mcp_toolset.js +2 -2
- package/dist/cjs/tools/tool_confirmation.js +1 -1
- package/dist/cjs/tools/tool_context.js +1 -1
- package/dist/cjs/utils/client_labels.js +1 -1
- package/dist/cjs/utils/env_aware_utils.js +11 -2
- package/dist/cjs/utils/gemini_schema_util.js +10 -5
- package/dist/cjs/utils/logger.js +48 -4
- package/dist/cjs/utils/model_name.js +1 -1
- package/dist/cjs/utils/object_notation_utils.js +78 -0
- package/dist/cjs/utils/simple_zod_to_json.js +101 -142
- package/dist/cjs/utils/variant_utils.js +3 -9
- package/dist/cjs/version.js +2 -2
- package/dist/esm/a2a/part_converter_utils.js +171 -0
- package/dist/esm/agents/base_agent.js +50 -24
- package/dist/esm/agents/callback_context.js +4 -1
- package/dist/esm/agents/content_processor_utils.js +25 -9
- package/dist/esm/agents/functions.js +84 -29
- package/dist/esm/agents/llm_agent.js +110 -62
- package/dist/esm/agents/loop_agent.js +2 -1
- package/dist/esm/agents/parallel_agent.js +3 -4
- package/dist/esm/agents/readonly_context.js +12 -0
- package/dist/esm/agents/run_config.js +1 -0
- package/dist/esm/artifacts/file_artifact_service.js +451 -0
- package/dist/esm/artifacts/gcs_artifact_service.js +144 -57
- package/dist/esm/artifacts/in_memory_artifact_service.js +69 -8
- package/dist/esm/artifacts/registry.js +28 -0
- package/dist/esm/auth/auth_handler.js +3 -1
- package/dist/esm/code_executors/base_code_executor.js +3 -1
- package/dist/esm/code_executors/built_in_code_executor.js +7 -3
- package/dist/esm/code_executors/code_executor_context.js +5 -5
- package/dist/esm/common.js +12 -2
- package/dist/esm/events/event.js +30 -5
- package/dist/esm/events/event_actions.js +1 -1
- package/dist/esm/events/structured_events.js +74 -0
- package/dist/esm/index.js +18 -88
- package/dist/esm/memory/in_memory_memory_service.js +3 -1
- package/dist/esm/models/apigee_llm.js +152 -0
- package/dist/esm/models/base_llm.js +8 -4
- package/dist/esm/models/gemini_llm_connection.js +1 -0
- package/dist/esm/models/google_llm.js +75 -53
- package/dist/esm/models/registry.js +2 -0
- package/dist/esm/plugins/base_plugin.js +12 -0
- package/dist/esm/plugins/logging_plugin.js +55 -14
- package/dist/esm/plugins/plugin_manager.js +56 -24
- package/dist/esm/plugins/security_plugin.js +1 -1
- package/dist/esm/runner/runner.js +145 -96
- package/dist/esm/sessions/base_session_service.js +49 -1
- package/dist/esm/sessions/database_session_service.js +350 -0
- package/dist/esm/sessions/db/operations.js +87 -0
- package/dist/esm/sessions/db/schema.js +172 -0
- package/dist/esm/sessions/in_memory_session_service.js +61 -33
- package/dist/esm/sessions/registry.js +25 -0
- package/dist/esm/telemetry/google_cloud.js +7 -9
- package/dist/esm/telemetry/setup.js +23 -9
- package/dist/esm/telemetry/tracing.js +37 -15
- package/dist/esm/tools/agent_tool.js +8 -4
- package/dist/esm/tools/base_tool.js +4 -2
- package/dist/esm/tools/forwarding_artifact_service.js +17 -1
- package/dist/esm/tools/function_tool.js +1 -2
- package/dist/esm/tools/google_search_tool.js +2 -5
- package/dist/esm/tools/long_running_tool.js +3 -1
- package/dist/esm/tools/mcp/mcp_session_manager.js +22 -12
- package/dist/esm/tools/mcp/mcp_tool.js +1 -3
- package/dist/esm/tools/mcp/mcp_toolset.js +1 -1
- package/dist/esm/utils/env_aware_utils.js +9 -1
- package/dist/esm/utils/gemini_schema_util.js +9 -4
- package/dist/esm/utils/logger.js +43 -2
- package/dist/esm/utils/object_notation_utils.js +47 -0
- package/dist/esm/utils/simple_zod_to_json.js +102 -141
- package/dist/esm/utils/variant_utils.js +1 -7
- package/dist/esm/version.js +1 -1
- package/dist/types/a2a/part_converter_utils.d.ts +47 -0
- package/dist/types/agents/base_agent.d.ts +2 -1
- package/dist/types/agents/callback_context.d.ts +1 -1
- package/dist/types/agents/llm_agent.d.ts +12 -12
- package/dist/types/agents/loop_agent.d.ts +1 -1
- package/dist/types/agents/parallel_agent.d.ts +1 -1
- package/dist/types/agents/readonly_context.d.ts +8 -0
- package/dist/types/agents/run_config.d.ts +6 -0
- package/dist/types/artifacts/base_artifact_service.d.ts +31 -0
- package/dist/types/artifacts/file_artifact_service.d.ts +43 -0
- package/dist/types/artifacts/gcs_artifact_service.d.ts +3 -1
- package/dist/types/artifacts/in_memory_artifact_service.d.ts +8 -5
- package/dist/types/artifacts/registry.d.ts +7 -0
- package/dist/types/code_executors/built_in_code_executor.d.ts +1 -1
- package/dist/types/code_executors/code_executor_context.d.ts +2 -4
- package/dist/types/common.d.ts +13 -3
- package/dist/types/events/event.d.ts +15 -1
- package/dist/types/events/event_actions.d.ts +1 -1
- package/dist/types/events/structured_events.d.ts +106 -0
- package/dist/types/index.d.ts +7 -3
- package/dist/types/models/apigee_llm.d.ts +59 -0
- package/dist/types/models/base_llm_connection.d.ts +1 -1
- package/dist/types/models/google_llm.d.ts +5 -2
- package/dist/types/models/llm_response.d.ts +1 -1
- package/dist/types/plugins/logging_plugin.d.ts +12 -12
- package/dist/types/plugins/plugin_manager.d.ts +12 -12
- package/dist/types/plugins/security_plugin.d.ts +1 -1
- package/dist/types/runner/runner.d.ts +16 -1
- package/dist/types/sessions/base_session_service.d.ts +20 -0
- package/dist/types/sessions/database_session_service.d.ts +31 -0
- package/dist/types/sessions/db/operations.d.ts +29 -0
- package/dist/types/sessions/db/schema.d.ts +45 -0
- package/dist/types/sessions/in_memory_session_service.d.ts +9 -6
- package/dist/types/sessions/registry.d.ts +7 -0
- package/dist/types/telemetry/setup.d.ts +1 -1
- package/dist/types/telemetry/tracing.d.ts +7 -6
- package/dist/types/tools/agent_tool.d.ts +1 -1
- package/dist/types/tools/base_tool.d.ts +1 -1
- package/dist/types/tools/base_toolset.d.ts +2 -1
- package/dist/types/tools/forwarding_artifact_service.d.ts +4 -2
- package/dist/types/tools/function_tool.d.ts +4 -3
- package/dist/types/tools/google_search_tool.d.ts +3 -3
- package/dist/types/tools/mcp/mcp_session_manager.d.ts +10 -3
- package/dist/types/tools/mcp/mcp_toolset.d.ts +1 -2
- package/dist/types/utils/env_aware_utils.d.ts +7 -0
- package/dist/types/utils/gemini_schema_util.d.ts +4 -12
- package/dist/types/utils/logger.d.ts +11 -10
- package/dist/types/utils/object_notation_utils.d.ts +21 -0
- package/dist/types/utils/simple_zod_to_json.d.ts +5 -4
- package/dist/types/version.d.ts +1 -1
- package/dist/web/a2a/part_converter_utils.js +171 -0
- package/dist/web/agents/base_agent.js +96 -35
- package/dist/web/agents/callback_context.js +4 -1
- package/dist/web/agents/content_processor_utils.js +25 -9
- package/dist/web/agents/functions.js +84 -29
- package/dist/web/agents/llm_agent.js +166 -83
- package/dist/web/agents/loop_agent.js +2 -1
- package/dist/web/agents/parallel_agent.js +3 -4
- package/dist/web/agents/readonly_context.js +12 -0
- package/dist/web/agents/run_config.js +2 -1
- package/dist/web/artifacts/file_artifact_service.js +506 -0
- package/dist/web/artifacts/gcs_artifact_service.js +139 -54
- package/dist/web/artifacts/in_memory_artifact_service.js +69 -8
- package/dist/web/artifacts/registry.js +28 -0
- package/dist/web/auth/auth_handler.js +3 -1
- package/dist/web/code_executors/base_code_executor.js +3 -1
- package/dist/web/code_executors/built_in_code_executor.js +7 -3
- package/dist/web/code_executors/code_executor_context.js +5 -5
- package/dist/web/common.js +12 -2
- package/dist/web/events/event.js +30 -5
- package/dist/web/events/event_actions.js +1 -1
- package/dist/web/events/structured_events.js +74 -0
- package/dist/web/index.js +18 -8
- package/dist/web/memory/in_memory_memory_service.js +3 -1
- package/dist/web/models/apigee_llm.js +219 -0
- package/dist/web/models/base_llm.js +8 -4
- package/dist/web/models/gemini_llm_connection.js +1 -0
- package/dist/web/models/google_llm.js +75 -50
- package/dist/web/models/registry.js +2 -0
- package/dist/web/plugins/base_plugin.js +12 -0
- package/dist/web/plugins/logging_plugin.js +55 -14
- package/dist/web/plugins/plugin_manager.js +56 -24
- package/dist/web/plugins/security_plugin.js +1 -1
- package/dist/web/runner/runner.js +192 -108
- package/dist/web/sessions/base_session_service.js +49 -1
- package/dist/web/sessions/database_session_service.js +368 -0
- package/dist/web/sessions/db/operations.js +87 -0
- package/dist/web/sessions/db/schema.js +172 -0
- package/dist/web/sessions/in_memory_session_service.js +61 -33
- package/dist/web/sessions/registry.js +25 -0
- package/dist/web/telemetry/google_cloud.js +7 -9
- package/dist/web/telemetry/setup.js +23 -9
- package/dist/web/telemetry/tracing.js +37 -15
- package/dist/web/tools/agent_tool.js +8 -4
- package/dist/web/tools/base_tool.js +4 -2
- package/dist/web/tools/forwarding_artifact_service.js +17 -1
- package/dist/web/tools/function_tool.js +1 -2
- package/dist/web/tools/google_search_tool.js +2 -5
- package/dist/web/tools/long_running_tool.js +3 -1
- package/dist/web/tools/mcp/mcp_session_manager.js +22 -12
- package/dist/web/tools/mcp/mcp_tool.js +1 -3
- package/dist/web/tools/mcp/mcp_toolset.js +1 -1
- package/dist/web/utils/env_aware_utils.js +9 -1
- package/dist/web/utils/gemini_schema_util.js +9 -4
- package/dist/web/utils/logger.js +43 -2
- package/dist/web/utils/object_notation_utils.js +47 -0
- package/dist/web/utils/simple_zod_to_json.js +102 -155
- package/dist/web/utils/variant_utils.js +1 -7
- package/dist/web/version.js +1 -1
- package/package.json +16 -5
- package/dist/cjs/index.js.map +0 -7
- package/dist/esm/index.js.map +0 -7
- package/dist/web/index.js.map +0 -7
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { GoogleGenAI } from '@google/genai';
|
|
6
|
+
import { GoogleGenAI, HttpOptions } from '@google/genai';
|
|
7
7
|
import { GoogleLLMVariant } from '../utils/variant_utils.js';
|
|
8
8
|
import { BaseLlm } from './base_llm.js';
|
|
9
9
|
import { BaseLlmConnection } from './base_llm_connection.js';
|
|
@@ -45,7 +45,7 @@ export interface GeminiParams {
|
|
|
45
45
|
*/
|
|
46
46
|
export declare class Gemini extends BaseLlm {
|
|
47
47
|
private readonly apiKey?;
|
|
48
|
-
|
|
48
|
+
protected readonly vertexai: boolean;
|
|
49
49
|
private readonly project?;
|
|
50
50
|
private readonly location?;
|
|
51
51
|
private readonly headers?;
|
|
@@ -72,9 +72,11 @@ export declare class Gemini extends BaseLlm {
|
|
|
72
72
|
* @yields LlmResponse: The model response.
|
|
73
73
|
*/
|
|
74
74
|
generateContentAsync(llmRequest: LlmRequest, stream?: boolean): AsyncGenerator<LlmResponse, void>;
|
|
75
|
+
protected getHttpOptions(): HttpOptions;
|
|
75
76
|
get apiClient(): GoogleGenAI;
|
|
76
77
|
get apiBackend(): GoogleLLMVariant;
|
|
77
78
|
get liveApiVersion(): string;
|
|
79
|
+
protected getLiveHttpOptions(): HttpOptions;
|
|
78
80
|
get liveApiClient(): GoogleGenAI;
|
|
79
81
|
/**
|
|
80
82
|
* Connects to the Gemini model and returns an llm connection.
|
|
@@ -85,3 +87,4 @@ export declare class Gemini extends BaseLlm {
|
|
|
85
87
|
connect(llmRequest: LlmRequest): Promise<BaseLlmConnection>;
|
|
86
88
|
private preprocessRequest;
|
|
87
89
|
}
|
|
90
|
+
export declare function geminiInitParams({ model, vertexai, project, location, apiKey, }: GeminiParams): GeminiParams;
|
|
@@ -46,53 +46,53 @@ export declare class LoggingPlugin extends BasePlugin {
|
|
|
46
46
|
* @param name The name of the plugin instance.
|
|
47
47
|
*/
|
|
48
48
|
constructor(name?: string);
|
|
49
|
-
onUserMessageCallback({ invocationContext, userMessage }: {
|
|
49
|
+
onUserMessageCallback({ invocationContext, userMessage, }: {
|
|
50
50
|
invocationContext: InvocationContext;
|
|
51
51
|
userMessage: Content;
|
|
52
52
|
}): Promise<Content | undefined>;
|
|
53
|
-
beforeRunCallback({ invocationContext }: {
|
|
53
|
+
beforeRunCallback({ invocationContext, }: {
|
|
54
54
|
invocationContext: InvocationContext;
|
|
55
55
|
}): Promise<Content | undefined>;
|
|
56
|
-
onEventCallback({
|
|
56
|
+
onEventCallback({ event, }: {
|
|
57
57
|
invocationContext: InvocationContext;
|
|
58
58
|
event: Event;
|
|
59
59
|
}): Promise<Event | undefined>;
|
|
60
|
-
afterRunCallback({ invocationContext }: {
|
|
60
|
+
afterRunCallback({ invocationContext, }: {
|
|
61
61
|
invocationContext: InvocationContext;
|
|
62
62
|
}): Promise<void>;
|
|
63
|
-
beforeAgentCallback({
|
|
63
|
+
beforeAgentCallback({ callbackContext, }: {
|
|
64
64
|
agent: BaseAgent;
|
|
65
65
|
callbackContext: CallbackContext;
|
|
66
66
|
}): Promise<Content | undefined>;
|
|
67
|
-
afterAgentCallback({
|
|
67
|
+
afterAgentCallback({ callbackContext, }: {
|
|
68
68
|
agent: BaseAgent;
|
|
69
69
|
callbackContext: CallbackContext;
|
|
70
70
|
}): Promise<Content | undefined>;
|
|
71
|
-
beforeModelCallback({ callbackContext, llmRequest }: {
|
|
71
|
+
beforeModelCallback({ callbackContext, llmRequest, }: {
|
|
72
72
|
callbackContext: CallbackContext;
|
|
73
73
|
llmRequest: LlmRequest;
|
|
74
74
|
}): Promise<LlmResponse | undefined>;
|
|
75
|
-
afterModelCallback({ callbackContext, llmResponse }: {
|
|
75
|
+
afterModelCallback({ callbackContext, llmResponse, }: {
|
|
76
76
|
callbackContext: CallbackContext;
|
|
77
77
|
llmResponse: LlmResponse;
|
|
78
78
|
}): Promise<LlmResponse | undefined>;
|
|
79
|
-
beforeToolCallback({ tool, toolArgs, toolContext }: {
|
|
79
|
+
beforeToolCallback({ tool, toolArgs, toolContext, }: {
|
|
80
80
|
tool: BaseTool;
|
|
81
81
|
toolArgs: Record<string, unknown>;
|
|
82
82
|
toolContext: ToolContext;
|
|
83
83
|
}): Promise<Record<string, unknown> | undefined>;
|
|
84
|
-
afterToolCallback({ tool,
|
|
84
|
+
afterToolCallback({ tool, toolContext, result, }: {
|
|
85
85
|
tool: BaseTool;
|
|
86
86
|
toolArgs: Record<string, unknown>;
|
|
87
87
|
toolContext: ToolContext;
|
|
88
88
|
result: Record<string, unknown>;
|
|
89
89
|
}): Promise<Record<string, unknown> | undefined>;
|
|
90
|
-
onModelErrorCallback({ callbackContext,
|
|
90
|
+
onModelErrorCallback({ callbackContext, error, }: {
|
|
91
91
|
callbackContext: CallbackContext;
|
|
92
92
|
llmRequest: LlmRequest;
|
|
93
93
|
error: Error;
|
|
94
94
|
}): Promise<LlmResponse | undefined>;
|
|
95
|
-
onToolErrorCallback({ tool, toolArgs, toolContext, error }: {
|
|
95
|
+
onToolErrorCallback({ tool, toolArgs, toolContext, error, }: {
|
|
96
96
|
tool: BaseTool;
|
|
97
97
|
toolArgs: Record<string, unknown>;
|
|
98
98
|
toolContext: ToolContext;
|
|
@@ -67,47 +67,47 @@ export declare class PluginManager {
|
|
|
67
67
|
/**
|
|
68
68
|
* Runs the `onUserMessageCallback` for all plugins.
|
|
69
69
|
*/
|
|
70
|
-
runOnUserMessageCallback({ userMessage, invocationContext }: {
|
|
70
|
+
runOnUserMessageCallback({ userMessage, invocationContext, }: {
|
|
71
71
|
userMessage: Content;
|
|
72
72
|
invocationContext: InvocationContext;
|
|
73
73
|
}): Promise<Content | undefined>;
|
|
74
74
|
/**
|
|
75
75
|
* Runs the `beforeRunCallback` for all plugins.
|
|
76
76
|
*/
|
|
77
|
-
runBeforeRunCallback({ invocationContext }: {
|
|
77
|
+
runBeforeRunCallback({ invocationContext, }: {
|
|
78
78
|
invocationContext: InvocationContext;
|
|
79
79
|
}): Promise<Content | undefined>;
|
|
80
80
|
/**
|
|
81
81
|
* Runs the `afterRunCallback` for all plugins.
|
|
82
82
|
*/
|
|
83
|
-
runAfterRunCallback({ invocationContext }: {
|
|
83
|
+
runAfterRunCallback({ invocationContext, }: {
|
|
84
84
|
invocationContext: InvocationContext;
|
|
85
85
|
}): Promise<void>;
|
|
86
86
|
/**
|
|
87
87
|
* Runs the `onEventCallback` for all plugins.
|
|
88
88
|
*/
|
|
89
|
-
runOnEventCallback({ invocationContext, event }: {
|
|
89
|
+
runOnEventCallback({ invocationContext, event, }: {
|
|
90
90
|
invocationContext: InvocationContext;
|
|
91
91
|
event: Event;
|
|
92
92
|
}): Promise<Event | undefined>;
|
|
93
93
|
/**
|
|
94
94
|
* Runs the `beforeAgentCallback` for all plugins.
|
|
95
95
|
*/
|
|
96
|
-
runBeforeAgentCallback({ agent, callbackContext }: {
|
|
96
|
+
runBeforeAgentCallback({ agent, callbackContext, }: {
|
|
97
97
|
agent: BaseAgent;
|
|
98
98
|
callbackContext: CallbackContext;
|
|
99
99
|
}): Promise<Content | undefined>;
|
|
100
100
|
/**
|
|
101
101
|
* Runs the `afterAgentCallback` for all plugins.
|
|
102
102
|
*/
|
|
103
|
-
runAfterAgentCallback({ agent, callbackContext }: {
|
|
103
|
+
runAfterAgentCallback({ agent, callbackContext, }: {
|
|
104
104
|
agent: BaseAgent;
|
|
105
105
|
callbackContext: CallbackContext;
|
|
106
106
|
}): Promise<Content | undefined>;
|
|
107
107
|
/**
|
|
108
108
|
* Runs the `beforeToolCallback` for all plugins.
|
|
109
109
|
*/
|
|
110
|
-
runBeforeToolCallback({ tool, toolArgs, toolContext }: {
|
|
110
|
+
runBeforeToolCallback({ tool, toolArgs, toolContext, }: {
|
|
111
111
|
tool: BaseTool;
|
|
112
112
|
toolArgs: Record<string, unknown>;
|
|
113
113
|
toolContext: ToolContext;
|
|
@@ -115,7 +115,7 @@ export declare class PluginManager {
|
|
|
115
115
|
/**
|
|
116
116
|
* Runs the `afterToolCallback` for all plugins.
|
|
117
117
|
*/
|
|
118
|
-
runAfterToolCallback({ tool, toolArgs, toolContext, result }: {
|
|
118
|
+
runAfterToolCallback({ tool, toolArgs, toolContext, result, }: {
|
|
119
119
|
tool: BaseTool;
|
|
120
120
|
toolArgs: Record<string, unknown>;
|
|
121
121
|
toolContext: ToolContext;
|
|
@@ -124,7 +124,7 @@ export declare class PluginManager {
|
|
|
124
124
|
/**
|
|
125
125
|
* Runs the `onModelErrorCallback` for all plugins.
|
|
126
126
|
*/
|
|
127
|
-
runOnModelErrorCallback({ callbackContext, llmRequest, error }: {
|
|
127
|
+
runOnModelErrorCallback({ callbackContext, llmRequest, error, }: {
|
|
128
128
|
callbackContext: CallbackContext;
|
|
129
129
|
llmRequest: LlmRequest;
|
|
130
130
|
error: Error;
|
|
@@ -132,21 +132,21 @@ export declare class PluginManager {
|
|
|
132
132
|
/**
|
|
133
133
|
* Runs the `beforeModelCallback` for all plugins.
|
|
134
134
|
*/
|
|
135
|
-
runBeforeModelCallback({ callbackContext, llmRequest }: {
|
|
135
|
+
runBeforeModelCallback({ callbackContext, llmRequest, }: {
|
|
136
136
|
callbackContext: CallbackContext;
|
|
137
137
|
llmRequest: LlmRequest;
|
|
138
138
|
}): Promise<LlmResponse | undefined>;
|
|
139
139
|
/**
|
|
140
140
|
* Runs the `afterModelCallback` for all plugins.
|
|
141
141
|
*/
|
|
142
|
-
runAfterModelCallback({ callbackContext, llmResponse }: {
|
|
142
|
+
runAfterModelCallback({ callbackContext, llmResponse, }: {
|
|
143
143
|
callbackContext: CallbackContext;
|
|
144
144
|
llmResponse: LlmResponse;
|
|
145
145
|
}): Promise<LlmResponse | undefined>;
|
|
146
146
|
/**
|
|
147
147
|
* Runs the `onToolErrorCallback` for all plugins.
|
|
148
148
|
*/
|
|
149
|
-
runOnToolErrorCallback({ tool, toolArgs, toolContext, error }: {
|
|
149
|
+
runOnToolErrorCallback({ tool, toolArgs, toolContext, error, }: {
|
|
150
150
|
tool: BaseTool;
|
|
151
151
|
toolArgs: Record<string, unknown>;
|
|
152
152
|
toolContext: ToolContext;
|
|
@@ -29,7 +29,7 @@ export interface BasePolicyEngine {
|
|
|
29
29
|
evaluate(context: ToolCallPolicyContext): Promise<PolicyCheckResult>;
|
|
30
30
|
}
|
|
31
31
|
export declare class InMemoryPolicyEngine implements BasePolicyEngine {
|
|
32
|
-
evaluate(
|
|
32
|
+
evaluate(): Promise<PolicyCheckResult>;
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* Security Plugin for running Orcas agents.
|
|
@@ -40,6 +40,21 @@ export declare class Runner {
|
|
|
40
40
|
readonly memoryService?: BaseMemoryService;
|
|
41
41
|
readonly credentialService?: BaseCredentialService;
|
|
42
42
|
constructor(input: RunnerConfig);
|
|
43
|
+
/**
|
|
44
|
+
* Runs the agent with a new, ephemeral session.
|
|
45
|
+
*
|
|
46
|
+
* @param params.userId The user ID of the session.
|
|
47
|
+
* @param params.newMessage A new message to append to the session.
|
|
48
|
+
* @param params.stateDelta An optional state delta to apply to the session.
|
|
49
|
+
* @param params.runConfig The run config for the agent.
|
|
50
|
+
* @yields The Events generated by the agent.
|
|
51
|
+
*/
|
|
52
|
+
runEphemeral(params: {
|
|
53
|
+
userId: string;
|
|
54
|
+
newMessage: Content;
|
|
55
|
+
stateDelta?: Record<string, unknown>;
|
|
56
|
+
runConfig?: RunConfig;
|
|
57
|
+
}): AsyncGenerator<Event, void, undefined>;
|
|
43
58
|
/**
|
|
44
59
|
* Runs the agent with the given message, and returns an async generator of
|
|
45
60
|
* events.
|
|
@@ -55,7 +70,7 @@ export declare class Runner {
|
|
|
55
70
|
userId: string;
|
|
56
71
|
sessionId: string;
|
|
57
72
|
newMessage: Content;
|
|
58
|
-
stateDelta?: Record<string,
|
|
73
|
+
stateDelta?: Record<string, unknown>;
|
|
59
74
|
runConfig?: RunConfig;
|
|
60
75
|
}): AsyncGenerator<Event, void, undefined>;
|
|
61
76
|
/**
|
|
@@ -99,6 +99,13 @@ export declare abstract class BaseSessionService {
|
|
|
99
99
|
* found.
|
|
100
100
|
*/
|
|
101
101
|
abstract getSession(request: GetSessionRequest): Promise<Session | undefined>;
|
|
102
|
+
/**
|
|
103
|
+
* Gets a session or creates one if it doesn't exist.
|
|
104
|
+
*
|
|
105
|
+
* @param request The request to get or create a session.
|
|
106
|
+
* @return A promise that resolves to the session instance.
|
|
107
|
+
*/
|
|
108
|
+
getOrCreateSession(request: CreateSessionRequest): Promise<Session>;
|
|
102
109
|
/**
|
|
103
110
|
* Lists sessions for a user.
|
|
104
111
|
*
|
|
@@ -127,3 +134,16 @@ export declare abstract class BaseSessionService {
|
|
|
127
134
|
*/
|
|
128
135
|
private updateSessionState;
|
|
129
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* Removes temporary state delta keys from the event.
|
|
139
|
+
*/
|
|
140
|
+
export declare function trimTempDeltaState(event: Event): Event;
|
|
141
|
+
/**
|
|
142
|
+
* Merges app state, user state, and session state.
|
|
143
|
+
*
|
|
144
|
+
* @param appState The application state.
|
|
145
|
+
* @param userState The user state.
|
|
146
|
+
* @param sessionState The session state.
|
|
147
|
+
* @return The merged state.
|
|
148
|
+
*/
|
|
149
|
+
export declare function mergeStates(appState?: Record<string, unknown>, userState?: Record<string, unknown>, sessionState?: Record<string, unknown>): Record<string, unknown>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Options as MikroDBOptions } from '@mikro-orm/core';
|
|
7
|
+
import { Event } from '../events/event.js';
|
|
8
|
+
import { AppendEventRequest, BaseSessionService, CreateSessionRequest, DeleteSessionRequest, GetSessionRequest, ListSessionsRequest, ListSessionsResponse } from './base_session_service.js';
|
|
9
|
+
import { Session } from './session.js';
|
|
10
|
+
/**
|
|
11
|
+
* Checks if a URI is a database connection URI.
|
|
12
|
+
*
|
|
13
|
+
* @param uri The URI to check.
|
|
14
|
+
* @returns True if the URI is a database connection URI, false otherwise.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isDatabaseConnectionString(uri?: string): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* A session service that uses a SQL database for storage via MikroORM.
|
|
19
|
+
*/
|
|
20
|
+
export declare class DatabaseSessionService extends BaseSessionService {
|
|
21
|
+
private orm?;
|
|
22
|
+
private initialized;
|
|
23
|
+
private options;
|
|
24
|
+
constructor(connectionStringOrOptions: MikroDBOptions | string);
|
|
25
|
+
init(): Promise<void>;
|
|
26
|
+
createSession({ appName, userId, state, sessionId, }: CreateSessionRequest): Promise<Session>;
|
|
27
|
+
getSession({ appName, userId, sessionId, config, }: GetSessionRequest): Promise<Session | undefined>;
|
|
28
|
+
listSessions({ appName, userId, }: ListSessionsRequest): Promise<ListSessionsResponse>;
|
|
29
|
+
deleteSession({ appName, userId, sessionId, }: DeleteSessionRequest): Promise<void>;
|
|
30
|
+
appendEvent({ session, event, }: AppendEventRequest): Promise<Event>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { MikroORM, Options as MikroORMOptions } from '@mikro-orm/core';
|
|
7
|
+
/**
|
|
8
|
+
* Parses a database connection URI and returns MikroORM Options.
|
|
9
|
+
*
|
|
10
|
+
* @param uri The database connection URI (e.g., "postgres://user:password@host:port/database")
|
|
11
|
+
* @returns MikroORM Options configured for the database
|
|
12
|
+
* @throws Error if the URI is invalid or unsupported
|
|
13
|
+
*/
|
|
14
|
+
export declare function getConnectionOptionsFromUri(uri: string): MikroORMOptions;
|
|
15
|
+
/**
|
|
16
|
+
* Creates a database and tables if they don't exist.
|
|
17
|
+
*
|
|
18
|
+
* @param url The database connection URI (e.g., "postgres://user:password@host:port/database")
|
|
19
|
+
* @returns Promise<void>
|
|
20
|
+
* @throws Error if the URI is invalid or unsupported
|
|
21
|
+
*/
|
|
22
|
+
export declare function ensureDatabaseCreated(ormOrUrlOrOptions: MikroORM | MikroORMOptions | string): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Validates the schema version.
|
|
25
|
+
*
|
|
26
|
+
* @param orm The MikroORM instance.
|
|
27
|
+
* @throws Error if the schema version is not compatible.
|
|
28
|
+
*/
|
|
29
|
+
export declare function validateDatabaseSchemaVersion(orm: MikroORM): Promise<void>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { PrimaryKey } from '@mikro-orm/core';
|
|
7
|
+
import { Event } from '../../events/event.js';
|
|
8
|
+
export declare const SCHEMA_VERSION_KEY = "schema_version";
|
|
9
|
+
export declare const SCHEMA_VERSION_1_JSON = "1";
|
|
10
|
+
export declare class StorageMetadata {
|
|
11
|
+
key: string;
|
|
12
|
+
value: string;
|
|
13
|
+
}
|
|
14
|
+
export declare class StorageAppState {
|
|
15
|
+
appName: string;
|
|
16
|
+
state: Record<string, unknown>;
|
|
17
|
+
updateTime: Date;
|
|
18
|
+
}
|
|
19
|
+
export declare class StorageUserState {
|
|
20
|
+
[PrimaryKey.name]?: [string, string] | undefined;
|
|
21
|
+
appName: string;
|
|
22
|
+
userId: string;
|
|
23
|
+
state: Record<string, unknown>;
|
|
24
|
+
updateTime: Date;
|
|
25
|
+
}
|
|
26
|
+
export declare class StorageSession {
|
|
27
|
+
[PrimaryKey.name]?: [string, string, string] | undefined;
|
|
28
|
+
id: string;
|
|
29
|
+
appName: string;
|
|
30
|
+
userId: string;
|
|
31
|
+
state: Record<string, unknown>;
|
|
32
|
+
createTime: Date;
|
|
33
|
+
updateTime: Date;
|
|
34
|
+
}
|
|
35
|
+
export declare class StorageEvent {
|
|
36
|
+
[PrimaryKey.name]?: [string, string, string, string] | undefined;
|
|
37
|
+
id: string;
|
|
38
|
+
appName: string;
|
|
39
|
+
userId: string;
|
|
40
|
+
sessionId: string;
|
|
41
|
+
invocationId: string;
|
|
42
|
+
timestamp: Date;
|
|
43
|
+
eventData: Event;
|
|
44
|
+
}
|
|
45
|
+
export declare const ENTITIES: (typeof StorageMetadata | typeof StorageAppState | typeof StorageEvent)[];
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { Event } from '../events/event.js';
|
|
2
2
|
import { AppendEventRequest, BaseSessionService, CreateSessionRequest, DeleteSessionRequest, GetSessionRequest, ListSessionsRequest, ListSessionsResponse } from './base_session_service.js';
|
|
3
3
|
import { Session } from './session.js';
|
|
4
|
+
/**
|
|
5
|
+
* Checks if the given URI is an in-memory memory service URI.
|
|
6
|
+
*/
|
|
7
|
+
export declare function isInMemoryConnectionString(uri?: string): boolean;
|
|
4
8
|
/**
|
|
5
9
|
* An in-memory implementation of the session service.
|
|
6
10
|
*/
|
|
@@ -18,10 +22,9 @@ export declare class InMemorySessionService extends BaseSessionService {
|
|
|
18
22
|
* A map from app name to a map from key to the value.
|
|
19
23
|
*/
|
|
20
24
|
private appState;
|
|
21
|
-
createSession({ appName, userId, state, sessionId }: CreateSessionRequest): Promise<Session>;
|
|
22
|
-
getSession({ appName, userId, sessionId, config }: GetSessionRequest): Promise<Session | undefined>;
|
|
23
|
-
listSessions({ appName, userId }: ListSessionsRequest): Promise<ListSessionsResponse>;
|
|
24
|
-
deleteSession({ appName, userId, sessionId }: DeleteSessionRequest): Promise<void>;
|
|
25
|
-
appendEvent({ session, event }: AppendEventRequest): Promise<Event>;
|
|
26
|
-
private mergeState;
|
|
25
|
+
createSession({ appName, userId, state, sessionId, }: CreateSessionRequest): Promise<Session>;
|
|
26
|
+
getSession({ appName, userId, sessionId, config, }: GetSessionRequest): Promise<Session | undefined>;
|
|
27
|
+
listSessions({ appName, userId, }: ListSessionsRequest): Promise<ListSessionsResponse>;
|
|
28
|
+
deleteSession({ appName, userId, sessionId, }: DeleteSessionRequest): Promise<void>;
|
|
29
|
+
appendEvent({ session, event, }: AppendEventRequest): Promise<Event>;
|
|
27
30
|
}
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
import { Resource } from '@opentelemetry/resources';
|
|
6
7
|
import { LogRecordProcessor } from '@opentelemetry/sdk-logs';
|
|
7
8
|
import { MetricReader } from '@opentelemetry/sdk-metrics';
|
|
8
|
-
import { Resource } from '@opentelemetry/resources';
|
|
9
9
|
import { SpanProcessor } from '@opentelemetry/sdk-trace-base';
|
|
10
10
|
export interface OtelExportersConfig {
|
|
11
11
|
enableTracing?: boolean;
|
|
@@ -101,11 +101,12 @@ export interface TraceSendDataParams {
|
|
|
101
101
|
*/
|
|
102
102
|
export declare function traceSendData({ invocationContext, eventId, data, }: TraceSendDataParams): void;
|
|
103
103
|
/**
|
|
104
|
-
*
|
|
105
|
-
* This is a temporary solution.
|
|
106
|
-
* @param ctx - The OpenTelemetry context to bind the generator to
|
|
107
|
-
* @param generator - The async generator to be bound to the context
|
|
104
|
+
* Runs an async generator function with both OTEL context and JavaScript 'this' context.
|
|
108
105
|
*
|
|
109
|
-
* @
|
|
106
|
+
* @param otelContext - The OpenTelemetry context to bind the generator to
|
|
107
|
+
* @param generatorFnContext - The 'this' context to bind to the generator function
|
|
108
|
+
* @param generatorFn - The generator function to execute
|
|
109
|
+
*
|
|
110
|
+
* @returns A new async generator that executes within both contexts
|
|
110
111
|
*/
|
|
111
|
-
export declare function
|
|
112
|
+
export declare function runAsyncGeneratorWithOtelContext<TThis, T>(otelContext: Context, generatorFnContext: TThis, generatorFn: (this: TThis) => AsyncGenerator<T, void, void>): AsyncGenerator<T, void, void>;
|
|
@@ -46,6 +46,6 @@ export declare class AgentTool extends BaseTool {
|
|
|
46
46
|
private readonly skipSummarization;
|
|
47
47
|
constructor(config: AgentToolConfig);
|
|
48
48
|
_getDeclaration(): FunctionDeclaration;
|
|
49
|
-
runAsync({ args, toolContext }: RunAsyncToolRequest): Promise<unknown>;
|
|
49
|
+
runAsync({ args, toolContext, }: RunAsyncToolRequest): Promise<unknown>;
|
|
50
50
|
}
|
|
51
51
|
export {};
|
|
@@ -89,7 +89,7 @@ export declare abstract class BaseTool {
|
|
|
89
89
|
*
|
|
90
90
|
* @param request The request to process the LLM request.
|
|
91
91
|
*/
|
|
92
|
-
processLlmRequest({
|
|
92
|
+
processLlmRequest({ llmRequest }: ToolProcessLlmRequest): Promise<void>;
|
|
93
93
|
/**
|
|
94
94
|
* The Google API LLM variant to use.
|
|
95
95
|
*/
|
|
@@ -60,5 +60,6 @@ export declare abstract class BaseToolset {
|
|
|
60
60
|
* @param toolContext The context of the tool.
|
|
61
61
|
* @param llmRequest The outgoing LLM request, mutable this method.
|
|
62
62
|
*/
|
|
63
|
-
processLlmRequest(toolContext: ToolContext,
|
|
63
|
+
processLlmRequest(toolContext: ToolContext, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
64
|
+
llmRequest: LlmRequest): Promise<void>;
|
|
64
65
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { Part } from '@google/genai';
|
|
7
|
-
import { BaseArtifactService, DeleteArtifactRequest,
|
|
7
|
+
import { ArtifactVersion, BaseArtifactService, DeleteArtifactRequest, ListVersionsRequest, LoadArtifactRequest, SaveArtifactRequest } from '../artifacts/base_artifact_service.js';
|
|
8
8
|
import { ToolContext } from './tool_context.js';
|
|
9
9
|
/**
|
|
10
10
|
* Artifact service that forwards to the parent tool context.
|
|
@@ -15,7 +15,9 @@ export declare class ForwardingArtifactService implements BaseArtifactService {
|
|
|
15
15
|
constructor(toolContext: ToolContext);
|
|
16
16
|
saveArtifact(request: SaveArtifactRequest): Promise<number>;
|
|
17
17
|
loadArtifact(request: LoadArtifactRequest): Promise<Part | undefined>;
|
|
18
|
-
listArtifactKeys(
|
|
18
|
+
listArtifactKeys(): Promise<string[]>;
|
|
19
19
|
deleteArtifact(request: DeleteArtifactRequest): Promise<void>;
|
|
20
20
|
listVersions(request: ListVersionsRequest): Promise<number[]>;
|
|
21
|
+
listArtifactVersions(request: ListVersionsRequest): Promise<ArtifactVersion[]>;
|
|
22
|
+
getArtifactVersion(request: LoadArtifactRequest): Promise<ArtifactVersion | undefined>;
|
|
21
23
|
}
|
|
@@ -4,14 +4,15 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { FunctionDeclaration, Schema } from '@google/genai';
|
|
7
|
-
import {
|
|
7
|
+
import { z as z3 } from 'zod/v3';
|
|
8
|
+
import { z as z4 } from 'zod/v4';
|
|
8
9
|
import { BaseTool, RunAsyncToolRequest } from './base_tool.js';
|
|
9
10
|
import { ToolContext } from './tool_context.js';
|
|
10
11
|
/**
|
|
11
12
|
* Input parameters of the function tool.
|
|
12
13
|
*/
|
|
13
|
-
export type ToolInputParameters =
|
|
14
|
-
export type ToolExecuteArgument<TParameters extends ToolInputParameters> = TParameters extends ZodObject<infer T, infer U, infer V> ?
|
|
14
|
+
export type ToolInputParameters = z3.ZodObject<z3.ZodRawShape> | z4.ZodObject<z4.ZodRawShape> | Schema | undefined;
|
|
15
|
+
export type ToolExecuteArgument<TParameters extends ToolInputParameters> = TParameters extends z3.ZodObject<infer T, infer U, infer V> ? z3.infer<z3.ZodObject<T, U, V>> : TParameters extends z4.ZodObject<infer T> ? z4.infer<z4.ZodObject<T>> : TParameters extends Schema ? unknown : string;
|
|
15
16
|
export type ToolExecuteFunction<TParameters extends ToolInputParameters> = (input: ToolExecuteArgument<TParameters>, tool_context?: ToolContext) => Promise<unknown> | unknown;
|
|
16
17
|
/**
|
|
17
18
|
* The configuration options for creating a function-based tool.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseTool,
|
|
1
|
+
import { BaseTool, ToolProcessLlmRequest } from './base_tool.js';
|
|
2
2
|
/**
|
|
3
3
|
* A built-in tool that is automatically invoked by Gemini 2 models to retrieve
|
|
4
4
|
* search results from Google Search.
|
|
@@ -8,8 +8,8 @@ import { BaseTool, RunAsyncToolRequest, ToolProcessLlmRequest } from './base_too
|
|
|
8
8
|
*/
|
|
9
9
|
export declare class GoogleSearchTool extends BaseTool {
|
|
10
10
|
constructor();
|
|
11
|
-
runAsync(
|
|
12
|
-
processLlmRequest({
|
|
11
|
+
runAsync(): Promise<unknown>;
|
|
12
|
+
processLlmRequest({ llmRequest, }: ToolProcessLlmRequest): Promise<void>;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* A global instance of {@link GoogleSearchTool}.
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
7
7
|
import { StdioServerParameters } from '@modelcontextprotocol/sdk/client/stdio.js';
|
|
8
|
+
import { StreamableHTTPClientTransportOptions } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
8
9
|
/**
|
|
9
10
|
* Defines the parameters for establishing a connection to an MCP server using
|
|
10
11
|
* standard input/output (stdio). This is typically used for running MCP servers
|
|
@@ -13,7 +14,7 @@ import { StdioServerParameters } from '@modelcontextprotocol/sdk/client/stdio.js
|
|
|
13
14
|
export interface StdioConnectionParams {
|
|
14
15
|
type: 'StdioConnectionParams';
|
|
15
16
|
serverParams: StdioServerParameters;
|
|
16
|
-
timeout?:
|
|
17
|
+
timeout?: number;
|
|
17
18
|
}
|
|
18
19
|
/**
|
|
19
20
|
* Defines the parameters for establishing a connection to an MCP server over
|
|
@@ -28,10 +29,16 @@ export interface StdioConnectionParams {
|
|
|
28
29
|
export interface StreamableHTTPConnectionParams {
|
|
29
30
|
type: 'StreamableHTTPConnectionParams';
|
|
30
31
|
url: string;
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated
|
|
34
|
+
* Use transportOptions.requestInit.headers instead.
|
|
35
|
+
* This field will be ignored if transportOptions is provided even if no headers are specified in transportOptions.
|
|
36
|
+
*/
|
|
31
37
|
header?: Record<string, unknown>;
|
|
32
|
-
timeout?:
|
|
33
|
-
sseReadTimeout?:
|
|
38
|
+
timeout?: number;
|
|
39
|
+
sseReadTimeout?: number;
|
|
34
40
|
terminateOnClose?: boolean;
|
|
41
|
+
transportOptions?: StreamableHTTPClientTransportOptions;
|
|
35
42
|
}
|
|
36
43
|
/**
|
|
37
44
|
* A union of all supported MCP connection parameter types.
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { ReadonlyContext } from '../../agents/readonly_context.js';
|
|
7
6
|
import { BaseTool } from '../base_tool.js';
|
|
8
7
|
import { BaseToolset, ToolPredicate } from '../base_toolset.js';
|
|
9
8
|
import { MCPConnectionParams } from './mcp_session_manager.js';
|
|
@@ -34,6 +33,6 @@ import { MCPConnectionParams } from './mcp_session_manager.js';
|
|
|
34
33
|
export declare class MCPToolset extends BaseToolset {
|
|
35
34
|
private readonly mcpSessionManager;
|
|
36
35
|
constructor(connectionParams: MCPConnectionParams, toolFilter?: ToolPredicate | string[]);
|
|
37
|
-
getTools(
|
|
36
|
+
getTools(): Promise<BaseTool[]>;
|
|
38
37
|
close(): Promise<void>;
|
|
39
38
|
}
|
|
@@ -29,3 +29,10 @@ export declare function base64Decode(data: string): string;
|
|
|
29
29
|
* @return True if the string is base64-encoded, false otherwise.
|
|
30
30
|
*/
|
|
31
31
|
export declare function isBase64Encoded(data: string): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Gets the boolean value of the given environment variable.
|
|
34
|
+
*
|
|
35
|
+
* @param envVar The environment variable to get the value of.
|
|
36
|
+
* @return The boolean value of the environment variable.
|
|
37
|
+
*/
|
|
38
|
+
export declare function getBooleanEnvVar(envVar: string): boolean;
|
|
@@ -5,19 +5,11 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { Schema } from '@google/genai';
|
|
7
7
|
import { z } from 'zod';
|
|
8
|
-
declare const
|
|
8
|
+
declare const MCPToolSchemaObject: z.ZodObject<{
|
|
9
9
|
type: z.ZodLiteral<"object">;
|
|
10
10
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
11
|
-
required: z.ZodOptional<z.ZodArray<z.ZodString
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
properties?: Record<string, unknown> | undefined;
|
|
15
|
-
required?: string[] | undefined;
|
|
16
|
-
}, {
|
|
17
|
-
type: "object";
|
|
18
|
-
properties?: Record<string, unknown> | undefined;
|
|
19
|
-
required?: string[] | undefined;
|
|
20
|
-
}>;
|
|
21
|
-
type MCPToolSchema = z.infer<typeof MCPToolSchema>;
|
|
11
|
+
required: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
type MCPToolSchema = z.infer<typeof MCPToolSchemaObject>;
|
|
22
14
|
export declare function toGeminiSchema(mcpSchema?: MCPToolSchema): Schema | undefined;
|
|
23
15
|
export {};
|