@google/adk 0.6.1 → 1.1.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/base_agent.js +11 -2
- package/dist/cjs/agents/context.js +1 -0
- package/dist/cjs/agents/functions.js +1 -0
- package/dist/cjs/agents/invocation_context.js +1 -0
- package/dist/cjs/agents/llm_agent.js +70 -13
- package/dist/cjs/agents/loop_agent.js +4 -0
- package/dist/cjs/agents/parallel_agent.js +4 -0
- package/dist/cjs/agents/processors/code_execution_request_processor.js +2 -0
- package/dist/cjs/agents/processors/context_compactor_request_processor.js +9 -0
- package/dist/cjs/agents/processors/tool_filter_request_processor.js +73 -0
- package/dist/cjs/agents/routed_agent.js +97 -0
- package/dist/cjs/auth/auth_handler.js +66 -1
- package/dist/cjs/auth/auth_preprocessor.js +178 -0
- package/dist/cjs/auth/auth_provider_registry.js +61 -0
- package/dist/cjs/auth/base_auth_provider.js +27 -0
- package/dist/cjs/auth/credential_service/session_state_credential_service.js +51 -0
- package/dist/cjs/auth/oauth2/oauth2_credential_exchanger.js +198 -0
- package/dist/cjs/auth/oauth2/oauth2_credential_refresher.js +109 -0
- package/dist/cjs/auth/oauth2/oauth2_discovery.js +186 -0
- package/dist/cjs/auth/oauth2/oauth2_utils.js +119 -0
- package/dist/cjs/auth/refresher/base_credential_refresher.js +44 -0
- package/dist/cjs/auth/refresher/credential_refresher_registry.js +68 -0
- package/dist/cjs/code_executors/base_code_executor.js +9 -5
- package/dist/cjs/code_executors/code_execution_utils.js +19 -0
- package/dist/cjs/code_executors/unsafe_local_code_executor.js +241 -0
- package/dist/cjs/common.js +69 -0
- package/dist/cjs/features/feature_registry.js +141 -0
- package/dist/cjs/index.js +83 -113
- package/dist/cjs/models/apigee_llm.js +2 -2
- package/dist/cjs/models/google_llm.js +18 -53
- package/dist/cjs/models/routed_llm.js +99 -0
- package/dist/cjs/plugins/base_plugin.js +39 -2
- package/dist/cjs/plugins/plugin_manager.js +39 -0
- package/dist/cjs/runner/runner.js +31 -3
- package/dist/cjs/sessions/db/operations.js +3 -10
- package/dist/cjs/skills/loader.js +283 -0
- package/dist/cjs/skills/prompt.js +58 -0
- package/dist/cjs/skills/skill.js +78 -0
- package/dist/cjs/tools/agent_tool.js +11 -4
- package/dist/cjs/tools/mcp/mcp_tool.js +7 -3
- package/dist/cjs/tools/mcp/mcp_toolset.js +1 -1
- package/dist/cjs/tools/skill/list_skills_tool.js +76 -0
- package/dist/cjs/tools/skill/load_skill_resource_tool.js +225 -0
- package/dist/cjs/tools/skill/load_skill_tool.js +108 -0
- package/dist/cjs/tools/skill/run_skill_inline_script_tool.js +146 -0
- package/dist/cjs/tools/skill/run_skill_script_tool.js +224 -0
- package/dist/cjs/tools/skill/skill_toolset.js +163 -0
- package/dist/cjs/tools/url_context_tool.js +73 -0
- package/dist/cjs/tools/vertex_ai_search_tool.js +127 -0
- package/dist/cjs/utils/experimental.js +74 -0
- package/dist/cjs/utils/failover_utils.js +93 -0
- package/dist/cjs/utils/file_extension_utils.js +77 -0
- package/dist/cjs/utils/file_utils.js +94 -0
- package/dist/cjs/utils/model_name.js +8 -2
- package/dist/cjs/utils/streaming_utils.js +333 -0
- package/dist/cjs/version.js +1 -1
- package/dist/esm/a2a/a2a_event.js +2 -0
- package/dist/esm/a2a/a2a_remote_agent.js +2 -0
- package/dist/esm/a2a/a2a_remote_agent_run_processor.js +2 -0
- package/dist/esm/a2a/a2a_remote_agent_utils.js +2 -0
- package/dist/esm/a2a/agent_card.js +2 -0
- package/dist/esm/a2a/agent_executor.js +2 -0
- package/dist/esm/a2a/agent_to_a2a.js +2 -0
- package/dist/esm/a2a/event_converter_utils.js +2 -0
- package/dist/esm/a2a/event_processor_utils.js +2 -0
- package/dist/esm/a2a/executor_context.js +2 -0
- package/dist/esm/a2a/metadata_converter_utils.js +2 -0
- package/dist/esm/a2a/part_converter_utils.js +2 -0
- package/dist/esm/agents/active_streaming_tool.js +2 -0
- package/dist/esm/agents/base_agent.js +13 -2
- package/dist/esm/agents/context.js +3 -0
- package/dist/esm/agents/functions.js +3 -0
- package/dist/esm/agents/instructions.js +2 -0
- package/dist/esm/agents/invocation_context.js +3 -0
- package/dist/esm/agents/live_request_queue.js +2 -0
- package/dist/esm/agents/llm_agent.js +72 -13
- package/dist/esm/agents/loop_agent.js +6 -0
- package/dist/esm/agents/parallel_agent.js +6 -0
- package/dist/esm/agents/processors/agent_transfer_llm_request_processor.js +2 -0
- package/dist/esm/agents/processors/base_llm_processor.js +2 -0
- package/dist/esm/agents/processors/basic_llm_request_processor.js +2 -0
- package/dist/esm/agents/processors/code_execution_request_processor.js +5 -0
- package/dist/esm/agents/processors/content_processor_utils.js +2 -0
- package/dist/esm/agents/processors/content_request_processor.js +2 -0
- package/dist/esm/agents/processors/context_compactor_request_processor.js +11 -0
- package/dist/esm/agents/processors/identity_llm_request_processor.js +2 -0
- package/dist/esm/agents/processors/instructions_llm_request_processor.js +2 -0
- package/dist/esm/agents/processors/request_confirmation_llm_request_processor.js +2 -0
- package/dist/esm/agents/processors/tool_filter_request_processor.js +44 -0
- package/dist/esm/agents/readonly_context.js +2 -0
- package/dist/esm/agents/routed_agent.js +70 -0
- package/dist/esm/agents/run_config.js +2 -0
- package/dist/esm/agents/sequential_agent.js +2 -0
- package/dist/esm/agents/transcription_entry.js +2 -0
- package/dist/esm/artifacts/base_artifact_service.js +2 -0
- package/dist/esm/artifacts/file_artifact_service.js +2 -0
- package/dist/esm/artifacts/gcs_artifact_service.js +2 -0
- package/dist/esm/artifacts/in_memory_artifact_service.js +2 -0
- package/dist/esm/artifacts/registry.js +2 -0
- package/dist/esm/auth/auth_credential.js +2 -0
- package/dist/esm/auth/auth_handler.js +68 -1
- package/dist/esm/auth/auth_preprocessor.js +155 -0
- package/dist/esm/auth/auth_provider_registry.js +33 -0
- package/dist/esm/auth/auth_schemes.js +2 -0
- package/dist/esm/auth/auth_tool.js +2 -0
- package/dist/esm/auth/base_auth_provider.js +7 -0
- package/dist/esm/auth/credential_service/base_credential_service.js +2 -0
- package/dist/esm/auth/credential_service/in_memory_credential_service.js +2 -0
- package/dist/esm/auth/credential_service/session_state_credential_service.js +23 -0
- package/dist/esm/auth/exchanger/base_credential_exchanger.js +2 -0
- package/dist/esm/auth/exchanger/credential_exchanger_registry.js +2 -0
- package/dist/esm/auth/oauth2/oauth2_credential_exchanger.js +177 -0
- package/dist/esm/auth/oauth2/oauth2_credential_refresher.js +85 -0
- package/dist/esm/auth/oauth2/oauth2_discovery.js +156 -0
- package/dist/esm/auth/oauth2/oauth2_utils.js +87 -0
- package/dist/esm/auth/refresher/base_credential_refresher.js +16 -0
- package/dist/esm/auth/refresher/credential_refresher_registry.js +40 -0
- package/dist/esm/code_executors/base_code_executor.js +11 -5
- package/dist/esm/code_executors/built_in_code_executor.js +2 -0
- package/dist/esm/code_executors/code_execution_utils.js +19 -0
- package/dist/esm/code_executors/code_executor_context.js +2 -0
- package/dist/esm/code_executors/unsafe_local_code_executor.js +205 -0
- package/dist/esm/common.js +52 -3
- package/dist/esm/context/base_context_compactor.js +2 -0
- package/dist/esm/context/summarizers/base_summarizer.js +2 -0
- package/dist/esm/context/summarizers/llm_summarizer.js +2 -0
- package/dist/esm/context/token_based_context_compactor.js +2 -0
- package/dist/esm/context/truncating_context_compactor.js +2 -0
- package/dist/esm/events/compacted_event.js +2 -0
- package/dist/esm/events/event.js +2 -0
- package/dist/esm/events/event_actions.js +2 -0
- package/dist/esm/events/structured_events.js +2 -0
- package/dist/esm/examples/base_example_provider.js +2 -0
- package/dist/esm/examples/example.js +2 -0
- package/dist/esm/examples/example_util.js +2 -0
- package/dist/esm/features/feature_registry.js +107 -0
- package/dist/esm/index.js +45 -119
- package/dist/esm/index_web.js +2 -0
- package/dist/esm/memory/base_memory_service.js +2 -0
- package/dist/esm/memory/in_memory_memory_service.js +2 -0
- package/dist/esm/memory/memory_entry.js +2 -0
- package/dist/esm/models/apigee_llm.js +4 -2
- package/dist/esm/models/base_llm.js +2 -0
- package/dist/esm/models/base_llm_connection.js +2 -0
- package/dist/esm/models/gemini_llm_connection.js +2 -0
- package/dist/esm/models/google_llm.js +20 -54
- package/dist/esm/models/llm_request.js +2 -0
- package/dist/esm/models/llm_response.js +2 -0
- package/dist/esm/models/registry.js +2 -0
- package/dist/esm/models/routed_llm.js +73 -0
- package/dist/esm/plugins/base_plugin.js +41 -1
- package/dist/esm/plugins/logging_plugin.js +2 -0
- package/dist/esm/plugins/plugin_manager.js +41 -0
- package/dist/esm/plugins/security_plugin.js +2 -0
- package/dist/esm/runner/in_memory_runner.js +2 -0
- package/dist/esm/runner/runner.js +33 -3
- package/dist/esm/sessions/base_session_service.js +2 -0
- package/dist/esm/sessions/database_session_service.js +2 -0
- package/dist/esm/sessions/db/operations.js +5 -10
- package/dist/esm/sessions/db/schema.js +2 -0
- package/dist/esm/sessions/in_memory_session_service.js +2 -0
- package/dist/esm/sessions/registry.js +2 -0
- package/dist/esm/sessions/session.js +2 -0
- package/dist/esm/sessions/state.js +2 -0
- package/dist/esm/skills/loader.js +244 -0
- package/dist/esm/skills/prompt.js +30 -0
- package/dist/esm/skills/skill.js +49 -0
- package/dist/esm/telemetry/google_cloud.js +2 -0
- package/dist/esm/telemetry/setup.js +2 -0
- package/dist/esm/telemetry/tracing.js +2 -0
- package/dist/esm/tools/agent_tool.js +13 -4
- package/dist/esm/tools/base_tool.js +2 -0
- package/dist/esm/tools/base_toolset.js +2 -0
- package/dist/esm/tools/exit_loop_tool.js +2 -0
- package/dist/esm/tools/forwarding_artifact_service.js +2 -0
- package/dist/esm/tools/function_tool.js +2 -0
- package/dist/esm/tools/google_search_tool.js +2 -0
- package/dist/esm/tools/load_artifacts_tool.js +2 -0
- package/dist/esm/tools/load_memory_tool.js +2 -0
- package/dist/esm/tools/long_running_tool.js +2 -0
- package/dist/esm/tools/mcp/mcp_session_manager.js +2 -0
- package/dist/esm/tools/mcp/mcp_tool.js +9 -3
- package/dist/esm/tools/mcp/mcp_toolset.js +3 -1
- package/dist/esm/tools/preload_memory_tool.js +2 -0
- package/dist/esm/tools/skill/list_skills_tool.js +50 -0
- package/dist/esm/tools/skill/load_skill_resource_tool.js +191 -0
- package/dist/esm/tools/skill/load_skill_tool.js +82 -0
- package/dist/esm/tools/skill/run_skill_inline_script_tool.js +120 -0
- package/dist/esm/tools/skill/run_skill_script_tool.js +192 -0
- package/dist/esm/tools/skill/skill_toolset.js +137 -0
- package/dist/esm/tools/tool_confirmation.js +2 -0
- package/dist/esm/tools/url_context_tool.js +44 -0
- package/dist/esm/tools/vertex_ai_search_tool.js +103 -0
- package/dist/esm/utils/client_labels.js +2 -0
- package/dist/esm/utils/env_aware_utils.js +2 -0
- package/dist/esm/utils/experimental.js +46 -0
- package/dist/esm/utils/failover_utils.js +65 -0
- package/dist/esm/utils/file_extension_utils.js +51 -0
- package/dist/esm/utils/file_utils.js +56 -0
- package/dist/esm/utils/gemini_schema_util.js +2 -0
- package/dist/esm/utils/logger.js +2 -0
- package/dist/esm/utils/model_name.js +8 -1
- package/dist/esm/utils/object_notation_utils.js +2 -0
- package/dist/esm/utils/simple_zod_to_json.js +2 -0
- package/dist/esm/utils/streaming_utils.js +307 -0
- package/dist/esm/utils/variant_utils.js +2 -0
- package/dist/esm/version.js +3 -1
- package/dist/types/agents/context.d.ts +1 -0
- package/dist/types/agents/invocation_context.d.ts +5 -0
- package/dist/types/agents/processors/tool_filter_request_processor.d.ts +14 -0
- package/dist/types/agents/routed_agent.d.ts +59 -0
- package/dist/types/auth/auth_credential.d.ts +17 -0
- package/dist/types/auth/auth_handler.d.ts +1 -0
- package/dist/types/auth/auth_preprocessor.d.ts +12 -0
- package/dist/types/auth/auth_provider_registry.d.ts +27 -0
- package/dist/types/auth/base_auth_provider.d.ts +20 -0
- package/dist/types/auth/credential_service/session_state_credential_service.d.ts +20 -0
- package/dist/types/auth/exchanger/base_credential_exchanger.d.ts +12 -5
- package/dist/types/auth/oauth2/oauth2_credential_exchanger.d.ts +26 -0
- package/dist/types/auth/oauth2/oauth2_credential_refresher.d.ts +29 -0
- package/dist/types/auth/oauth2/oauth2_discovery.d.ts +38 -0
- package/dist/types/auth/oauth2/oauth2_utils.d.ts +56 -0
- package/dist/types/auth/refresher/base_credential_refresher.d.ts +38 -0
- package/dist/types/auth/refresher/credential_refresher_registry.d.ts +27 -0
- package/dist/types/code_executors/base_code_executor.d.ts +4 -4
- package/dist/types/code_executors/code_execution_utils.d.ts +29 -1
- package/dist/types/code_executors/unsafe_local_code_executor.d.ts +48 -0
- package/dist/types/common.d.ts +29 -3
- package/dist/types/features/feature_registry.d.ts +66 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/memory/base_memory_service.d.ts +6 -0
- package/dist/types/memory/memory_entry.d.ts +11 -5
- package/dist/types/models/apigee_llm.d.ts +1 -1
- package/dist/types/models/base_llm.d.ts +1 -1
- package/dist/types/models/google_llm.d.ts +1 -1
- package/dist/types/models/llm_request.d.ts +4 -0
- package/dist/types/models/routed_llm.d.ts +38 -0
- package/dist/types/plugins/base_plugin.d.ts +49 -0
- package/dist/types/plugins/plugin_manager.d.ts +22 -1
- package/dist/types/runner/runner.d.ts +1 -0
- package/dist/types/skills/loader.d.ts +38 -0
- package/dist/types/skills/prompt.d.ts +13 -0
- package/dist/types/skills/skill.d.ts +48 -0
- package/dist/types/tools/mcp/mcp_tool.d.ts +7 -1
- package/dist/types/tools/mcp/mcp_toolset.d.ts +5 -0
- package/dist/types/tools/skill/list_skills_tool.d.ts +14 -0
- package/dist/types/tools/skill/load_skill_resource_tool.d.ts +15 -0
- package/dist/types/tools/skill/load_skill_tool.d.ts +14 -0
- package/dist/types/tools/skill/run_skill_inline_script_tool.d.ts +14 -0
- package/dist/types/tools/skill/run_skill_script_tool.d.ts +17 -0
- package/dist/types/tools/skill/skill_toolset.d.ts +28 -0
- package/dist/types/tools/url_context_tool.d.ts +17 -0
- package/dist/types/tools/vertex_ai_search_tool.d.ts +55 -0
- package/dist/types/utils/experimental.d.ts +11 -0
- package/dist/types/utils/failover_utils.d.ts +17 -0
- package/dist/types/utils/file_extension_utils.d.ts +21 -0
- package/dist/types/utils/file_utils.d.ts +11 -0
- package/dist/types/utils/model_name.d.ts +4 -0
- package/dist/types/utils/streaming_utils.d.ts +40 -0
- package/dist/types/version.d.ts +1 -1
- package/dist/web/a2a/a2a_event.js +2 -0
- package/dist/web/a2a/a2a_remote_agent.js +2 -0
- package/dist/web/a2a/a2a_remote_agent_run_processor.js +2 -0
- package/dist/web/a2a/a2a_remote_agent_utils.js +2 -0
- package/dist/web/a2a/agent_card.js +2 -0
- package/dist/web/a2a/agent_executor.js +2 -0
- package/dist/web/a2a/agent_to_a2a.js +2 -0
- package/dist/web/a2a/event_converter_utils.js +2 -0
- package/dist/web/a2a/event_processor_utils.js +2 -0
- package/dist/web/a2a/executor_context.js +2 -0
- package/dist/web/a2a/metadata_converter_utils.js +2 -0
- package/dist/web/a2a/part_converter_utils.js +2 -0
- package/dist/web/agents/active_streaming_tool.js +2 -0
- package/dist/web/agents/base_agent.js +13 -2
- package/dist/web/agents/context.js +3 -0
- package/dist/web/agents/functions.js +3 -0
- package/dist/web/agents/instructions.js +2 -0
- package/dist/web/agents/invocation_context.js +3 -0
- package/dist/web/agents/live_request_queue.js +2 -0
- package/dist/web/agents/llm_agent.js +72 -13
- package/dist/web/agents/loop_agent.js +6 -0
- package/dist/web/agents/parallel_agent.js +6 -0
- package/dist/web/agents/processors/agent_transfer_llm_request_processor.js +2 -0
- package/dist/web/agents/processors/base_llm_processor.js +2 -0
- package/dist/web/agents/processors/basic_llm_request_processor.js +2 -0
- package/dist/web/agents/processors/code_execution_request_processor.js +5 -0
- package/dist/web/agents/processors/content_processor_utils.js +2 -0
- package/dist/web/agents/processors/content_request_processor.js +2 -0
- package/dist/web/agents/processors/context_compactor_request_processor.js +11 -0
- package/dist/web/agents/processors/identity_llm_request_processor.js +2 -0
- package/dist/web/agents/processors/instructions_llm_request_processor.js +2 -0
- package/dist/web/agents/processors/request_confirmation_llm_request_processor.js +2 -0
- package/dist/web/agents/processors/tool_filter_request_processor.js +62 -0
- package/dist/web/agents/readonly_context.js +2 -0
- package/dist/web/agents/routed_agent.js +138 -0
- package/dist/web/agents/run_config.js +2 -0
- package/dist/web/agents/sequential_agent.js +2 -0
- package/dist/web/agents/transcription_entry.js +2 -0
- package/dist/web/artifacts/base_artifact_service.js +2 -0
- package/dist/web/artifacts/file_artifact_service.js +2 -0
- package/dist/web/artifacts/gcs_artifact_service.js +2 -0
- package/dist/web/artifacts/in_memory_artifact_service.js +2 -0
- package/dist/web/artifacts/registry.js +2 -0
- package/dist/web/auth/auth_credential.js +2 -0
- package/dist/web/auth/auth_handler.js +85 -1
- package/dist/web/auth/auth_preprocessor.js +173 -0
- package/dist/web/auth/auth_provider_registry.js +33 -0
- package/dist/web/auth/auth_schemes.js +2 -0
- package/dist/web/auth/auth_tool.js +2 -0
- package/dist/web/auth/base_auth_provider.js +7 -0
- package/dist/web/auth/credential_service/base_credential_service.js +2 -0
- package/dist/web/auth/credential_service/in_memory_credential_service.js +2 -0
- package/dist/web/auth/credential_service/session_state_credential_service.js +23 -0
- package/dist/web/auth/exchanger/base_credential_exchanger.js +2 -0
- package/dist/web/auth/exchanger/credential_exchanger_registry.js +2 -0
- package/dist/web/auth/oauth2/oauth2_credential_exchanger.js +188 -0
- package/dist/web/auth/oauth2/oauth2_credential_refresher.js +102 -0
- package/dist/web/auth/oauth2/oauth2_discovery.js +156 -0
- package/dist/web/auth/oauth2/oauth2_utils.js +87 -0
- package/dist/web/auth/refresher/base_credential_refresher.js +16 -0
- package/dist/web/auth/refresher/credential_refresher_registry.js +40 -0
- package/dist/web/code_executors/base_code_executor.js +11 -5
- package/dist/web/code_executors/built_in_code_executor.js +2 -0
- package/dist/web/code_executors/code_execution_utils.js +19 -0
- package/dist/web/code_executors/code_executor_context.js +2 -0
- package/dist/web/code_executors/unsafe_local_code_executor.js +203 -0
- package/dist/web/common.js +52 -3
- package/dist/web/context/base_context_compactor.js +2 -0
- package/dist/web/context/summarizers/base_summarizer.js +2 -0
- package/dist/web/context/summarizers/llm_summarizer.js +2 -0
- package/dist/web/context/token_based_context_compactor.js +2 -0
- package/dist/web/context/truncating_context_compactor.js +2 -0
- package/dist/web/events/compacted_event.js +2 -0
- package/dist/web/events/event.js +2 -0
- package/dist/web/events/event_actions.js +2 -0
- package/dist/web/events/structured_events.js +2 -0
- package/dist/web/examples/base_example_provider.js +2 -0
- package/dist/web/examples/example.js +2 -0
- package/dist/web/examples/example_util.js +2 -0
- package/dist/web/features/feature_registry.js +107 -0
- package/dist/web/index.js +45 -13
- package/dist/web/index_web.js +2 -0
- package/dist/web/memory/base_memory_service.js +2 -0
- package/dist/web/memory/in_memory_memory_service.js +2 -0
- package/dist/web/memory/memory_entry.js +2 -0
- package/dist/web/models/apigee_llm.js +4 -2
- package/dist/web/models/base_llm.js +2 -0
- package/dist/web/models/base_llm_connection.js +2 -0
- package/dist/web/models/gemini_llm_connection.js +2 -0
- package/dist/web/models/google_llm.js +37 -59
- package/dist/web/models/llm_request.js +2 -0
- package/dist/web/models/llm_response.js +2 -0
- package/dist/web/models/registry.js +2 -0
- package/dist/web/models/routed_llm.js +122 -0
- package/dist/web/plugins/base_plugin.js +41 -1
- package/dist/web/plugins/logging_plugin.js +2 -0
- package/dist/web/plugins/plugin_manager.js +41 -0
- package/dist/web/plugins/security_plugin.js +2 -0
- package/dist/web/runner/in_memory_runner.js +2 -0
- package/dist/web/runner/runner.js +33 -3
- package/dist/web/sessions/base_session_service.js +2 -0
- package/dist/web/sessions/database_session_service.js +2 -0
- package/dist/web/sessions/db/operations.js +5 -10
- package/dist/web/sessions/db/schema.js +2 -0
- package/dist/web/sessions/in_memory_session_service.js +2 -0
- package/dist/web/sessions/registry.js +2 -0
- package/dist/web/sessions/session.js +2 -0
- package/dist/web/sessions/state.js +2 -0
- package/dist/web/skills/loader.js +262 -0
- package/dist/web/skills/prompt.js +30 -0
- package/dist/web/skills/skill.js +67 -0
- package/dist/web/telemetry/google_cloud.js +2 -0
- package/dist/web/telemetry/setup.js +2 -0
- package/dist/web/telemetry/tracing.js +2 -0
- package/dist/web/tools/agent_tool.js +13 -4
- package/dist/web/tools/base_tool.js +2 -0
- package/dist/web/tools/base_toolset.js +2 -0
- package/dist/web/tools/exit_loop_tool.js +2 -0
- package/dist/web/tools/forwarding_artifact_service.js +2 -0
- package/dist/web/tools/function_tool.js +2 -0
- package/dist/web/tools/google_search_tool.js +2 -0
- package/dist/web/tools/load_artifacts_tool.js +2 -0
- package/dist/web/tools/load_memory_tool.js +2 -0
- package/dist/web/tools/long_running_tool.js +2 -0
- package/dist/web/tools/mcp/mcp_session_manager.js +2 -0
- package/dist/web/tools/mcp/mcp_tool.js +9 -3
- package/dist/web/tools/mcp/mcp_toolset.js +3 -1
- package/dist/web/tools/preload_memory_tool.js +2 -0
- package/dist/web/tools/skill/list_skills_tool.js +50 -0
- package/dist/web/tools/skill/load_skill_resource_tool.js +191 -0
- package/dist/web/tools/skill/load_skill_tool.js +82 -0
- package/dist/web/tools/skill/run_skill_inline_script_tool.js +120 -0
- package/dist/web/tools/skill/run_skill_script_tool.js +190 -0
- package/dist/web/tools/skill/skill_toolset.js +123 -0
- package/dist/web/tools/tool_confirmation.js +2 -0
- package/dist/web/tools/url_context_tool.js +44 -0
- package/dist/web/tools/vertex_ai_search_tool.js +103 -0
- package/dist/web/utils/client_labels.js +2 -0
- package/dist/web/utils/env_aware_utils.js +2 -0
- package/dist/web/utils/experimental.js +46 -0
- package/dist/web/utils/failover_utils.js +96 -0
- package/dist/web/utils/file_extension_utils.js +51 -0
- package/dist/web/utils/file_utils.js +74 -0
- package/dist/web/utils/gemini_schema_util.js +2 -0
- package/dist/web/utils/logger.js +2 -0
- package/dist/web/utils/model_name.js +8 -1
- package/dist/web/utils/object_notation_utils.js +2 -0
- package/dist/web/utils/simple_zod_to_json.js +2 -0
- package/dist/web/utils/streaming_utils.js +325 -0
- package/dist/web/utils/variant_utils.js +2 -0
- package/dist/web/version.js +3 -1
- package/package.json +20 -18
- package/dist/cjs/index.js.map +0 -7
- package/dist/esm/index.js.map +0 -7
- package/dist/web/index.js.map +0 -7
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import {createRequire as topLevelCreateRequire} from 'module';
|
|
2
|
+
const require = topLevelCreateRequire(import.meta.url);
|
|
1
3
|
/**
|
|
2
4
|
* @license
|
|
3
5
|
* Copyright 2025 Google LLC
|
|
@@ -5,12 +7,12 @@
|
|
|
5
7
|
*/
|
|
6
8
|
import {
|
|
7
9
|
createPartFromText,
|
|
8
|
-
FinishReason,
|
|
9
10
|
GoogleGenAI
|
|
10
11
|
} from "@google/genai";
|
|
11
12
|
import { getBooleanEnvVar, isBrowser } from "../utils/env_aware_utils.js";
|
|
12
13
|
import { logger } from "../utils/logger.js";
|
|
13
14
|
import { GoogleLLMVariant } from "../utils/variant_utils.js";
|
|
15
|
+
import { StreamingResponseAggregator } from "../utils/streaming_utils.js";
|
|
14
16
|
import { BaseLlm } from "./base_llm.js";
|
|
15
17
|
import { GeminiLlmConnection } from "./gemini_llm_connection.js";
|
|
16
18
|
import { createLlmResponse } from "./llm_response.js";
|
|
@@ -55,80 +57,44 @@ class Gemini extends BaseLlm {
|
|
|
55
57
|
* @param stream bool = false, whether to do streaming call.
|
|
56
58
|
* @yields LlmResponse: The model response.
|
|
57
59
|
*/
|
|
58
|
-
async *generateContentAsync(llmRequest, stream = false) {
|
|
59
|
-
var _a, _b, _c
|
|
60
|
+
async *generateContentAsync(llmRequest, stream = false, abortSignal) {
|
|
61
|
+
var _a, _b, _c;
|
|
60
62
|
this.preprocessRequest(llmRequest);
|
|
61
63
|
this.maybeAppendUserContent(llmRequest);
|
|
62
64
|
logger.info(
|
|
63
|
-
`Sending out request, model: ${llmRequest.model}, backend: ${this.apiBackend}, stream: ${stream}`
|
|
65
|
+
`Sending out request, model: ${(_a = llmRequest.model) != null ? _a : this.model}, backend: ${this.apiBackend}, stream: ${stream}`
|
|
64
66
|
);
|
|
65
|
-
if (
|
|
67
|
+
if (!llmRequest.config) {
|
|
68
|
+
llmRequest.config = {};
|
|
69
|
+
}
|
|
70
|
+
if (llmRequest.config.httpOptions) {
|
|
66
71
|
llmRequest.config.httpOptions.headers = {
|
|
67
72
|
...llmRequest.config.httpOptions.headers,
|
|
68
73
|
...this.trackingHeaders
|
|
69
74
|
};
|
|
70
75
|
}
|
|
76
|
+
if (abortSignal) {
|
|
77
|
+
llmRequest.config.abortSignal = abortSignal;
|
|
78
|
+
}
|
|
71
79
|
if (stream) {
|
|
72
80
|
const streamResult = await this.apiClient.models.generateContentStream({
|
|
73
81
|
model: (_b = llmRequest.model) != null ? _b : this.model,
|
|
74
82
|
contents: llmRequest.contents,
|
|
75
83
|
config: llmRequest.config
|
|
76
84
|
});
|
|
77
|
-
|
|
78
|
-
let text = "";
|
|
79
|
-
let usageMetadata;
|
|
80
|
-
let lastResponse;
|
|
85
|
+
const aggregator = new StreamingResponseAggregator();
|
|
81
86
|
for await (const response of streamResult) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
usageMetadata = llmResponse.usageMetadata;
|
|
85
|
-
const firstPart = (_d = (_c = llmResponse.content) == null ? void 0 : _c.parts) == null ? void 0 : _d[0];
|
|
86
|
-
if (firstPart == null ? void 0 : firstPart.text) {
|
|
87
|
-
if ("thought" in firstPart && firstPart.thought) {
|
|
88
|
-
thoughtText += firstPart.text;
|
|
89
|
-
} else {
|
|
90
|
-
text += firstPart.text;
|
|
91
|
-
}
|
|
92
|
-
llmResponse.partial = true;
|
|
93
|
-
} else if ((thoughtText || text) && (!firstPart || !firstPart.inlineData)) {
|
|
94
|
-
const parts = [];
|
|
95
|
-
if (thoughtText) {
|
|
96
|
-
parts.push({ text: thoughtText, thought: true });
|
|
97
|
-
}
|
|
98
|
-
if (text) {
|
|
99
|
-
parts.push(createPartFromText(text));
|
|
100
|
-
}
|
|
101
|
-
yield {
|
|
102
|
-
content: {
|
|
103
|
-
role: "model",
|
|
104
|
-
parts
|
|
105
|
-
},
|
|
106
|
-
usageMetadata: llmResponse.usageMetadata
|
|
107
|
-
};
|
|
108
|
-
thoughtText = "";
|
|
109
|
-
text = "";
|
|
87
|
+
for await (const llmResponse of aggregator.processResponse(response)) {
|
|
88
|
+
yield llmResponse;
|
|
110
89
|
}
|
|
111
|
-
yield llmResponse;
|
|
112
90
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
parts.push({ text: thoughtText, thought: true });
|
|
117
|
-
}
|
|
118
|
-
if (text) {
|
|
119
|
-
parts.push({ text });
|
|
120
|
-
}
|
|
121
|
-
yield {
|
|
122
|
-
content: {
|
|
123
|
-
role: "model",
|
|
124
|
-
parts
|
|
125
|
-
},
|
|
126
|
-
usageMetadata
|
|
127
|
-
};
|
|
91
|
+
const finalResponse = aggregator.close();
|
|
92
|
+
if (finalResponse) {
|
|
93
|
+
yield finalResponse;
|
|
128
94
|
}
|
|
129
95
|
} else {
|
|
130
96
|
const response = await this.apiClient.models.generateContent({
|
|
131
|
-
model: (
|
|
97
|
+
model: (_c = llmRequest.model) != null ? _c : this.model,
|
|
132
98
|
contents: llmRequest.contents,
|
|
133
99
|
config: llmRequest.config
|
|
134
100
|
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import {createRequire as topLevelCreateRequire} from 'module';
|
|
2
|
+
const require = topLevelCreateRequire(import.meta.url);
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
6
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
7
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8
|
+
if (decorator = decorators[i])
|
|
9
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
10
|
+
if (kind && result) __defProp(target, key, result);
|
|
11
|
+
return result;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* @license
|
|
15
|
+
* Copyright 2026 Google LLC
|
|
16
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
17
|
+
*/
|
|
18
|
+
import { BaseLlm } from "./base_llm.js";
|
|
19
|
+
import { experimental } from "../utils/experimental.js";
|
|
20
|
+
import { runWithRouting } from "../utils/failover_utils.js";
|
|
21
|
+
import { logger } from "../utils/logger.js";
|
|
22
|
+
let RoutedLlm = class extends BaseLlm {
|
|
23
|
+
constructor({
|
|
24
|
+
models,
|
|
25
|
+
router,
|
|
26
|
+
modelName = "routed-llm"
|
|
27
|
+
}) {
|
|
28
|
+
const modelsMap = Array.isArray(models) ? Object.fromEntries(models.map((m) => [m.model, m])) : models;
|
|
29
|
+
const modelNames = Object.entries(modelsMap).map(
|
|
30
|
+
([name, model]) => `${name} (${model.model})`
|
|
31
|
+
);
|
|
32
|
+
const computedName = `RoutedLlm[${modelNames.join(", ")}]`;
|
|
33
|
+
super({ model: modelName === "routed-llm" ? computedName : modelName });
|
|
34
|
+
this.models = modelsMap;
|
|
35
|
+
this.router = router;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Generates content by delegating to the selected model.
|
|
39
|
+
*/
|
|
40
|
+
async *generateContentAsync(llmRequest, stream) {
|
|
41
|
+
logger.info(`Routing request via ${this.model}`);
|
|
42
|
+
yield* runWithRouting(
|
|
43
|
+
this.models,
|
|
44
|
+
llmRequest,
|
|
45
|
+
this.router,
|
|
46
|
+
(model) => model.generateContentAsync(llmRequest, stream)
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Creates a live connection to the LLM by delegating to the selected model.
|
|
51
|
+
* This live connection cannot be switched mid-stream, it is tied to the model
|
|
52
|
+
* selected at the time of connection.
|
|
53
|
+
*/
|
|
54
|
+
async connect(llmRequest) {
|
|
55
|
+
const generator = runWithRouting(
|
|
56
|
+
this.models,
|
|
57
|
+
llmRequest,
|
|
58
|
+
this.router,
|
|
59
|
+
(model) => model.connect(llmRequest)
|
|
60
|
+
);
|
|
61
|
+
const result = await generator.next();
|
|
62
|
+
if (result.done || result.value === void 0) {
|
|
63
|
+
throw new Error("Failed to establish connection: No connection yielded.");
|
|
64
|
+
}
|
|
65
|
+
return result.value;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
RoutedLlm = __decorateClass([
|
|
69
|
+
experimental
|
|
70
|
+
], RoutedLlm);
|
|
71
|
+
export {
|
|
72
|
+
RoutedLlm
|
|
73
|
+
};
|
|
@@ -1,8 +1,26 @@
|
|
|
1
|
+
import {createRequire as topLevelCreateRequire} from 'module';
|
|
2
|
+
const require = topLevelCreateRequire(import.meta.url);
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
6
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
7
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8
|
+
if (decorator = decorators[i])
|
|
9
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
10
|
+
if (kind && result) __defProp(target, key, result);
|
|
11
|
+
return result;
|
|
12
|
+
};
|
|
1
13
|
/**
|
|
2
14
|
* @license
|
|
3
15
|
* Copyright 2025 Google LLC
|
|
4
16
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
17
|
*/
|
|
18
|
+
import { experimental } from "../utils/experimental.js";
|
|
19
|
+
var ContextCompactionTrigger = /* @__PURE__ */ ((ContextCompactionTrigger2) => {
|
|
20
|
+
ContextCompactionTrigger2["Manual"] = "Manual";
|
|
21
|
+
ContextCompactionTrigger2["Auto"] = "Auto";
|
|
22
|
+
return ContextCompactionTrigger2;
|
|
23
|
+
})(ContextCompactionTrigger || {});
|
|
6
24
|
class BasePlugin {
|
|
7
25
|
/**
|
|
8
26
|
* Initializes the plugin.
|
|
@@ -157,6 +175,18 @@ class BasePlugin {
|
|
|
157
175
|
async onModelErrorCallback(params) {
|
|
158
176
|
return;
|
|
159
177
|
}
|
|
178
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
179
|
+
async beforeToolSelection(params) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
183
|
+
async beforeContextCompaction(params) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
187
|
+
async afterContextCompaction(params) {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
160
190
|
/**
|
|
161
191
|
* Callback executed before a tool is called.
|
|
162
192
|
*
|
|
@@ -223,6 +253,16 @@ class BasePlugin {
|
|
|
223
253
|
return;
|
|
224
254
|
}
|
|
225
255
|
}
|
|
256
|
+
__decorateClass([
|
|
257
|
+
experimental
|
|
258
|
+
], BasePlugin.prototype, "beforeToolSelection", 1);
|
|
259
|
+
__decorateClass([
|
|
260
|
+
experimental
|
|
261
|
+
], BasePlugin.prototype, "beforeContextCompaction", 1);
|
|
262
|
+
__decorateClass([
|
|
263
|
+
experimental
|
|
264
|
+
], BasePlugin.prototype, "afterContextCompaction", 1);
|
|
226
265
|
export {
|
|
227
|
-
BasePlugin
|
|
266
|
+
BasePlugin,
|
|
267
|
+
ContextCompactionTrigger
|
|
228
268
|
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import {createRequire as topLevelCreateRequire} from 'module';
|
|
2
|
+
const require = topLevelCreateRequire(import.meta.url);
|
|
1
3
|
/**
|
|
2
4
|
* @license
|
|
3
5
|
* Copyright 2025 Google LLC
|
|
@@ -151,6 +153,45 @@ class PluginManager {
|
|
|
151
153
|
"afterAgentCallback"
|
|
152
154
|
);
|
|
153
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* Runs the `beforeToolSelection` for all plugins.
|
|
158
|
+
*/
|
|
159
|
+
async runBeforeToolSelection({
|
|
160
|
+
callbackContext,
|
|
161
|
+
tools
|
|
162
|
+
}) {
|
|
163
|
+
return await this.runCallbacks(
|
|
164
|
+
this.plugins,
|
|
165
|
+
(plugin) => plugin.beforeToolSelection({ callbackContext, tools }),
|
|
166
|
+
"beforeToolSelection"
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Runs the `beforeContextCompaction` for all plugins.
|
|
171
|
+
*/
|
|
172
|
+
async runBeforeContextCompaction({
|
|
173
|
+
invocationContext,
|
|
174
|
+
trigger
|
|
175
|
+
}) {
|
|
176
|
+
await this.runCallbacks(
|
|
177
|
+
this.plugins,
|
|
178
|
+
(plugin) => plugin.beforeContextCompaction({ invocationContext, trigger }),
|
|
179
|
+
"beforeContextCompaction"
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Runs the `afterContextCompaction` for all plugins.
|
|
184
|
+
*/
|
|
185
|
+
async runAfterContextCompaction({
|
|
186
|
+
invocationContext,
|
|
187
|
+
trigger
|
|
188
|
+
}) {
|
|
189
|
+
await this.runCallbacks(
|
|
190
|
+
this.plugins,
|
|
191
|
+
(plugin) => plugin.afterContextCompaction({ invocationContext, trigger }),
|
|
192
|
+
"afterContextCompaction"
|
|
193
|
+
);
|
|
194
|
+
}
|
|
154
195
|
/**
|
|
155
196
|
* Runs the `beforeToolCallback` for all plugins.
|
|
156
197
|
*/
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import {createRequire as topLevelCreateRequire} from 'module';
|
|
2
|
+
const require = topLevelCreateRequire(import.meta.url);
|
|
1
3
|
/**
|
|
2
4
|
* @license
|
|
3
5
|
* Copyright 2025 Google LLC
|
|
@@ -96,12 +98,15 @@ class Runner {
|
|
|
96
98
|
ctx,
|
|
97
99
|
this,
|
|
98
100
|
async function* () {
|
|
99
|
-
var _a2;
|
|
101
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
100
102
|
const session = await this.sessionService.getSession({
|
|
101
103
|
appName: this.appName,
|
|
102
104
|
userId,
|
|
103
105
|
sessionId
|
|
104
106
|
});
|
|
107
|
+
if ((_a2 = params.abortSignal) == null ? void 0 : _a2.aborted) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
105
110
|
if (!session) {
|
|
106
111
|
if (!this.appName) {
|
|
107
112
|
throw new Error(
|
|
@@ -131,17 +136,21 @@ class Runner {
|
|
|
131
136
|
session,
|
|
132
137
|
userContent: newMessage,
|
|
133
138
|
runConfig,
|
|
134
|
-
pluginManager: this.pluginManager
|
|
139
|
+
pluginManager: this.pluginManager,
|
|
140
|
+
abortSignal: params.abortSignal
|
|
135
141
|
});
|
|
136
142
|
const pluginUserMessage = await this.pluginManager.runOnUserMessageCallback({
|
|
137
143
|
userMessage: newMessage,
|
|
138
144
|
invocationContext
|
|
139
145
|
});
|
|
146
|
+
if ((_b = params.abortSignal) == null ? void 0 : _b.aborted) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
140
149
|
if (pluginUserMessage) {
|
|
141
150
|
newMessage = pluginUserMessage;
|
|
142
151
|
}
|
|
143
152
|
if (newMessage) {
|
|
144
|
-
if (!((
|
|
153
|
+
if (!((_c = newMessage.parts) == null ? void 0 : _c.length)) {
|
|
145
154
|
throw new Error("No parts in the newMessage.");
|
|
146
155
|
}
|
|
147
156
|
if (runConfig.saveInputBlobsAsArtifacts) {
|
|
@@ -151,6 +160,9 @@ class Runner {
|
|
|
151
160
|
session.id,
|
|
152
161
|
newMessage
|
|
153
162
|
);
|
|
163
|
+
if ((_d = params.abortSignal) == null ? void 0 : _d.aborted) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
154
166
|
}
|
|
155
167
|
await this.sessionService.appendEvent({
|
|
156
168
|
session,
|
|
@@ -161,6 +173,9 @@ class Runner {
|
|
|
161
173
|
content: newMessage
|
|
162
174
|
})
|
|
163
175
|
});
|
|
176
|
+
if ((_e = params.abortSignal) == null ? void 0 : _e.aborted) {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
164
179
|
}
|
|
165
180
|
invocationContext.agent = this.determineAgentForResumption(
|
|
166
181
|
session,
|
|
@@ -170,6 +185,9 @@ class Runner {
|
|
|
170
185
|
const beforeRunCallbackResponse = await this.pluginManager.runBeforeRunCallback({
|
|
171
186
|
invocationContext
|
|
172
187
|
});
|
|
188
|
+
if ((_f = params.abortSignal) == null ? void 0 : _f.aborted) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
173
191
|
if (beforeRunCallbackResponse) {
|
|
174
192
|
const earlyExitEvent = createEvent({
|
|
175
193
|
invocationId: invocationContext.invocationId,
|
|
@@ -180,11 +198,17 @@ class Runner {
|
|
|
180
198
|
session,
|
|
181
199
|
event: earlyExitEvent
|
|
182
200
|
});
|
|
201
|
+
if ((_g = params.abortSignal) == null ? void 0 : _g.aborted) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
183
204
|
yield earlyExitEvent;
|
|
184
205
|
} else {
|
|
185
206
|
for await (const event of invocationContext.agent.runAsync(
|
|
186
207
|
invocationContext
|
|
187
208
|
)) {
|
|
209
|
+
if ((_h = params.abortSignal) == null ? void 0 : _h.aborted) {
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
188
212
|
if (!event.partial) {
|
|
189
213
|
await this.sessionService.appendEvent({ session, event });
|
|
190
214
|
}
|
|
@@ -192,6 +216,9 @@ class Runner {
|
|
|
192
216
|
invocationContext,
|
|
193
217
|
event
|
|
194
218
|
});
|
|
219
|
+
if ((_i = params.abortSignal) == null ? void 0 : _i.aborted) {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
195
222
|
if (modifiedEvent) {
|
|
196
223
|
yield modifiedEvent;
|
|
197
224
|
} else {
|
|
@@ -199,6 +226,9 @@ class Runner {
|
|
|
199
226
|
}
|
|
200
227
|
}
|
|
201
228
|
await this.pluginManager.runAfterRunCallback({ invocationContext });
|
|
229
|
+
if ((_j = params.abortSignal) == null ? void 0 : _j.aborted) {
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
202
232
|
}
|
|
203
233
|
}
|
|
204
234
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import {createRequire as topLevelCreateRequire} from 'module';
|
|
2
|
+
const require = topLevelCreateRequire(import.meta.url);
|
|
1
3
|
var __create = Object.create;
|
|
2
4
|
var __defProp = Object.defineProperty;
|
|
3
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -51,23 +53,16 @@ async function getConnectionOptionsFromUri(uri) {
|
|
|
51
53
|
} else {
|
|
52
54
|
throw new Error(`Unsupported database URI: ${uri}`);
|
|
53
55
|
}
|
|
54
|
-
if (uri
|
|
56
|
+
if (uri.startsWith("sqlite://")) {
|
|
55
57
|
return {
|
|
56
58
|
entities: ENTITIES,
|
|
57
|
-
dbName: ":memory:",
|
|
59
|
+
dbName: uri === "sqlite://:memory:" ? ":memory:" : uri.substring("sqlite://".length),
|
|
58
60
|
driver
|
|
59
61
|
};
|
|
60
62
|
}
|
|
61
|
-
const { host, port, username, password, pathname } = new URL(uri);
|
|
62
|
-
const hostName = host.split(":")[0];
|
|
63
|
-
const dbName = uri.startsWith("sqlite://") ? uri.substring("sqlite://".length) : pathname.slice(1);
|
|
64
63
|
return {
|
|
65
64
|
entities: ENTITIES,
|
|
66
|
-
|
|
67
|
-
host: hostName,
|
|
68
|
-
port: port ? parseInt(port) : void 0,
|
|
69
|
-
user: username,
|
|
70
|
-
password,
|
|
65
|
+
clientUrl: uri,
|
|
71
66
|
driver
|
|
72
67
|
};
|
|
73
68
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import {createRequire as topLevelCreateRequire} from 'module';
|
|
2
|
+
const require = topLevelCreateRequire(import.meta.url);
|
|
1
3
|
var __defProp = Object.defineProperty;
|
|
2
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
5
|
var __decorateClass = (decorators, target, key, kind) => {
|