@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
package/dist/cjs/common.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -27,6 +27,7 @@ var common_exports = {};
|
|
|
27
27
|
__export(common_exports, {
|
|
28
28
|
ActiveStreamingTool: () => import_active_streaming_tool.ActiveStreamingTool,
|
|
29
29
|
AgentTool: () => import_agent_tool.AgentTool,
|
|
30
|
+
ApigeeLlm: () => import_apigee_llm.ApigeeLlm,
|
|
30
31
|
AuthCredentialTypes: () => import_auth_credential.AuthCredentialTypes,
|
|
31
32
|
BaseAgent: () => import_base_agent.BaseAgent,
|
|
32
33
|
BaseCodeExecutor: () => import_base_code_executor.BaseCodeExecutor,
|
|
@@ -35,10 +36,12 @@ __export(common_exports, {
|
|
|
35
36
|
BaseLlmRequestProcessor: () => import_base_llm_processor.BaseLlmRequestProcessor,
|
|
36
37
|
BaseLlmResponseProcessor: () => import_base_llm_processor.BaseLlmResponseProcessor,
|
|
37
38
|
BasePlugin: () => import_base_plugin.BasePlugin,
|
|
39
|
+
BaseSessionService: () => import_base_session_service.BaseSessionService,
|
|
38
40
|
BaseTool: () => import_base_tool.BaseTool,
|
|
39
41
|
BaseToolset: () => import_base_toolset.BaseToolset,
|
|
40
42
|
BuiltInCodeExecutor: () => import_built_in_code_executor.BuiltInCodeExecutor,
|
|
41
43
|
CallbackContext: () => import_callback_context.CallbackContext,
|
|
44
|
+
EventType: () => import_structured_events.EventType,
|
|
42
45
|
FunctionTool: () => import_function_tool.FunctionTool,
|
|
43
46
|
GOOGLE_SEARCH: () => import_google_search_tool.GOOGLE_SEARCH,
|
|
44
47
|
Gemini: () => import_google_llm.Gemini,
|
|
@@ -73,9 +76,11 @@ __export(common_exports, {
|
|
|
73
76
|
createEventActions: () => import_event_actions.createEventActions,
|
|
74
77
|
createSession: () => import_session.createSession,
|
|
75
78
|
functionsExportedForTestingOnly: () => import_functions.functionsExportedForTestingOnly,
|
|
79
|
+
geminiInitParams: () => import_google_llm.geminiInitParams,
|
|
76
80
|
getAskUserConfirmationFunctionCalls: () => import_security_plugin.getAskUserConfirmationFunctionCalls,
|
|
77
81
|
getFunctionCalls: () => import_event.getFunctionCalls,
|
|
78
82
|
getFunctionResponses: () => import_event.getFunctionResponses,
|
|
83
|
+
getLogger: () => import_logger.getLogger,
|
|
79
84
|
hasTrailingCodeExecutionResult: () => import_event.hasTrailingCodeExecutionResult,
|
|
80
85
|
isAgentTool: () => import_agent_tool.isAgentTool,
|
|
81
86
|
isBaseAgent: () => import_base_agent.isBaseAgent,
|
|
@@ -90,7 +95,9 @@ __export(common_exports, {
|
|
|
90
95
|
isParallelAgent: () => import_parallel_agent.isParallelAgent,
|
|
91
96
|
isSequentialAgent: () => import_sequential_agent.isSequentialAgent,
|
|
92
97
|
setLogLevel: () => import_logger.setLogLevel,
|
|
98
|
+
setLogger: () => import_logger.setLogger,
|
|
93
99
|
stringifyContent: () => import_event.stringifyContent,
|
|
100
|
+
toStructuredEvents: () => import_structured_events.toStructuredEvents,
|
|
94
101
|
version: () => import_version.version,
|
|
95
102
|
zodObjectToSchema: () => import_simple_zod_to_json.zodObjectToSchema
|
|
96
103
|
});
|
|
@@ -114,8 +121,10 @@ var import_base_code_executor = require("./code_executors/base_code_executor.js"
|
|
|
114
121
|
var import_built_in_code_executor = require("./code_executors/built_in_code_executor.js");
|
|
115
122
|
var import_event = require("./events/event.js");
|
|
116
123
|
var import_event_actions = require("./events/event_actions.js");
|
|
124
|
+
var import_structured_events = require("./events/structured_events.js");
|
|
117
125
|
var import_base_example_provider = require("./examples/base_example_provider.js");
|
|
118
126
|
var import_in_memory_memory_service = require("./memory/in_memory_memory_service.js");
|
|
127
|
+
var import_apigee_llm = require("./models/apigee_llm.js");
|
|
119
128
|
var import_base_llm = require("./models/base_llm.js");
|
|
120
129
|
var import_google_llm = require("./models/google_llm.js");
|
|
121
130
|
var import_registry = require("./models/registry.js");
|
|
@@ -125,6 +134,7 @@ var import_plugin_manager = require("./plugins/plugin_manager.js");
|
|
|
125
134
|
var import_security_plugin = require("./plugins/security_plugin.js");
|
|
126
135
|
var import_in_memory_runner = require("./runner/in_memory_runner.js");
|
|
127
136
|
var import_runner = require("./runner/runner.js");
|
|
137
|
+
var import_base_session_service = require("./sessions/base_session_service.js");
|
|
128
138
|
var import_in_memory_session_service = require("./sessions/in_memory_session_service.js");
|
|
129
139
|
var import_session = require("./sessions/session.js");
|
|
130
140
|
var import_state = require("./sessions/state.js");
|
|
@@ -154,6 +164,7 @@ __reExport(common_exports, require("./tools/base_tool.js"), module.exports);
|
|
|
154
164
|
0 && (module.exports = {
|
|
155
165
|
ActiveStreamingTool,
|
|
156
166
|
AgentTool,
|
|
167
|
+
ApigeeLlm,
|
|
157
168
|
AuthCredentialTypes,
|
|
158
169
|
BaseAgent,
|
|
159
170
|
BaseCodeExecutor,
|
|
@@ -162,10 +173,12 @@ __reExport(common_exports, require("./tools/base_tool.js"), module.exports);
|
|
|
162
173
|
BaseLlmRequestProcessor,
|
|
163
174
|
BaseLlmResponseProcessor,
|
|
164
175
|
BasePlugin,
|
|
176
|
+
BaseSessionService,
|
|
165
177
|
BaseTool,
|
|
166
178
|
BaseToolset,
|
|
167
179
|
BuiltInCodeExecutor,
|
|
168
180
|
CallbackContext,
|
|
181
|
+
EventType,
|
|
169
182
|
FunctionTool,
|
|
170
183
|
GOOGLE_SEARCH,
|
|
171
184
|
Gemini,
|
|
@@ -200,9 +213,11 @@ __reExport(common_exports, require("./tools/base_tool.js"), module.exports);
|
|
|
200
213
|
createEventActions,
|
|
201
214
|
createSession,
|
|
202
215
|
functionsExportedForTestingOnly,
|
|
216
|
+
geminiInitParams,
|
|
203
217
|
getAskUserConfirmationFunctionCalls,
|
|
204
218
|
getFunctionCalls,
|
|
205
219
|
getFunctionResponses,
|
|
220
|
+
getLogger,
|
|
206
221
|
hasTrailingCodeExecutionResult,
|
|
207
222
|
isAgentTool,
|
|
208
223
|
isBaseAgent,
|
|
@@ -217,7 +232,9 @@ __reExport(common_exports, require("./tools/base_tool.js"), module.exports);
|
|
|
217
232
|
isParallelAgent,
|
|
218
233
|
isSequentialAgent,
|
|
219
234
|
setLogLevel,
|
|
235
|
+
setLogger,
|
|
220
236
|
stringifyContent,
|
|
237
|
+
toStructuredEvents,
|
|
221
238
|
version,
|
|
222
239
|
zodObjectToSchema,
|
|
223
240
|
...require("./artifacts/base_artifact_service.js"),
|
package/dist/cjs/events/event.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -30,13 +30,16 @@ __export(event_exports, {
|
|
|
30
30
|
getFunctionResponses: () => getFunctionResponses,
|
|
31
31
|
hasTrailingCodeExecutionResult: () => hasTrailingCodeExecutionResult,
|
|
32
32
|
isFinalResponse: () => isFinalResponse,
|
|
33
|
-
stringifyContent: () => stringifyContent
|
|
33
|
+
stringifyContent: () => stringifyContent,
|
|
34
|
+
transformToCamelCaseEvent: () => transformToCamelCaseEvent,
|
|
35
|
+
transformToSnakeCaseEvent: () => transformToSnakeCaseEvent
|
|
34
36
|
});
|
|
35
37
|
module.exports = __toCommonJS(event_exports);
|
|
38
|
+
var import_object_notation_utils = require("../utils/object_notation_utils.js");
|
|
36
39
|
var import_event_actions = require("./event_actions.js");
|
|
37
40
|
/**
|
|
38
41
|
* @license
|
|
39
|
-
* Copyright
|
|
42
|
+
* Copyright 2026 Google LLC
|
|
40
43
|
* SPDX-License-Identifier: Apache-2.0
|
|
41
44
|
*/
|
|
42
45
|
function createEvent(params = {}) {
|
|
@@ -101,12 +104,34 @@ const ASCII_LETTERS_AND_NUMBERS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRS
|
|
|
101
104
|
function createNewEventId() {
|
|
102
105
|
let id = "";
|
|
103
106
|
for (let i = 0; i < 8; i++) {
|
|
104
|
-
id += ASCII_LETTERS_AND_NUMBERS[Math.floor(
|
|
105
|
-
Math.random() * ASCII_LETTERS_AND_NUMBERS.length
|
|
106
|
-
)];
|
|
107
|
+
id += ASCII_LETTERS_AND_NUMBERS[Math.floor(Math.random() * ASCII_LETTERS_AND_NUMBERS.length)];
|
|
107
108
|
}
|
|
108
109
|
return id;
|
|
109
110
|
}
|
|
111
|
+
const PRESERVE_KEYS_CAMEL_CASE = [
|
|
112
|
+
"actions.stateDelta",
|
|
113
|
+
"actions.artifactDelta",
|
|
114
|
+
"actions.requestedAuthConfigs",
|
|
115
|
+
"actions.requestedToolConfirmations",
|
|
116
|
+
"actions.customMetadata",
|
|
117
|
+
"content.parts.functionCall.args",
|
|
118
|
+
"content.parts.functionResponse.response"
|
|
119
|
+
];
|
|
120
|
+
const PRESERVE_KEYS_SNAKE_CASE = [
|
|
121
|
+
"actions.state_delta",
|
|
122
|
+
"actions.artifact_delta",
|
|
123
|
+
"actions.requested_auth_configs",
|
|
124
|
+
"actions.requested_tool_confirmations",
|
|
125
|
+
"actions.custom_metadata",
|
|
126
|
+
"content.parts.function_call.args",
|
|
127
|
+
"content.parts.function_response.response"
|
|
128
|
+
];
|
|
129
|
+
function transformToCamelCaseEvent(event) {
|
|
130
|
+
return (0, import_object_notation_utils.toCamelCase)(event, PRESERVE_KEYS_SNAKE_CASE);
|
|
131
|
+
}
|
|
132
|
+
function transformToSnakeCaseEvent(event) {
|
|
133
|
+
return (0, import_object_notation_utils.toSnakeCase)(event, PRESERVE_KEYS_CAMEL_CASE);
|
|
134
|
+
}
|
|
110
135
|
// Annotate the CommonJS export names for ESM import in node:
|
|
111
136
|
0 && (module.exports = {
|
|
112
137
|
createEvent,
|
|
@@ -115,5 +140,7 @@ function createNewEventId() {
|
|
|
115
140
|
getFunctionResponses,
|
|
116
141
|
hasTrailingCodeExecutionResult,
|
|
117
142
|
isFinalResponse,
|
|
118
|
-
stringifyContent
|
|
143
|
+
stringifyContent,
|
|
144
|
+
transformToCamelCaseEvent,
|
|
145
|
+
transformToSnakeCaseEvent
|
|
119
146
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -30,7 +30,7 @@ __export(event_actions_exports, {
|
|
|
30
30
|
module.exports = __toCommonJS(event_actions_exports);
|
|
31
31
|
/**
|
|
32
32
|
* @license
|
|
33
|
-
* Copyright
|
|
33
|
+
* Copyright 2026 Google LLC
|
|
34
34
|
* SPDX-License-Identifier: Apache-2.0
|
|
35
35
|
*/
|
|
36
36
|
function createEventActions(state = {}) {
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
"use strict";
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
10
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __export = (target, all) => {
|
|
13
|
+
for (var name in all)
|
|
14
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
15
|
+
};
|
|
16
|
+
var __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
+
for (let key of __getOwnPropNames(from))
|
|
19
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
20
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var structured_events_exports = {};
|
|
26
|
+
__export(structured_events_exports, {
|
|
27
|
+
EventType: () => EventType,
|
|
28
|
+
toStructuredEvents: () => toStructuredEvents
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(structured_events_exports);
|
|
31
|
+
var import_lodash_es = require("lodash-es");
|
|
32
|
+
var import_event = require("./event.js");
|
|
33
|
+
/**
|
|
34
|
+
* @license
|
|
35
|
+
* Copyright 2026 Google LLC
|
|
36
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
37
|
+
*/
|
|
38
|
+
var EventType = /* @__PURE__ */ ((EventType2) => {
|
|
39
|
+
EventType2["THOUGHT"] = "thought";
|
|
40
|
+
EventType2["CONTENT"] = "content";
|
|
41
|
+
EventType2["TOOL_CALL"] = "tool_call";
|
|
42
|
+
EventType2["TOOL_RESULT"] = "tool_result";
|
|
43
|
+
EventType2["CALL_CODE"] = "call_code";
|
|
44
|
+
EventType2["CODE_RESULT"] = "code_result";
|
|
45
|
+
EventType2["ERROR"] = "error";
|
|
46
|
+
EventType2["ACTIVITY"] = "activity";
|
|
47
|
+
EventType2["TOOL_CONFIRMATION"] = "tool_confirmation";
|
|
48
|
+
EventType2["FINISHED"] = "finished";
|
|
49
|
+
return EventType2;
|
|
50
|
+
})(EventType || {});
|
|
51
|
+
function toStructuredEvents(event) {
|
|
52
|
+
var _a, _b;
|
|
53
|
+
const structuredEvents = [];
|
|
54
|
+
if (event.errorCode) {
|
|
55
|
+
structuredEvents.push({
|
|
56
|
+
type: "error" /* ERROR */,
|
|
57
|
+
error: new Error(event.errorMessage || event.errorCode)
|
|
58
|
+
});
|
|
59
|
+
return structuredEvents;
|
|
60
|
+
}
|
|
61
|
+
for (const part of (_b = (_a = event.content) == null ? void 0 : _a.parts) != null ? _b : []) {
|
|
62
|
+
if (part.functionCall && !(0, import_lodash_es.isEmpty)(part.functionCall)) {
|
|
63
|
+
structuredEvents.push({
|
|
64
|
+
type: "tool_call" /* TOOL_CALL */,
|
|
65
|
+
call: part.functionCall
|
|
66
|
+
});
|
|
67
|
+
} else if (part.functionResponse && !(0, import_lodash_es.isEmpty)(part.functionResponse)) {
|
|
68
|
+
structuredEvents.push({
|
|
69
|
+
type: "tool_result" /* TOOL_RESULT */,
|
|
70
|
+
result: part.functionResponse
|
|
71
|
+
});
|
|
72
|
+
} else if (part.executableCode && !(0, import_lodash_es.isEmpty)(part.executableCode)) {
|
|
73
|
+
structuredEvents.push({
|
|
74
|
+
type: "call_code" /* CALL_CODE */,
|
|
75
|
+
code: part.executableCode
|
|
76
|
+
});
|
|
77
|
+
} else if (part.codeExecutionResult && !(0, import_lodash_es.isEmpty)(part.codeExecutionResult)) {
|
|
78
|
+
structuredEvents.push({
|
|
79
|
+
type: "code_result" /* CODE_RESULT */,
|
|
80
|
+
result: part.codeExecutionResult
|
|
81
|
+
});
|
|
82
|
+
} else if (part.text) {
|
|
83
|
+
if (part.thought) {
|
|
84
|
+
structuredEvents.push({ type: "thought" /* THOUGHT */, content: part.text });
|
|
85
|
+
} else {
|
|
86
|
+
structuredEvents.push({ type: "content" /* CONTENT */, content: part.text });
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (event.actions.requestedToolConfirmations && !(0, import_lodash_es.isEmpty)(event.actions.requestedToolConfirmations)) {
|
|
91
|
+
structuredEvents.push({
|
|
92
|
+
type: "tool_confirmation" /* TOOL_CONFIRMATION */,
|
|
93
|
+
confirmations: event.actions.requestedToolConfirmations
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
if ((0, import_event.isFinalResponse)(event)) {
|
|
97
|
+
structuredEvents.push({ type: "finished" /* FINISHED */, output: void 0 });
|
|
98
|
+
}
|
|
99
|
+
return structuredEvents;
|
|
100
|
+
}
|
|
101
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
102
|
+
0 && (module.exports = {
|
|
103
|
+
EventType,
|
|
104
|
+
toStructuredEvents
|
|
105
|
+
});
|