@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,172 @@
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 __name = (target, value) => __defProp(target, "name", { value, configurable: true });
13
+ var __export = (target, all) => {
14
+ for (var name in all)
15
+ __defProp(target, name, { get: all[name], enumerable: true });
16
+ };
17
+ var __copyProps = (to, from, except, desc) => {
18
+ if (from && typeof from === "object" || typeof from === "function") {
19
+ for (let key of __getOwnPropNames(from))
20
+ if (!__hasOwnProp.call(to, key) && key !== except)
21
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
22
+ }
23
+ return to;
24
+ };
25
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
26
+ var plan_re_act_planner_exports = {};
27
+ __export(plan_re_act_planner_exports, {
28
+ PlanReActPlanner: () => PlanReActPlanner
29
+ });
30
+ module.exports = __toCommonJS(plan_re_act_planner_exports);
31
+ var import_base_planner = require("./base_planner.js");
32
+ /**
33
+ * @license
34
+ * Copyright 2026 Google LLC
35
+ * SPDX-License-Identifier: Apache-2.0
36
+ */
37
+ const PLANNING_TAG = "/*PLANNING*/";
38
+ const REPLANNING_TAG = "/*REPLANNING*/";
39
+ const REASONING_TAG = "/*REASONING*/";
40
+ const ACTION_TAG = "/*ACTION*/";
41
+ const FINAL_ANSWER_TAG = "/*FINAL_ANSWER*/";
42
+ const THOUGHT_PREFIX_TAGS = [
43
+ PLANNING_TAG,
44
+ REASONING_TAG,
45
+ ACTION_TAG,
46
+ REPLANNING_TAG
47
+ ];
48
+ const _PlanReActPlanner = class _PlanReActPlanner extends import_base_planner.BasePlanner {
49
+ buildPlanningInstruction(_readonlyContext, _llmRequest) {
50
+ return buildNlPlannerInstruction();
51
+ }
52
+ processPlanningResponse(_callbackContext, responseParts) {
53
+ if (!responseParts || responseParts.length === 0) {
54
+ return void 0;
55
+ }
56
+ const preservedParts = [];
57
+ let firstFcPartIndex = -1;
58
+ for (let i = 0; i < responseParts.length; i++) {
59
+ const part = responseParts[i];
60
+ if (part.functionCall) {
61
+ if (!part.functionCall.name) {
62
+ continue;
63
+ }
64
+ preservedParts.push(part);
65
+ firstFcPartIndex = i;
66
+ break;
67
+ }
68
+ handleNonFunctionCallPart(part, preservedParts);
69
+ }
70
+ if (firstFcPartIndex > 0) {
71
+ for (let j = firstFcPartIndex + 1; j < responseParts.length; j++) {
72
+ if (!responseParts[j].functionCall) {
73
+ break;
74
+ }
75
+ preservedParts.push(responseParts[j]);
76
+ }
77
+ }
78
+ return preservedParts;
79
+ }
80
+ };
81
+ __name(_PlanReActPlanner, "PlanReActPlanner");
82
+ let PlanReActPlanner = _PlanReActPlanner;
83
+ function splitByLastPattern(text, separator) {
84
+ const index = text.lastIndexOf(separator);
85
+ if (index === -1) {
86
+ return [text, ""];
87
+ }
88
+ const end = index + separator.length;
89
+ return [text.slice(0, end), text.slice(end)];
90
+ }
91
+ __name(splitByLastPattern, "splitByLastPattern");
92
+ function handleNonFunctionCallPart(responsePart, preservedParts) {
93
+ var _a;
94
+ if (responsePart.text && responsePart.text.includes(FINAL_ANSWER_TAG)) {
95
+ const [reasoningText, finalAnswerText] = splitByLastPattern(
96
+ responsePart.text,
97
+ FINAL_ANSWER_TAG
98
+ );
99
+ if (reasoningText) {
100
+ preservedParts.push(markAsThought({ text: reasoningText }));
101
+ }
102
+ if (finalAnswerText) {
103
+ preservedParts.push({ text: finalAnswerText });
104
+ }
105
+ return;
106
+ }
107
+ const responseText = (_a = responsePart.text) != null ? _a : "";
108
+ if (responseText && THOUGHT_PREFIX_TAGS.some((tag) => responseText.startsWith(tag))) {
109
+ preservedParts.push(markAsThought(responsePart));
110
+ return;
111
+ }
112
+ preservedParts.push(responsePart);
113
+ }
114
+ __name(handleNonFunctionCallPart, "handleNonFunctionCallPart");
115
+ function markAsThought(responsePart) {
116
+ if (responsePart.text) {
117
+ return { ...responsePart, thought: true };
118
+ }
119
+ return responsePart;
120
+ }
121
+ __name(markAsThought, "markAsThought");
122
+ function buildNlPlannerInstruction() {
123
+ const highLevelPreamble = `
124
+ When answering the question, try to leverage the available tools to gather the information instead of your memorized knowledge.
125
+
126
+ 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.
127
+
128
+ 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}.
129
+ `;
130
+ const planningPreamble = `
131
+ Below are the requirements for the planning:
132
+ 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.
133
+ 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.
134
+ `;
135
+ const reasoningPreamble = `
136
+ Below are the requirements for the reasoning:
137
+ 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.
138
+ `;
139
+ const finalAnswerPreamble = `
140
+ Below are the requirements for the final answer:
141
+ 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.
142
+ `;
143
+ const toolCodeWithoutPythonLibrariesPreamble = `
144
+ Below are the requirements for the tool code:
145
+
146
+ **Custom Tools:** The available tools are described in the context and can be directly used.
147
+ - 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.
148
+ - You cannot use any parameters or fields that are not explicitly defined in the APIs in the context.
149
+ - The code snippets should be readable, efficient, and directly relevant to the user query and reasoning steps.
150
+ - When using the tools, you should use the library name together with the function name, e.g., vertex_search.search().
151
+ - If Python libraries are not provided in the context, NEVER write your own code other than the function calls using the provided tools.
152
+ `;
153
+ const userInputPreamble = `
154
+ VERY IMPORTANT instruction that you MUST follow in addition to the above instructions:
155
+
156
+ You should ask for clarification if you need more information to answer the question.
157
+ You should prefer using the information available in the context instead of repeated tool use.
158
+ `;
159
+ return [
160
+ highLevelPreamble,
161
+ planningPreamble,
162
+ reasoningPreamble,
163
+ finalAnswerPreamble,
164
+ toolCodeWithoutPythonLibrariesPreamble,
165
+ userInputPreamble
166
+ ].join("\n\n");
167
+ }
168
+ __name(buildNlPlannerInstruction, "buildNlPlannerInstruction");
169
+ // Annotate the CommonJS export names for ESM import in node:
170
+ 0 && (module.exports = {
171
+ PlanReActPlanner
172
+ });
@@ -65,14 +65,13 @@ const _BasePlugin = class _BasePlugin {
65
65
  * This callback helps logging and modifying the user message before the
66
66
  * runner starts the invocation.
67
67
  *
68
- * @param params.invocationContext The context for the entire invocation.
69
- * @param params.userMessage The message content input by user.
68
+ * @param _params.invocationContext The context for the entire invocation.
69
+ * @param _params.userMessage The message content input by user.
70
70
  * @returns An optional `Content` to be returned to the ADK. Returning a
71
71
  * value to replace the user message. Returning `undefined` to proceed
72
72
  * normally.
73
73
  */
74
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
75
- async onUserMessageCallback(params) {
74
+ async onUserMessageCallback(_params) {
76
75
  return;
77
76
  }
78
77
  /**
@@ -81,14 +80,13 @@ const _BasePlugin = class _BasePlugin {
81
80
  * This is the first callback to be called in the lifecycle, ideal for global
82
81
  * setup or initialization tasks.
83
82
  *
84
- * @param params.invocationContext The context for the entire invocation, containing
83
+ * @param _params.invocationContext The context for the entire invocation, containing
85
84
  * session information, the root agent, etc.
86
85
  * @returns An optional `Event` to be returned to the ADK. Returning a value
87
86
  * to halt execution of the runner and ends the runner with that event.
88
87
  * Return `undefined` to proceed normally.
89
88
  */
90
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
91
- async beforeRunCallback(params) {
89
+ async beforeRunCallback(_params) {
92
90
  return;
93
91
  }
94
92
  /**
@@ -97,16 +95,15 @@ const _BasePlugin = class _BasePlugin {
97
95
  * This is the ideal place to make modification to the event before the event
98
96
  * is handled by the underlying agent app.
99
97
  *
100
- * @param params.invocationContext The context for the entire invocation.
101
- * @param params.event The event raised by the runner.
98
+ * @param _params.invocationContext The context for the entire invocation.
99
+ * @param _params.event The event raised by the runner.
102
100
  * @returns An optional value. A non-`undefined` return may be used by the
103
- * framework to modify or replace the response. Copy `params.event` when
104
- * constructing a replacement to preserve fields that are not being
105
- * modified, such as event actions. Returning `undefined` allows the
101
+ * framework to modify or replace the response. Copy the incoming
102
+ * `event` when constructing a replacement to preserve fields that are not
103
+ * being modified, such as event actions. Returning `undefined` allows the
106
104
  * original response to be used.
107
105
  */
108
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
109
- async onEventCallback(params) {
106
+ async onEventCallback(_params) {
110
107
  return;
111
108
  }
112
109
  /**
@@ -115,11 +112,10 @@ const _BasePlugin = class _BasePlugin {
115
112
  * This is the final callback in the ADK lifecycle, suitable for cleanup,
116
113
  * final logging, or reporting tasks.
117
114
  *
118
- * @param params.invocationContext The context for the entire invocation.
115
+ * @param _params.invocationContext The context for the entire invocation.
119
116
  * @returns undefined
120
117
  */
121
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
122
- async afterRunCallback(params) {
118
+ async afterRunCallback(_params) {
123
119
  return;
124
120
  }
125
121
  /**
@@ -128,14 +124,13 @@ const _BasePlugin = class _BasePlugin {
128
124
  * This callback can be used for logging, setup, or to short-circuit the
129
125
  * agent's execution by returning a value.
130
126
  *
131
- * @param params.agent The agent that is about to run.
132
- * @param params.callbackContext The context for the agent invocation.
127
+ * @param _params.agent The agent that is about to run.
128
+ * @param _params.callbackContext The context for the agent invocation.
133
129
  * @returns An optional `Content` object. If a value is returned, it will
134
130
  * bypass the agent's callbacks and its execution, and return this value
135
131
  * directly. Returning `undefined` allows the agent to proceed normally.
136
132
  */
137
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
138
- async beforeAgentCallback(params) {
133
+ async beforeAgentCallback(_params) {
139
134
  return;
140
135
  }
141
136
  /**
@@ -144,14 +139,13 @@ const _BasePlugin = class _BasePlugin {
144
139
  * This callback can be used to inspect, log, or modify the agent's final
145
140
  * result before it is returned.
146
141
  *
147
- * @param params.agent The agent that has just run.
148
- * @param params.callbackContext The context for the agent invocation.
142
+ * @param _params.agent The agent that has just run.
143
+ * @param _params.callbackContext The context for the agent invocation.
149
144
  * @returns An optional `Content` object. If a value is returned, it will
150
145
  * replace the agent's original result. Returning `undefined` uses the
151
146
  * original, unmodified result.
152
147
  */
153
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
154
- async afterAgentCallback(params) {
148
+ async afterAgentCallback(_params) {
155
149
  return;
156
150
  }
157
151
  /**
@@ -192,14 +186,13 @@ const _BasePlugin = class _BasePlugin {
192
186
  * object. It can also be used to implement caching by returning a cached
193
187
  * `LlmResponse`, which would skip the actual model call.
194
188
  *
195
- * @param params.callbackContext The context for the current agent call.
196
- * @param params.llmRequest The prepared request object to be sent to the model.
189
+ * @param _params.callbackContext The context for the current agent call.
190
+ * @param _params.llmRequest The prepared request object to be sent to the model.
197
191
  * @returns An optional value. The interpretation of a non-`undefined`
198
192
  * trigger an early exit and returns the response immediately. Returning
199
193
  * `undefined` allows the LLM request to proceed normally.
200
194
  */
201
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
202
- async beforeModelCallback(params) {
195
+ async beforeModelCallback(_params) {
203
196
  return;
204
197
  }
205
198
  /**
@@ -208,14 +201,13 @@ const _BasePlugin = class _BasePlugin {
208
201
  * This is the ideal place to log model responses, collect metrics on token
209
202
  * usage, or perform post-processing on the raw `LlmResponse`.
210
203
  *
211
- * @param params.callbackContext The context for the current agent call.
212
- * @param params.llmResponse The response object received from the model.
204
+ * @param _params.callbackContext The context for the current agent call.
205
+ * @param _params.llmResponse The response object received from the model.
213
206
  * @returns An optional value. A non-`undefined` return may be used by the
214
207
  * framework to modify or replace the response. Returning `undefined`
215
208
  * allows the original response to be used.
216
209
  */
217
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
218
- async afterModelCallback(params) {
210
+ async afterModelCallback(_params) {
219
211
  return;
220
212
  }
221
213
  /**
@@ -224,28 +216,24 @@ const _BasePlugin = class _BasePlugin {
224
216
  * This callback provides an opportunity to handle model errors gracefully,
225
217
  * potentially providing alternative responses or recovery mechanisms.
226
218
  *
227
- * @param params.callbackContext The context for the current agent call.
228
- * @param params.llmRequest The request that was sent to the model when the error
219
+ * @param _params.callbackContext The context for the current agent call.
220
+ * @param _params.llmRequest The request that was sent to the model when the error
229
221
  * occurred.
230
- * @param params.error The exception that was raised during model execution.
222
+ * @param _params.error The exception that was raised during model execution.
231
223
  * @returns An optional LlmResponse. If an LlmResponse is returned, it will be
232
224
  * used instead of propagating the error. Returning `undefined` allows
233
225
  * the original error to be raised.
234
226
  */
235
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
236
- async onModelErrorCallback(params) {
227
+ async onModelErrorCallback(_params) {
237
228
  return;
238
229
  }
239
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
240
- async beforeToolSelection(params) {
230
+ async beforeToolSelection(_params) {
241
231
  return;
242
232
  }
243
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
244
- async beforeContextCompaction(params) {
233
+ async beforeContextCompaction(_params) {
245
234
  return;
246
235
  }
247
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
248
- async afterContextCompaction(params) {
236
+ async afterContextCompaction(_params) {
249
237
  return;
250
238
  }
251
239
  /**
@@ -254,16 +242,15 @@ const _BasePlugin = class _BasePlugin {
254
242
  * This callback is useful for logging tool usage, input validation, or
255
243
  * modifying the arguments before they are passed to the tool.
256
244
  *
257
- * @param params.tool The tool instance that is about to be executed.
258
- * @param params.toolArgs The dictionary of arguments to be used for invoking the
245
+ * @param _params.tool The tool instance that is about to be executed.
246
+ * @param _params.toolArgs The dictionary of arguments to be used for invoking the
259
247
  * tool.
260
- * @param params.toolContext The context specific to the tool execution.
248
+ * @param _params.toolContext The context specific to the tool execution.
261
249
  * @returns An optional dictionary. If a dictionary is returned, it will stop
262
250
  * the tool execution and return this response immediately. Returning
263
251
  * `undefined` uses the original, unmodified arguments.
264
252
  */
265
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
266
- async beforeToolCallback(params) {
253
+ async beforeToolCallback(_params) {
267
254
  return;
268
255
  }
269
256
  /**
@@ -272,17 +259,16 @@ const _BasePlugin = class _BasePlugin {
272
259
  * This callback allows for inspecting, logging, or modifying the result
273
260
  * returned by a tool.
274
261
  *
275
- * @param params.tool The tool instance that has just been executed.
276
- * @param params.toolArgs The original arguments that were passed to the tool.
277
- * @param params.toolContext The context specific to the tool execution.
278
- * @param params.result The dictionary returned by the tool invocation.
262
+ * @param _params.tool The tool instance that has just been executed.
263
+ * @param _params.toolArgs The original arguments that were passed to the tool.
264
+ * @param _params.toolContext The context specific to the tool execution.
265
+ * @param _params.result The dictionary returned by the tool invocation.
279
266
  * @returns An optional dictionary. If a dictionary is returned, it will
280
267
  * **replace** the original result from the tool. This allows for
281
268
  * post-processing or altering tool outputs. Returning `undefined` uses
282
269
  * the original, unmodified result.
283
270
  */
284
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
285
- async afterToolCallback(params) {
271
+ async afterToolCallback(_params) {
286
272
  return;
287
273
  }
288
274
  /**
@@ -301,16 +287,15 @@ const _BasePlugin = class _BasePlugin {
301
287
  * This callback provides an opportunity to handle tool errors gracefully,
302
288
  * potentially providing alternative responses or recovery mechanisms.
303
289
  *
304
- * @param params.tool The tool instance that encountered an error.
305
- * @param params.toolArgs The arguments that were passed to the tool.
306
- * @param params.toolContext The context specific to the tool execution.
307
- * @param params.error The exception that was raised during tool execution.
290
+ * @param _params.tool The tool instance that encountered an error.
291
+ * @param _params.toolArgs The arguments that were passed to the tool.
292
+ * @param _params.toolContext The context specific to the tool execution.
293
+ * @param _params.error The exception that was raised during tool execution.
308
294
  * @returns An optional dictionary. If a dictionary is returned, it will be
309
295
  * used as the tool response instead of propagating the error. Returning
310
296
  * `undefined` allows the original error to be raised.
311
297
  */
312
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
313
- async onToolErrorCallback(params) {
298
+ async onToolErrorCallback(_params) {
314
299
  return;
315
300
  }
316
301
  };