java.lang.Object
com.agentforge4j.runtime.command.CommandApplier
Dispatches each
LlmCommand to its registered CommandHandler and returns the first
non-CommandApplicationResult.CONTINUE result, or CommandApplicationResult.CONTINUE
when every command continues.-
Constructor Summary
ConstructorsConstructorDescriptionCommandApplier(List<CommandHandler<? extends LlmCommand>> commandHandlers) Indexes handlers byCommandHandler.getCommandClass(); duplicate command classes fail construction. -
Method Summary
Modifier and TypeMethodDescriptionapply(List<LlmCommand> commands, WorkflowState state, ContextMapping contextMapping, String agentId, int currentStepUid) Applies commands in list order until one yields a non-continue outcome or the list ends.
-
Constructor Details
-
CommandApplier
Indexes handlers byCommandHandler.getCommandClass(); duplicate command classes fail construction.- Parameters:
commandHandlers- one handler per distinct command class, non-empty- Throws:
IllegalArgumentException- ifcommandHandlersis emptyIllegalStateException- if two handlers declare the same command class
-
-
Method Details
-
apply
public CommandApplicationResult apply(List<LlmCommand> commands, WorkflowState state, ContextMapping contextMapping, String agentId, int currentStepUid) Applies commands in list order until one yields a non-continue outcome or the list ends.- Parameters:
commands- parsed commands in application orderstate- workflow state updated by handlerscontextMapping- allowed output keys foragentIdagentId- agent id recorded on events and permission checkscurrentStepUid- step instance id used when recording context writes- Returns:
- aggregated control-flow result for the batch
- Throws:
IllegalArgumentException- if any argument isnullor no handler is registered for a command's concrete class
-