package com.example.rzgb.task; import jakarta.validation.constraints.*; import java.math.BigDecimal; import jakarta.validation.Valid; import com.example.rzgb.opportunity.OpportunityQuery; /** D1 每个验证任务最多执行一个白名单动作;后续工作流复用同一任务账本。 */ public record TaskRequest(@NotNull Operation operation, @NotNull Workflow workflow, @NotNull @Size(max=2000) String input, boolean entityConfirmed, @Min(1) @Max(25) int maxCalls, @NotNull @DecimalMin("0.01") @DecimalMax("1000") BigDecimal maxCostUnits, @Valid OpportunityQuery opportunity, @Valid com.example.rzgb.research.ResearchRequest research, com.example.rzgb.conversation.SnapshotQa.Scope qa, Boolean summarizeList) { public TaskRequest { // 升级前的任务请求没有该字段。反序列化后沿用原列表流程,继续和回查时都能读取旧批次。 summarizeList = Boolean.TRUE.equals(summarizeList); } public TaskRequest(Operation operation, Workflow workflow, String input, boolean entityConfirmed, int maxCalls, BigDecimal maxCostUnits, OpportunityQuery opportunity, com.example.rzgb.research.ResearchRequest research, com.example.rzgb.conversation.SnapshotQa.Scope qa) { this(operation,workflow,input,entityConfirmed,maxCalls,maxCostUnits,opportunity,research,qa,false); } /** 原有请求保持兼容;只有显式快照问答携带 qa 范围。 */ public TaskRequest(Operation operation, Workflow workflow, String input, boolean entityConfirmed, int maxCalls, BigDecimal maxCostUnits, OpportunityQuery opportunity, com.example.rzgb.research.ResearchRequest research) { this(operation,workflow,input,entityConfirmed,maxCalls,maxCostUnits,opportunity,research,null); } /** D1/D2 调用仍沿用原构造方法,新增参数默认不启用深查。 */ public TaskRequest(Operation operation, Workflow workflow, String input, boolean entityConfirmed, int maxCalls, BigDecimal maxCostUnits, OpportunityQuery opportunity) { this(operation, workflow, input, entityConfirmed, maxCalls, maxCostUnits, opportunity, null); } /** 保留 D1 单动作调用契约;业务获客另外携带结构化条件,不把偏好塞进自由文本。 */ public TaskRequest(Operation operation, Workflow workflow, String input, boolean entityConfirmed, int maxCalls, BigDecimal maxCostUnits) { this(operation, workflow, input, entityConfirmed, maxCalls, maxCostUnits, null, null); } public enum Operation { ZLBX_BALANCE, BID_SEARCH, BID_DETAIL, COMPANY_SEARCH, COMPANY_PROFILE, MODEL_TEXT, MODEL_JSON, MODEL_STREAM, WEB_SEARCH, WEB_FETCH, VISION, OPPORTUNITY_SEARCH, COMPANY_RESEARCH, BID_RESEARCH, SNAPSHOT_QA; public boolean researchTask() { return this == COMPANY_RESEARCH || this == BID_RESEARCH; } public boolean zlbx() { return switch (this) { case ZLBX_BALANCE, BID_SEARCH, BID_DETAIL, COMPANY_SEARCH, COMPANY_PROFILE, OPPORTUNITY_SEARCH -> true; default -> false; }; } } /** 工作流版本锁定;不是三个远程 Skill 服务,也不能伪造“已调用完整 Skill”。 */ public enum Workflow { TENDER_SEARCH("zlbx-bidding/2.3.0", "2.3.0"), COMPANY_INTEL("company-intel/1.0.2", "1.0.2"), BID_DECISION("bid-decision/1.0.4", "1.0.4"); public final String client; public final String version; Workflow(String client, String version) { this.client = client; this.version = version; } } }