Skip to content

fix(adk): fix lodash ESM import for Node 22 #63

@Kotchanit

Description

@Kotchanit

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch @google/adk@0.2.2 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/@google/adk/dist/esm/agents/llm_agent.js b/node_modules/@google/adk/dist/esm/agents/llm_agent.js
index a73f981..297576e 100644
--- a/node_modules/@google/adk/dist/esm/agents/llm_agent.js
+++ b/node_modules/@google/adk/dist/esm/agents/llm_agent.js
@@ -3,7 +3,7 @@
  * Copyright 2025 Google LLC
  * SPDX-License-Identifier: Apache-2.0
  */
-import { cloneDeep } from "lodash";
+import _ from "lodash";
 import { z } from "zod";
 import { BaseCodeExecutor } from "../code_executors/base_code_executor.js";
 import { BuiltInCodeExecutor } from "../code_executors/built_in_code_executor.js";
@@ -452,7 +452,7 @@ async function* runPreProcessor(invocationContext, llmRequest) {
         buildExecutableCodePart(codeStr)
       ]
     };
-    llmRequest.contents.push(cloneDeep(codeContent));
+    llmRequest.contents.push(_.cloneDeep(codeContent));
     yield createEvent({
       invocationId: invocationContext.invocationId,
       author: agent.name,
@@ -481,7 +481,7 @@ async function* runPreProcessor(invocationContext, llmRequest) {
       codeExecutionResult
     );
     yield executionResultEvent;
-    llmRequest.contents.push(cloneDeep(executionResultEvent.content));
+    llmRequest.contents.push(_.cloneDeep(executionResultEvent.content));
   }
 }
 async function* runPostProcessor(invocationContext, llmResponse) {

This issue body was partially generated by patch-package.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions