package tech.easyflow.manuagent.mapper; import com.mybatisflex.core.BaseMapper; import java.util.UUID; import org.apache.ibatis.annotations.Param; import tech.easyflow.manuagent.entity.AgentEventEntity; /** * 提供 Agent 事件写入、游标回放及运行恢复所需的持久化能力。 */ public interface AgentEventMapper extends BaseMapper { /** * 插入事件并原子返回数据库生成的 BIGSERIAL 序号及创建时间。 * * @param event 待写入事件 * @return 已持久化的完整事件 */ AgentEventEntity insertReturning(@Param("event") AgentEventEntity event); /** 查询指定 Run 最近一次 RUN_STARTED 事件中的业务阶段。 */ String selectLatestStartedPhase(@Param("runId") UUID runId); /** 查询项目最近一次包含材料决策数组的 ASK_RESPONDED 事件负载。 */ String selectLatestMaterialResponseJson(@Param("projectId") UUID projectId); }