Volver al índice
src/main/java/ar/com/companeros/action/ActionRequest.java
package ar.com.companeros.action;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.UUID;
/** Solicitud declarativa; no contiene referencias vivas al cuerpo o al mundo. */
public record ActionRequest(UUID actionId, UUID agentId, UUID planId, String toolId,
int toolVersion, Map<String, String> arguments, long observationSeq,
long deadlineUtc, Set<String> grantedScope) {
public ActionRequest {
Objects.requireNonNull(actionId, "actionId");
Objects.requireNonNull(agentId, "agentId");
Objects.requireNonNull(toolId, "toolId");
if (toolId.isBlank() || toolVersion < 1 || observationSeq < 0 || deadlineUtc < 0)
throw new IllegalArgumentException("Solicitud de acción inválida");
arguments = Map.copyOf(arguments);
grantedScope = Set.copyOf(grantedScope);
}
public boolean expired(long nowUtc) { return deadlineUtc > 0 && nowUtc >= deadlineUtc; }
}