@google/adk 0.3.0 → 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.
Files changed (183) hide show
  1. package/dist/cjs/a2a/part_converter_utils.js +210 -0
  2. package/dist/cjs/agents/active_streaming_tool.js +1 -1
  3. package/dist/cjs/agents/base_agent.js +3 -3
  4. package/dist/cjs/agents/base_llm_processor.js +1 -1
  5. package/dist/cjs/agents/callback_context.js +1 -1
  6. package/dist/cjs/agents/content_processor_utils.js +1 -1
  7. package/dist/cjs/agents/functions.js +2 -1
  8. package/dist/cjs/agents/instructions.js +1 -1
  9. package/dist/cjs/agents/invocation_context.js +1 -1
  10. package/dist/cjs/agents/live_request_queue.js +1 -1
  11. package/dist/cjs/agents/llm_agent.js +58 -40
  12. package/dist/cjs/agents/loop_agent.js +1 -1
  13. package/dist/cjs/agents/parallel_agent.js +1 -1
  14. package/dist/cjs/agents/readonly_context.js +13 -1
  15. package/dist/cjs/agents/run_config.js +2 -1
  16. package/dist/cjs/agents/sequential_agent.js +1 -1
  17. package/dist/cjs/agents/transcription_entry.js +1 -1
  18. package/dist/cjs/artifacts/base_artifact_service.js +1 -1
  19. package/dist/cjs/artifacts/file_artifact_service.js +491 -0
  20. package/dist/cjs/artifacts/gcs_artifact_service.js +127 -48
  21. package/dist/cjs/artifacts/in_memory_artifact_service.js +54 -6
  22. package/dist/cjs/artifacts/registry.js +55 -0
  23. package/dist/cjs/auth/auth_credential.js +1 -1
  24. package/dist/cjs/auth/auth_handler.js +1 -1
  25. package/dist/cjs/auth/auth_schemes.js +1 -1
  26. package/dist/cjs/auth/auth_tool.js +1 -1
  27. package/dist/cjs/auth/credential_service/base_credential_service.js +1 -1
  28. package/dist/cjs/auth/credential_service/in_memory_credential_service.js +1 -1
  29. package/dist/cjs/auth/exchanger/base_credential_exchanger.js +1 -1
  30. package/dist/cjs/auth/exchanger/credential_exchanger_registry.js +1 -1
  31. package/dist/cjs/code_executors/base_code_executor.js +1 -1
  32. package/dist/cjs/code_executors/built_in_code_executor.js +1 -1
  33. package/dist/cjs/code_executors/code_execution_utils.js +1 -1
  34. package/dist/cjs/code_executors/code_executor_context.js +1 -1
  35. package/dist/cjs/common.js +14 -1
  36. package/dist/cjs/events/event.js +33 -4
  37. package/dist/cjs/events/event_actions.js +2 -2
  38. package/dist/cjs/events/structured_events.js +105 -0
  39. package/dist/cjs/examples/base_example_provider.js +1 -1
  40. package/dist/cjs/examples/example.js +1 -1
  41. package/dist/cjs/examples/example_util.js +1 -1
  42. package/dist/cjs/index.js +54 -83
  43. package/dist/cjs/index_web.js +1 -1
  44. package/dist/cjs/memory/base_memory_service.js +1 -1
  45. package/dist/cjs/memory/in_memory_memory_service.js +1 -1
  46. package/dist/cjs/memory/memory_entry.js +1 -1
  47. package/dist/cjs/models/apigee_llm.js +182 -0
  48. package/dist/cjs/models/base_llm.js +1 -1
  49. package/dist/cjs/models/base_llm_connection.js +1 -1
  50. package/dist/cjs/models/gemini_llm_connection.js +1 -1
  51. package/dist/cjs/models/google_llm.js +70 -51
  52. package/dist/cjs/models/llm_request.js +1 -1
  53. package/dist/cjs/models/llm_response.js +1 -1
  54. package/dist/cjs/models/registry.js +3 -1
  55. package/dist/cjs/plugins/base_plugin.js +1 -1
  56. package/dist/cjs/plugins/logging_plugin.js +1 -1
  57. package/dist/cjs/plugins/plugin_manager.js +1 -1
  58. package/dist/cjs/plugins/security_plugin.js +1 -1
  59. package/dist/cjs/runner/in_memory_runner.js +1 -1
  60. package/dist/cjs/runner/runner.js +32 -1
  61. package/dist/cjs/sessions/base_session_service.js +53 -3
  62. package/dist/cjs/sessions/database_session_service.js +364 -0
  63. package/dist/cjs/sessions/db/operations.js +114 -0
  64. package/dist/cjs/sessions/db/schema.js +204 -0
  65. package/dist/cjs/sessions/in_memory_session_service.js +24 -22
  66. package/dist/cjs/sessions/registry.js +49 -0
  67. package/dist/cjs/sessions/session.js +1 -1
  68. package/dist/cjs/sessions/state.js +1 -1
  69. package/dist/cjs/telemetry/google_cloud.js +1 -1
  70. package/dist/cjs/telemetry/setup.js +1 -1
  71. package/dist/cjs/telemetry/tracing.js +1 -1
  72. package/dist/cjs/tools/agent_tool.js +1 -1
  73. package/dist/cjs/tools/base_tool.js +1 -1
  74. package/dist/cjs/tools/base_toolset.js +1 -1
  75. package/dist/cjs/tools/forwarding_artifact_service.js +17 -1
  76. package/dist/cjs/tools/function_tool.js +1 -1
  77. package/dist/cjs/tools/google_search_tool.js +1 -1
  78. package/dist/cjs/tools/long_running_tool.js +1 -1
  79. package/dist/cjs/tools/mcp/mcp_session_manager.js +1 -1
  80. package/dist/cjs/tools/mcp/mcp_tool.js +1 -1
  81. package/dist/cjs/tools/mcp/mcp_toolset.js +1 -1
  82. package/dist/cjs/tools/tool_confirmation.js +1 -1
  83. package/dist/cjs/tools/tool_context.js +1 -1
  84. package/dist/cjs/utils/client_labels.js +1 -1
  85. package/dist/cjs/utils/env_aware_utils.js +10 -1
  86. package/dist/cjs/utils/gemini_schema_util.js +1 -1
  87. package/dist/cjs/utils/logger.js +1 -1
  88. package/dist/cjs/utils/model_name.js +1 -1
  89. package/dist/cjs/utils/object_notation_utils.js +78 -0
  90. package/dist/cjs/utils/simple_zod_to_json.js +1 -1
  91. package/dist/cjs/utils/variant_utils.js +3 -9
  92. package/dist/cjs/version.js +2 -2
  93. package/dist/esm/a2a/part_converter_utils.js +171 -0
  94. package/dist/esm/agents/base_agent.js +2 -2
  95. package/dist/esm/agents/functions.js +1 -0
  96. package/dist/esm/agents/llm_agent.js +58 -40
  97. package/dist/esm/agents/readonly_context.js +12 -0
  98. package/dist/esm/agents/run_config.js +1 -0
  99. package/dist/esm/artifacts/file_artifact_service.js +451 -0
  100. package/dist/esm/artifacts/gcs_artifact_service.js +126 -47
  101. package/dist/esm/artifacts/in_memory_artifact_service.js +51 -4
  102. package/dist/esm/artifacts/registry.js +28 -0
  103. package/dist/esm/common.js +9 -1
  104. package/dist/esm/events/event.js +29 -2
  105. package/dist/esm/events/event_actions.js +1 -1
  106. package/dist/esm/events/structured_events.js +74 -0
  107. package/dist/esm/index.js +18 -88
  108. package/dist/esm/models/apigee_llm.js +152 -0
  109. package/dist/esm/models/google_llm.js +67 -49
  110. package/dist/esm/models/registry.js +2 -0
  111. package/dist/esm/runner/runner.js +31 -0
  112. package/dist/esm/sessions/base_session_service.js +49 -1
  113. package/dist/esm/sessions/database_session_service.js +350 -0
  114. package/dist/esm/sessions/db/operations.js +87 -0
  115. package/dist/esm/sessions/db/schema.js +172 -0
  116. package/dist/esm/sessions/in_memory_session_service.js +23 -21
  117. package/dist/esm/sessions/registry.js +25 -0
  118. package/dist/esm/tools/forwarding_artifact_service.js +16 -0
  119. package/dist/esm/utils/env_aware_utils.js +8 -0
  120. package/dist/esm/utils/object_notation_utils.js +47 -0
  121. package/dist/esm/utils/variant_utils.js +1 -7
  122. package/dist/esm/version.js +1 -1
  123. package/dist/types/a2a/part_converter_utils.d.ts +47 -0
  124. package/dist/types/agents/llm_agent.d.ts +11 -11
  125. package/dist/types/agents/readonly_context.d.ts +8 -0
  126. package/dist/types/agents/run_config.d.ts +6 -0
  127. package/dist/types/artifacts/base_artifact_service.d.ts +31 -0
  128. package/dist/types/artifacts/file_artifact_service.d.ts +43 -0
  129. package/dist/types/artifacts/gcs_artifact_service.d.ts +3 -1
  130. package/dist/types/artifacts/in_memory_artifact_service.d.ts +5 -2
  131. package/dist/types/artifacts/registry.d.ts +7 -0
  132. package/dist/types/common.d.ts +11 -2
  133. package/dist/types/events/event.d.ts +15 -1
  134. package/dist/types/events/event_actions.d.ts +1 -1
  135. package/dist/types/events/structured_events.d.ts +106 -0
  136. package/dist/types/index.d.ts +5 -1
  137. package/dist/types/models/apigee_llm.d.ts +59 -0
  138. package/dist/types/models/google_llm.d.ts +5 -2
  139. package/dist/types/runner/runner.d.ts +15 -0
  140. package/dist/types/sessions/base_session_service.d.ts +20 -0
  141. package/dist/types/sessions/database_session_service.d.ts +31 -0
  142. package/dist/types/sessions/db/operations.d.ts +29 -0
  143. package/dist/types/sessions/db/schema.d.ts +45 -0
  144. package/dist/types/sessions/in_memory_session_service.d.ts +4 -1
  145. package/dist/types/sessions/registry.d.ts +7 -0
  146. package/dist/types/tools/forwarding_artifact_service.d.ts +3 -1
  147. package/dist/types/utils/env_aware_utils.d.ts +7 -0
  148. package/dist/types/utils/object_notation_utils.d.ts +21 -0
  149. package/dist/types/version.d.ts +1 -1
  150. package/dist/web/a2a/part_converter_utils.js +171 -0
  151. package/dist/web/agents/base_agent.js +2 -2
  152. package/dist/web/agents/functions.js +1 -0
  153. package/dist/web/agents/llm_agent.js +79 -59
  154. package/dist/web/agents/readonly_context.js +12 -0
  155. package/dist/web/agents/run_config.js +2 -1
  156. package/dist/web/artifacts/file_artifact_service.js +506 -0
  157. package/dist/web/artifacts/gcs_artifact_service.js +123 -46
  158. package/dist/web/artifacts/in_memory_artifact_service.js +51 -4
  159. package/dist/web/artifacts/registry.js +28 -0
  160. package/dist/web/common.js +9 -1
  161. package/dist/web/events/event.js +29 -2
  162. package/dist/web/events/event_actions.js +1 -1
  163. package/dist/web/events/structured_events.js +74 -0
  164. package/dist/web/index.js +18 -8
  165. package/dist/web/models/apigee_llm.js +219 -0
  166. package/dist/web/models/google_llm.js +67 -46
  167. package/dist/web/models/registry.js +2 -0
  168. package/dist/web/runner/runner.js +33 -0
  169. package/dist/web/sessions/base_session_service.js +49 -1
  170. package/dist/web/sessions/database_session_service.js +368 -0
  171. package/dist/web/sessions/db/operations.js +87 -0
  172. package/dist/web/sessions/db/schema.js +172 -0
  173. package/dist/web/sessions/in_memory_session_service.js +23 -21
  174. package/dist/web/sessions/registry.js +25 -0
  175. package/dist/web/tools/forwarding_artifact_service.js +16 -0
  176. package/dist/web/utils/env_aware_utils.js +8 -0
  177. package/dist/web/utils/object_notation_utils.js +47 -0
  178. package/dist/web/utils/variant_utils.js +1 -7
  179. package/dist/web/version.js +1 -1
  180. package/package.json +13 -4
  181. package/dist/cjs/index.js.map +0 -7
  182. package/dist/esm/index.js.map +0 -7
  183. package/dist/web/index.js.map +0 -7
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2025 Google LLC
3
+ * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
@@ -24,7 +24,8 @@ var __copyProps = (to, from, except, desc) => {
24
24
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
25
  var in_memory_session_service_exports = {};
26
26
  __export(in_memory_session_service_exports, {
27
- InMemorySessionService: () => InMemorySessionService
27
+ InMemorySessionService: () => InMemorySessionService,
28
+ isInMemoryConnectionString: () => isInMemoryConnectionString
28
29
  });
29
30
  module.exports = __toCommonJS(in_memory_session_service_exports);
30
31
  var import_lodash_es = require("lodash-es");
@@ -38,6 +39,9 @@ var import_state = require("./state.js");
38
39
  * Copyright 2025 Google LLC
39
40
  * SPDX-License-Identifier: Apache-2.0
40
41
  */
42
+ function isInMemoryConnectionString(uri) {
43
+ return uri === "memory://";
44
+ }
41
45
  class InMemorySessionService extends import_base_session_service.BaseSessionService {
42
46
  constructor() {
43
47
  super(...arguments);
@@ -55,12 +59,13 @@ class InMemorySessionService extends import_base_session_service.BaseSessionServ
55
59
  */
56
60
  this.appState = {};
57
61
  }
58
- createSession({
62
+ async createSession({
59
63
  appName,
60
64
  userId,
61
65
  state,
62
66
  sessionId
63
67
  }) {
68
+ var _a;
64
69
  const session = (0, import_session.createSession)({
65
70
  id: sessionId || (0, import_env_aware_utils.randomUUID)(),
66
71
  appName,
@@ -76,16 +81,21 @@ class InMemorySessionService extends import_base_session_service.BaseSessionServ
76
81
  this.sessions[appName][userId] = {};
77
82
  }
78
83
  this.sessions[appName][userId][session.id] = session;
79
- return Promise.resolve(
80
- this.mergeState(appName, userId, (0, import_lodash_es.cloneDeep)(session))
84
+ const copiedSession = (0, import_lodash_es.cloneDeep)(session);
85
+ copiedSession.state = (0, import_base_session_service.mergeStates)(
86
+ this.appState[appName],
87
+ (_a = this.userState[appName]) == null ? void 0 : _a[userId],
88
+ copiedSession.state
81
89
  );
90
+ return copiedSession;
82
91
  }
83
- getSession({
92
+ async getSession({
84
93
  appName,
85
94
  userId,
86
95
  sessionId,
87
96
  config
88
97
  }) {
98
+ var _a;
89
99
  if (!this.sessions[appName] || !this.sessions[appName][userId] || !this.sessions[appName][userId][sessionId]) {
90
100
  return Promise.resolve(void 0);
91
101
  }
@@ -110,7 +120,12 @@ class InMemorySessionService extends import_base_session_service.BaseSessionServ
110
120
  }
111
121
  }
112
122
  }
113
- return Promise.resolve(this.mergeState(appName, userId, copiedSession));
123
+ copiedSession.state = (0, import_base_session_service.mergeStates)(
124
+ this.appState[appName],
125
+ (_a = this.userState[appName]) == null ? void 0 : _a[userId],
126
+ copiedSession.state
127
+ );
128
+ return copiedSession;
114
129
  }
115
130
  listSessions({
116
131
  appName,
@@ -187,22 +202,9 @@ class InMemorySessionService extends import_base_session_service.BaseSessionServ
187
202
  storageSession.lastUpdateTime = event.timestamp;
188
203
  return event;
189
204
  }
190
- mergeState(appName, userId, copiedSession) {
191
- if (this.appState[appName]) {
192
- for (const key of Object.keys(this.appState[appName])) {
193
- copiedSession.state[import_state.State.APP_PREFIX + key] = this.appState[appName][key];
194
- }
195
- }
196
- if (!this.userState[appName] || !this.userState[appName][userId]) {
197
- return copiedSession;
198
- }
199
- for (const key of Object.keys(this.userState[appName][userId])) {
200
- copiedSession.state[import_state.State.USER_PREFIX + key] = this.userState[appName][userId][key];
201
- }
202
- return copiedSession;
203
- }
204
205
  }
205
206
  // Annotate the CommonJS export names for ESM import in node:
206
207
  0 && (module.exports = {
207
- InMemorySessionService
208
+ InMemorySessionService,
209
+ isInMemoryConnectionString
208
210
  });
@@ -0,0 +1,49 @@
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 registry_exports = {};
26
+ __export(registry_exports, {
27
+ getSessionServiceFromUri: () => getSessionServiceFromUri
28
+ });
29
+ module.exports = __toCommonJS(registry_exports);
30
+ var import_database_session_service = require("./database_session_service.js");
31
+ var import_in_memory_session_service = require("./in_memory_session_service.js");
32
+ /**
33
+ * @license
34
+ * Copyright 2026 Google LLC
35
+ * SPDX-License-Identifier: Apache-2.0
36
+ */
37
+ function getSessionServiceFromUri(uri) {
38
+ if ((0, import_in_memory_session_service.isInMemoryConnectionString)(uri)) {
39
+ return new import_in_memory_session_service.InMemorySessionService();
40
+ }
41
+ if ((0, import_database_session_service.isDatabaseConnectionString)(uri)) {
42
+ return new import_database_session_service.DatabaseSessionService(uri);
43
+ }
44
+ throw new Error(`Unsupported session service URI: ${uri}`);
45
+ }
46
+ // Annotate the CommonJS export names for ESM import in node:
47
+ 0 && (module.exports = {
48
+ getSessionServiceFromUri
49
+ });
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2025 Google LLC
3
+ * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2025 Google LLC
3
+ * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2025 Google LLC
3
+ * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2025 Google LLC
3
+ * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2025 Google LLC
3
+ * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2025 Google LLC
3
+ * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2025 Google LLC
3
+ * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2025 Google LLC
3
+ * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2025 Google LLC
3
+ * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
@@ -64,6 +64,22 @@ class ForwardingArtifactService {
64
64
  request
65
65
  );
66
66
  }
67
+ listArtifactVersions(request) {
68
+ if (!this.toolContext.invocationContext.artifactService) {
69
+ throw new Error("Artifact service is not initialized.");
70
+ }
71
+ return this.toolContext.invocationContext.artifactService.listArtifactVersions(
72
+ request
73
+ );
74
+ }
75
+ getArtifactVersion(request) {
76
+ if (!this.toolContext.invocationContext.artifactService) {
77
+ throw new Error("Artifact service is not initialized.");
78
+ }
79
+ return this.toolContext.invocationContext.artifactService.getArtifactVersion(
80
+ request
81
+ );
82
+ }
67
83
  }
68
84
  // Annotate the CommonJS export names for ESM import in node:
69
85
  0 && (module.exports = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2025 Google LLC
3
+ * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2025 Google LLC
3
+ * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2025 Google LLC
3
+ * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2025 Google LLC
3
+ * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2025 Google LLC
3
+ * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2025 Google LLC
3
+ * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2025 Google LLC
3
+ * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2025 Google LLC
3
+ * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2025 Google LLC
3
+ * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2025 Google LLC
3
+ * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
@@ -26,6 +26,7 @@ var env_aware_utils_exports = {};
26
26
  __export(env_aware_utils_exports, {
27
27
  base64Decode: () => base64Decode,
28
28
  base64Encode: () => base64Encode,
29
+ getBooleanEnvVar: () => getBooleanEnvVar,
29
30
  isBase64Encoded: () => isBase64Encoded,
30
31
  isBrowser: () => isBrowser,
31
32
  randomUUID: () => randomUUID
@@ -73,10 +74,18 @@ function isBase64Encoded(data) {
73
74
  return false;
74
75
  }
75
76
  }
77
+ function getBooleanEnvVar(envVar) {
78
+ if (!process.env) {
79
+ return false;
80
+ }
81
+ const envVarValue = (process.env[envVar] || "").toLowerCase();
82
+ return ["true", "1"].includes(envVarValue);
83
+ }
76
84
  // Annotate the CommonJS export names for ESM import in node:
77
85
  0 && (module.exports = {
78
86
  base64Decode,
79
87
  base64Encode,
88
+ getBooleanEnvVar,
80
89
  isBase64Encoded,
81
90
  isBrowser,
82
91
  randomUUID
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2025 Google LLC
3
+ * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2025 Google LLC
3
+ * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2025 Google LLC
3
+ * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
@@ -0,0 +1,78 @@
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 object_notation_utils_exports = {};
26
+ __export(object_notation_utils_exports, {
27
+ toCamelCase: () => toCamelCase,
28
+ toSnakeCase: () => toSnakeCase
29
+ });
30
+ module.exports = __toCommonJS(object_notation_utils_exports);
31
+ /**
32
+ * @license
33
+ * Copyright 2026 Google LLC
34
+ * SPDX-License-Identifier: Apache-2.0
35
+ */
36
+ function toCamelCase(obj, preserveKeys = []) {
37
+ return toNotation(obj, toCamelCaseKey, "", preserveKeys);
38
+ }
39
+ function toSnakeCase(obj, preserveKeys = []) {
40
+ return toNotation(obj, toSnakeCaseKey, "", preserveKeys);
41
+ }
42
+ const toCamelCaseKey = (key) => key.replace(
43
+ /_([a-z])/g,
44
+ (_match, letter) => letter.toUpperCase()
45
+ );
46
+ const toSnakeCaseKey = (key) => key.replace(/[A-Z]/g, (g) => "_" + g.toLowerCase());
47
+ function toNotation(obj, converter, parentKey = "", preserveKeys = []) {
48
+ if (Array.isArray(obj)) {
49
+ return obj.map(
50
+ (item) => toNotation(item, converter, parentKey, preserveKeys)
51
+ );
52
+ }
53
+ if (typeof obj === "object" && obj !== null) {
54
+ const source = obj;
55
+ const result = {};
56
+ for (const key of Object.keys(source)) {
57
+ const convertedKey = converter(key);
58
+ const fullPath = parentKey !== "" ? parentKey + "." + key : key;
59
+ if (preserveKeys.includes(fullPath)) {
60
+ result[convertedKey] = source[key];
61
+ } else {
62
+ result[convertedKey] = toNotation(
63
+ source[key],
64
+ converter,
65
+ fullPath,
66
+ preserveKeys
67
+ );
68
+ }
69
+ }
70
+ return result;
71
+ }
72
+ return obj;
73
+ }
74
+ // Annotate the CommonJS export names for ESM import in node:
75
+ 0 && (module.exports = {
76
+ toCamelCase,
77
+ toSnakeCase
78
+ });
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2025 Google LLC
3
+ * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2025 Google LLC
3
+ * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
@@ -28,6 +28,7 @@ __export(variant_utils_exports, {
28
28
  getGoogleLlmVariant: () => getGoogleLlmVariant
29
29
  });
30
30
  module.exports = __toCommonJS(variant_utils_exports);
31
+ var import_env_aware_utils = require("./env_aware_utils.js");
31
32
  /**
32
33
  * @license
33
34
  * Copyright 2025 Google LLC
@@ -39,14 +40,7 @@ var GoogleLLMVariant = /* @__PURE__ */ ((GoogleLLMVariant2) => {
39
40
  return GoogleLLMVariant2;
40
41
  })(GoogleLLMVariant || {});
41
42
  function getGoogleLlmVariant() {
42
- return getBooleanEnvVar("GOOGLE_GENAI_USE_VERTEXAI") ? "VERTEX_AI" /* VERTEX_AI */ : "GEMINI_API" /* GEMINI_API */;
43
- }
44
- function getBooleanEnvVar(envVar) {
45
- if (!process.env) {
46
- return false;
47
- }
48
- const envVarValue = (process.env[envVar] || "").toLowerCase();
49
- return ["true", "1"].includes(envVarValue);
43
+ return (0, import_env_aware_utils.getBooleanEnvVar)("GOOGLE_GENAI_USE_VERTEXAI") ? "VERTEX_AI" /* VERTEX_AI */ : "GEMINI_API" /* GEMINI_API */;
50
44
  }
51
45
  // Annotate the CommonJS export names for ESM import in node:
52
46
  0 && (module.exports = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2025 Google LLC
3
+ * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
@@ -32,7 +32,7 @@ module.exports = __toCommonJS(version_exports);
32
32
  * Copyright 2025 Google LLC
33
33
  * SPDX-License-Identifier: Apache-2.0
34
34
  */
35
- const version = "0.3.0";
35
+ const version = "0.4.0";
36
36
  // Annotate the CommonJS export names for ESM import in node:
37
37
  0 && (module.exports = {
38
38
  version