@google/adk 2.1.0 → 2.2.1

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 (166) hide show
  1. package/dist/cjs/a2a/agent_card.js +8 -0
  2. package/dist/cjs/a2a/agent_executor.js +8 -3
  3. package/dist/cjs/a2a/event_converter_utils.js +5 -1
  4. package/dist/cjs/a2a/metadata_converter_utils.js +2 -1
  5. package/dist/cjs/agents/llm_agent.js +15 -1
  6. package/dist/cjs/agents/processors/content_processor_utils.js +10 -2
  7. package/dist/cjs/agents/processors/nl_planning_processor.js +114 -0
  8. package/dist/cjs/artifacts/gcs_artifact_service.js +13 -7
  9. package/dist/cjs/auth/auth_credential.js +12 -2
  10. package/dist/cjs/code_executors/code_execution_utils.js +3 -3
  11. package/dist/cjs/common.js +63 -0
  12. package/dist/cjs/events/abort_events.js +135 -0
  13. package/dist/cjs/events/internal_metadata.js +131 -0
  14. package/dist/cjs/examples/example.js +92 -0
  15. package/dist/cjs/examples/example_util.js +28 -4
  16. package/dist/cjs/examples/index.js +39 -0
  17. package/dist/cjs/examples/vertex_ai_example_store.js +39 -0
  18. package/dist/cjs/index.js +46 -0
  19. package/dist/cjs/memory/vertex_ai_memory_bank_service.js +17 -5
  20. package/dist/cjs/models/base_llm.js +1 -6
  21. package/dist/cjs/models/chrome_prompt_llm.js +16 -2
  22. package/dist/cjs/models/chrome_prompt_utils.js +54 -2
  23. package/dist/cjs/models/gemini_continuation.js +232 -0
  24. package/dist/cjs/models/gemini_llm_connection.js +5 -4
  25. package/dist/cjs/planners/base_planner.js +56 -0
  26. package/dist/cjs/planners/built_in_planner.js +85 -0
  27. package/dist/cjs/planners/plan_re_act_planner.js +172 -0
  28. package/dist/cjs/plugins/base_plugin.js +46 -61
  29. package/dist/cjs/plugins/debug_logging_plugin.js +653 -0
  30. package/dist/cjs/plugins/plugin_manager.js +1 -1
  31. package/dist/cjs/plugins/tool_call_integrity_plugin.js +364 -0
  32. package/dist/cjs/runner/runner.js +17 -3
  33. package/dist/cjs/tools/example_tool.js +1 -1
  34. package/dist/cjs/tools/mcp/mcp_session_manager.js +14 -8
  35. package/dist/cjs/tools/openapi_tool/auth/auth_helpers.js +281 -2
  36. package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.js +15 -1
  37. package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/base_auth_credential_exchanger.js +70 -0
  38. package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +120 -0
  39. package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.js +10 -10
  40. package/dist/cjs/tools/openapi_tool/common/common.js +139 -0
  41. package/dist/cjs/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js +11 -6
  42. package/dist/cjs/tools/openapi_tool/openapi_spec_parser/operation_parser.js +73 -13
  43. package/dist/cjs/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js +146 -34
  44. package/dist/cjs/tools/openapi_tool/openapi_toolset.js +14 -2
  45. package/dist/cjs/tools/openapi_tool/rest_api_tool.js +90 -28
  46. package/dist/cjs/tools/skill/skill_toolset.js +2 -0
  47. package/dist/cjs/tools/tool_context.js +41 -0
  48. package/dist/cjs/tools/webmcp/index.js +37 -0
  49. package/dist/cjs/tools/webmcp/webmcp_tool.js +156 -0
  50. package/dist/cjs/tools/webmcp/webmcp_toolset.js +116 -0
  51. package/dist/cjs/tools/webmcp/webmcp_types.js +50 -0
  52. package/dist/cjs/utils/case_utils.js +52 -2
  53. package/dist/cjs/utils/client_labels.js +67 -0
  54. package/dist/cjs/utils/gemini_schema_util.js +103 -3
  55. package/dist/cjs/utils/hash_utils.js +73 -0
  56. package/dist/cjs/utils/live_connection_utils.js +10 -9
  57. package/dist/cjs/utils/model_name.js +17 -2
  58. package/dist/cjs/utils/simple_zod_to_json.js +5 -0
  59. package/dist/cjs/version.js +1 -1
  60. package/dist/esm/a2a/agent_card.js +8 -0
  61. package/dist/esm/a2a/agent_executor.js +8 -3
  62. package/dist/esm/a2a/event_converter_utils.js +5 -1
  63. package/dist/esm/a2a/metadata_converter_utils.js +2 -1
  64. package/dist/esm/agents/llm_agent.js +18 -1
  65. package/dist/esm/agents/processors/content_processor_utils.js +10 -2
  66. package/dist/esm/agents/processors/nl_planning_processor.js +87 -0
  67. package/dist/esm/artifacts/gcs_artifact_service.js +13 -7
  68. package/dist/esm/auth/auth_credential.js +11 -1
  69. package/dist/esm/code_executors/code_execution_utils.js +3 -3
  70. package/dist/esm/common.js +58 -2
  71. package/dist/esm/events/abort_events.js +110 -0
  72. package/dist/esm/events/internal_metadata.js +97 -0
  73. package/dist/esm/examples/example.js +85 -0
  74. package/dist/esm/examples/example_util.js +25 -3
  75. package/dist/esm/examples/index.js +11 -0
  76. package/dist/esm/examples/vertex_ai_example_store.js +11 -0
  77. package/dist/esm/index.js +51 -1
  78. package/dist/esm/memory/vertex_ai_memory_bank_service.js +17 -5
  79. package/dist/esm/models/base_llm.js +2 -7
  80. package/dist/esm/models/chrome_prompt_llm.js +20 -3
  81. package/dist/esm/models/chrome_prompt_utils.js +51 -2
  82. package/dist/esm/models/gemini_continuation.js +205 -0
  83. package/dist/esm/models/gemini_llm_connection.js +6 -5
  84. package/dist/esm/planners/base_planner.js +28 -0
  85. package/dist/esm/planners/built_in_planner.js +57 -0
  86. package/dist/esm/planners/plan_re_act_planner.js +145 -0
  87. package/dist/esm/plugins/base_plugin.js +46 -61
  88. package/dist/esm/plugins/debug_logging_plugin.js +615 -0
  89. package/dist/esm/plugins/plugin_manager.js +1 -1
  90. package/dist/esm/plugins/tool_call_integrity_plugin.js +339 -0
  91. package/dist/esm/runner/runner.js +20 -3
  92. package/dist/esm/tools/example_tool.js +1 -1
  93. package/dist/esm/tools/mcp/mcp_session_manager.js +14 -8
  94. package/dist/esm/tools/openapi_tool/auth/auth_helpers.js +272 -1
  95. package/dist/esm/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.js +15 -1
  96. package/dist/esm/tools/openapi_tool/auth/credential_exchangers/base_auth_credential_exchanger.js +43 -0
  97. package/dist/esm/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +93 -0
  98. package/dist/esm/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.js +10 -12
  99. package/dist/esm/tools/openapi_tool/common/common.js +112 -0
  100. package/dist/esm/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js +11 -6
  101. package/dist/esm/tools/openapi_tool/openapi_spec_parser/operation_parser.js +80 -13
  102. package/dist/esm/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.js +146 -33
  103. package/dist/esm/tools/openapi_tool/openapi_toolset.js +14 -2
  104. package/dist/esm/tools/openapi_tool/rest_api_tool.js +89 -28
  105. package/dist/esm/tools/skill/skill_toolset.js +2 -0
  106. package/dist/esm/tools/tool_context.js +15 -0
  107. package/dist/esm/tools/webmcp/index.js +10 -0
  108. package/dist/esm/tools/webmcp/webmcp_tool.js +131 -0
  109. package/dist/esm/tools/webmcp/webmcp_toolset.js +89 -0
  110. package/dist/esm/tools/webmcp/webmcp_types.js +22 -0
  111. package/dist/esm/utils/case_utils.js +49 -1
  112. package/dist/esm/utils/client_labels.js +65 -0
  113. package/dist/esm/utils/gemini_schema_util.js +102 -3
  114. package/dist/esm/utils/hash_utils.js +45 -0
  115. package/dist/esm/utils/live_connection_utils.js +11 -10
  116. package/dist/esm/utils/model_name.js +15 -2
  117. package/dist/esm/utils/simple_zod_to_json.js +5 -0
  118. package/dist/esm/version.js +1 -1
  119. package/dist/types/agents/llm_agent.d.ts +12 -1
  120. package/dist/types/agents/processors/nl_planning_processor.d.ts +30 -0
  121. package/dist/types/auth/auth_credential.d.ts +9 -0
  122. package/dist/types/common.d.ts +19 -4
  123. package/dist/types/events/abort_events.d.ts +43 -0
  124. package/dist/types/events/internal_metadata.d.ts +78 -0
  125. package/dist/types/examples/base_example_provider.d.ts +2 -2
  126. package/dist/types/examples/example.d.ts +75 -0
  127. package/dist/types/examples/example_util.d.ts +13 -2
  128. package/dist/types/examples/index.d.ts +18 -0
  129. package/dist/types/examples/vertex_ai_example_store.d.ts +7 -0
  130. package/dist/types/index.d.ts +12 -3
  131. package/dist/types/memory/memory_entry.d.ts +15 -0
  132. package/dist/types/memory/vertex_ai_memory_bank_service.d.ts +9 -0
  133. package/dist/types/models/chrome_prompt_utils.d.ts +29 -0
  134. package/dist/types/models/gemini_continuation.d.ts +59 -0
  135. package/dist/types/planners/base_planner.d.ts +50 -0
  136. package/dist/types/planners/built_in_planner.d.ts +53 -0
  137. package/dist/types/planners/plan_re_act_planner.d.ts +21 -0
  138. package/dist/types/plugins/base_plugin.d.ts +52 -52
  139. package/dist/types/plugins/debug_logging_plugin.d.ts +157 -0
  140. package/dist/types/plugins/tool_call_integrity_plugin.d.ts +116 -0
  141. package/dist/types/skills/skill_registry.d.ts +8 -0
  142. package/dist/types/tools/openapi_tool/auth/auth_helpers.d.ts +110 -1
  143. package/dist/types/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.d.ts +32 -2
  144. package/dist/types/tools/openapi_tool/auth/credential_exchangers/base_auth_credential_exchanger.d.ts +35 -0
  145. package/dist/types/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.d.ts +54 -0
  146. package/dist/types/tools/openapi_tool/common/common.d.ts +60 -0
  147. package/dist/types/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.d.ts +7 -0
  148. package/dist/types/tools/openapi_tool/openapi_spec_parser/operation_parser.d.ts +56 -2
  149. package/dist/types/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.d.ts +73 -5
  150. package/dist/types/tools/openapi_tool/openapi_toolset.d.ts +11 -0
  151. package/dist/types/tools/openapi_tool/rest_api_tool.d.ts +42 -8
  152. package/dist/types/tools/tool_context.d.ts +19 -0
  153. package/dist/types/tools/webmcp/index.d.ts +12 -0
  154. package/dist/types/tools/webmcp/webmcp_tool.d.ts +47 -0
  155. package/dist/types/tools/webmcp/webmcp_toolset.d.ts +67 -0
  156. package/dist/types/tools/webmcp/webmcp_types.d.ts +69 -0
  157. package/dist/types/utils/case_utils.d.ts +36 -0
  158. package/dist/types/utils/client_labels.d.ts +33 -0
  159. package/dist/types/utils/gemini_schema_util.d.ts +13 -0
  160. package/dist/types/utils/hash_utils.d.ts +25 -0
  161. package/dist/types/utils/logger.d.ts +10 -2
  162. package/dist/types/utils/model_name.d.ts +30 -2
  163. package/dist/types/version.d.ts +1 -1
  164. package/dist/web/index_web.js +113 -80
  165. package/dist/web/index_web.js.map +4 -4
  166. package/package.json +8 -2
@@ -0,0 +1,57 @@
1
+ import {createRequire as topLevelCreateRequire} from 'module';
2
+ const require = topLevelCreateRequire(import.meta.url);
3
+ var __defProp = Object.defineProperty;
4
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
+ /**
6
+ * @license
7
+ * Copyright 2026 Google LLC
8
+ * SPDX-License-Identifier: Apache-2.0
9
+ */
10
+ var _a, _b;
11
+ import { BasePlanner } from "./base_planner.js";
12
+ const BUILT_IN_PLANNER_SIGNATURE_SYMBOL = /* @__PURE__ */ Symbol.for(
13
+ "google.adk.builtInPlanner"
14
+ );
15
+ function isBuiltInPlanner(obj) {
16
+ return typeof obj === "object" && obj !== null && BUILT_IN_PLANNER_SIGNATURE_SYMBOL in obj && obj[BUILT_IN_PLANNER_SIGNATURE_SYMBOL] === true;
17
+ }
18
+ __name(isBuiltInPlanner, "isBuiltInPlanner");
19
+ const _BuiltInPlanner = class _BuiltInPlanner extends (_b = BasePlanner, _a = BUILT_IN_PLANNER_SIGNATURE_SYMBOL, _b) {
20
+ /**
21
+ * Initializes the built-in planner.
22
+ *
23
+ * @param options.thinkingConfig Config for model built-in thinking features.
24
+ * An error will be returned if this field is set for models that don't
25
+ * support thinking.
26
+ */
27
+ constructor(options) {
28
+ super();
29
+ /** A unique symbol to identify ADK built-in planner class. */
30
+ this[_a] = true;
31
+ this.thinkingConfig = options.thinkingConfig;
32
+ }
33
+ /**
34
+ * Applies the thinking config to the LLM request.
35
+ *
36
+ * @param llmRequest The LLM request to apply the thinking config to.
37
+ */
38
+ applyThinkingConfig(llmRequest) {
39
+ var _a2;
40
+ if (this.thinkingConfig) {
41
+ llmRequest.config = (_a2 = llmRequest.config) != null ? _a2 : {};
42
+ llmRequest.config.thinkingConfig = this.thinkingConfig;
43
+ }
44
+ }
45
+ buildPlanningInstruction(_readonlyContext, _llmRequest) {
46
+ return void 0;
47
+ }
48
+ processPlanningResponse(_callbackContext, _responseParts) {
49
+ return void 0;
50
+ }
51
+ };
52
+ __name(_BuiltInPlanner, "BuiltInPlanner");
53
+ let BuiltInPlanner = _BuiltInPlanner;
54
+ export {
55
+ BuiltInPlanner,
56
+ isBuiltInPlanner
57
+ };
@@ -0,0 +1,145 @@
1
+ import {createRequire as topLevelCreateRequire} from 'module';
2
+ const require = topLevelCreateRequire(import.meta.url);
3
+ var __defProp = Object.defineProperty;
4
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
+ /**
6
+ * @license
7
+ * Copyright 2026 Google LLC
8
+ * SPDX-License-Identifier: Apache-2.0
9
+ */
10
+ import { BasePlanner } from "./base_planner.js";
11
+ const PLANNING_TAG = "/*PLANNING*/";
12
+ const REPLANNING_TAG = "/*REPLANNING*/";
13
+ const REASONING_TAG = "/*REASONING*/";
14
+ const ACTION_TAG = "/*ACTION*/";
15
+ const FINAL_ANSWER_TAG = "/*FINAL_ANSWER*/";
16
+ const THOUGHT_PREFIX_TAGS = [
17
+ PLANNING_TAG,
18
+ REASONING_TAG,
19
+ ACTION_TAG,
20
+ REPLANNING_TAG
21
+ ];
22
+ const _PlanReActPlanner = class _PlanReActPlanner extends BasePlanner {
23
+ buildPlanningInstruction(_readonlyContext, _llmRequest) {
24
+ return buildNlPlannerInstruction();
25
+ }
26
+ processPlanningResponse(_callbackContext, responseParts) {
27
+ if (!responseParts || responseParts.length === 0) {
28
+ return void 0;
29
+ }
30
+ const preservedParts = [];
31
+ let firstFcPartIndex = -1;
32
+ for (let i = 0; i < responseParts.length; i++) {
33
+ const part = responseParts[i];
34
+ if (part.functionCall) {
35
+ if (!part.functionCall.name) {
36
+ continue;
37
+ }
38
+ preservedParts.push(part);
39
+ firstFcPartIndex = i;
40
+ break;
41
+ }
42
+ handleNonFunctionCallPart(part, preservedParts);
43
+ }
44
+ if (firstFcPartIndex > 0) {
45
+ for (let j = firstFcPartIndex + 1; j < responseParts.length; j++) {
46
+ if (!responseParts[j].functionCall) {
47
+ break;
48
+ }
49
+ preservedParts.push(responseParts[j]);
50
+ }
51
+ }
52
+ return preservedParts;
53
+ }
54
+ };
55
+ __name(_PlanReActPlanner, "PlanReActPlanner");
56
+ let PlanReActPlanner = _PlanReActPlanner;
57
+ function splitByLastPattern(text, separator) {
58
+ const index = text.lastIndexOf(separator);
59
+ if (index === -1) {
60
+ return [text, ""];
61
+ }
62
+ const end = index + separator.length;
63
+ return [text.slice(0, end), text.slice(end)];
64
+ }
65
+ __name(splitByLastPattern, "splitByLastPattern");
66
+ function handleNonFunctionCallPart(responsePart, preservedParts) {
67
+ var _a;
68
+ if (responsePart.text && responsePart.text.includes(FINAL_ANSWER_TAG)) {
69
+ const [reasoningText, finalAnswerText] = splitByLastPattern(
70
+ responsePart.text,
71
+ FINAL_ANSWER_TAG
72
+ );
73
+ if (reasoningText) {
74
+ preservedParts.push(markAsThought({ text: reasoningText }));
75
+ }
76
+ if (finalAnswerText) {
77
+ preservedParts.push({ text: finalAnswerText });
78
+ }
79
+ return;
80
+ }
81
+ const responseText = (_a = responsePart.text) != null ? _a : "";
82
+ if (responseText && THOUGHT_PREFIX_TAGS.some((tag) => responseText.startsWith(tag))) {
83
+ preservedParts.push(markAsThought(responsePart));
84
+ return;
85
+ }
86
+ preservedParts.push(responsePart);
87
+ }
88
+ __name(handleNonFunctionCallPart, "handleNonFunctionCallPart");
89
+ function markAsThought(responsePart) {
90
+ if (responsePart.text) {
91
+ return { ...responsePart, thought: true };
92
+ }
93
+ return responsePart;
94
+ }
95
+ __name(markAsThought, "markAsThought");
96
+ function buildNlPlannerInstruction() {
97
+ const highLevelPreamble = `
98
+ When answering the question, try to leverage the available tools to gather the information instead of your memorized knowledge.
99
+
100
+ Follow this process when answering the question: (1) first come up with a plan in natural language text format; (2) Then use tools to execute the plan and provide reasoning between tool code snippets to make a summary of current state and next step. Tool code snippets and reasoning should be interleaved with each other. (3) In the end, return one final answer.
101
+
102
+ Follow this format when answering the question: (1) The planning part should be under ${PLANNING_TAG}. (2) The tool code snippets should be under ${ACTION_TAG}, and the reasoning parts should be under ${REASONING_TAG}. (3) The final answer part should be under ${FINAL_ANSWER_TAG}.
103
+ `;
104
+ const planningPreamble = `
105
+ Below are the requirements for the planning:
106
+ The plan is made to answer the user query if following the plan. The plan is coherent and covers all aspects of information from user query, and only involves the tools that are accessible by the agent. The plan contains the decomposed steps as a numbered list where each step should use one or multiple available tools. By reading the plan, you can intuitively know which tools to trigger or what actions to take.
107
+ If the initial plan cannot be successfully executed, you should learn from previous execution results and revise your plan. The revised plan should be be under ${REPLANNING_TAG}. Then use tools to follow the new plan.
108
+ `;
109
+ const reasoningPreamble = `
110
+ Below are the requirements for the reasoning:
111
+ The reasoning makes a summary of the current trajectory based on the user query and tool outputs. Based on the tool outputs and plan, the reasoning also comes up with instructions to the next steps, making the trajectory closer to the final answer.
112
+ `;
113
+ const finalAnswerPreamble = `
114
+ Below are the requirements for the final answer:
115
+ The final answer should be precise and follow query formatting requirements. Some queries may not be answerable with the available tools and information. In those cases, inform the user why you cannot process their query and ask for more information.
116
+ `;
117
+ const toolCodeWithoutPythonLibrariesPreamble = `
118
+ Below are the requirements for the tool code:
119
+
120
+ **Custom Tools:** The available tools are described in the context and can be directly used.
121
+ - Code must be valid self-contained Python snippets with no imports and no references to tools or Python libraries that are not in the context.
122
+ - You cannot use any parameters or fields that are not explicitly defined in the APIs in the context.
123
+ - The code snippets should be readable, efficient, and directly relevant to the user query and reasoning steps.
124
+ - When using the tools, you should use the library name together with the function name, e.g., vertex_search.search().
125
+ - If Python libraries are not provided in the context, NEVER write your own code other than the function calls using the provided tools.
126
+ `;
127
+ const userInputPreamble = `
128
+ VERY IMPORTANT instruction that you MUST follow in addition to the above instructions:
129
+
130
+ You should ask for clarification if you need more information to answer the question.
131
+ You should prefer using the information available in the context instead of repeated tool use.
132
+ `;
133
+ return [
134
+ highLevelPreamble,
135
+ planningPreamble,
136
+ reasoningPreamble,
137
+ finalAnswerPreamble,
138
+ toolCodeWithoutPythonLibrariesPreamble,
139
+ userInputPreamble
140
+ ].join("\n\n");
141
+ }
142
+ __name(buildNlPlannerInstruction, "buildNlPlannerInstruction");
143
+ export {
144
+ PlanReActPlanner
145
+ };
@@ -39,14 +39,13 @@ const _BasePlugin = class _BasePlugin {
39
39
  * This callback helps logging and modifying the user message before the
40
40
  * runner starts the invocation.
41
41
  *
42
- * @param params.invocationContext The context for the entire invocation.
43
- * @param params.userMessage The message content input by user.
42
+ * @param _params.invocationContext The context for the entire invocation.
43
+ * @param _params.userMessage The message content input by user.
44
44
  * @returns An optional `Content` to be returned to the ADK. Returning a
45
45
  * value to replace the user message. Returning `undefined` to proceed
46
46
  * normally.
47
47
  */
48
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
49
- async onUserMessageCallback(params) {
48
+ async onUserMessageCallback(_params) {
50
49
  return;
51
50
  }
52
51
  /**
@@ -55,14 +54,13 @@ const _BasePlugin = class _BasePlugin {
55
54
  * This is the first callback to be called in the lifecycle, ideal for global
56
55
  * setup or initialization tasks.
57
56
  *
58
- * @param params.invocationContext The context for the entire invocation, containing
57
+ * @param _params.invocationContext The context for the entire invocation, containing
59
58
  * session information, the root agent, etc.
60
59
  * @returns An optional `Event` to be returned to the ADK. Returning a value
61
60
  * to halt execution of the runner and ends the runner with that event.
62
61
  * Return `undefined` to proceed normally.
63
62
  */
64
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
65
- async beforeRunCallback(params) {
63
+ async beforeRunCallback(_params) {
66
64
  return;
67
65
  }
68
66
  /**
@@ -71,16 +69,15 @@ const _BasePlugin = class _BasePlugin {
71
69
  * This is the ideal place to make modification to the event before the event
72
70
  * is handled by the underlying agent app.
73
71
  *
74
- * @param params.invocationContext The context for the entire invocation.
75
- * @param params.event The event raised by the runner.
72
+ * @param _params.invocationContext The context for the entire invocation.
73
+ * @param _params.event The event raised by the runner.
76
74
  * @returns An optional value. A non-`undefined` return may be used by the
77
- * framework to modify or replace the response. Copy `params.event` when
78
- * constructing a replacement to preserve fields that are not being
79
- * modified, such as event actions. Returning `undefined` allows the
75
+ * framework to modify or replace the response. Copy the incoming
76
+ * `event` when constructing a replacement to preserve fields that are not
77
+ * being modified, such as event actions. Returning `undefined` allows the
80
78
  * original response to be used.
81
79
  */
82
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
83
- async onEventCallback(params) {
80
+ async onEventCallback(_params) {
84
81
  return;
85
82
  }
86
83
  /**
@@ -89,11 +86,10 @@ const _BasePlugin = class _BasePlugin {
89
86
  * This is the final callback in the ADK lifecycle, suitable for cleanup,
90
87
  * final logging, or reporting tasks.
91
88
  *
92
- * @param params.invocationContext The context for the entire invocation.
89
+ * @param _params.invocationContext The context for the entire invocation.
93
90
  * @returns undefined
94
91
  */
95
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
96
- async afterRunCallback(params) {
92
+ async afterRunCallback(_params) {
97
93
  return;
98
94
  }
99
95
  /**
@@ -102,14 +98,13 @@ const _BasePlugin = class _BasePlugin {
102
98
  * This callback can be used for logging, setup, or to short-circuit the
103
99
  * agent's execution by returning a value.
104
100
  *
105
- * @param params.agent The agent that is about to run.
106
- * @param params.callbackContext The context for the agent invocation.
101
+ * @param _params.agent The agent that is about to run.
102
+ * @param _params.callbackContext The context for the agent invocation.
107
103
  * @returns An optional `Content` object. If a value is returned, it will
108
104
  * bypass the agent's callbacks and its execution, and return this value
109
105
  * directly. Returning `undefined` allows the agent to proceed normally.
110
106
  */
111
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
112
- async beforeAgentCallback(params) {
107
+ async beforeAgentCallback(_params) {
113
108
  return;
114
109
  }
115
110
  /**
@@ -118,14 +113,13 @@ const _BasePlugin = class _BasePlugin {
118
113
  * This callback can be used to inspect, log, or modify the agent's final
119
114
  * result before it is returned.
120
115
  *
121
- * @param params.agent The agent that has just run.
122
- * @param params.callbackContext The context for the agent invocation.
116
+ * @param _params.agent The agent that has just run.
117
+ * @param _params.callbackContext The context for the agent invocation.
123
118
  * @returns An optional `Content` object. If a value is returned, it will
124
119
  * replace the agent's original result. Returning `undefined` uses the
125
120
  * original, unmodified result.
126
121
  */
127
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
128
- async afterAgentCallback(params) {
122
+ async afterAgentCallback(_params) {
129
123
  return;
130
124
  }
131
125
  /**
@@ -166,14 +160,13 @@ const _BasePlugin = class _BasePlugin {
166
160
  * object. It can also be used to implement caching by returning a cached
167
161
  * `LlmResponse`, which would skip the actual model call.
168
162
  *
169
- * @param params.callbackContext The context for the current agent call.
170
- * @param params.llmRequest The prepared request object to be sent to the model.
163
+ * @param _params.callbackContext The context for the current agent call.
164
+ * @param _params.llmRequest The prepared request object to be sent to the model.
171
165
  * @returns An optional value. The interpretation of a non-`undefined`
172
166
  * trigger an early exit and returns the response immediately. Returning
173
167
  * `undefined` allows the LLM request to proceed normally.
174
168
  */
175
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
176
- async beforeModelCallback(params) {
169
+ async beforeModelCallback(_params) {
177
170
  return;
178
171
  }
179
172
  /**
@@ -182,14 +175,13 @@ const _BasePlugin = class _BasePlugin {
182
175
  * This is the ideal place to log model responses, collect metrics on token
183
176
  * usage, or perform post-processing on the raw `LlmResponse`.
184
177
  *
185
- * @param params.callbackContext The context for the current agent call.
186
- * @param params.llmResponse The response object received from the model.
178
+ * @param _params.callbackContext The context for the current agent call.
179
+ * @param _params.llmResponse The response object received from the model.
187
180
  * @returns An optional value. A non-`undefined` return may be used by the
188
181
  * framework to modify or replace the response. Returning `undefined`
189
182
  * allows the original response to be used.
190
183
  */
191
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
192
- async afterModelCallback(params) {
184
+ async afterModelCallback(_params) {
193
185
  return;
194
186
  }
195
187
  /**
@@ -198,28 +190,24 @@ const _BasePlugin = class _BasePlugin {
198
190
  * This callback provides an opportunity to handle model errors gracefully,
199
191
  * potentially providing alternative responses or recovery mechanisms.
200
192
  *
201
- * @param params.callbackContext The context for the current agent call.
202
- * @param params.llmRequest The request that was sent to the model when the error
193
+ * @param _params.callbackContext The context for the current agent call.
194
+ * @param _params.llmRequest The request that was sent to the model when the error
203
195
  * occurred.
204
- * @param params.error The exception that was raised during model execution.
196
+ * @param _params.error The exception that was raised during model execution.
205
197
  * @returns An optional LlmResponse. If an LlmResponse is returned, it will be
206
198
  * used instead of propagating the error. Returning `undefined` allows
207
199
  * the original error to be raised.
208
200
  */
209
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
210
- async onModelErrorCallback(params) {
201
+ async onModelErrorCallback(_params) {
211
202
  return;
212
203
  }
213
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
214
- async beforeToolSelection(params) {
204
+ async beforeToolSelection(_params) {
215
205
  return;
216
206
  }
217
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
218
- async beforeContextCompaction(params) {
207
+ async beforeContextCompaction(_params) {
219
208
  return;
220
209
  }
221
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
222
- async afterContextCompaction(params) {
210
+ async afterContextCompaction(_params) {
223
211
  return;
224
212
  }
225
213
  /**
@@ -228,16 +216,15 @@ const _BasePlugin = class _BasePlugin {
228
216
  * This callback is useful for logging tool usage, input validation, or
229
217
  * modifying the arguments before they are passed to the tool.
230
218
  *
231
- * @param params.tool The tool instance that is about to be executed.
232
- * @param params.toolArgs The dictionary of arguments to be used for invoking the
219
+ * @param _params.tool The tool instance that is about to be executed.
220
+ * @param _params.toolArgs The dictionary of arguments to be used for invoking the
233
221
  * tool.
234
- * @param params.toolContext The context specific to the tool execution.
222
+ * @param _params.toolContext The context specific to the tool execution.
235
223
  * @returns An optional dictionary. If a dictionary is returned, it will stop
236
224
  * the tool execution and return this response immediately. Returning
237
225
  * `undefined` uses the original, unmodified arguments.
238
226
  */
239
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
240
- async beforeToolCallback(params) {
227
+ async beforeToolCallback(_params) {
241
228
  return;
242
229
  }
243
230
  /**
@@ -246,17 +233,16 @@ const _BasePlugin = class _BasePlugin {
246
233
  * This callback allows for inspecting, logging, or modifying the result
247
234
  * returned by a tool.
248
235
  *
249
- * @param params.tool The tool instance that has just been executed.
250
- * @param params.toolArgs The original arguments that were passed to the tool.
251
- * @param params.toolContext The context specific to the tool execution.
252
- * @param params.result The dictionary returned by the tool invocation.
236
+ * @param _params.tool The tool instance that has just been executed.
237
+ * @param _params.toolArgs The original arguments that were passed to the tool.
238
+ * @param _params.toolContext The context specific to the tool execution.
239
+ * @param _params.result The dictionary returned by the tool invocation.
253
240
  * @returns An optional dictionary. If a dictionary is returned, it will
254
241
  * **replace** the original result from the tool. This allows for
255
242
  * post-processing or altering tool outputs. Returning `undefined` uses
256
243
  * the original, unmodified result.
257
244
  */
258
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
259
- async afterToolCallback(params) {
245
+ async afterToolCallback(_params) {
260
246
  return;
261
247
  }
262
248
  /**
@@ -275,16 +261,15 @@ const _BasePlugin = class _BasePlugin {
275
261
  * This callback provides an opportunity to handle tool errors gracefully,
276
262
  * potentially providing alternative responses or recovery mechanisms.
277
263
  *
278
- * @param params.tool The tool instance that encountered an error.
279
- * @param params.toolArgs The arguments that were passed to the tool.
280
- * @param params.toolContext The context specific to the tool execution.
281
- * @param params.error The exception that was raised during tool execution.
264
+ * @param _params.tool The tool instance that encountered an error.
265
+ * @param _params.toolArgs The arguments that were passed to the tool.
266
+ * @param _params.toolContext The context specific to the tool execution.
267
+ * @param _params.error The exception that was raised during tool execution.
282
268
  * @returns An optional dictionary. If a dictionary is returned, it will be
283
269
  * used as the tool response instead of propagating the error. Returning
284
270
  * `undefined` allows the original error to be raised.
285
271
  */
286
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
287
- async onToolErrorCallback(params) {
272
+ async onToolErrorCallback(_params) {
288
273
  return;
289
274
  }
290
275
  };