@google/adk 0.2.2 → 0.2.4

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 (47) hide show
  1. package/dist/cjs/agents/content_processor_utils.js +2 -2
  2. package/dist/cjs/agents/functions.js +3 -3
  3. package/dist/cjs/agents/llm_agent.js +3 -3
  4. package/dist/cjs/code_executors/built_in_code_executor.js +1 -1
  5. package/dist/cjs/code_executors/code_execution_utils.js +2 -2
  6. package/dist/cjs/code_executors/code_executor_context.js +2 -2
  7. package/dist/cjs/common.js +3 -0
  8. package/dist/cjs/index.js +11 -16
  9. package/dist/cjs/index.js.map +3 -3
  10. package/dist/cjs/runner/runner.js +5 -4
  11. package/dist/cjs/sessions/in_memory_session_service.js +3 -3
  12. package/dist/cjs/utils/model_name.js +24 -4
  13. package/dist/cjs/version.js +2 -2
  14. package/dist/esm/agents/content_processor_utils.js +1 -1
  15. package/dist/esm/agents/functions.js +1 -1
  16. package/dist/esm/agents/llm_agent.js +1 -1
  17. package/dist/esm/code_executors/built_in_code_executor.js +2 -2
  18. package/dist/esm/code_executors/code_execution_utils.js +1 -1
  19. package/dist/esm/code_executors/code_executor_context.js +1 -1
  20. package/dist/esm/common.js +2 -0
  21. package/dist/esm/index.js +11 -16
  22. package/dist/esm/index.js.map +3 -3
  23. package/dist/esm/runner/runner.js +5 -4
  24. package/dist/esm/sessions/in_memory_session_service.js +1 -1
  25. package/dist/esm/utils/model_name.js +23 -3
  26. package/dist/esm/version.js +2 -2
  27. package/dist/types/common.d.ts +1 -0
  28. package/dist/types/utils/model_name.d.ts +1 -1
  29. package/dist/types/version.d.ts +2 -2
  30. package/dist/web/agents/content_processor_utils.js +1 -1
  31. package/dist/web/agents/functions.js +1 -1
  32. package/dist/web/agents/llm_agent.js +1 -1
  33. package/dist/web/code_executors/built_in_code_executor.js +2 -2
  34. package/dist/web/code_executors/code_execution_utils.js +1 -1
  35. package/dist/web/code_executors/code_executor_context.js +1 -1
  36. package/dist/web/common.js +2 -0
  37. package/dist/web/index.js +1 -6
  38. package/dist/web/index.js.map +3 -3
  39. package/dist/web/runner/runner.js +5 -4
  40. package/dist/web/sessions/in_memory_session_service.js +1 -1
  41. package/dist/web/utils/model_name.js +23 -3
  42. package/dist/web/version.js +2 -2
  43. package/package.json +4 -4
  44. package/dist/cjs/utils/deep_clone.js +0 -44
  45. package/dist/esm/utils/deep_clone.js +0 -14
  46. package/dist/types/utils/deep_clone.d.ts +0 -1
  47. package/dist/web/utils/deep_clone.js +0 -14
@@ -30,6 +30,7 @@ import { createEvent, getFunctionCalls } from "../events/event.js";
30
30
  import { createEventActions } from "../events/event_actions.js";
31
31
  import { PluginManager } from "../plugins/plugin_manager.js";
32
32
  import { logger } from "../utils/logger.js";
33
+ import { isGemini2OrAbove } from "../utils/model_name.js";
33
34
  class Runner {
34
35
  constructor(input) {
35
36
  var _a;
@@ -76,12 +77,12 @@ class Runner {
76
77
  }
77
78
  if (runConfig.supportCfc && this.agent instanceof LlmAgent) {
78
79
  const modelName = this.agent.canonicalModel.model;
79
- if (!modelName.startsWith("gemini-2")) {
80
+ if (!isGemini2OrAbove(modelName)) {
80
81
  throw new Error("CFC is not supported for model: ".concat(modelName, " in agent: ").concat(this.agent.name));
81
82
  }
82
- }
83
- if (this.agent instanceof LlmAgent && !(this.agent.codeExecutor instanceof BuiltInCodeExecutor)) {
84
- this.agent.codeExecutor = new BuiltInCodeExecutor();
83
+ if (!(this.agent.codeExecutor instanceof BuiltInCodeExecutor)) {
84
+ this.agent.codeExecutor = new BuiltInCodeExecutor();
85
+ }
85
86
  }
86
87
  const invocationContext = new InvocationContext({
87
88
  artifactService: this.artifactService,
@@ -3,7 +3,7 @@
3
3
  * Copyright 2025 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { cloneDeep } from "lodash";
6
+ import { cloneDeep } from "lodash-es";
7
7
  import { randomUUID } from "../utils/env_aware_utils.js";
8
8
  import { logger } from "../utils/logger.js";
9
9
  import { BaseSessionService } from "./base_session_service.js";
@@ -15,17 +15,37 @@ function isGeminiModel(modelString) {
15
15
  const modelName = extractModelName(modelString);
16
16
  return modelName.startsWith("gemini-");
17
17
  }
18
+ function parseVersion(versionString) {
19
+ if (!/^\d+(\.\d+)*$/.test(versionString)) {
20
+ return { valid: false, major: 0, minor: 0, patch: 0 };
21
+ }
22
+ const parts = versionString.split(".").map((part) => parseInt(part, 10));
23
+ return {
24
+ valid: true,
25
+ major: parts[0],
26
+ minor: parts.length > 1 ? parts[1] : 0,
27
+ patch: parts.length > 2 ? parts[2] : 0
28
+ };
29
+ }
18
30
  function isGemini1Model(modelString) {
19
31
  const modelName = extractModelName(modelString);
20
32
  return modelName.startsWith("gemini-1");
21
33
  }
22
- function isGemini2Model(modelString) {
34
+ function isGemini2OrAbove(modelString) {
35
+ if (!modelString) {
36
+ return false;
37
+ }
23
38
  const modelName = extractModelName(modelString);
24
- return modelName.startsWith("gemini-2");
39
+ if (!modelName.startsWith("gemini-")) {
40
+ return false;
41
+ }
42
+ const versionString = modelName.slice("gemini-".length).split("-", 1)[0];
43
+ const parsedVersion = parseVersion(versionString);
44
+ return parsedVersion.valid && parsedVersion.major >= 2;
25
45
  }
26
46
  export {
27
47
  extractModelName,
28
48
  isGemini1Model,
29
- isGemini2Model,
49
+ isGemini2OrAbove,
30
50
  isGeminiModel
31
51
  };
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2026 Google LLC
3
+ * Copyright 2025 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- const version = "0.2.3";
6
+ const version = "0.2.4";
7
7
  export {
8
8
  version
9
9
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google/adk",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "Google ADK JS",
5
5
  "author": "Google",
6
6
  "license": "Apache-2.0",
@@ -39,14 +39,14 @@
39
39
  "prepublishOnly": "npm run build:bundle"
40
40
  },
41
41
  "dependencies": {
42
- "@google/genai": "1.32.0",
42
+ "@google/genai": "^1.37.0",
43
43
  "@modelcontextprotocol/sdk": "^1.24.0",
44
44
  "google-auth-library": "^10.3.0",
45
- "lodash": "^4.17.21",
45
+ "lodash-es": "^4.17.22",
46
46
  "zod": "3.25.76"
47
47
  },
48
48
  "devDependencies": {
49
- "@types/lodash": "^4.17.21",
49
+ "@types/lodash-es": "^4.17.12",
50
50
  "openapi-types": "^12.1.3"
51
51
  },
52
52
  "peerDependencies": {
@@ -1,44 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 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 deep_clone_exports = {};
26
- __export(deep_clone_exports, {
27
- deepClone: () => deepClone
28
- });
29
- module.exports = __toCommonJS(deep_clone_exports);
30
- /**
31
- * @license
32
- * Copyright 2025 Google LLC
33
- * SPDX-License-Identifier: Apache-2.0
34
- */
35
- function deepClone(obj) {
36
- if (obj === void 0) {
37
- return void 0;
38
- }
39
- return JSON.parse(JSON.stringify(obj));
40
- }
41
- // Annotate the CommonJS export names for ESM import in node:
42
- 0 && (module.exports = {
43
- deepClone
44
- });
@@ -1,14 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- function deepClone(obj) {
7
- if (obj === void 0) {
8
- return void 0;
9
- }
10
- return JSON.parse(JSON.stringify(obj));
11
- }
12
- export {
13
- deepClone
14
- };
@@ -1 +0,0 @@
1
- export declare function deepClone<T>(obj: T): T;
@@ -1,14 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- function deepClone(obj) {
7
- if (obj === void 0) {
8
- return void 0;
9
- }
10
- return JSON.parse(JSON.stringify(obj));
11
- }
12
- export {
13
- deepClone
14
- };