3434import java .util .Map ;
3535import java .util .Optional ;
3636import java .util .function .Function ;
37+ import org .jspecify .annotations .Nullable ;
3738import org .slf4j .Logger ;
3839import org .slf4j .LoggerFactory ;
3940
@@ -47,7 +48,7 @@ public class PluginManager extends BasePlugin {
4748 private static final Logger logger = LoggerFactory .getLogger (PluginManager .class );
4849 private final List <Plugin > plugins = new ArrayList <>();
4950
50- public PluginManager (List <? extends Plugin > plugins ) {
51+ public PluginManager (@ Nullable List <? extends Plugin > plugins ) {
5152 super ("PluginManager" );
5253 if (plugins != null ) {
5354 plugins .forEach (this ::registerPlugin );
@@ -123,10 +124,6 @@ public Maybe<Content> beforeRunCallback(InvocationContext invocationContext) {
123124 plugin -> plugin .beforeRunCallback (invocationContext ), "beforeRunCallback" );
124125 }
125126
126- public Completable runAfterRunCallback (InvocationContext invocationContext ) {
127- return afterRunCallback (invocationContext );
128- }
129-
130127 @ Override
131128 public Completable afterRunCallback (InvocationContext invocationContext ) {
132129 return Flowable .fromIterable (plugins )
@@ -155,65 +152,38 @@ public Completable close() {
155152 "[{}] Error during callback 'close'" , plugin .getName (), e )));
156153 }
157154
158- public Maybe <Event > runOnEventCallback (InvocationContext invocationContext , Event event ) {
159- return onEventCallback (invocationContext , event );
160- }
161-
162155 @ Override
163156 public Maybe <Event > onEventCallback (InvocationContext invocationContext , Event event ) {
164157 return runMaybeCallbacks (
165158 plugin -> plugin .onEventCallback (invocationContext , event ), "onEventCallback" );
166159 }
167160
168- public Maybe <Content > runBeforeAgentCallback (BaseAgent agent , CallbackContext callbackContext ) {
169- return beforeAgentCallback (agent , callbackContext );
170- }
171-
172161 @ Override
173162 public Maybe <Content > beforeAgentCallback (BaseAgent agent , CallbackContext callbackContext ) {
174163 return runMaybeCallbacks (
175164 plugin -> plugin .beforeAgentCallback (agent , callbackContext ), "beforeAgentCallback" );
176165 }
177166
178- public Maybe <Content > runAfterAgentCallback (BaseAgent agent , CallbackContext callbackContext ) {
179- return afterAgentCallback (agent , callbackContext );
180- }
181-
182167 @ Override
183168 public Maybe <Content > afterAgentCallback (BaseAgent agent , CallbackContext callbackContext ) {
184169 return runMaybeCallbacks (
185170 plugin -> plugin .afterAgentCallback (agent , callbackContext ), "afterAgentCallback" );
186171 }
187172
188- public Maybe <LlmResponse > runBeforeModelCallback (
189- CallbackContext callbackContext , LlmRequest .Builder llmRequest ) {
190- return beforeModelCallback (callbackContext , llmRequest );
191- }
192-
193173 @ Override
194174 public Maybe <LlmResponse > beforeModelCallback (
195175 CallbackContext callbackContext , LlmRequest .Builder llmRequest ) {
196176 return runMaybeCallbacks (
197177 plugin -> plugin .beforeModelCallback (callbackContext , llmRequest ), "beforeModelCallback" );
198178 }
199179
200- public Maybe <LlmResponse > runAfterModelCallback (
201- CallbackContext callbackContext , LlmResponse llmResponse ) {
202- return afterModelCallback (callbackContext , llmResponse );
203- }
204-
205180 @ Override
206181 public Maybe <LlmResponse > afterModelCallback (
207182 CallbackContext callbackContext , LlmResponse llmResponse ) {
208183 return runMaybeCallbacks (
209184 plugin -> plugin .afterModelCallback (callbackContext , llmResponse ), "afterModelCallback" );
210185 }
211186
212- public Maybe <LlmResponse > runOnModelErrorCallback (
213- CallbackContext callbackContext , LlmRequest .Builder llmRequest , Throwable error ) {
214- return onModelErrorCallback (callbackContext , llmRequest , error );
215- }
216-
217187 @ Override
218188 public Maybe <LlmResponse > onModelErrorCallback (
219189 CallbackContext callbackContext , LlmRequest .Builder llmRequest , Throwable error ) {
@@ -222,26 +192,13 @@ public Maybe<LlmResponse> onModelErrorCallback(
222192 "onModelErrorCallback" );
223193 }
224194
225- public Maybe <Map <String , Object >> runBeforeToolCallback (
226- BaseTool tool , Map <String , Object > toolArgs , ToolContext toolContext ) {
227- return beforeToolCallback (tool , toolArgs , toolContext );
228- }
229-
230195 @ Override
231196 public Maybe <Map <String , Object >> beforeToolCallback (
232197 BaseTool tool , Map <String , Object > toolArgs , ToolContext toolContext ) {
233198 return runMaybeCallbacks (
234199 plugin -> plugin .beforeToolCallback (tool , toolArgs , toolContext ), "beforeToolCallback" );
235200 }
236201
237- public Maybe <Map <String , Object >> runAfterToolCallback (
238- BaseTool tool ,
239- Map <String , Object > toolArgs ,
240- ToolContext toolContext ,
241- Map <String , Object > result ) {
242- return afterToolCallback (tool , toolArgs , toolContext , result );
243- }
244-
245202 @ Override
246203 public Maybe <Map <String , Object >> afterToolCallback (
247204 BaseTool tool ,
@@ -253,11 +210,6 @@ public Maybe<Map<String, Object>> afterToolCallback(
253210 "afterToolCallback" );
254211 }
255212
256- public Maybe <Map <String , Object >> runOnToolErrorCallback (
257- BaseTool tool , Map <String , Object > toolArgs , ToolContext toolContext , Throwable error ) {
258- return onToolErrorCallback (tool , toolArgs , toolContext , error );
259- }
260-
261213 @ Override
262214 public Maybe <Map <String , Object >> onToolErrorCallback (
263215 BaseTool tool , Map <String , Object > toolArgs , ToolContext toolContext , Throwable error ) {
0 commit comments