@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
|
@@ -12,7 +12,15 @@ import { BaseLlmRequestProcessor } from './base_llm_processor.js';
|
|
|
12
12
|
* corresponding tools before the next LLM turn.
|
|
13
13
|
*/
|
|
14
14
|
export declare class RequestConfirmationLlmRequestProcessor extends BaseLlmRequestProcessor {
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Resumes tool calls that were paused for user confirmation, re-invoking
|
|
17
|
+
* them with the confirmed or denied decision before the next LLM turn.
|
|
18
|
+
*
|
|
19
|
+
* @param invocationContext - The current invocation context, including the
|
|
20
|
+
* session event history used to locate pending confirmation responses.
|
|
21
|
+
* @yields Function response events for tools that have been confirmed and
|
|
22
|
+
* are ready to resume.
|
|
23
|
+
*/
|
|
16
24
|
runAsync(invocationContext: InvocationContext): AsyncGenerator<Event, void, void>;
|
|
17
25
|
}
|
|
18
26
|
export declare const REQUEST_CONFIRMATION_LLM_REQUEST_PROCESSOR: RequestConfirmationLlmRequestProcessor;
|
|
@@ -7,8 +7,19 @@ import { Event } from '../../events/event.js';
|
|
|
7
7
|
import { LlmRequest } from '../../models/llm_request.js';
|
|
8
8
|
import { InvocationContext } from '../invocation_context.js';
|
|
9
9
|
import { BaseLlmRequestProcessor } from './base_llm_processor.js';
|
|
10
|
+
/**
|
|
11
|
+
* Filters the set of tools on the {@link LlmRequest} by delegating to the
|
|
12
|
+
* active plugin manager's `beforeToolSelection` hook. If no plugin restricts
|
|
13
|
+
* the tool set, the request is left unchanged.
|
|
14
|
+
*/
|
|
10
15
|
export declare class ToolFilterRequestProcessor extends BaseLlmRequestProcessor {
|
|
11
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Invokes plugin-based tool filtering and updates {@link LlmRequest.allowedTools}
|
|
18
|
+
* with the reduced tool set if any plugin returns a filtered result.
|
|
19
|
+
*
|
|
20
|
+
* @param invocationContext - The current invocation context.
|
|
21
|
+
* @param llmRequest - The request whose allowed tools may be restricted.
|
|
22
|
+
*/
|
|
12
23
|
runAsync(invocationContext: InvocationContext, llmRequest: LlmRequest): AsyncGenerator<Event, void, void>;
|
|
13
24
|
}
|
|
14
25
|
export declare const TOOL_FILTER_REQUEST_PROCESSOR: ToolFilterRequestProcessor;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { BaseAgent } from '../agents/base_agent.js';
|
|
7
|
+
import { BasePlugin } from '../plugins/base_plugin.js';
|
|
8
|
+
import { ResumabilityConfig } from './resumability_config.js';
|
|
9
|
+
/**
|
|
10
|
+
* Ensures the provided application name is safe and intuitive.
|
|
11
|
+
*/
|
|
12
|
+
export declare function validateAppName(name: string): void;
|
|
13
|
+
/**
|
|
14
|
+
* A unique symbol to identify ADK App classes.
|
|
15
|
+
* Defined once and shared by all App instances.
|
|
16
|
+
*/
|
|
17
|
+
declare const APP_SIGNATURE_SYMBOL: unique symbol;
|
|
18
|
+
/**
|
|
19
|
+
* Type guard to check if an object is an instance of App.
|
|
20
|
+
* @param obj The object to check.
|
|
21
|
+
* @returns True if the object is an instance of App, false otherwise.
|
|
22
|
+
*/
|
|
23
|
+
export declare function isApp(obj: unknown): obj is App;
|
|
24
|
+
/**
|
|
25
|
+
* Options for initializing an App.
|
|
26
|
+
*/
|
|
27
|
+
export interface AppOptions {
|
|
28
|
+
name: string;
|
|
29
|
+
rootAgent: BaseAgent;
|
|
30
|
+
plugins?: BasePlugin[];
|
|
31
|
+
resumabilityConfig?: ResumabilityConfig;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Represents an LLM-backed agentic application.
|
|
35
|
+
*
|
|
36
|
+
* An `App` is the top-level container for an agentic system powered by LLMs.
|
|
37
|
+
* It manages a root agent (`rootAgent`), which serves as the entry point for execution.
|
|
38
|
+
*
|
|
39
|
+
* Exactly one `rootAgent` must be provided.
|
|
40
|
+
*
|
|
41
|
+
* The `plugins` are application-wide components that provide shared capabilities
|
|
42
|
+
* and services to the entire system.
|
|
43
|
+
*/
|
|
44
|
+
export declare class App {
|
|
45
|
+
readonly [APP_SIGNATURE_SYMBOL] = true;
|
|
46
|
+
readonly name: string;
|
|
47
|
+
readonly rootAgent: BaseAgent | any;
|
|
48
|
+
readonly plugins: BasePlugin[];
|
|
49
|
+
readonly resumabilityConfig?: ResumabilityConfig;
|
|
50
|
+
constructor(options: AppOptions);
|
|
51
|
+
}
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* The configuration of resumability for an application or runner.
|
|
8
|
+
*
|
|
9
|
+
* The "resumability" in ADK refers to the ability to:
|
|
10
|
+
* 1. pause an invocation upon a long-running function call.
|
|
11
|
+
* 2. resume an invocation from the last event, if it's paused or failed midway
|
|
12
|
+
* through.
|
|
13
|
+
*/
|
|
14
|
+
export interface ResumabilityConfig {
|
|
15
|
+
/**
|
|
16
|
+
* Whether the app/runner supports agent resumption.
|
|
17
|
+
* If enabled, resumption routing based on matching function responses will be active.
|
|
18
|
+
*/
|
|
19
|
+
isResumable: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Creates a {@link ResumabilityConfig} with default values.
|
|
23
|
+
*
|
|
24
|
+
* @param params Optional partial {@link ResumabilityConfig} overriding defaults.
|
|
25
|
+
* @returns A merged {@link ResumabilityConfig} object.
|
|
26
|
+
*/
|
|
27
|
+
export declare function createResumabilityConfig(params?: Partial<ResumabilityConfig>): ResumabilityConfig;
|
|
@@ -4,16 +4,11 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { Part } from '@google/genai';
|
|
7
|
+
import { CompositeSessionKey } from '../sessions/session.js';
|
|
7
8
|
/**
|
|
8
9
|
* The parameters for `saveArtifact`.
|
|
9
10
|
*/
|
|
10
|
-
export interface SaveArtifactRequest {
|
|
11
|
-
/** The app name. */
|
|
12
|
-
appName: string;
|
|
13
|
-
/** The user ID. */
|
|
14
|
-
userId: string;
|
|
15
|
-
/** The session ID. */
|
|
16
|
-
sessionId: string;
|
|
11
|
+
export interface SaveArtifactRequest extends CompositeSessionKey {
|
|
17
12
|
/** The filename of the artifact. */
|
|
18
13
|
filename: string;
|
|
19
14
|
/** The artifact to save. */
|
|
@@ -26,13 +21,7 @@ export interface SaveArtifactRequest {
|
|
|
26
21
|
/**
|
|
27
22
|
* The parameters for `loadArtifact`.
|
|
28
23
|
*/
|
|
29
|
-
export interface LoadArtifactRequest {
|
|
30
|
-
/** The app name. */
|
|
31
|
-
appName: string;
|
|
32
|
-
/** The user ID. */
|
|
33
|
-
userId: string;
|
|
34
|
-
/** The session ID. */
|
|
35
|
-
sessionId: string;
|
|
24
|
+
export interface LoadArtifactRequest extends CompositeSessionKey {
|
|
36
25
|
/** The filename of the artifact. */
|
|
37
26
|
filename: string;
|
|
38
27
|
/**
|
|
@@ -44,37 +33,18 @@ export interface LoadArtifactRequest {
|
|
|
44
33
|
/**
|
|
45
34
|
* The parameters for `listArtifactKeys`.
|
|
46
35
|
*/
|
|
47
|
-
export
|
|
48
|
-
/** The app name. */
|
|
49
|
-
appName: string;
|
|
50
|
-
/** The user ID. */
|
|
51
|
-
userId: string;
|
|
52
|
-
/** The session ID. */
|
|
53
|
-
sessionId: string;
|
|
54
|
-
}
|
|
36
|
+
export type ListArtifactKeysRequest = CompositeSessionKey;
|
|
55
37
|
/**
|
|
56
38
|
* The parameters for `deleteArtifact`.
|
|
57
39
|
*/
|
|
58
|
-
export interface DeleteArtifactRequest {
|
|
59
|
-
/** The app name. */
|
|
60
|
-
appName: string;
|
|
61
|
-
/** The user ID. */
|
|
62
|
-
userId: string;
|
|
63
|
-
/** The session ID. */
|
|
64
|
-
sessionId: string;
|
|
40
|
+
export interface DeleteArtifactRequest extends CompositeSessionKey {
|
|
65
41
|
/** The filename of the artifact. */
|
|
66
42
|
filename: string;
|
|
67
43
|
}
|
|
68
44
|
/**
|
|
69
45
|
* The parameters for `listVersions`.
|
|
70
46
|
*/
|
|
71
|
-
export interface ListVersionsRequest {
|
|
72
|
-
/** The app name. */
|
|
73
|
-
appName: string;
|
|
74
|
-
/** The user ID. */
|
|
75
|
-
userId: string;
|
|
76
|
-
/** The session ID. */
|
|
77
|
-
sessionId: string;
|
|
47
|
+
export interface ListVersionsRequest extends CompositeSessionKey {
|
|
78
48
|
/** The filename of the artifact. */
|
|
79
49
|
filename: string;
|
|
80
50
|
}
|
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
import { StorageOptions } from '@google-cloud/storage';
|
|
6
7
|
import { Part } from '@google/genai';
|
|
7
8
|
import { ArtifactVersion, BaseArtifactService, DeleteArtifactRequest, ListArtifactKeysRequest, ListVersionsRequest, LoadArtifactRequest, SaveArtifactRequest } from './base_artifact_service.js';
|
|
8
9
|
export declare class GcsArtifactService implements BaseArtifactService {
|
|
9
10
|
private readonly bucket;
|
|
10
|
-
constructor(bucket: string);
|
|
11
|
+
constructor(bucket: string, options?: StorageOptions);
|
|
11
12
|
saveArtifact(request: SaveArtifactRequest): Promise<number>;
|
|
12
13
|
loadArtifact(request: LoadArtifactRequest): Promise<Part | undefined>;
|
|
13
14
|
listArtifactKeys(request: ListArtifactKeysRequest): Promise<string[]>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Part } from '@google/genai';
|
|
7
|
+
import { ArtifactVersion, BaseArtifactService } from './base_artifact_service.js';
|
|
8
|
+
import { SessionArtifactService, SessionLoadArtifactRequest, SessionSaveArtifactRequest } from './session_artifact_service.js';
|
|
9
|
+
/**
|
|
10
|
+
* A wrapper that scopes a BaseArtifactService to a specific session.
|
|
11
|
+
*/
|
|
12
|
+
export declare class ScopedArtifactService implements SessionArtifactService {
|
|
13
|
+
private readonly delegate;
|
|
14
|
+
private readonly appName;
|
|
15
|
+
private readonly userId;
|
|
16
|
+
private readonly sessionId;
|
|
17
|
+
constructor(delegate: BaseArtifactService, appName: string, userId: string, sessionId: string);
|
|
18
|
+
saveArtifact(request: SessionSaveArtifactRequest): Promise<number>;
|
|
19
|
+
loadArtifact(request: SessionLoadArtifactRequest): Promise<Part | undefined>;
|
|
20
|
+
listArtifactKeys(): Promise<string[]>;
|
|
21
|
+
deleteArtifact(filename: string): Promise<void>;
|
|
22
|
+
listVersions(filename: string): Promise<number[]>;
|
|
23
|
+
listArtifactVersions(filename: string): Promise<ArtifactVersion[]>;
|
|
24
|
+
getArtifactVersion(request: SessionLoadArtifactRequest): Promise<ArtifactVersion | undefined>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Part } from '@google/genai';
|
|
7
|
+
import { ArtifactVersion } from './base_artifact_service.js';
|
|
8
|
+
export interface SessionSaveArtifactRequest {
|
|
9
|
+
filename: string;
|
|
10
|
+
artifact: Part;
|
|
11
|
+
customMetadata?: Record<string, unknown>;
|
|
12
|
+
}
|
|
13
|
+
export interface SessionLoadArtifactRequest {
|
|
14
|
+
filename: string;
|
|
15
|
+
version?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface SessionArtifactService {
|
|
18
|
+
saveArtifact(request: SessionSaveArtifactRequest): Promise<number>;
|
|
19
|
+
loadArtifact(request: SessionLoadArtifactRequest): Promise<Part | undefined>;
|
|
20
|
+
listArtifactKeys(): Promise<string[]>;
|
|
21
|
+
deleteArtifact(filename: string): Promise<void>;
|
|
22
|
+
listVersions(filename: string): Promise<number[]>;
|
|
23
|
+
listArtifactVersions(filename: string): Promise<ArtifactVersion[]>;
|
|
24
|
+
getArtifactVersion(request: SessionLoadArtifactRequest): Promise<ArtifactVersion | undefined>;
|
|
25
|
+
}
|
|
@@ -36,3 +36,14 @@ export declare class OAuth2DiscoveryManager {
|
|
|
36
36
|
*/
|
|
37
37
|
discoverResourceMetadata(resourceUrl: string): Promise<ProtectedResourceMetadata | undefined>;
|
|
38
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Normalises the hostname returned by the WHATWG URL parser so that
|
|
41
|
+
* IPv4-mapped IPv6 addresses (e.g. [::ffff:7f00:1]) are converted to
|
|
42
|
+
* their canonical dotted-decimal IPv4 form (127.0.0.1) before any
|
|
43
|
+
* blocklist checks are applied.
|
|
44
|
+
*
|
|
45
|
+
* Without this step an attacker can bypass every IPv4 block by encoding
|
|
46
|
+
* the address as its IPv4-mapped IPv6 equivalent (CWE-918).
|
|
47
|
+
*/
|
|
48
|
+
export declare function normaliseHostname(raw: string): string;
|
|
49
|
+
export declare function validateDiscoveryUrl(urlStr: string): boolean;
|
package/dist/types/common.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export type { ActiveStreamingToolParams } from './agents/active_streaming_tool.j
|
|
|
8
8
|
export { BaseAgent, isBaseAgent } from './agents/base_agent.js';
|
|
9
9
|
export type { AfterAgentCallback, BaseAgentConfig, BeforeAgentCallback, SingleAgentCallback, } from './agents/base_agent.js';
|
|
10
10
|
export { Context } from './agents/context.js';
|
|
11
|
-
export { functionsExportedForTestingOnly } from './agents/functions.js';
|
|
11
|
+
export { findEventByFunctionCallId, findMatchingFunctionCall, functionsExportedForTestingOnly, } from './agents/functions.js';
|
|
12
12
|
export { InvocationContext } from './agents/invocation_context.js';
|
|
13
13
|
export type { InvocationContextParams } from './agents/invocation_context.js';
|
|
14
14
|
export { LiveRequestQueue } from './agents/live_request_queue.js';
|
|
@@ -22,6 +22,7 @@ export { AgentTransferLlmRequestProcessor } from './agents/processors/agent_tran
|
|
|
22
22
|
export { BaseLlmRequestProcessor, BaseLlmResponseProcessor, } from './agents/processors/base_llm_processor.js';
|
|
23
23
|
export { CONTENT_REQUEST_PROCESSOR, ContentRequestProcessor, } from './agents/processors/content_request_processor.js';
|
|
24
24
|
export { ContextCompactorRequestProcessor } from './agents/processors/context_compactor_request_processor.js';
|
|
25
|
+
export { INTERACTIONS_REQUEST_PROCESSOR, InteractionsRequestProcessor, } from './agents/processors/interactions_request_processor.js';
|
|
25
26
|
export { ReadonlyContext } from './agents/readonly_context.js';
|
|
26
27
|
export { RoutedAgent, isRoutedAgent } from './agents/routed_agent.js';
|
|
27
28
|
export type { AgentRouter, RoutedAgentConfig } from './agents/routed_agent.js';
|
|
@@ -29,11 +30,15 @@ export { StreamingMode } from './agents/run_config.js';
|
|
|
29
30
|
export type { RunConfig } from './agents/run_config.js';
|
|
30
31
|
export { SequentialAgent, isSequentialAgent } from './agents/sequential_agent.js';
|
|
31
32
|
export type { TranscriptionEntry } from './agents/transcription_entry.js';
|
|
33
|
+
export { createResumabilityConfig } from './apps/resumability_config.js';
|
|
34
|
+
export type { ResumabilityConfig } from './apps/resumability_config.js';
|
|
32
35
|
export type { BaseArtifactService, DeleteArtifactRequest, ListArtifactKeysRequest, ListVersionsRequest, LoadArtifactRequest, SaveArtifactRequest, } from './artifacts/base_artifact_service.js';
|
|
33
36
|
export { InMemoryArtifactService } from './artifacts/in_memory_artifact_service.js';
|
|
37
|
+
export type { SessionArtifactService, SessionLoadArtifactRequest, SessionSaveArtifactRequest, } from './artifacts/session_artifact_service.js';
|
|
34
38
|
export { AuthCredentialTypes } from './auth/auth_credential.js';
|
|
35
39
|
export type { AuthCredential, HttpAuth, HttpCredentials, OAuth2Auth, ServiceAccount, ServiceAccountCredential, } from './auth/auth_credential.js';
|
|
36
40
|
export { AuthHandler } from './auth/auth_handler.js';
|
|
41
|
+
export { AUTH_PREPROCESSOR, AuthPreprocessor } from './auth/auth_preprocessor.js';
|
|
37
42
|
export { AuthProviderRegistry } from './auth/auth_provider_registry.js';
|
|
38
43
|
export { OAuthGrantType } from './auth/auth_schemes.js';
|
|
39
44
|
export type { AuthScheme, OpenIdConnectWithConfig } from './auth/auth_schemes.js';
|
|
@@ -52,12 +57,15 @@ export { BaseCodeExecutor } from './code_executors/base_code_executor.js';
|
|
|
52
57
|
export type { ExecuteCodeParams } from './code_executors/base_code_executor.js';
|
|
53
58
|
export { BuiltInCodeExecutor } from './code_executors/built_in_code_executor.js';
|
|
54
59
|
export { CodeExecutionLanguage, FileContentEncoding, type CodeExecutionInput, type CodeExecutionResult, type File, } from './code_executors/code_execution_utils.js';
|
|
60
|
+
export { AgentControlledContextCompactor } from './context/agent_controlled_context_compactor.js';
|
|
55
61
|
export type { BaseContextCompactor } from './context/base_context_compactor.js';
|
|
56
62
|
export type { BaseSummarizer } from './context/summarizers/base_summarizer.js';
|
|
57
63
|
export { LlmSummarizer } from './context/summarizers/llm_summarizer.js';
|
|
58
64
|
export type { LlmSummarizerOptions } from './context/summarizers/llm_summarizer.js';
|
|
59
65
|
export { TokenBasedContextCompactor } from './context/token_based_context_compactor.js';
|
|
60
66
|
export type { TokenBasedContextCompactorOptions } from './context/token_based_context_compactor.js';
|
|
67
|
+
export { TrajectoryThoughtPruningCompactor } from './context/trajectory_thought_pruning_compactor.js';
|
|
68
|
+
export type { TrajectoryThoughtPruningCompactorOptions } from './context/trajectory_thought_pruning_compactor.js';
|
|
61
69
|
export { TruncatingContextCompactor } from './context/truncating_context_compactor.js';
|
|
62
70
|
export type { TruncatingContextCompactorOptions } from './context/truncating_context_compactor.js';
|
|
63
71
|
export { isCompactedEvent } from './events/compacted_event.js';
|
|
@@ -93,13 +101,13 @@ export { PluginManager } from './plugins/plugin_manager.js';
|
|
|
93
101
|
export { InMemoryPolicyEngine, PolicyOutcome, REQUEST_CONFIRMATION_FUNCTION_CALL_NAME, SecurityPlugin, getAskUserConfirmationFunctionCalls, } from './plugins/security_plugin.js';
|
|
94
102
|
export type { BasePolicyEngine, PolicyCheckResult, ToolCallPolicyContext, } from './plugins/security_plugin.js';
|
|
95
103
|
export { InMemoryRunner } from './runner/in_memory_runner.js';
|
|
96
|
-
export { Runner, isRunner } from './runner/runner.js';
|
|
104
|
+
export { Runner, determineAgentForResumption, findEventByLastFunctionResponseId, isRoutableLlmAgent, isRunner, } from './runner/runner.js';
|
|
97
105
|
export type { RunnerConfig } from './runner/runner.js';
|
|
98
106
|
export { BaseSessionService } from './sessions/base_session_service.js';
|
|
99
107
|
export type { AppendEventRequest, CreateSessionRequest, DeleteSessionRequest, GetSessionConfig, GetSessionRequest, ListSessionsRequest, ListSessionsResponse, } from './sessions/base_session_service.js';
|
|
100
108
|
export { InMemorySessionService } from './sessions/in_memory_session_service.js';
|
|
101
109
|
export { createSession } from './sessions/session.js';
|
|
102
|
-
export type { Session } from './sessions/session.js';
|
|
110
|
+
export type { CompositeSessionKey, Session } from './sessions/session.js';
|
|
103
111
|
export { State } from './sessions/state.js';
|
|
104
112
|
export { AgentTool, isAgentTool } from './tools/agent_tool.js';
|
|
105
113
|
export type { AgentToolConfig } from './tools/agent_tool.js';
|
|
@@ -107,6 +115,7 @@ export { BaseTool, isBaseTool } from './tools/base_tool.js';
|
|
|
107
115
|
export type { BaseToolParams, RunAsyncToolRequest, ToolProcessLlmRequest, } from './tools/base_tool.js';
|
|
108
116
|
export { BaseToolset, isBaseToolset } from './tools/base_toolset.js';
|
|
109
117
|
export type { ToolPredicate } from './tools/base_toolset.js';
|
|
118
|
+
export { ConsolidateContextTool } from './tools/consolidate_context_tool.js';
|
|
110
119
|
export { EXIT_LOOP, ExitLoopTool } from './tools/exit_loop_tool.js';
|
|
111
120
|
export { FunctionTool, isFunctionTool } from './tools/function_tool.js';
|
|
112
121
|
export type { ToolExecuteArgument, ToolExecuteFunction, ToolInputParameters, ToolOptions, } from './tools/function_tool.js';
|
|
@@ -121,19 +130,41 @@ export { URL_CONTEXT, UrlContextTool } from './tools/url_context_tool.js';
|
|
|
121
130
|
export { VertexAiSearchTool } from './tools/vertex_ai_search_tool.js';
|
|
122
131
|
export type { DataStoreParams, SearchEngineParams, VertexAISearchConfig, VertexAISearchDataStoreSpec, VertexAiSearchToolParams, } from './tools/vertex_ai_search_tool.js';
|
|
123
132
|
export { VertexRagRetrievalTool } from './tools/vertex_rag_retrieval_tool.js';
|
|
133
|
+
export { getClientLabels, runWithClientLabel } from './utils/client_labels.js';
|
|
124
134
|
export { LogLevel, getLogger, setLogLevel, setLogger } from './utils/logger.js';
|
|
125
135
|
export type { Logger } from './utils/logger.js';
|
|
126
|
-
export { isGemini2OrAbove } from './utils/model_name.js';
|
|
136
|
+
export { isGemini2OrAbove, isGemini3xFlashLive } from './utils/model_name.js';
|
|
127
137
|
export { zodObjectToSchema } from './utils/simple_zod_to_json.js';
|
|
138
|
+
export { Task } from './utils/task.js';
|
|
139
|
+
export type { TaskExecutable } from './utils/task.js';
|
|
128
140
|
export { GoogleLLMVariant } from './utils/variant_utils.js';
|
|
129
141
|
export { version } from './version.js';
|
|
142
|
+
export { GCPSkillRegistry } from './skills/gcp_skill_registry.js';
|
|
143
|
+
export type { GCPSkillRegistryOptions } from './skills/gcp_skill_registry.js';
|
|
144
|
+
export { loadAllSkillsInDir, loadSkillFromDir, loadSkillFromZipBuffer, validateSkillDir, } from './skills/loader.js';
|
|
130
145
|
export type { Frontmatter, Resources, Script, Skill } from './skills/skill.js';
|
|
146
|
+
export type { SkillRegistry } from './skills/skill_registry.js';
|
|
131
147
|
export { ListSkillsTool } from './tools/skill/list_skills_tool.js';
|
|
132
148
|
export { LoadSkillResourceTool } from './tools/skill/load_skill_resource_tool.js';
|
|
133
149
|
export { LoadSkillTool } from './tools/skill/load_skill_tool.js';
|
|
150
|
+
export { SearchSkillsTool } from './tools/skill/search_skills_tool.js';
|
|
134
151
|
export { SkillToolset } from './tools/skill/skill_toolset.js';
|
|
135
152
|
export * from './artifacts/base_artifact_service.js';
|
|
136
153
|
export * from './features/feature_registry.js';
|
|
137
154
|
export * from './memory/base_memory_service.js';
|
|
138
155
|
export * from './sessions/base_session_service.js';
|
|
139
156
|
export * from './tools/base_tool.js';
|
|
157
|
+
export { OpenApiSpecParser } from './tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js';
|
|
158
|
+
export type { OperationEndpoint, ParsedOperation, } from './tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js';
|
|
159
|
+
export { OperationParser } from './tools/openapi_tool/openapi_spec_parser/operation_parser.js';
|
|
160
|
+
export type { ApiParameter } from './tools/openapi_tool/openapi_spec_parser/operation_parser.js';
|
|
161
|
+
export { ToolAuthHandler } from './tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js';
|
|
162
|
+
export type { AuthPreparationResult } from './tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js';
|
|
163
|
+
export { OpenAPIToolset } from './tools/openapi_tool/openapi_toolset.js';
|
|
164
|
+
export { RestApiTool, createRestApiTool, } from './tools/openapi_tool/rest_api_tool.js';
|
|
165
|
+
export * from './apps/app.js';
|
|
166
|
+
export * from './artifacts/base_artifact_service.js';
|
|
167
|
+
export * from './features/feature_registry.js';
|
|
168
|
+
export * from './memory/base_memory_service.js';
|
|
169
|
+
export * from './sessions/base_session_service.js';
|
|
170
|
+
export * from './tools/base_tool.js';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { InvocationContext } from '../agents/invocation_context.js';
|
|
7
|
+
import { ContextCompactionTrigger } from '../plugins/base_plugin.js';
|
|
8
|
+
import { BaseContextCompactor } from './base_context_compactor.js';
|
|
9
|
+
import { BaseSummarizer } from './summarizers/base_summarizer.js';
|
|
10
|
+
/**
|
|
11
|
+
* A context compactor that triggers compaction when the agent explicitly
|
|
12
|
+
* requests it via the `ConsolidateContextTool`.
|
|
13
|
+
*/
|
|
14
|
+
export declare class AgentControlledContextCompactor implements BaseContextCompactor {
|
|
15
|
+
readonly trigger = ContextCompactionTrigger.AgentControlled;
|
|
16
|
+
private readonly summarizer;
|
|
17
|
+
constructor(options: {
|
|
18
|
+
summarizer: BaseSummarizer;
|
|
19
|
+
});
|
|
20
|
+
shouldCompact(invocationContext: InvocationContext): boolean;
|
|
21
|
+
compact(invocationContext: InvocationContext): Promise<void>;
|
|
22
|
+
private clearFlags;
|
|
23
|
+
private getActiveEvents;
|
|
24
|
+
}
|
|
@@ -4,10 +4,13 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { InvocationContext } from '../agents/invocation_context.js';
|
|
7
|
+
import { ContextCompactionTrigger } from '../plugins/base_plugin.js';
|
|
7
8
|
/**
|
|
8
9
|
* Interface for compacting the context history in an agent session.
|
|
9
10
|
*/
|
|
10
11
|
export interface BaseContextCompactor {
|
|
12
|
+
/** The trigger associated with this compactor. */
|
|
13
|
+
readonly trigger?: ContextCompactionTrigger;
|
|
11
14
|
/**
|
|
12
15
|
* Determines whether the context should be compacted.
|
|
13
16
|
*
|
|
@@ -7,8 +7,14 @@ import { CompactedEvent } from '../../events/compacted_event.js';
|
|
|
7
7
|
import { Event } from '../../events/event.js';
|
|
8
8
|
import { BaseLlm } from '../../models/base_llm.js';
|
|
9
9
|
import { BaseSummarizer } from './base_summarizer.js';
|
|
10
|
+
/** Options for constructing an {@link LlmSummarizer}. */
|
|
10
11
|
export interface LlmSummarizerOptions {
|
|
12
|
+
/** The LLM instance used to generate the summary. */
|
|
11
13
|
llm: BaseLlm;
|
|
14
|
+
/**
|
|
15
|
+
* Optional system prompt prepended to the formatted events. Defaults to a
|
|
16
|
+
* built-in summarization prompt when omitted.
|
|
17
|
+
*/
|
|
12
18
|
prompt?: string;
|
|
13
19
|
}
|
|
14
20
|
/**
|
|
@@ -18,6 +24,17 @@ export interface LlmSummarizerOptions {
|
|
|
18
24
|
export declare class LlmSummarizer implements BaseSummarizer {
|
|
19
25
|
private readonly llm;
|
|
20
26
|
private readonly prompt;
|
|
27
|
+
/**
|
|
28
|
+
* @param options - Configuration specifying the LLM and optional prompt.
|
|
29
|
+
*/
|
|
21
30
|
constructor(options: LlmSummarizerOptions);
|
|
31
|
+
/**
|
|
32
|
+
* Summarizes a list of events into a single {@link CompactedEvent} using the
|
|
33
|
+
* configured LLM.
|
|
34
|
+
*
|
|
35
|
+
* @param events - The events to summarize. Must be non-empty.
|
|
36
|
+
* @returns A promise resolving to the compacted representation.
|
|
37
|
+
* @throws {Error} If `events` is empty or the LLM returns no content.
|
|
38
|
+
*/
|
|
22
39
|
summarize(events: Event[]): Promise<CompactedEvent>;
|
|
23
40
|
}
|
|
@@ -7,7 +7,12 @@ import { InvocationContext } from '../agents/invocation_context.js';
|
|
|
7
7
|
import { BaseContextCompactor } from './base_context_compactor.js';
|
|
8
8
|
import { BaseSummarizer } from './summarizers/base_summarizer.js';
|
|
9
9
|
export interface TokenBasedContextCompactorOptions {
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Prompt-size threshold (in tokens) that triggers compaction. Compared
|
|
12
|
+
* against the most recently observed LLM request size
|
|
13
|
+
* (`usageMetadata.promptTokenCount`), falling back to a character-based
|
|
14
|
+
* estimate of the effective contents when no usage metadata is available.
|
|
15
|
+
*/
|
|
11
16
|
tokenThreshold: number;
|
|
12
17
|
/**
|
|
13
18
|
* The minimum number of raw events to keep at the end of the session.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { InvocationContext } from '../agents/invocation_context.js';
|
|
7
|
+
import { BaseContextCompactor } from './base_context_compactor.js';
|
|
8
|
+
/**
|
|
9
|
+
* Options for TrajectoryThoughtPruningCompactor.
|
|
10
|
+
*/
|
|
11
|
+
export interface TrajectoryThoughtPruningCompactorOptions {
|
|
12
|
+
/**
|
|
13
|
+
* The minimum number of raw events to keep at the end of the session.
|
|
14
|
+
* Compaction will not affect these tail events.
|
|
15
|
+
*/
|
|
16
|
+
eventRetentionSize: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A context compactor that prunes thought parts from older events in the session history.
|
|
20
|
+
* Preserves the causal history (actions and observations) while reducing token usage.
|
|
21
|
+
*/
|
|
22
|
+
export declare class TrajectoryThoughtPruningCompactor implements BaseContextCompactor {
|
|
23
|
+
private readonly eventRetentionSize;
|
|
24
|
+
constructor(options: TrajectoryThoughtPruningCompactorOptions);
|
|
25
|
+
shouldCompact(invocationContext: InvocationContext): boolean | Promise<boolean>;
|
|
26
|
+
compact(invocationContext: InvocationContext): void | Promise<void>;
|
|
27
|
+
}
|
|
@@ -82,6 +82,14 @@ export declare function hasTrailingCodeExecutionResult(event: Event): boolean;
|
|
|
82
82
|
* @returns A single string with the combined text.
|
|
83
83
|
*/
|
|
84
84
|
export declare function stringifyContent(event: Event): string;
|
|
85
|
+
/**
|
|
86
|
+
* Returns whether the event contains any thought parts.
|
|
87
|
+
*/
|
|
88
|
+
export declare function hasThoughts(event: Event): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Returns a copy of the event with all thought parts removed.
|
|
91
|
+
*/
|
|
92
|
+
export declare function pruneThoughts(event: Event): Event;
|
|
85
93
|
/**
|
|
86
94
|
* Generates a new unique ID for the event.
|
|
87
95
|
*/
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Copyright 2026 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
import { AuthConfig } from '../auth/auth_tool.js';
|
|
6
7
|
import { ToolConfirmation } from '../tools/tool_confirmation.js';
|
|
7
|
-
type AuthConfig = any;
|
|
8
8
|
/**
|
|
9
9
|
* Represents the actions attached to an event.
|
|
10
10
|
*/
|
|
@@ -89,4 +89,3 @@ export declare function createEventActions(state?: Partial<EventActions>): Event
|
|
|
89
89
|
* @returns A new {@link EventActions} containing the merged result.
|
|
90
90
|
*/
|
|
91
91
|
export declare function mergeEventActions(sources: Array<Partial<EventActions>>, target?: EventActions): EventActions;
|
|
92
|
-
export {};
|
|
@@ -25,6 +25,19 @@ export declare class AgentRegistrySingleMCPToolset extends BaseToolset {
|
|
|
25
25
|
readonly headerProvider?: (context?: ReadonlyContext) => Promise<Record<string, string>> | Record<string, string>;
|
|
26
26
|
readonly authScheme?: AuthScheme;
|
|
27
27
|
readonly authCredential?: AuthCredential;
|
|
28
|
+
/**
|
|
29
|
+
* @param options - Configuration for the MCP toolset.
|
|
30
|
+
* @param options.destinationResourceId - Telemetry identifier injected as
|
|
31
|
+
* `gcp.mcp.server.destination.id` into each resolved tool's custom metadata.
|
|
32
|
+
* @param options.connectionParams - HTTP connection parameters for the MCP server.
|
|
33
|
+
* @param options.toolFilter - Optional predicate or list of tool names to include.
|
|
34
|
+
* When omitted, all tools from the server are returned.
|
|
35
|
+
* @param options.prefix - Optional prefix prepended to each tool name (e.g. `myServer_toolName`).
|
|
36
|
+
* @param options.headerProvider - Optional async function called immediately before each
|
|
37
|
+
* {@link getTools} invocation to supply or refresh request headers (e.g. GCP auth tokens).
|
|
38
|
+
* @param options.authScheme - Optional auth scheme forwarded to each resolved tool.
|
|
39
|
+
* @param options.authCredential - Optional credential forwarded to each resolved tool.
|
|
40
|
+
*/
|
|
28
41
|
constructor(options: {
|
|
29
42
|
destinationResourceId?: string;
|
|
30
43
|
connectionParams: StreamableHTTPConnectionParams;
|
|
@@ -35,8 +48,14 @@ export declare class AgentRegistrySingleMCPToolset extends BaseToolset {
|
|
|
35
48
|
authCredential?: AuthCredential;
|
|
36
49
|
});
|
|
37
50
|
/**
|
|
38
|
-
* Connects to the underlying MCP server, retrieves tool definitions, prefixes
|
|
39
|
-
* and injects destination telemetry metadata.
|
|
51
|
+
* Connects to the underlying MCP server, retrieves tool definitions, prefixes
|
|
52
|
+
* tool names, and injects destination telemetry metadata into each tool.
|
|
53
|
+
*
|
|
54
|
+
* The `headerProvider`, if configured, is invoked immediately before the
|
|
55
|
+
* connection is established so that tokens are always fresh.
|
|
56
|
+
*
|
|
57
|
+
* @param context - Optional readonly agent context passed to the header provider.
|
|
58
|
+
* @returns The resolved and optionally filtered list of {@link MCPTool} instances.
|
|
40
59
|
*/
|
|
41
60
|
getTools(context?: ReadonlyContext): Promise<BaseTool[]>;
|
|
42
61
|
close(): Promise<void>;
|
|
@@ -38,6 +38,16 @@ export interface BaseLlmConnection {
|
|
|
38
38
|
* @param blob The blob to send to the model.
|
|
39
39
|
*/
|
|
40
40
|
sendRealtime(blob: Blob): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Optionally signals the start of user activity (e.g. user begins speaking)
|
|
43
|
+
* for models that support manual activity boundaries.
|
|
44
|
+
*/
|
|
45
|
+
sendActivityStart?(): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Optionally signals the end of user activity (e.g. user finishes speaking)
|
|
48
|
+
* for models that support manual activity boundaries.
|
|
49
|
+
*/
|
|
50
|
+
sendActivityEnd?(): Promise<void>;
|
|
41
51
|
/**
|
|
42
52
|
* Receives the model response using the llm server connection.
|
|
43
53
|
*
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { Blob, Content, Session } from '@google/genai';
|
|
6
|
+
import { Blob, Content, LiveServerMessage, Session } from '@google/genai';
|
|
7
7
|
import { BaseLlmConnection } from './base_llm_connection.js';
|
|
8
8
|
import { LlmResponse } from './llm_response.js';
|
|
9
9
|
/** The Gemini model connection. */
|
|
10
10
|
export declare class GeminiLlmConnection implements BaseLlmConnection {
|
|
11
11
|
private readonly geminiSession;
|
|
12
|
-
|
|
12
|
+
private readonly modelVersion?;
|
|
13
|
+
private readonly messageQueue?;
|
|
14
|
+
constructor(geminiSession: Session, modelVersion?: string | undefined, messageQueue?: AsyncIterable<LiveServerMessage> | undefined);
|
|
13
15
|
/**
|
|
14
16
|
* Sends the conversation history to the gemini model.
|
|
15
17
|
*
|
|
@@ -36,6 +38,14 @@ export declare class GeminiLlmConnection implements BaseLlmConnection {
|
|
|
36
38
|
* @param blob The blob to send to the model.
|
|
37
39
|
*/
|
|
38
40
|
sendRealtime(blob: Blob): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Sends an activity start signal to the model.
|
|
43
|
+
*/
|
|
44
|
+
sendActivityStart(): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Sends an activity end signal to the model.
|
|
47
|
+
*/
|
|
48
|
+
sendActivityEnd(): Promise<void>;
|
|
39
49
|
/**
|
|
40
50
|
* Builds a full text response.
|
|
41
51
|
*
|
|
@@ -43,9 +53,10 @@ export declare class GeminiLlmConnection implements BaseLlmConnection {
|
|
|
43
53
|
* partial.
|
|
44
54
|
*
|
|
45
55
|
* @param text The text to be included in the response.
|
|
56
|
+
* @param isThought Whether the text is a thought.
|
|
57
|
+
* @param groundingMetadata The grounding metadata to include.
|
|
46
58
|
* @returns An LlmResponse containing the full text.
|
|
47
59
|
*/
|
|
48
|
-
private buildFullTextResponse;
|
|
49
60
|
receive(): AsyncGenerator<LlmResponse, void, void>;
|
|
50
61
|
/**
|
|
51
62
|
* Closes the llm server connection.
|