From 21b3a0e846203de0723eb6f9372b2a7996eb5724 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Wed, 22 Oct 2025 15:15:38 +0800 Subject: [PATCH 001/182] =?UTF-8?q?=E5=BC=80=E5=A7=8B=E6=8E=A8=E8=BF=9B=20?= =?UTF-8?q?ActionDispatcher=20=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ActionDispatcher 划分为 ActionScheduler 和 ActionExecutor 两个子模块,分别负责处理计划任务和即时任务 - 正式确定 Action 将以 ActionChain 的形式进行执行,也采用同组并发策略,按照 order 字段在 chain 中进行排序 - 调整了 ActionInfo 等类以适应当前的元行动类 - 对于行动能力的支持,或可考虑这几种方式: Agent自生成python脚本(必须经过验证,确认可执行且无风险)、MCP调用(需适配为Partner所支持的形式)、普通插件(在指定目录动态加载) --- .../partner/core/action/ActionCapability.java | 16 ++--- .../slhaf/partner/core/action/ActionCore.java | 40 ++++++------ .../core/action/entity/ActionData.java | 11 ---- .../{MetaActionInfo.java => ActionInfo.java} | 8 ++- .../action/entity/ImmediateActionInfo.java | 2 +- .../core/action/entity/MetaAction.java | 26 ++++++++ .../action/entity/ScheduledActionInfo.java | 2 +- .../entity/{ => cache}/ActionCacheData.java | 2 +- .../entity/{ => cache}/CacheAdjustData.java | 2 +- .../{ => cache}/CacheAdjustMetaData.java | 2 +- .../action/dispatcher/ActionDispatcher.java | 61 +++++++++++++++++++ .../dispatcher/executor/ActionExecutor.java | 22 +++++++ .../dispatcher/scheduler/ActionScheduler.java | 16 +++++ .../modules/action/planner/ActionPlanner.java | 40 ++++++------ .../confirmer/entity/ConfirmerInput.java | 4 +- .../evaluator/entity/EvaluatorResult.java | 6 +- .../action/scheduler/ActionDispatcher.java | 4 -- .../action/scheduler/TaskScheduler.java | 7 --- 18 files changed, 192 insertions(+), 79 deletions(-) delete mode 100644 Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java rename Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/{MetaActionInfo.java => ActionInfo.java} (54%) create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java rename Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/{ => cache}/ActionCacheData.java (99%) rename Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/{ => cache}/CacheAdjustData.java (75%) rename Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/{ => cache}/CacheAdjustMetaData.java (73%) create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/ActionDispatcher.java create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.java delete mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/scheduler/ActionDispatcher.java delete mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/scheduler/TaskScheduler.java diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java index 69bf78bd..03d4f0c2 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java @@ -1,24 +1,24 @@ package work.slhaf.partner.core.action; import work.slhaf.partner.api.agent.factory.capability.annotation.Capability; -import work.slhaf.partner.core.action.entity.CacheAdjustData; -import work.slhaf.partner.core.action.entity.MetaActionInfo; +import work.slhaf.partner.core.action.entity.ActionInfo; +import work.slhaf.partner.core.action.entity.cache.CacheAdjustData; import java.util.List; @Capability(value = "action") public interface ActionCapability { - void putPreparedAction(String uuid, MetaActionInfo metaActionInfo); + void putPreparedAction(String uuid, ActionInfo actionInfo); - List popPreparedAction(String userId); + List popPreparedAction(String userId); - List popPendingAction(String userId); + List popPendingAction(String userId); - List listPreparedAction(String userId); + List listPreparedAction(String userId); - List listPendingAction(String userId); + List listPendingAction(String userId); - void putPendingActions(String userId, MetaActionInfo metaActionInfo); + void putPendingActions(String userId, ActionInfo actionInfo); List selectTendencyCache(String input); diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java index 502a3753..8dd95d58 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java @@ -1,14 +1,14 @@ package work.slhaf.partner.core.action; import lombok.extern.slf4j.Slf4j; -import work.slhaf.partner.api.agent.factory.capability.annotation.Capability; +import work.slhaf.partner.api.agent.factory.capability.annotation.CapabilityCore; import work.slhaf.partner.api.agent.factory.capability.annotation.CapabilityMethod; import work.slhaf.partner.common.vector.VectorClient; import work.slhaf.partner.core.PartnerCore; -import work.slhaf.partner.core.action.entity.ActionCacheData; -import work.slhaf.partner.core.action.entity.CacheAdjustData; -import work.slhaf.partner.core.action.entity.CacheAdjustMetaData; -import work.slhaf.partner.core.action.entity.MetaActionInfo; +import work.slhaf.partner.core.action.entity.ActionInfo; +import work.slhaf.partner.core.action.entity.cache.ActionCacheData; +import work.slhaf.partner.core.action.entity.cache.CacheAdjustData; +import work.slhaf.partner.core.action.entity.cache.CacheAdjustMetaData; import java.io.IOException; import java.util.ArrayList; @@ -21,19 +21,19 @@ import java.util.concurrent.locks.ReentrantLock; import java.util.stream.Collectors; @SuppressWarnings("FieldMayBeFinal") -@Capability(value = "action") +@CapabilityCore(value = "action") @Slf4j public class ActionCore extends PartnerCore { /** * 对应本次交互即将执行或将要放置在行动池的预备任务,因此将以本次交互的uuid为键,其起到的作用相当于暂时的模块上下文 */ - private HashMap> preparedActions = new HashMap<>(); + private HashMap> preparedActions = new HashMap<>(); /** * 待确认任务,以userId区分不同用户,因为需要跨请求确认 */ - private HashMap> pendingActions = new HashMap<>(); + private HashMap> pendingActions = new HashMap<>(); /** * 语义缓存与行为倾向映射 @@ -48,44 +48,44 @@ public class ActionCore extends PartnerCore { } @CapabilityMethod - public synchronized void putPendingActions(String userId, MetaActionInfo metaActionInfo) { + public synchronized void putPendingActions(String userId, ActionInfo actionInfo) { pendingActions.computeIfAbsent(userId, k -> { - List temp = new ArrayList<>(); - temp.add(metaActionInfo); + List temp = new ArrayList<>(); + temp.add(actionInfo); return temp; }); } @CapabilityMethod - public synchronized List popPendingAction(String userId) { - List infos = pendingActions.get(userId); + public synchronized List popPendingAction(String userId) { + List infos = pendingActions.get(userId); pendingActions.remove(userId); return infos; } @CapabilityMethod - public synchronized void putPreparedAction(String uuid, MetaActionInfo metaActionInfo) { + public synchronized void putPreparedAction(String uuid, ActionInfo actionInfo) { preparedActions.computeIfAbsent(uuid, k -> { - List temp = new ArrayList<>(); - temp.add(metaActionInfo); + List temp = new ArrayList<>(); + temp.add(actionInfo); return temp; }); } @CapabilityMethod - public synchronized List popPreparedAction(String userId) { - List infos = preparedActions.get(userId); + public synchronized List popPreparedAction(String userId) { + List infos = preparedActions.get(userId); preparedActions.remove(userId); return infos; } @CapabilityMethod - public List listPreparedAction(String userId) { + public List listPreparedAction(String userId) { return preparedActions.get(userId); } @CapabilityMethod - public List listPendingAction(String userId) { + public List listPendingAction(String userId) { return pendingActions.get(userId); } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java deleted file mode 100644 index 4fed2443..00000000 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java +++ /dev/null @@ -1,11 +0,0 @@ -package work.slhaf.partner.core.action.entity; - -import lombok.Data; - -@Data -public class ActionData { - private String key; - private String[] array; - private String reason; - private String description; -} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaActionInfo.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionInfo.java similarity index 54% rename from Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaActionInfo.java rename to Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionInfo.java index bc2abe4a..d3a3318d 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaActionInfo.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionInfo.java @@ -2,11 +2,15 @@ package work.slhaf.partner.core.action.entity; import lombok.Data; +import java.util.List; + @Data -public abstract class MetaActionInfo { +public abstract class ActionInfo { protected String uuid; protected String tendency; protected ActionStatus status; - protected ActionData actionData; + protected List actionChain; protected String Result; + protected String reason; + protected String description; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ImmediateActionInfo.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ImmediateActionInfo.java index f0ba45ff..5e65d871 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ImmediateActionInfo.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ImmediateActionInfo.java @@ -5,5 +5,5 @@ import lombok.EqualsAndHashCode; @EqualsAndHashCode(callSuper = true) @Data -public class ImmediateActionInfo extends MetaActionInfo{ +public class ImmediateActionInfo extends ActionInfo { } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java new file mode 100644 index 00000000..bdf2451b --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java @@ -0,0 +1,26 @@ +package work.slhaf.partner.core.action.entity; + +import lombok.Data; +import org.jetbrains.annotations.NotNull; + +@Data +public class MetaAction implements Comparable { + //行动key + private String key; + //行动参数 + private String[] params; + //行动回应 + private String response; + //执行顺序,升序排列 + private int order; + private boolean io; + + @Override + public int compareTo(@NotNull MetaAction metaAction) { + return this.order - metaAction.order; + } + + private void execute() { + + } +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ScheduledActionInfo.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ScheduledActionInfo.java index ddf86503..d2f1283b 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ScheduledActionInfo.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ScheduledActionInfo.java @@ -5,7 +5,7 @@ import lombok.EqualsAndHashCode; @EqualsAndHashCode(callSuper = true) @Data -public class ScheduledActionInfo extends MetaActionInfo { +public class ScheduledActionInfo extends ActionInfo { private ScheduledType type; private String scheduleContent; //如果为周期,则对应cron表达式,如果为一次性,则对应为LocalDateTime字符串 diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionCacheData.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/cache/ActionCacheData.java similarity index 99% rename from Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionCacheData.java rename to Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/cache/ActionCacheData.java index caba8198..38deccd7 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionCacheData.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/cache/ActionCacheData.java @@ -1,4 +1,4 @@ -package work.slhaf.partner.core.action.entity; +package work.slhaf.partner.core.action.entity.cache; import lombok.Data; import work.slhaf.partner.common.vector.VectorClient; diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/CacheAdjustData.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/cache/CacheAdjustData.java similarity index 75% rename from Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/CacheAdjustData.java rename to Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/cache/CacheAdjustData.java index b0289fde..d2fadd26 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/CacheAdjustData.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/cache/CacheAdjustData.java @@ -1,4 +1,4 @@ -package work.slhaf.partner.core.action.entity; +package work.slhaf.partner.core.action.entity.cache; import lombok.Data; diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/CacheAdjustMetaData.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/cache/CacheAdjustMetaData.java similarity index 73% rename from Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/CacheAdjustMetaData.java rename to Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/cache/CacheAdjustMetaData.java index 3afed553..04cb8dff 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/CacheAdjustMetaData.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/cache/CacheAdjustMetaData.java @@ -1,4 +1,4 @@ -package work.slhaf.partner.core.action.entity; +package work.slhaf.partner.core.action.entity.cache; import lombok.Data; diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/ActionDispatcher.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/ActionDispatcher.java new file mode 100644 index 00000000..8b278967 --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/ActionDispatcher.java @@ -0,0 +1,61 @@ +package work.slhaf.partner.module.modules.action.dispatcher; + +import work.slhaf.partner.api.agent.factory.capability.annotation.InjectCapability; +import work.slhaf.partner.api.agent.factory.module.annotation.AgentModule; +import work.slhaf.partner.api.agent.factory.module.annotation.Init; +import work.slhaf.partner.api.agent.factory.module.annotation.InjectModule; +import work.slhaf.partner.common.thread.InteractionThreadPoolExecutor; +import work.slhaf.partner.core.action.ActionCapability; +import work.slhaf.partner.core.action.entity.ActionInfo; +import work.slhaf.partner.core.action.entity.ImmediateActionInfo; +import work.slhaf.partner.core.action.entity.ScheduledActionInfo; +import work.slhaf.partner.module.common.module.PostRunningModule; +import work.slhaf.partner.module.modules.action.dispatcher.executor.ActionExecutor; +import work.slhaf.partner.module.modules.action.dispatcher.scheduler.ActionScheduler; +import work.slhaf.partner.runtime.interaction.data.context.PartnerRunningFlowContext; + +import java.util.ArrayList; +import java.util.List; + +@AgentModule(name = "action_dispatcher", order = 7) +public class ActionDispatcher extends PostRunningModule { + + @InjectCapability + private ActionCapability actionCapability; + + @InjectModule + private ActionExecutor actionExecutor; + @InjectModule + private ActionScheduler actionScheduler; + + private InteractionThreadPoolExecutor executor; + + @Init + public void init() { + executor = InteractionThreadPoolExecutor.getInstance(); + } + + @Override + public void doExecute(PartnerRunningFlowContext context) { + //只需要处理prepared action,因为pending action在用户确认后也将变为prepared action + //将PLANNING action放入时间轮中,IMMEDIATE action直接进入并发执行流 + //对于将触发的PLANNING action,理想做法是将执行工具做成执行链的形式,模型的自对话流程、是否通知用户都做成与普通工具同等的通用可选能力,避免绑定固定流程 + executor.execute(() -> { + String userId = context.getUserId(); + List preparedActions = actionCapability.popPreparedAction(userId); + //分类成PLANNING和IMMEDIATE两类 + List scheduledActions = new ArrayList<>(); + List immediateActions = new ArrayList<>(); + for (ActionInfo preparedAction : preparedActions) { + if (preparedAction instanceof ScheduledActionInfo actionInfo) { + scheduledActions.add(actionInfo); + } else if (preparedAction instanceof ImmediateActionInfo actionInfo) { + immediateActions.add(actionInfo); + } + } + actionExecutor.execute(immediateActions); + actionScheduler.execute(scheduledActions); + }); + } + +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java new file mode 100644 index 00000000..435b65e7 --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java @@ -0,0 +1,22 @@ +package work.slhaf.partner.module.modules.action.dispatcher.executor; + +import work.slhaf.partner.api.agent.factory.capability.annotation.InjectCapability; +import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule; +import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.AgentRunningSubModule; +import work.slhaf.partner.core.action.ActionCapability; +import work.slhaf.partner.core.action.entity.ImmediateActionInfo; + +import java.util.List; + +@AgentSubModule +public class ActionExecutor extends AgentRunningSubModule, Void> { + + @InjectCapability + private ActionCapability actionCapability; + + @Override + public Void execute(List immediateActions) { + + return null; + } +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.java new file mode 100644 index 00000000..3c7d0878 --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.java @@ -0,0 +1,16 @@ +package work.slhaf.partner.module.modules.action.dispatcher.scheduler; + +import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule; +import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.AgentRunningSubModule; +import work.slhaf.partner.core.action.entity.ScheduledActionInfo; + +import java.util.List; + +@AgentSubModule +public class ActionScheduler extends AgentRunningSubModule, Void> { + @Override + public Void execute(List data) { + + return null; + } +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java index abfbe049..2629ac05 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java @@ -9,7 +9,12 @@ import work.slhaf.partner.api.chat.pojo.Message; import work.slhaf.partner.common.thread.InteractionThreadPoolExecutor; import work.slhaf.partner.common.vector.VectorClient; import work.slhaf.partner.core.action.ActionCapability; -import work.slhaf.partner.core.action.entity.*; +import work.slhaf.partner.core.action.entity.ActionInfo; +import work.slhaf.partner.core.action.entity.ActionStatus; +import work.slhaf.partner.core.action.entity.ImmediateActionInfo; +import work.slhaf.partner.core.action.entity.ScheduledActionInfo; +import work.slhaf.partner.core.action.entity.cache.CacheAdjustData; +import work.slhaf.partner.core.action.entity.cache.CacheAdjustMetaData; import work.slhaf.partner.core.cognation.CognationCapability; import work.slhaf.partner.core.memory.MemoryCapability; import work.slhaf.partner.core.perceive.PerceiveCapability; @@ -129,14 +134,14 @@ public class ActionPlanner extends PreRunningModule { } private void setupPendingActionInfo(PartnerRunningFlowContext context, ConfirmerResult result) { - //TODO 需考虑未确认任务的失效或者拒绝时机 + //TODO 需考虑未确认任务的失效或者拒绝时机,在action core中实现 List uuids = result.getUuids(); if (uuids == null) { return; } String contextUuid = context.getUuid(); - List pendingActions = actionCapability.popPendingAction(context.getUserId()); - for (MetaActionInfo actionInfo : pendingActions) { + List pendingActions = actionCapability.popPendingAction(context.getUserId()); + for (ActionInfo actionInfo : pendingActions) { if (uuids.contains(actionInfo.getUuid())) { actionCapability.putPreparedAction(contextUuid, actionInfo); } @@ -146,11 +151,11 @@ public class ActionPlanner extends PreRunningModule { private void setupActionInfo(List evaluatorResults, PartnerRunningFlowContext context) { for (EvaluatorResult evaluatorResult : evaluatorResults) { - MetaActionInfo metaActionInfo = assemblyHelper.buildMetaActionInfo(evaluatorResult); + ActionInfo actionInfo = assemblyHelper.buildMetaActionInfo(evaluatorResult); if (evaluatorResult.isNeedConfirm()) { - actionCapability.putPendingActions(context.getUserId(), metaActionInfo); + actionCapability.putPendingActions(context.getUserId(), actionInfo); } else { - actionCapability.putPreparedAction(context.getUuid(), metaActionInfo); + actionCapability.putPreparedAction(context.getUuid(), actionInfo); } } } @@ -165,7 +170,7 @@ public class ActionPlanner extends PreRunningModule { } private void setupPendingActions(HashMap map, String userId) { - List actionInfos = actionCapability.listPendingAction(userId); + List actionInfos = actionCapability.listPendingAction(userId); if (actionInfos == null || actionInfos.isEmpty()) { map.put("[待确认行动] <待确认行动信息>", "无待确认行动"); return; @@ -176,7 +181,7 @@ public class ActionPlanner extends PreRunningModule { } private void setupPreparedActions(HashMap map, String uuid) { - List actionInfos = actionCapability.listPreparedAction(uuid); + List actionInfos = actionCapability.listPreparedAction(uuid); if (actionInfos == null || actionInfos.isEmpty()) { map.put("[预备行动] <预备行动信息>", "无预备行动"); return; @@ -186,11 +191,10 @@ public class ActionPlanner extends PreRunningModule { } } - private String generateActionStr(MetaActionInfo metaActionInfo) { - ActionData actionData = metaActionInfo.getActionData(); - return "<行动倾向>" + " : " + metaActionInfo.getTendency() + - "<行动原因>" + " : " + actionData.getReason() + - "<工具描述>" + " : " + actionData.getDescription(); + private String generateActionStr(ActionInfo actionInfo) { + return "<行动倾向>" + " : " + actionInfo.getTendency() + + "<行动原因>" + " : " + actionInfo.getReason() + + "<工具描述>" + " : " + actionInfo.getDescription(); } @Override @@ -225,11 +229,11 @@ public class ActionPlanner extends PreRunningModule { return input; } - private MetaActionInfo buildMetaActionInfo(EvaluatorResult evaluatorResult) { + private ActionInfo buildMetaActionInfo(EvaluatorResult evaluatorResult) { return switch (evaluatorResult.getType()) { case PLANNING -> { ScheduledActionInfo actionInfo = new ScheduledActionInfo(); - actionInfo.setActionData(evaluatorResult.getActionData()); + actionInfo.setActionChain(evaluatorResult.getActionChain()); actionInfo.setScheduleContent(evaluatorResult.getScheduleContent()); actionInfo.setStatus(ActionStatus.PREPARE); actionInfo.setUuid(UUID.randomUUID().toString()); @@ -237,7 +241,7 @@ public class ActionPlanner extends PreRunningModule { } case IMMEDIATE -> { ImmediateActionInfo actionInfo = new ImmediateActionInfo(); - actionInfo.setActionData(evaluatorResult.getActionData()); + actionInfo.setActionChain(evaluatorResult.getActionChain()); actionInfo.setStatus(ActionStatus.PREPARE); actionInfo.setUuid(UUID.randomUUID().toString()); yield actionInfo; @@ -248,7 +252,7 @@ public class ActionPlanner extends PreRunningModule { private ConfirmerInput buildConfirmerInput(PartnerRunningFlowContext context) { ConfirmerInput confirmerInput = new ConfirmerInput(); confirmerInput.setInput(context.getInput()); - List pendingActions = actionCapability.listPendingAction(context.getUserId()); + List pendingActions = actionCapability.listPendingAction(context.getUserId()); confirmerInput.setActionInfos(pendingActions); return confirmerInput; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/confirmer/entity/ConfirmerInput.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/confirmer/entity/ConfirmerInput.java index 88fc4a9a..54f0247c 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/confirmer/entity/ConfirmerInput.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/confirmer/entity/ConfirmerInput.java @@ -2,13 +2,13 @@ package work.slhaf.partner.module.modules.action.planner.confirmer.entity; import lombok.Data; import work.slhaf.partner.api.chat.pojo.Message; -import work.slhaf.partner.core.action.entity.MetaActionInfo; +import work.slhaf.partner.core.action.entity.ActionInfo; import java.util.List; @Data public class ConfirmerInput { private String input; - private List actionInfos; + private List actionInfos; private List recentMessages; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/evaluator/entity/EvaluatorResult.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/evaluator/entity/EvaluatorResult.java index 797edc1b..1f7232b7 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/evaluator/entity/EvaluatorResult.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/evaluator/entity/EvaluatorResult.java @@ -1,8 +1,10 @@ package work.slhaf.partner.module.modules.action.planner.evaluator.entity; import lombok.Data; -import work.slhaf.partner.core.action.entity.ActionData; import work.slhaf.partner.core.action.entity.ActionType; +import work.slhaf.partner.core.action.entity.MetaAction; + +import java.util.List; @Data public class EvaluatorResult { @@ -10,6 +12,6 @@ public class EvaluatorResult { private boolean needConfirm; private ActionType type; private String scheduleContent; - private ActionData actionData; + private List actionChain; private String tendency; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/scheduler/ActionDispatcher.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/scheduler/ActionDispatcher.java deleted file mode 100644 index 7b2c8805..00000000 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/scheduler/ActionDispatcher.java +++ /dev/null @@ -1,4 +0,0 @@ -package work.slhaf.partner.module.modules.action.scheduler; - -public class ActionDispatcher { -} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/scheduler/TaskScheduler.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/scheduler/TaskScheduler.java deleted file mode 100644 index 72e88c4c..00000000 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/scheduler/TaskScheduler.java +++ /dev/null @@ -1,7 +0,0 @@ -package work.slhaf.partner.module.modules.action.scheduler; - -/** - * 负责综合前置模块 - */ -public class TaskScheduler { -} From 4757425a151244491730e90e7d820b5ac6139f90 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Thu, 23 Oct 2025 23:24:30 +0800 Subject: [PATCH 002/182] =?UTF-8?q?=E6=8E=A8=E8=BF=9B=20ActionDispatcher?= =?UTF-8?q?=20=E6=A8=A1=E5=9D=97=E3=80=81=E5=AE=8C=E5=96=84=E8=A1=8C?= =?UTF-8?q?=E5=8A=A8=E7=A8=8B=E5=BA=8F=E8=A7=84=E8=8C=83=E4=B8=8E=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 明确行动程序的存储形式与加载规则,分为执行程序和描述文件,前者负责逻辑,后者提供必要的描述性信息; - 将 ActionInfo 重命名为 ActionData,更新相关接口和实现,增强代码一致性和可读性; - 添加异常处理类以支持行动程序、描述信息的初始化和加载失败的场景; - 实现行动程序目录的监控功能,支持行动程序的动态加载与管理; - 明确了 ActionDispatcher 两个子模块的输入输出规范 --- .idea/copilot.data.migration.agent.xml | 6 + .idea/copilot.data.migration.ask.xml | 6 + .idea/copilot.data.migration.edit.xml | 6 + .../work/slhaf/partner/common/Constant.java | 11 + .../work/slhaf/partner/core/PartnerCore.java | 9 +- .../partner/core/action/ActionCapability.java | 14 +- .../slhaf/partner/core/action/ActionCore.java | 227 ++++++++++++++++-- .../{ActionInfo.java => ActionData.java} | 9 +- .../core/action/entity/ActionStatus.java | 5 - .../core/action/entity/ActionType.java | 5 - ...tionInfo.java => ImmediateActionData.java} | 5 +- .../core/action/entity/MetaAction.java | 86 ++++++- .../core/action/entity/MetaActionInfo.java | 62 +++++ .../core/action/entity/MetaActionType.java | 5 + ...tionInfo.java => ScheduledActionData.java} | 5 +- .../exception/ActionInitFailedException.java | 13 + .../exception/ActionLoadFailedException.java | 13 + .../slhaf/partner/core/memory/MemoryCore.java | 8 +- .../action/dispatcher/ActionDispatcher.java | 18 +- .../dispatcher/executor/ActionExecutor.java | 6 +- .../dispatcher/scheduler/ActionScheduler.java | 6 +- .../modules/action/planner/ActionPlanner.java | 59 +++-- .../confirmer/entity/ConfirmerInput.java | 4 +- .../evaluator/entity/EvaluatorResult.java | 5 +- 24 files changed, 487 insertions(+), 106 deletions(-) create mode 100644 .idea/copilot.data.migration.agent.xml create mode 100644 .idea/copilot.data.migration.ask.xml create mode 100644 .idea/copilot.data.migration.edit.xml create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/common/Constant.java rename Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/{ActionInfo.java => ActionData.java} (54%) delete mode 100644 Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionStatus.java delete mode 100644 Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionType.java rename Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/{ImmediateActionInfo.java => ImmediateActionData.java} (55%) create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaActionInfo.java create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaActionType.java rename Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/{ScheduledActionInfo.java => ScheduledActionData.java} (56%) create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/core/action/exception/ActionInitFailedException.java create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/core/action/exception/ActionLoadFailedException.java diff --git a/.idea/copilot.data.migration.agent.xml b/.idea/copilot.data.migration.agent.xml new file mode 100644 index 00000000..4ea72a91 --- /dev/null +++ b/.idea/copilot.data.migration.agent.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/copilot.data.migration.ask.xml b/.idea/copilot.data.migration.ask.xml new file mode 100644 index 00000000..7ef04e2e --- /dev/null +++ b/.idea/copilot.data.migration.ask.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/copilot.data.migration.edit.xml b/.idea/copilot.data.migration.edit.xml new file mode 100644 index 00000000..8648f940 --- /dev/null +++ b/.idea/copilot.data.migration.edit.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/Partner-Main/src/main/java/work/slhaf/partner/common/Constant.java b/Partner-Main/src/main/java/work/slhaf/partner/common/Constant.java new file mode 100644 index 00000000..0707b3d3 --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/common/Constant.java @@ -0,0 +1,11 @@ +package work.slhaf.partner.common; + +public final class Constant { + + public static final class Path { + public static final String DATA = "./data"; + public static final String MEMORY_DATA = DATA + "/memory"; + public static final String ACTION_PROGRAM = DATA + "/action"; + } + +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/PartnerCore.java b/Partner-Main/src/main/java/work/slhaf/partner/core/PartnerCore.java index eee0652c..9b75d06d 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/PartnerCore.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/PartnerCore.java @@ -13,10 +13,11 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.StandardCopyOption; +import static work.slhaf.partner.common.Constant.Path.MEMORY_DATA; + @Slf4j public abstract class PartnerCore> extends PersistableObject { - private static final String STORAGE_DIR = "./data/memory/"; private final String id = ((PartnerAgentConfigManager) AgentConfigManager.INSTANCE).getConfig().getAgentId(); public PartnerCore() throws IOException, ClassNotFoundException { @@ -53,7 +54,7 @@ public abstract class PartnerCore> extends PersistableO public void serialize() throws IOException { //先写入到临时文件,如果正常写入则覆盖原文件 Path filePath = getFilePath(id + "-temp"); - Files.createDirectories(Path.of(STORAGE_DIR)); + Files.createDirectories(Path.of(MEMORY_DATA)); try { ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(filePath.toFile())); oos.writeObject(this); @@ -78,12 +79,12 @@ public abstract class PartnerCore> extends PersistableO } private Path getFilePath(String s) { - return Paths.get(STORAGE_DIR, s + "-" + getCoreKey() + ".memory"); + return Paths.get(MEMORY_DATA, s + "-" + getCoreKey() + ".memory"); } private void createStorageDirectory() { try { - Files.createDirectories(Paths.get(STORAGE_DIR)); + Files.createDirectories(Paths.get(MEMORY_DATA)); } catch (IOException e) { log.error("[{}]创建存储目录失败: {}", getCoreKey(), e.getMessage()); } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java index 03d4f0c2..79003548 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java @@ -1,24 +1,24 @@ package work.slhaf.partner.core.action; import work.slhaf.partner.api.agent.factory.capability.annotation.Capability; -import work.slhaf.partner.core.action.entity.ActionInfo; +import work.slhaf.partner.core.action.entity.ActionData; import work.slhaf.partner.core.action.entity.cache.CacheAdjustData; import java.util.List; @Capability(value = "action") public interface ActionCapability { - void putPreparedAction(String uuid, ActionInfo actionInfo); + void putPreparedAction(String uuid, ActionData actionData); - List popPreparedAction(String userId); + List popPreparedAction(String userId); - List popPendingAction(String userId); + List popPendingAction(String userId); - List listPreparedAction(String userId); + List listPreparedAction(String userId); - List listPendingAction(String userId); + List listPendingAction(String userId); - void putPendingActions(String userId, ActionInfo actionInfo); + void putPendingActions(String userId, ActionData actionData); List selectTendencyCache(String input); diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java index 8dd95d58..9497147b 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java @@ -1,25 +1,35 @@ package work.slhaf.partner.core.action; import lombok.extern.slf4j.Slf4j; +import org.jetbrains.annotations.NotNull; import work.slhaf.partner.api.agent.factory.capability.annotation.CapabilityCore; import work.slhaf.partner.api.agent.factory.capability.annotation.CapabilityMethod; import work.slhaf.partner.common.vector.VectorClient; import work.slhaf.partner.core.PartnerCore; -import work.slhaf.partner.core.action.entity.ActionInfo; +import work.slhaf.partner.core.action.entity.ActionData; +import work.slhaf.partner.core.action.entity.MetaActionInfo; import work.slhaf.partner.core.action.entity.cache.ActionCacheData; import work.slhaf.partner.core.action.entity.cache.CacheAdjustData; import work.slhaf.partner.core.action.entity.cache.CacheAdjustMetaData; +import work.slhaf.partner.core.action.exception.ActionInitFailedException; +import work.slhaf.partner.core.action.exception.ActionLoadFailedException; +import java.io.File; import java.io.IOException; +import java.nio.file.*; +import java.nio.file.attribute.BasicFileAttributes; import java.util.ArrayList; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; -import java.util.concurrent.Executor; +import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import java.util.stream.Collectors; +import static work.slhaf.partner.common.Constant.Path.ACTION_PROGRAM; + @SuppressWarnings("FieldMayBeFinal") @CapabilityCore(value = "action") @Slf4j @@ -28,64 +38,68 @@ public class ActionCore extends PartnerCore { /** * 对应本次交互即将执行或将要放置在行动池的预备任务,因此将以本次交互的uuid为键,其起到的作用相当于暂时的模块上下文 */ - private HashMap> preparedActions = new HashMap<>(); + private HashMap> preparedActions = new HashMap<>(); /** * 待确认任务,以userId区分不同用户,因为需要跨请求确认 */ - private HashMap> pendingActions = new HashMap<>(); + private HashMap> pendingActions = new HashMap<>(); /** * 语义缓存与行为倾向映射 */ private List actionCache = new ArrayList<>(); - private Lock cacheLock = new ReentrantLock(); + private final Lock cacheLock = new ReentrantLock(); - private Executor executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()); + private final ExecutorService platformExecutor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()); + private final ExecutorService virtualExecutor = Executors.newVirtualThreadPerTaskExecutor(); + + private final LinkedHashMap existedMetaActions = new LinkedHashMap<>(); public ActionCore() throws IOException, ClassNotFoundException { + new ActionWatchService().launch(); } @CapabilityMethod - public synchronized void putPendingActions(String userId, ActionInfo actionInfo) { + public synchronized void putPendingActions(String userId, ActionData actionData) { pendingActions.computeIfAbsent(userId, k -> { - List temp = new ArrayList<>(); - temp.add(actionInfo); + List temp = new ArrayList<>(); + temp.add(actionData); return temp; }); } @CapabilityMethod - public synchronized List popPendingAction(String userId) { - List infos = pendingActions.get(userId); + public synchronized List popPendingAction(String userId) { + List infos = pendingActions.get(userId); pendingActions.remove(userId); return infos; } @CapabilityMethod - public synchronized void putPreparedAction(String uuid, ActionInfo actionInfo) { + public synchronized void putPreparedAction(String uuid, ActionData actionData) { preparedActions.computeIfAbsent(uuid, k -> { - List temp = new ArrayList<>(); - temp.add(actionInfo); + List temp = new ArrayList<>(); + temp.add(actionData); return temp; }); } @CapabilityMethod - public synchronized List popPreparedAction(String userId) { - List infos = preparedActions.get(userId); + public synchronized List popPreparedAction(String userId) { + List infos = preparedActions.get(userId); preparedActions.remove(userId); return infos; } @CapabilityMethod - public List listPreparedAction(String userId) { + public List listPreparedAction(String userId) { return preparedActions.get(userId); } @CapabilityMethod - public List listPendingAction(String userId) { + public List listPendingAction(String userId) { return pendingActions.get(userId); } @@ -136,9 +150,9 @@ public class ActionCore extends PartnerCore { } } - executor.execute(() -> adjustMatchAndPassed(matchAndPassed, inputVector, input, vectorClient)); - executor.execute(() -> adjustMatchNotPassed(matchNotPassed, vectorClient)); - executor.execute(() -> adjustNotMatchPassed(notMatchPassed, inputVector, input, vectorClient)); + platformExecutor.execute(() -> adjustMatchAndPassed(matchAndPassed, inputVector, input, vectorClient)); + platformExecutor.execute(() -> adjustMatchNotPassed(matchNotPassed, vectorClient)); + platformExecutor.execute(() -> adjustNotMatchPassed(notMatchPassed, inputVector, input, vectorClient)); } /** @@ -148,7 +162,8 @@ public class ActionCore extends PartnerCore { * @param inputVector 本次输入内容的语义向量 * @param vectorClient 向量客户端 */ - private void adjustMatchAndPassed(List matchAndPassed, float[] inputVector, String input, VectorClient vectorClient) { + private void adjustMatchAndPassed(List matchAndPassed, float[] inputVector, String + input, VectorClient vectorClient) { matchAndPassed.forEach(adjustData -> { //获取原始缓存条目 String tendency = adjustData.getTendency(); @@ -204,7 +219,8 @@ public class ActionCore extends PartnerCore { * @param input 本次输入内容 * @param vectorClient 向量客户端 */ - private void adjustNotMatchPassed(List notMatchPassed, float[] inputVector, String input, VectorClient vectorClient) { + private void adjustNotMatchPassed(List notMatchPassed, float[] inputVector, String + input, VectorClient vectorClient) { notMatchPassed.forEach(adjustData -> { //获取原始缓存条目 String tendency = adjustData.getTendency(); @@ -232,4 +248,169 @@ public class ActionCore extends PartnerCore { protected String getCoreKey() { return "action-core"; } + + @SuppressWarnings("unchecked") + private class ActionWatchService { + + private HashMap registeredPaths = new HashMap<>(); + + public void launch() { + Path path = Path.of(ACTION_PROGRAM); + scanActions(path.toFile()); + launchActionDirectoryWatcher(path); + } + + private void launchActionDirectoryWatcher(Path path) { + WatchService watchService; + try { + watchService = FileSystems.getDefault().newWatchService(); + setupShutdownHook(watchService); + registerParentToWatch(path, watchService); + registerSubToWatch(path, watchService); + virtualExecutor.execute(registerWatchTask(path, watchService)); + } catch (IOException e) { + throw new ActionInitFailedException("行动程序目录监听器启动失败", e); + } + } + + private void setupShutdownHook(WatchService watchService) { + Runtime.getRuntime().addShutdownHook(new Thread(() -> { + try { + watchService.close(); + } catch (IOException e) { + throw new RuntimeException(e); + } + })); + } + + private Runnable registerWatchTask(Path path, WatchService watchService) { + return () -> { + log.info("[{}] 行动程序目录监听器已启动", getCoreKey()); + while (true) { + WatchKey key; + try { + key = watchService.take(); + List> events = key.pollEvents(); + for (WatchEvent e : events) { + WatchEvent event = (WatchEvent) e; + WatchEvent.Kind kind = event.kind(); + Path context = event.context(); + log.info("[{}] 行动程序目录变更事件: {} - {}", getCoreKey(), kind.name(), context.toString()); + Path thisDir = (Path) key.watchable(); + //根据事件发生的目录进行分流,分为父目录事件和子程序事件 + if (thisDir.equals(path)) { + handleParentDirEvent(kind, thisDir, context, watchService); + } else { + handleSubDirEvent(kind, thisDir); + } + } + } catch (InterruptedException e) { + log.info("监听线程被中断,准备退出..."); + Thread.currentThread().interrupt(); // 恢复中断标志 + break; + } catch (ClosedWatchServiceException e) { + log.info("WatchService 已关闭,监听线程退出。"); + break; + } + } + }; + } + + private void handleSubDirEvent(WatchEvent.Kind kind, Path thisDir) { + // path为触发本次行动的文件的路径(当前位于某个action目录下) + // 先判定发生的目录前缀是否匹配(action、desc),否则忽略 + if (kind == StandardWatchEventKinds.ENTRY_CREATE || kind == StandardWatchEventKinds.ENTRY_MODIFY) { + // CREATE、MODIFY 事件将触发一次检测,看当前thisDir中action和desc是否都具备,如果通过则尝试加载(put)。 + boolean complete = checkComplete(thisDir); + if (!complete) return; + try { + MetaActionInfo newActionInfo = new MetaActionInfo(thisDir.toFile()); + existedMetaActions.put(thisDir.toString(), newActionInfo); + } catch (ActionLoadFailedException e) { + log.warn("[{}] 行动信息重新加载失败,触发行为: {}", getCoreKey(), kind.name()); + } + } else if (kind == StandardWatchEventKinds.ENTRY_DELETE) { + // DELETE 事件将会把该 MetaActionInfo 从记录中移除 + existedMetaActions.remove(thisDir.toString()); + } + } + + private boolean checkComplete(Path thisDir) { + File[] files = thisDir.toFile().listFiles(); + if (files == null) { + log.error("[{}]当前目录无法访问: [{}]", getCoreKey(), thisDir); + return false; + } + boolean existedAction = false; + boolean existedDesc = false; + for (File file : files) { + String fileName = file.getName(); + String nameWithoutExt = fileName.substring(0, fileName.lastIndexOf('.')); + if (nameWithoutExt.equals("action")) existedAction = true; + else if (nameWithoutExt.equals("desc")) existedDesc = true; + } + return existedAction && existedDesc; + } + + private void handleParentDirEvent(WatchEvent.Kind kind, Path thisDir, Path context, WatchService watchService) { + Path path = Path.of(thisDir.toString(), context.toString()); + // MODIFY 事件不进行处理 + if (kind == StandardWatchEventKinds.ENTRY_CREATE) { + try { + path.register(watchService, + StandardWatchEventKinds.ENTRY_CREATE, + StandardWatchEventKinds.ENTRY_DELETE, + StandardWatchEventKinds.ENTRY_MODIFY); + } catch (IOException e) { + log.error("[{}] 新增行动程序目录监听失败: {}", getCoreKey(), path, e); + } + } else if (kind == StandardWatchEventKinds.ENTRY_DELETE) { + WatchKey remove = registeredPaths.remove(path); + remove.cancel(); + } + } + + private void registerSubToWatch(Path path, WatchService watchService) throws IOException { + Files.walkFileTree(path, new SimpleFileVisitor<>() { + @Override + public @NotNull FileVisitResult preVisitDirectory(@NotNull Path dir, @NotNull BasicFileAttributes attrs) throws IOException { + if (dir.getFileName().startsWith(".")) return FileVisitResult.CONTINUE; + WatchKey key = dir.register(watchService, + StandardWatchEventKinds.ENTRY_CREATE, + StandardWatchEventKinds.ENTRY_DELETE, + StandardWatchEventKinds.ENTRY_MODIFY); + registeredPaths.put(dir, key); + return FileVisitResult.CONTINUE; + } + }); + } + + private void registerParentToWatch(Path path, WatchService watchService) throws IOException { + WatchKey key = path.register(watchService, + StandardWatchEventKinds.ENTRY_CREATE, + StandardWatchEventKinds.ENTRY_DELETE, + StandardWatchEventKinds.ENTRY_MODIFY); + registeredPaths.put(path, key); + } + + private void scanActions(File file) { + if (!file.exists() || file.isFile()) { + throw new ActionInitFailedException("未找到行动程序目录: " + file.getAbsolutePath()); + } + File[] files = file.listFiles(); + if (files == null) { + throw new ActionInitFailedException("目录无法访问: " + file.getAbsolutePath()); + } + for (File f : files) { + try { + MetaActionInfo actionInfo = new MetaActionInfo(f); + existedMetaActions.put(f.getName(), actionInfo); + log.info("[{}] 行动程序[{}]已加载", getCoreKey(), actionInfo.getKey()); + } catch (ActionLoadFailedException e) { + log.warn("[{}] 行动程序未加载: {}", getCoreKey(), e.getMessage()); + } + } + + } + } } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionInfo.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java similarity index 54% rename from Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionInfo.java rename to Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java index d3a3318d..18ddcddc 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionInfo.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java @@ -4,8 +4,11 @@ import lombok.Data; import java.util.List; +/** + * 行动模块传递的行动数据,包含行动uuid、倾向、状态、行动链、结果、发起原因、行动描述等信息。 + */ @Data -public abstract class ActionInfo { +public abstract class ActionData { protected String uuid; protected String tendency; protected ActionStatus status; @@ -13,4 +16,8 @@ public abstract class ActionInfo { protected String Result; protected String reason; protected String description; + + public enum ActionStatus { + SUCCESS, FAILED, EXECUTING, WAITING, PREPARE + } } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionStatus.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionStatus.java deleted file mode 100644 index 31256076..00000000 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionStatus.java +++ /dev/null @@ -1,5 +0,0 @@ -package work.slhaf.partner.core.action.entity; - -public enum ActionStatus { - SUCCESS, FAILED, EXECUTING, WAITING, PREPARE -} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionType.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionType.java deleted file mode 100644 index 2354929e..00000000 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionType.java +++ /dev/null @@ -1,5 +0,0 @@ -package work.slhaf.partner.core.action.entity; - -public enum ActionType { - IMMEDIATE, PLANNING -} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ImmediateActionInfo.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ImmediateActionData.java similarity index 55% rename from Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ImmediateActionInfo.java rename to Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ImmediateActionData.java index 5e65d871..388ea0b1 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ImmediateActionInfo.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ImmediateActionData.java @@ -3,7 +3,10 @@ package work.slhaf.partner.core.action.entity; import lombok.Data; import lombok.EqualsAndHashCode; +/** + * 即时行动数据类,继承自{@link ActionData} + */ @EqualsAndHashCode(callSuper = true) @Data -public class ImmediateActionInfo extends ActionInfo { +public class ImmediateActionData extends ActionData { } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java index bdf2451b..349bebb8 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java @@ -2,25 +2,97 @@ package work.slhaf.partner.core.action.entity; import lombok.Data; import org.jetbrains.annotations.NotNull; +import work.slhaf.partner.common.Constant; +import java.io.File; +import java.nio.file.Path; +import java.util.concurrent.Callable; + +import static work.slhaf.partner.common.Constant.Path.ACTION_PROGRAM; + +/** + * 行动链中的单一元素,实现{@link Runnable}接口,封装了调用外部行动程序的必要信息,可被执行 + */ @Data -public class MetaAction implements Comparable { - //行动key +public class MetaAction implements Comparable, Callable { + + /** + * 行动key,用于标识与定位行动程序 + */ private String key; - //行动参数 + /** + * 行动程序可接受的参数,由调用处设置 + */ private String[] params; - //行动回应 - private String response; - //执行顺序,升序排列 + /** + * 行动结果,包括执行状态和相应内容(执行结果或者错误信息) + */ + private Result result; + /** + * 执行顺序,升序排列 + */ private int order; + /** + * 是否IO密集,用于决定使用何种线程池 + */ private boolean io; + /** + * 行动程序类型,可分为PLUGIN(jar文件)、SCRIPT(Python程序)、MCP(MCP服务) + */ + private MetaActionType type; @Override public int compareTo(@NotNull MetaAction metaAction) { return this.order - metaAction.order; } - private void execute() { + @Override + public Void call() { + File action = loadFromFile(); + if (!action.exists()) { + result = new Result(); + result.setSuccess(false); + result.setData("Action file not found: " + action.getAbsolutePath()); + return null; + } + try { + switch (type) { + case PLUGIN -> executePlugin(action); + case MCP -> executeMcp(action); + case SCRIPT -> executeScript(action); + } + } catch (Exception e) { + result = new Result(); + result.setSuccess(false); + result.setData(e.getMessage()); + } + return null; + } + + private File loadFromFile() { + return switch (type) { + case PLUGIN -> Path.of(Constant.Path.ACTION_PROGRAM, key, "action.jar").toFile(); + case SCRIPT -> Path.of(ACTION_PROGRAM, key, "action.py").toFile(); + case MCP -> Path.of(ACTION_PROGRAM, key, "action.json").toFile(); + }; + } + + private void executePlugin(File actionFile) { } + + private void executeMcp(File actionFile) { + + } + + private void executeScript(File actionFile) { + + } + + @Data + public static class Result { + private boolean success; + private String data; + } + } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaActionInfo.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaActionInfo.java new file mode 100644 index 00000000..c9bbd04d --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaActionInfo.java @@ -0,0 +1,62 @@ +package work.slhaf.partner.core.action.entity; + +import cn.hutool.core.bean.BeanUtil; +import com.alibaba.fastjson2.JSONObject; +import lombok.Data; +import org.apache.commons.io.FileUtils; +import work.slhaf.partner.core.action.exception.ActionLoadFailedException; + +import java.io.File; +import java.nio.charset.StandardCharsets; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Data +public class MetaActionInfo { + private String key; + private boolean io; + private MetaActionType type; + + private Map params; + private String description; + private List tags; + + private List preActions; + private List postActions; + /** + * 是否严格依赖前置行动的成功执行,若为true且前置行动失败则不执行该行动,后置任务多为触发式。默认即执行。 + */ + private boolean strictDependencies; + + private JSONObject responseSchema; + + public MetaActionInfo(File actionDir) { + if (actionDir.isFile()) { + throw new ActionLoadFailedException("Action directory expected, but file found: " + actionDir.getAbsolutePath()); + } + File[] files = actionDir.listFiles(); + if (files == null || files.length == 0) { + throw new ActionLoadFailedException("Action directory is empty: " + actionDir.getAbsolutePath()); + } + //加载desc.json + File desc = Path.of(actionDir.getPath(), "desc.json").toFile(); + if (!desc.exists() || desc.isDirectory()) { + throw new ActionLoadFailedException("Action desc.json not found: " + desc.getAbsolutePath()); + } + try { + String s = FileUtils.readFileToString(desc, StandardCharsets.UTF_8); + MetaActionInfo temp = JSONObject.parseObject(s, MetaActionInfo.class); + BeanUtil.copyProperties(temp, this); + } catch (Exception e) { + throw new ActionLoadFailedException("Failed to load action desc.json: " + desc.getAbsolutePath(), e); + } + //进行必要的字段校验和初始化 + if (type == null) throw new ActionLoadFailedException("Action type missing in desc.json"); + if (params == null) params = new HashMap<>(); + if (preActions == null) preActions = new ArrayList<>(); + if (postActions == null) postActions = new ArrayList<>(); + } +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaActionType.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaActionType.java new file mode 100644 index 00000000..a260141a --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaActionType.java @@ -0,0 +1,5 @@ +package work.slhaf.partner.core.action.entity; + +public enum MetaActionType { + PLUGIN, MCP, SCRIPT +} \ No newline at end of file diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ScheduledActionInfo.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ScheduledActionData.java similarity index 56% rename from Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ScheduledActionInfo.java rename to Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ScheduledActionData.java index d2f1283b..00eaaaea 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ScheduledActionInfo.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ScheduledActionData.java @@ -3,9 +3,12 @@ package work.slhaf.partner.core.action.entity; import lombok.Data; import lombok.EqualsAndHashCode; +/** + * 计划行动数据类,继承自{@link ActionData},扩展了属性{@link ScheduledActionData#type}和{@link ScheduledActionData#scheduleContent},用于标识计划类型(单次还是周期性任务)和计划内容 + */ @EqualsAndHashCode(callSuper = true) @Data -public class ScheduledActionInfo extends ActionInfo { +public class ScheduledActionData extends ActionData { private ScheduledType type; private String scheduleContent; //如果为周期,则对应cron表达式,如果为一次性,则对应为LocalDateTime字符串 diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/exception/ActionInitFailedException.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/exception/ActionInitFailedException.java new file mode 100644 index 00000000..4e3e2849 --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/exception/ActionInitFailedException.java @@ -0,0 +1,13 @@ +package work.slhaf.partner.core.action.exception; + +import work.slhaf.partner.api.agent.runtime.exception.AgentLaunchFailedException; + +public class ActionInitFailedException extends AgentLaunchFailedException { + public ActionInitFailedException(String message, Throwable cause) { + super(message, cause); + } + + public ActionInitFailedException(String message) { + super(message); + } +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/exception/ActionLoadFailedException.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/exception/ActionLoadFailedException.java new file mode 100644 index 00000000..7cded2a6 --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/exception/ActionLoadFailedException.java @@ -0,0 +1,13 @@ +package work.slhaf.partner.core.action.exception; + +import work.slhaf.partner.api.agent.runtime.exception.AgentRuntimeException; + +public class ActionLoadFailedException extends AgentRuntimeException { + public ActionLoadFailedException(String message) { + super(message); + } + + public ActionLoadFailedException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/memory/MemoryCore.java b/Partner-Main/src/main/java/work/slhaf/partner/core/memory/MemoryCore.java index 46924c05..98c6d4b6 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/memory/MemoryCore.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/memory/MemoryCore.java @@ -198,9 +198,9 @@ public class MemoryCore extends PartnerCore { //尝试更新缓存 updateCache(topicPath, memoryResult); } catch (Exception e) { - log.error("[CoordinatedManager] selectMemory error: ", e); - log.error("[CoordinatedManager] 路径: {}", topicPathStr); - log.error("[CoordinatedManager] 主题树: {}", getTopicTree()); + log.error("[{}] selectMemory error: ", getCoreKey(), e); + log.error("[{}] 路径: {}", getCoreKey(), topicPathStr); + log.error("[{}] 主题树: {}", getCoreKey(), getTopicTree()); memoryResult = new MemoryResult(); memoryResult.setRelatedMemorySliceResult(new ArrayList<>()); memoryResult.setMemorySliceResult(new CopyOnWriteArrayList<>()); @@ -211,7 +211,7 @@ public class MemoryCore extends PartnerCore { @CapabilityMethod public void updateActivatedSlices(String userId, List memorySlices) { cache.activatedSlices.put(userId, memorySlices); - log.debug("[CoordinatedManager] 已更新激活切片, userId: {}", userId); + log.debug("[{}] 已更新激活切片, userId: {}", getCoreKey(), userId); } @CapabilityMethod diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/ActionDispatcher.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/ActionDispatcher.java index 8b278967..d07b95f3 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/ActionDispatcher.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/ActionDispatcher.java @@ -6,9 +6,9 @@ import work.slhaf.partner.api.agent.factory.module.annotation.Init; import work.slhaf.partner.api.agent.factory.module.annotation.InjectModule; import work.slhaf.partner.common.thread.InteractionThreadPoolExecutor; import work.slhaf.partner.core.action.ActionCapability; -import work.slhaf.partner.core.action.entity.ActionInfo; -import work.slhaf.partner.core.action.entity.ImmediateActionInfo; -import work.slhaf.partner.core.action.entity.ScheduledActionInfo; +import work.slhaf.partner.core.action.entity.ActionData; +import work.slhaf.partner.core.action.entity.ImmediateActionData; +import work.slhaf.partner.core.action.entity.ScheduledActionData; import work.slhaf.partner.module.common.module.PostRunningModule; import work.slhaf.partner.module.modules.action.dispatcher.executor.ActionExecutor; import work.slhaf.partner.module.modules.action.dispatcher.scheduler.ActionScheduler; @@ -42,14 +42,14 @@ public class ActionDispatcher extends PostRunningModule { //对于将触发的PLANNING action,理想做法是将执行工具做成执行链的形式,模型的自对话流程、是否通知用户都做成与普通工具同等的通用可选能力,避免绑定固定流程 executor.execute(() -> { String userId = context.getUserId(); - List preparedActions = actionCapability.popPreparedAction(userId); + List preparedActions = actionCapability.popPreparedAction(userId); //分类成PLANNING和IMMEDIATE两类 - List scheduledActions = new ArrayList<>(); - List immediateActions = new ArrayList<>(); - for (ActionInfo preparedAction : preparedActions) { - if (preparedAction instanceof ScheduledActionInfo actionInfo) { + List scheduledActions = new ArrayList<>(); + List immediateActions = new ArrayList<>(); + for (ActionData preparedAction : preparedActions) { + if (preparedAction instanceof ScheduledActionData actionInfo) { scheduledActions.add(actionInfo); - } else if (preparedAction instanceof ImmediateActionInfo actionInfo) { + } else if (preparedAction instanceof ImmediateActionData actionInfo) { immediateActions.add(actionInfo); } } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java index 435b65e7..8f97e60e 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java @@ -4,18 +4,18 @@ import work.slhaf.partner.api.agent.factory.capability.annotation.InjectCapabili import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule; import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.AgentRunningSubModule; import work.slhaf.partner.core.action.ActionCapability; -import work.slhaf.partner.core.action.entity.ImmediateActionInfo; +import work.slhaf.partner.core.action.entity.ImmediateActionData; import java.util.List; @AgentSubModule -public class ActionExecutor extends AgentRunningSubModule, Void> { +public class ActionExecutor extends AgentRunningSubModule, Void> { @InjectCapability private ActionCapability actionCapability; @Override - public Void execute(List immediateActions) { + public Void execute(List immediateActions) { return null; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.java index 3c7d0878..a6fc5b07 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.java @@ -2,14 +2,14 @@ package work.slhaf.partner.module.modules.action.dispatcher.scheduler; import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule; import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.AgentRunningSubModule; -import work.slhaf.partner.core.action.entity.ScheduledActionInfo; +import work.slhaf.partner.core.action.entity.ScheduledActionData; import java.util.List; @AgentSubModule -public class ActionScheduler extends AgentRunningSubModule, Void> { +public class ActionScheduler extends AgentRunningSubModule, Void> { @Override - public Void execute(List data) { + public Void execute(List data) { return null; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java index 2629ac05..59088261 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java @@ -9,10 +9,9 @@ import work.slhaf.partner.api.chat.pojo.Message; import work.slhaf.partner.common.thread.InteractionThreadPoolExecutor; import work.slhaf.partner.common.vector.VectorClient; import work.slhaf.partner.core.action.ActionCapability; -import work.slhaf.partner.core.action.entity.ActionInfo; -import work.slhaf.partner.core.action.entity.ActionStatus; -import work.slhaf.partner.core.action.entity.ImmediateActionInfo; -import work.slhaf.partner.core.action.entity.ScheduledActionInfo; +import work.slhaf.partner.core.action.entity.ActionData; +import work.slhaf.partner.core.action.entity.ImmediateActionData; +import work.slhaf.partner.core.action.entity.ScheduledActionData; import work.slhaf.partner.core.action.entity.cache.CacheAdjustData; import work.slhaf.partner.core.action.entity.cache.CacheAdjustMetaData; import work.slhaf.partner.core.cognation.CognationCapability; @@ -140,10 +139,10 @@ public class ActionPlanner extends PreRunningModule { return; } String contextUuid = context.getUuid(); - List pendingActions = actionCapability.popPendingAction(context.getUserId()); - for (ActionInfo actionInfo : pendingActions) { - if (uuids.contains(actionInfo.getUuid())) { - actionCapability.putPreparedAction(contextUuid, actionInfo); + List pendingActions = actionCapability.popPendingAction(context.getUserId()); + for (ActionData actionData : pendingActions) { + if (uuids.contains(actionData.getUuid())) { + actionCapability.putPreparedAction(contextUuid, actionData); } } } @@ -151,11 +150,11 @@ public class ActionPlanner extends PreRunningModule { private void setupActionInfo(List evaluatorResults, PartnerRunningFlowContext context) { for (EvaluatorResult evaluatorResult : evaluatorResults) { - ActionInfo actionInfo = assemblyHelper.buildMetaActionInfo(evaluatorResult); + ActionData actionData = assemblyHelper.buildMetaActionInfo(evaluatorResult); if (evaluatorResult.isNeedConfirm()) { - actionCapability.putPendingActions(context.getUserId(), actionInfo); + actionCapability.putPendingActions(context.getUserId(), actionData); } else { - actionCapability.putPreparedAction(context.getUuid(), actionInfo); + actionCapability.putPreparedAction(context.getUuid(), actionData); } } } @@ -170,31 +169,31 @@ public class ActionPlanner extends PreRunningModule { } private void setupPendingActions(HashMap map, String userId) { - List actionInfos = actionCapability.listPendingAction(userId); - if (actionInfos == null || actionInfos.isEmpty()) { + List actionData = actionCapability.listPendingAction(userId); + if (actionData == null || actionData.isEmpty()) { map.put("[待确认行动] <待确认行动信息>", "无待确认行动"); return; } - for (int i = 0; i < actionInfos.size(); i++) { - map.put("[待确认行动 " + (i + 1) + " ]", generateActionStr(actionInfos.get(i))); + for (int i = 0; i < actionData.size(); i++) { + map.put("[待确认行动 " + (i + 1) + " ]", generateActionStr(actionData.get(i))); } } private void setupPreparedActions(HashMap map, String uuid) { - List actionInfos = actionCapability.listPreparedAction(uuid); - if (actionInfos == null || actionInfos.isEmpty()) { + List actionData = actionCapability.listPreparedAction(uuid); + if (actionData == null || actionData.isEmpty()) { map.put("[预备行动] <预备行动信息>", "无预备行动"); return; } - for (int i = 0; i < actionInfos.size(); i++) { - map.put("[预备行动 " + (i + 1) + " ]", generateActionStr(actionInfos.get(i))); + for (int i = 0; i < actionData.size(); i++) { + map.put("[预备行动 " + (i + 1) + " ]", generateActionStr(actionData.get(i))); } } - private String generateActionStr(ActionInfo actionInfo) { - return "<行动倾向>" + " : " + actionInfo.getTendency() + - "<行动原因>" + " : " + actionInfo.getReason() + - "<工具描述>" + " : " + actionInfo.getDescription(); + private String generateActionStr(ActionData actionData) { + return "<行动倾向>" + " : " + actionData.getTendency() + + "<行动原因>" + " : " + actionData.getReason() + + "<工具描述>" + " : " + actionData.getDescription(); } @Override @@ -229,20 +228,20 @@ public class ActionPlanner extends PreRunningModule { return input; } - private ActionInfo buildMetaActionInfo(EvaluatorResult evaluatorResult) { + private ActionData buildMetaActionInfo(EvaluatorResult evaluatorResult) { return switch (evaluatorResult.getType()) { case PLANNING -> { - ScheduledActionInfo actionInfo = new ScheduledActionInfo(); + ScheduledActionData actionInfo = new ScheduledActionData(); actionInfo.setActionChain(evaluatorResult.getActionChain()); actionInfo.setScheduleContent(evaluatorResult.getScheduleContent()); - actionInfo.setStatus(ActionStatus.PREPARE); + actionInfo.setStatus(ActionData.ActionStatus.PREPARE); actionInfo.setUuid(UUID.randomUUID().toString()); yield actionInfo; } case IMMEDIATE -> { - ImmediateActionInfo actionInfo = new ImmediateActionInfo(); + ImmediateActionData actionInfo = new ImmediateActionData(); actionInfo.setActionChain(evaluatorResult.getActionChain()); - actionInfo.setStatus(ActionStatus.PREPARE); + actionInfo.setStatus(ActionData.ActionStatus.PREPARE); actionInfo.setUuid(UUID.randomUUID().toString()); yield actionInfo; } @@ -252,8 +251,8 @@ public class ActionPlanner extends PreRunningModule { private ConfirmerInput buildConfirmerInput(PartnerRunningFlowContext context) { ConfirmerInput confirmerInput = new ConfirmerInput(); confirmerInput.setInput(context.getInput()); - List pendingActions = actionCapability.listPendingAction(context.getUserId()); - confirmerInput.setActionInfos(pendingActions); + List pendingActions = actionCapability.listPendingAction(context.getUserId()); + confirmerInput.setActionData(pendingActions); return confirmerInput; } } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/confirmer/entity/ConfirmerInput.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/confirmer/entity/ConfirmerInput.java index 54f0247c..40b0b5ac 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/confirmer/entity/ConfirmerInput.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/confirmer/entity/ConfirmerInput.java @@ -2,13 +2,13 @@ package work.slhaf.partner.module.modules.action.planner.confirmer.entity; import lombok.Data; import work.slhaf.partner.api.chat.pojo.Message; -import work.slhaf.partner.core.action.entity.ActionInfo; +import work.slhaf.partner.core.action.entity.ActionData; import java.util.List; @Data public class ConfirmerInput { private String input; - private List actionInfos; + private List actionData; private List recentMessages; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/evaluator/entity/EvaluatorResult.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/evaluator/entity/EvaluatorResult.java index 1f7232b7..76289180 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/evaluator/entity/EvaluatorResult.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/evaluator/entity/EvaluatorResult.java @@ -1,7 +1,6 @@ package work.slhaf.partner.module.modules.action.planner.evaluator.entity; import lombok.Data; -import work.slhaf.partner.core.action.entity.ActionType; import work.slhaf.partner.core.action.entity.MetaAction; import java.util.List; @@ -14,4 +13,8 @@ public class EvaluatorResult { private String scheduleContent; private List actionChain; private String tendency; + + public enum ActionType { + IMMEDIATE, PLANNING + } } From 83832d2060243d9f12f7937e492108c37787244e Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sun, 26 Oct 2025 23:26:03 +0800 Subject: [PATCH 003/182] =?UTF-8?q?=E6=8E=A8=E8=BF=9B=20ActionExecutor?= =?UTF-8?q?=E3=80=81=E9=92=88=E5=AF=B9action=20core=E5=81=9A=E5=87=BA?= =?UTF-8?q?=E4=BA=86=E4=B8=80=E4=BA=9B=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将 ActionWatchService 抽取为独立的类,使用构造参数传递所需内容 - ActionCore 中除了pendingAction外,将只维护一个行动池,通过用户键和STATUS区分类型 - 开始推进 ActionExecutor,但其中的同组并发、动态行动链、行动间参数对齐、参数重构等内容需要仔细考虑 --- .../partner/core/action/ActionCapability.java | 8 +- .../slhaf/partner/core/action/ActionCore.java | 209 ++---------------- .../core/action/ActionWatchService.java | 191 ++++++++++++++++ .../core/action/entity/ActionData.java | 2 +- .../core/action/entity/MetaAction.java | 7 +- .../core/cognation/CognationCapability.java | 1 - .../partner/core/cognation/CognationCore.java | 5 - .../action/dispatcher/ActionDispatcher.java | 2 +- .../dispatcher/executor/ActionExecutor.java | 102 ++++++++- 9 files changed, 324 insertions(+), 203 deletions(-) create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionWatchService.java diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java index 79003548..9a3e8627 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java @@ -5,13 +5,13 @@ import work.slhaf.partner.core.action.entity.ActionData; import work.slhaf.partner.core.action.entity.cache.CacheAdjustData; import java.util.List; +import java.util.Set; +import java.util.concurrent.ExecutorService; @Capability(value = "action") public interface ActionCapability { void putPreparedAction(String uuid, ActionData actionData); - List popPreparedAction(String userId); - List popPendingAction(String userId); List listPreparedAction(String userId); @@ -23,4 +23,8 @@ public interface ActionCapability { List selectTendencyCache(String input); void updateTendencyCache(CacheAdjustData data); + + ExecutorService getExecutor(ActionCore.ExecutorType type); + + Set getExistedMetaActions(); } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java index 9497147b..9e01dd3a 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java @@ -1,7 +1,6 @@ package work.slhaf.partner.core.action; import lombok.extern.slf4j.Slf4j; -import org.jetbrains.annotations.NotNull; import work.slhaf.partner.api.agent.factory.capability.annotation.CapabilityCore; import work.slhaf.partner.api.agent.factory.capability.annotation.CapabilityMethod; import work.slhaf.partner.common.vector.VectorClient; @@ -11,25 +10,15 @@ import work.slhaf.partner.core.action.entity.MetaActionInfo; import work.slhaf.partner.core.action.entity.cache.ActionCacheData; import work.slhaf.partner.core.action.entity.cache.CacheAdjustData; import work.slhaf.partner.core.action.entity.cache.CacheAdjustMetaData; -import work.slhaf.partner.core.action.exception.ActionInitFailedException; -import work.slhaf.partner.core.action.exception.ActionLoadFailedException; -import java.io.File; import java.io.IOException; -import java.nio.file.*; -import java.nio.file.attribute.BasicFileAttributes; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; +import java.util.*; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import java.util.stream.Collectors; -import static work.slhaf.partner.common.Constant.Path.ACTION_PROGRAM; - @SuppressWarnings("FieldMayBeFinal") @CapabilityCore(value = "action") @Slf4j @@ -38,7 +27,7 @@ public class ActionCore extends PartnerCore { /** * 对应本次交互即将执行或将要放置在行动池的预备任务,因此将以本次交互的uuid为键,其起到的作用相当于暂时的模块上下文 */ - private HashMap> preparedActions = new HashMap<>(); + private HashMap> actionPool = new HashMap<>(); /** * 待确认任务,以userId区分不同用户,因为需要跨请求确认 @@ -58,7 +47,7 @@ public class ActionCore extends PartnerCore { private final LinkedHashMap existedMetaActions = new LinkedHashMap<>(); public ActionCore() throws IOException, ClassNotFoundException { - new ActionWatchService().launch(); + new ActionWatchService(existedMetaActions, virtualExecutor).launch(); } @CapabilityMethod @@ -79,23 +68,19 @@ public class ActionCore extends PartnerCore { @CapabilityMethod public synchronized void putPreparedAction(String uuid, ActionData actionData) { - preparedActions.computeIfAbsent(uuid, k -> { + actionPool.computeIfAbsent(uuid, k -> { List temp = new ArrayList<>(); temp.add(actionData); return temp; }); } - @CapabilityMethod - public synchronized List popPreparedAction(String userId) { - List infos = preparedActions.get(userId); - preparedActions.remove(userId); - return infos; - } - @CapabilityMethod public List listPreparedAction(String userId) { - return preparedActions.get(userId); + List actions = actionPool.get(userId); + return actions.stream() + .filter(actionData -> actionData.getStatus().equals(ActionData.ActionStatus.PREPARE)) + .toList(); } @CapabilityMethod @@ -155,6 +140,19 @@ public class ActionCore extends PartnerCore { platformExecutor.execute(() -> adjustNotMatchPassed(notMatchPassed, inputVector, input, vectorClient)); } + @CapabilityMethod + public ExecutorService getExecutor(ExecutorType type) { + return switch (type) { + case VIRTUAL -> virtualExecutor; + case PLATFORM -> platformExecutor; + }; + } + + @CapabilityMethod + public Set getExistedMetaActions() { + return existedMetaActions.keySet(); + } + /** * 命中缓存且评估通过时 * @@ -249,168 +247,7 @@ public class ActionCore extends PartnerCore { return "action-core"; } - @SuppressWarnings("unchecked") - private class ActionWatchService { - - private HashMap registeredPaths = new HashMap<>(); - - public void launch() { - Path path = Path.of(ACTION_PROGRAM); - scanActions(path.toFile()); - launchActionDirectoryWatcher(path); - } - - private void launchActionDirectoryWatcher(Path path) { - WatchService watchService; - try { - watchService = FileSystems.getDefault().newWatchService(); - setupShutdownHook(watchService); - registerParentToWatch(path, watchService); - registerSubToWatch(path, watchService); - virtualExecutor.execute(registerWatchTask(path, watchService)); - } catch (IOException e) { - throw new ActionInitFailedException("行动程序目录监听器启动失败", e); - } - } - - private void setupShutdownHook(WatchService watchService) { - Runtime.getRuntime().addShutdownHook(new Thread(() -> { - try { - watchService.close(); - } catch (IOException e) { - throw new RuntimeException(e); - } - })); - } - - private Runnable registerWatchTask(Path path, WatchService watchService) { - return () -> { - log.info("[{}] 行动程序目录监听器已启动", getCoreKey()); - while (true) { - WatchKey key; - try { - key = watchService.take(); - List> events = key.pollEvents(); - for (WatchEvent e : events) { - WatchEvent event = (WatchEvent) e; - WatchEvent.Kind kind = event.kind(); - Path context = event.context(); - log.info("[{}] 行动程序目录变更事件: {} - {}", getCoreKey(), kind.name(), context.toString()); - Path thisDir = (Path) key.watchable(); - //根据事件发生的目录进行分流,分为父目录事件和子程序事件 - if (thisDir.equals(path)) { - handleParentDirEvent(kind, thisDir, context, watchService); - } else { - handleSubDirEvent(kind, thisDir); - } - } - } catch (InterruptedException e) { - log.info("监听线程被中断,准备退出..."); - Thread.currentThread().interrupt(); // 恢复中断标志 - break; - } catch (ClosedWatchServiceException e) { - log.info("WatchService 已关闭,监听线程退出。"); - break; - } - } - }; - } - - private void handleSubDirEvent(WatchEvent.Kind kind, Path thisDir) { - // path为触发本次行动的文件的路径(当前位于某个action目录下) - // 先判定发生的目录前缀是否匹配(action、desc),否则忽略 - if (kind == StandardWatchEventKinds.ENTRY_CREATE || kind == StandardWatchEventKinds.ENTRY_MODIFY) { - // CREATE、MODIFY 事件将触发一次检测,看当前thisDir中action和desc是否都具备,如果通过则尝试加载(put)。 - boolean complete = checkComplete(thisDir); - if (!complete) return; - try { - MetaActionInfo newActionInfo = new MetaActionInfo(thisDir.toFile()); - existedMetaActions.put(thisDir.toString(), newActionInfo); - } catch (ActionLoadFailedException e) { - log.warn("[{}] 行动信息重新加载失败,触发行为: {}", getCoreKey(), kind.name()); - } - } else if (kind == StandardWatchEventKinds.ENTRY_DELETE) { - // DELETE 事件将会把该 MetaActionInfo 从记录中移除 - existedMetaActions.remove(thisDir.toString()); - } - } - - private boolean checkComplete(Path thisDir) { - File[] files = thisDir.toFile().listFiles(); - if (files == null) { - log.error("[{}]当前目录无法访问: [{}]", getCoreKey(), thisDir); - return false; - } - boolean existedAction = false; - boolean existedDesc = false; - for (File file : files) { - String fileName = file.getName(); - String nameWithoutExt = fileName.substring(0, fileName.lastIndexOf('.')); - if (nameWithoutExt.equals("action")) existedAction = true; - else if (nameWithoutExt.equals("desc")) existedDesc = true; - } - return existedAction && existedDesc; - } - - private void handleParentDirEvent(WatchEvent.Kind kind, Path thisDir, Path context, WatchService watchService) { - Path path = Path.of(thisDir.toString(), context.toString()); - // MODIFY 事件不进行处理 - if (kind == StandardWatchEventKinds.ENTRY_CREATE) { - try { - path.register(watchService, - StandardWatchEventKinds.ENTRY_CREATE, - StandardWatchEventKinds.ENTRY_DELETE, - StandardWatchEventKinds.ENTRY_MODIFY); - } catch (IOException e) { - log.error("[{}] 新增行动程序目录监听失败: {}", getCoreKey(), path, e); - } - } else if (kind == StandardWatchEventKinds.ENTRY_DELETE) { - WatchKey remove = registeredPaths.remove(path); - remove.cancel(); - } - } - - private void registerSubToWatch(Path path, WatchService watchService) throws IOException { - Files.walkFileTree(path, new SimpleFileVisitor<>() { - @Override - public @NotNull FileVisitResult preVisitDirectory(@NotNull Path dir, @NotNull BasicFileAttributes attrs) throws IOException { - if (dir.getFileName().startsWith(".")) return FileVisitResult.CONTINUE; - WatchKey key = dir.register(watchService, - StandardWatchEventKinds.ENTRY_CREATE, - StandardWatchEventKinds.ENTRY_DELETE, - StandardWatchEventKinds.ENTRY_MODIFY); - registeredPaths.put(dir, key); - return FileVisitResult.CONTINUE; - } - }); - } - - private void registerParentToWatch(Path path, WatchService watchService) throws IOException { - WatchKey key = path.register(watchService, - StandardWatchEventKinds.ENTRY_CREATE, - StandardWatchEventKinds.ENTRY_DELETE, - StandardWatchEventKinds.ENTRY_MODIFY); - registeredPaths.put(path, key); - } - - private void scanActions(File file) { - if (!file.exists() || file.isFile()) { - throw new ActionInitFailedException("未找到行动程序目录: " + file.getAbsolutePath()); - } - File[] files = file.listFiles(); - if (files == null) { - throw new ActionInitFailedException("目录无法访问: " + file.getAbsolutePath()); - } - for (File f : files) { - try { - MetaActionInfo actionInfo = new MetaActionInfo(f); - existedMetaActions.put(f.getName(), actionInfo); - log.info("[{}] 行动程序[{}]已加载", getCoreKey(), actionInfo.getKey()); - } catch (ActionLoadFailedException e) { - log.warn("[{}] 行动程序未加载: {}", getCoreKey(), e.getMessage()); - } - } - - } + public enum ExecutorType { + VIRTUAL, PLATFORM } } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionWatchService.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionWatchService.java new file mode 100644 index 00000000..a10cc59d --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionWatchService.java @@ -0,0 +1,191 @@ +package work.slhaf.partner.core.action; + +import lombok.extern.slf4j.Slf4j; +import org.jetbrains.annotations.NotNull; +import work.slhaf.partner.core.action.entity.MetaActionInfo; +import work.slhaf.partner.core.action.exception.ActionInitFailedException; +import work.slhaf.partner.core.action.exception.ActionLoadFailedException; + +import java.io.File; +import java.io.IOException; +import java.nio.file.*; +import java.nio.file.attribute.BasicFileAttributes; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.concurrent.ExecutorService; + +import static work.slhaf.partner.common.Constant.Path.ACTION_PROGRAM; + +@SuppressWarnings("unchecked") +@Slf4j +class ActionWatchService { + + private HashMap registeredPaths = new HashMap<>(); + private LinkedHashMap existedMetaActions; + private ExecutorService virtualExecutor; + + public ActionWatchService(LinkedHashMap existedMetaActions, ExecutorService virtualExecutor) { + this.existedMetaActions = existedMetaActions; + this.virtualExecutor = virtualExecutor; + } + + public void launch() { + Path path = Path.of(ACTION_PROGRAM); + scanActions(path.toFile()); + launchActionDirectoryWatcher(path); + } + + private void launchActionDirectoryWatcher(Path path) { + WatchService watchService; + try { + watchService = FileSystems.getDefault().newWatchService(); + setupShutdownHook(watchService); + registerParentToWatch(path, watchService); + registerSubToWatch(path, watchService); + virtualExecutor.execute(registerWatchTask(path, watchService)); + } catch (IOException e) { + throw new ActionInitFailedException("行动程序目录监听器启动失败", e); + } + } + + private void setupShutdownHook(WatchService watchService) { + Runtime.getRuntime().addShutdownHook(new Thread(() -> { + try { + watchService.close(); + } catch (IOException e) { + throw new RuntimeException(e); + } + })); + } + + private Runnable registerWatchTask(Path path, WatchService watchService) { + return () -> { + log.info("行动程序目录监听器已启动"); + while (true) { + WatchKey key; + try { + key = watchService.take(); + List> events = key.pollEvents(); + for (WatchEvent e : events) { + WatchEvent event = (WatchEvent) e; + WatchEvent.Kind kind = event.kind(); + Path context = event.context(); + log.info("行动程序目录变更事件: {} - {}", kind.name(), context.toString()); + Path thisDir = (Path) key.watchable(); + //根据事件发生的目录进行分流,分为父目录事件和子程序事件 + if (thisDir.equals(path)) { + handleParentDirEvent(kind, thisDir, context, watchService); + } else { + handleSubDirEvent(kind, thisDir); + } + } + } catch (InterruptedException e) { + log.info("监听线程被中断,准备退出..."); + Thread.currentThread().interrupt(); // 恢复中断标志 + break; + } catch (ClosedWatchServiceException e) { + log.info("WatchService 已关闭,监听线程退出。"); + break; + } + } + }; + } + + private void handleSubDirEvent(WatchEvent.Kind kind, Path thisDir) { + // path为触发本次行动的文件的路径(当前位于某个action目录下) + // 先判定发生的目录前缀是否匹配(action、desc),否则忽略 + if (kind == StandardWatchEventKinds.ENTRY_CREATE || kind == StandardWatchEventKinds.ENTRY_MODIFY) { + // CREATE、MODIFY 事件将触发一次检测,看当前thisDir中action和desc是否都具备,如果通过则尝试加载(put)。 + boolean complete = checkComplete(thisDir); + if (!complete) return; + try { + MetaActionInfo newActionInfo = new MetaActionInfo(thisDir.toFile()); + existedMetaActions.put(thisDir.toString(), newActionInfo); + } catch (ActionLoadFailedException e) { + log.warn("行动信息重新加载失败,触发行为: {}", kind.name()); + } + } else if (kind == StandardWatchEventKinds.ENTRY_DELETE) { + // DELETE 事件将会把该 MetaActionInfo 从记录中移除 + existedMetaActions.remove(thisDir.toString()); + } + } + + private boolean checkComplete(Path thisDir) { + File[] files = thisDir.toFile().listFiles(); + if (files == null) { + log.error("[{}]当前目录无法访问: [{}]", thisDir); + return false; + } + boolean existedAction = false; + boolean existedDesc = false; + for (File file : files) { + String fileName = file.getName(); + String nameWithoutExt = fileName.substring(0, fileName.lastIndexOf('.')); + if (nameWithoutExt.equals("action")) existedAction = true; + else if (nameWithoutExt.equals("desc")) existedDesc = true; + } + return existedAction && existedDesc; + } + + private void handleParentDirEvent(WatchEvent.Kind kind, Path thisDir, Path context, WatchService watchService) { + Path path = Path.of(thisDir.toString(), context.toString()); + // MODIFY 事件不进行处理 + if (kind == StandardWatchEventKinds.ENTRY_CREATE) { + try { + path.register(watchService, + StandardWatchEventKinds.ENTRY_CREATE, + StandardWatchEventKinds.ENTRY_DELETE, + StandardWatchEventKinds.ENTRY_MODIFY); + } catch (IOException e) { + log.error("新增行动程序目录监听失败: {}", path, e); + } + } else if (kind == StandardWatchEventKinds.ENTRY_DELETE) { + WatchKey remove = registeredPaths.remove(path); + remove.cancel(); + } + } + + private void registerSubToWatch(Path path, WatchService watchService) throws IOException { + Files.walkFileTree(path, new SimpleFileVisitor<>() { + @Override + public @NotNull FileVisitResult preVisitDirectory(@NotNull Path dir, @NotNull BasicFileAttributes attrs) throws IOException { + if (dir.getFileName().startsWith(".")) return FileVisitResult.CONTINUE; + WatchKey key = dir.register(watchService, + StandardWatchEventKinds.ENTRY_CREATE, + StandardWatchEventKinds.ENTRY_DELETE, + StandardWatchEventKinds.ENTRY_MODIFY); + registeredPaths.put(dir, key); + return FileVisitResult.CONTINUE; + } + }); + } + + private void registerParentToWatch(Path path, WatchService watchService) throws IOException { + WatchKey key = path.register(watchService, + StandardWatchEventKinds.ENTRY_CREATE, + StandardWatchEventKinds.ENTRY_DELETE, + StandardWatchEventKinds.ENTRY_MODIFY); + registeredPaths.put(path, key); + } + + private void scanActions(File file) { + if (!file.exists() || file.isFile()) { + throw new ActionInitFailedException("未找到行动程序目录: " + file.getAbsolutePath()); + } + File[] files = file.listFiles(); + if (files == null) { + throw new ActionInitFailedException("目录无法访问: " + file.getAbsolutePath()); + } + for (File f : files) { + try { + MetaActionInfo actionInfo = new MetaActionInfo(f); + existedMetaActions.put(f.getName(), actionInfo); + log.info("行动程序[{}]已加载", actionInfo.getKey()); + } catch (ActionLoadFailedException e) { + log.warn("行动程序未加载: {}", e.getMessage()); + } + } + + } +} \ No newline at end of file diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java index 18ddcddc..3bf7aea2 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java @@ -13,7 +13,7 @@ public abstract class ActionData { protected String tendency; protected ActionStatus status; protected List actionChain; - protected String Result; + protected String result; protected String reason; protected String description; diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java index 349bebb8..73587070 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java @@ -6,7 +6,6 @@ import work.slhaf.partner.common.Constant; import java.io.File; import java.nio.file.Path; -import java.util.concurrent.Callable; import static work.slhaf.partner.common.Constant.Path.ACTION_PROGRAM; @@ -14,7 +13,7 @@ import static work.slhaf.partner.common.Constant.Path.ACTION_PROGRAM; * 行动链中的单一元素,实现{@link Runnable}接口,封装了调用外部行动程序的必要信息,可被执行 */ @Data -public class MetaAction implements Comparable, Callable { +public class MetaAction implements Comparable, Runnable { /** * 行动key,用于标识与定位行动程序 @@ -47,13 +46,12 @@ public class MetaAction implements Comparable, Callable { } @Override - public Void call() { + public void run() { File action = loadFromFile(); if (!action.exists()) { result = new Result(); result.setSuccess(false); result.setData("Action file not found: " + action.getAbsolutePath()); - return null; } try { switch (type) { @@ -66,7 +64,6 @@ public class MetaAction implements Comparable, Callable { result.setSuccess(false); result.setData(e.getMessage()); } - return null; } private File loadFromFile() { diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/cognation/CognationCapability.java b/Partner-Main/src/main/java/work/slhaf/partner/core/cognation/CognationCapability.java index 81c4b290..4f9ac125 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/cognation/CognationCapability.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/cognation/CognationCapability.java @@ -13,7 +13,6 @@ import java.util.concurrent.locks.Lock; public interface CognationCapability { List getChatMessages(); - void setChatMessages(List chatMessages); void cleanMessage(List messages); Lock getMessageLock(); void addMetaMessage(String userId, MetaMessage metaMessage); diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/cognation/CognationCore.java b/Partner-Main/src/main/java/work/slhaf/partner/core/cognation/CognationCore.java index 1157c1a8..675a7e6a 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/cognation/CognationCore.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/cognation/CognationCore.java @@ -63,11 +63,6 @@ public class CognationCore extends PartnerCore { return currentMemoryId; } - @CapabilityMethod - public void setChatMessages(List chatMessages) { - this.chatMessages = chatMessages; - } - @CapabilityMethod public void cleanMessage(List messages) { messageLock.lock(); diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/ActionDispatcher.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/ActionDispatcher.java index d07b95f3..307afe38 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/ActionDispatcher.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/ActionDispatcher.java @@ -42,7 +42,7 @@ public class ActionDispatcher extends PostRunningModule { //对于将触发的PLANNING action,理想做法是将执行工具做成执行链的形式,模型的自对话流程、是否通知用户都做成与普通工具同等的通用可选能力,避免绑定固定流程 executor.execute(() -> { String userId = context.getUserId(); - List preparedActions = actionCapability.popPreparedAction(userId); + List preparedActions = actionCapability.listPreparedAction(userId); //分类成PLANNING和IMMEDIATE两类 List scheduledActions = new ArrayList<>(); List immediateActions = new ArrayList<>(); diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java index 8f97e60e..a870ae0c 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java @@ -1,22 +1,120 @@ package work.slhaf.partner.module.modules.action.dispatcher.executor; +import lombok.extern.slf4j.Slf4j; import work.slhaf.partner.api.agent.factory.capability.annotation.InjectCapability; import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule; +import work.slhaf.partner.api.agent.factory.module.annotation.Init; +import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.ActivateModel; import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.AgentRunningSubModule; import work.slhaf.partner.core.action.ActionCapability; +import work.slhaf.partner.core.action.ActionCore; +import work.slhaf.partner.core.action.entity.ActionData; import work.slhaf.partner.core.action.entity.ImmediateActionData; +import work.slhaf.partner.core.action.entity.MetaAction; +import java.util.ArrayList; +import java.util.HashSet; import java.util.List; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; +@Slf4j @AgentSubModule -public class ActionExecutor extends AgentRunningSubModule, Void> { +public class ActionExecutor extends AgentRunningSubModule, Void> implements ActivateModel { @InjectCapability private ActionCapability actionCapability; + private ExecutorService virtualExecutor; + private ExecutorService platformExecutor; + + @Init + public void init() { + virtualExecutor = actionCapability.getExecutor(ActionCore.ExecutorType.VIRTUAL); + platformExecutor = actionCapability.getExecutor(ActionCore.ExecutorType.PLATFORM); + } + @Override public Void execute(List immediateActions) { - + for (ImmediateActionData actionData : immediateActions) { + handleActionData(actionData); + } return null; } + + private void handleActionData(ImmediateActionData actionData) { + virtualExecutor.execute(() -> { + actionData.setStatus(ActionData.ActionStatus.EXECUTING); + List actionChain = actionData.getActionChain(); + actionChain.sort(MetaAction::compareTo); + List virtual = new ArrayList<>(); + List platform = new ArrayList<>(); + int order; + for (int index = 0; index < actionChain.size(); index++) { + MetaAction metaAction = actionChain.get(index); + // 根据io类型放入合适的列表 + if (metaAction.isIo()) { + virtual.add(metaAction); + } else { + platform.add(metaAction); + } + // 记录当前order + order = metaAction.getOrder(); + // 如果下一个行动单元的order与当前不同,则执行并清空当前组内容 + if (actionChain.size() <= (index + 1) || actionChain.get(index + 1).getOrder() != order) { + runGroupAction(virtual, platform, actionChain); + } + } + }); + } + + //TODO 考虑是否使用phaser来承担同组的动态任务新增 + private void runGroupAction(List virtual, List platform, List actionChain) { + boolean first = true; + do { + CountDownLatch latch = new CountDownLatch(virtual.size() + platform.size()); + runGroupAction(virtual, virtualExecutor, actionChain, latch, first); + runGroupAction(platform, platformExecutor, actionChain, latch, first); + try { + latch.await(); + } catch (InterruptedException e) { + log.error("[{}] CountDownLatch被中断", modelKey()); + } + first = false; + } while (!virtual.isEmpty() || !platform.isEmpty()); + } + + private void runGroupAction(List actions, ExecutorService executor, List actionChain, CountDownLatch latch, boolean first) { + if (!first && !new HashSet<>(actionChain).containsAll(actions)) { + // 该部分对应LLM新增本组执行单元时,将其添加至actionChain记录。对于后续组级别的新增,将直接在上一级调用处体现,除了注意并发安全外无需额外处理 + int index = actionChain.indexOf(actions.getLast()); + actionChain.addAll(index, actions); + } + for (MetaAction action : actions) { + executor.execute(() -> { + boolean success = true; + do { + // 该循环对应LLM的调整参数后重试 + if (!success) { + //TODO LLM决策是重构参数、执行自对话反思、还是选择向用户求助(通过cognationCore暴露方法,可能需要修改其他模块以进行适应) + + } + action.run(); + success = action.getResult().isSuccess(); + } while (!success); + latch.countDown(); + //TODO 将执行结果写入特定对话角色记忆(cognationCore暴露方法) + }); + } + } + + @Override + public String modelKey() { + return "action_executor"; + } + + @Override + public boolean withBasicPrompt() { + return false; + } } From e35e18f3b7d0f817ec3ed31268a1e9c06a040a30 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 27 Oct 2025 23:43:06 +0800 Subject: [PATCH 004/182] =?UTF-8?q?=E6=8E=A8=E8=BF=9B=20ActionExecutor?= =?UTF-8?q?=E3=80=81=E7=A1=AE=E5=AE=9A=E5=8A=A8=E6=80=81=E6=8F=92=E6=8B=94?= =?UTF-8?q?=E5=BC=8F=E8=A1=8C=E5=8A=A8=E8=B0=83=E5=BA=A6=E7=9A=84=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0=E6=80=9D=E8=B7=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 ActionCore 中添加关闭hook,用于正确设置异常中断时执行中任务的状态 - 修正 actionPool 相关注释及用法 - 将 ActionData 中行动链字段调整为 LinkedHashMap 用于更好地支持分组并发及动态调度 - 重构 ActionExecutor 行动链执行逻辑,采用 Phaser 支持动态调度 - 扩展 InputData、Context 字段并调整 GateWay 格式化逻辑以适应特殊输入 --- .../slhaf/partner/core/action/ActionCore.java | 20 +++- .../core/action/entity/ActionData.java | 3 +- .../core/action/entity/MetaAction.java | 4 +- .../dispatcher/executor/ActionExecutor.java | 91 +++++++++---------- .../modules/action/planner/ActionPlanner.java | 23 +++-- .../PartnerInteractionAdapter.java | 5 + .../runtime/interaction/WebSocketGateway.java | 10 +- .../interaction/data/PartnerInputData.java | 7 +- .../interaction/data/PartnerInputType.java | 5 + .../data/SpecializedPartnerInputData.java | 12 +++ .../data/SpecializedPayloadConstant.java | 7 ++ .../context/PartnerRunningFlowContext.java | 5 + 12 files changed, 125 insertions(+), 67 deletions(-) create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/PartnerInputType.java create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/SpecializedPartnerInputData.java create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/SpecializedPayloadConstant.java diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java index 9e01dd3a..b7fe5a7e 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java @@ -25,7 +25,7 @@ import java.util.stream.Collectors; public class ActionCore extends PartnerCore { /** - * 对应本次交互即将执行或将要放置在行动池的预备任务,因此将以本次交互的uuid为键,其起到的作用相当于暂时的模块上下文 + * 持久行动池,以用户id为键存储所有状态的任务 */ private HashMap> actionPool = new HashMap<>(); @@ -48,8 +48,26 @@ public class ActionCore extends PartnerCore { public ActionCore() throws IOException, ClassNotFoundException { new ActionWatchService(existedMetaActions, virtualExecutor).launch(); + setupShutdownHook(); } + private void setupShutdownHook() { + // 将执行中的行动状态置为失败 + List executingActionList = listExecutingAction(); + for (ActionData actionData : executingActionList) { + actionData.setStatus(ActionData.ActionStatus.FAILED); + actionData.setResult("由于系统中断而失败"); + } + } + + private List listExecutingAction() { + return actionPool.values().stream() + .flatMap(Collection::stream) + .filter(action -> action.getStatus() == ActionData.ActionStatus.EXECUTING) + .collect(Collectors.toList()); + } + + @CapabilityMethod public synchronized void putPendingActions(String userId, ActionData actionData) { pendingActions.computeIfAbsent(userId, k -> { diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java index 3bf7aea2..f98be7b0 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java @@ -2,6 +2,7 @@ package work.slhaf.partner.core.action.entity; import lombok.Data; +import java.util.LinkedHashMap; import java.util.List; /** @@ -12,7 +13,7 @@ public abstract class ActionData { protected String uuid; protected String tendency; protected ActionStatus status; - protected List actionChain; + protected LinkedHashMap> actionChain; protected String result; protected String reason; protected String description; diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java index 73587070..6d5f9ab3 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java @@ -26,7 +26,7 @@ public class MetaAction implements Comparable, Runnable { /** * 行动结果,包括执行状态和相应内容(执行结果或者错误信息) */ - private Result result; + private Result result = new Result(); /** * 执行顺序,升序排列 */ @@ -88,7 +88,7 @@ public class MetaAction implements Comparable, Runnable { @Data public static class Result { - private boolean success; + private boolean success = true; private String data; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java index a870ae0c..541c3d24 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java @@ -12,11 +12,9 @@ import work.slhaf.partner.core.action.entity.ActionData; import work.slhaf.partner.core.action.entity.ImmediateActionData; import work.slhaf.partner.core.action.entity.MetaAction; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.concurrent.CountDownLatch; +import java.util.*; import java.util.concurrent.ExecutorService; +import java.util.concurrent.Phaser; @Slf4j @AgentSubModule @@ -28,6 +26,8 @@ public class ActionExecutor extends AgentRunningSubModule phaserRecorder = new HashMap<>(); + @Init public void init() { virtualExecutor = actionCapability.getExecutor(ActionCore.ExecutorType.VIRTUAL); @@ -45,69 +45,63 @@ public class ActionExecutor extends AgentRunningSubModule { actionData.setStatus(ActionData.ActionStatus.EXECUTING); - List actionChain = actionData.getActionChain(); - actionChain.sort(MetaAction::compareTo); + LinkedHashMap> actionChain = actionData.getActionChain(); List virtual = new ArrayList<>(); List platform = new ArrayList<>(); - int order; - for (int index = 0; index < actionChain.size(); index++) { - MetaAction metaAction = actionChain.get(index); - // 根据io类型放入合适的列表 - if (metaAction.isIo()) { - virtual.add(metaAction); - } else { - platform.add(metaAction); + actionChain.forEach((k, v) -> { + for (MetaAction metaAction : v) { + // 根据io类型放入合适的列表 + if (metaAction.isIo()) { + virtual.add(metaAction); + } else { + platform.add(metaAction); + } } - // 记录当前order - order = metaAction.getOrder(); - // 如果下一个行动单元的order与当前不同,则执行并清空当前组内容 - if (actionChain.size() <= (index + 1) || actionChain.get(index + 1).getOrder() != order) { - runGroupAction(virtual, platform, actionChain); - } - } + runGroupAction(virtual, platform, actionChain); + }); }); } - //TODO 考虑是否使用phaser来承担同组的动态任务新增 - private void runGroupAction(List virtual, List platform, List actionChain) { - boolean first = true; - do { - CountDownLatch latch = new CountDownLatch(virtual.size() + platform.size()); - runGroupAction(virtual, virtualExecutor, actionChain, latch, first); - runGroupAction(platform, platformExecutor, actionChain, latch, first); - try { - latch.await(); - } catch (InterruptedException e) { - log.error("[{}] CountDownLatch被中断", modelKey()); - } - first = false; - } while (!virtual.isEmpty() || !platform.isEmpty()); + // 使用phaser来承担同组的动态任务新增 + private void runGroupAction(List virtual, List platform, LinkedHashMap> actionChain) { + Phaser phaser = new Phaser(); + phaser.register(); + String groupId = UUID.randomUUID().toString(); + phaserRecorder.put(groupId, new PhaserActionChain(phaser, actionChain)); + runGroupAction(virtual, virtualExecutor, actionChain, phaser); + runGroupAction(platform, platformExecutor, actionChain, phaser); + phaserRecorder.remove(groupId); + phaser.arriveAndAwaitAdvance(); } - private void runGroupAction(List actions, ExecutorService executor, List actionChain, CountDownLatch latch, boolean first) { - if (!first && !new HashSet<>(actionChain).containsAll(actions)) { - // 该部分对应LLM新增本组执行单元时,将其添加至actionChain记录。对于后续组级别的新增,将直接在上一级调用处体现,除了注意并发安全外无需额外处理 - int index = actionChain.indexOf(actions.getLast()); - actionChain.addAll(index, actions); - } + private void runGroupAction(List actions, ExecutorService executor, LinkedHashMap> actionChain, Phaser phaser) { for (MetaAction action : actions) { + phaser.register(); executor.execute(() -> { - boolean success = true; + MetaAction.Result result = action.getResult(); do { // 该循环对应LLM的调整参数后重试 - if (!success) { - //TODO LLM决策是重构参数、执行自对话反思、还是选择向用户求助(通过cognationCore暴露方法,可能需要修改其他模块以进行适应) + if (!result.isSuccess()) { + //TODO LLM决策是重构参数、执行自对话反思、还是选择向用户求助(通过cognationCore暴露方法,可能需要修改其他模块以进行适应),仅重构参数时无需结束当前循环 + // 若使用Phaser作为执行线程与反思、求助等调用流程的同步协调,应当需要额外维护Phaser全局字段,获取到反思结果或者用户反馈后, + // 调用对应的phaser注册任务,在ActionExecutor中动态添加任务至actionChain,同时启动异步执行 + // 而且由于执行与放入的为同一个MetaAction对象,所以执行结果可被当前行动链获取,但virtual、executor两个列表似乎不行,需要重构执行模式,建议将行动链直接重构为LinkedHashMap,order为键 + String input = getInput(result.getData()); } action.run(); - success = action.getResult().isSuccess(); - } while (!success); - latch.countDown(); + } while (!result.isSuccess()); //TODO 将执行结果写入特定对话角色记忆(cognationCore暴露方法) + phaser.arriveAndDeregister(); }); } } + private String getInput(String data) { + + return null; + } + @Override public String modelKey() { return "action_executor"; @@ -117,4 +111,7 @@ public class ActionExecutor extends AgentRunningSubModule> actionChain) { + } } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java index 59088261..dea85a98 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java @@ -11,6 +11,7 @@ import work.slhaf.partner.common.vector.VectorClient; import work.slhaf.partner.core.action.ActionCapability; import work.slhaf.partner.core.action.entity.ActionData; import work.slhaf.partner.core.action.entity.ImmediateActionData; +import work.slhaf.partner.core.action.entity.MetaAction; import work.slhaf.partner.core.action.entity.ScheduledActionData; import work.slhaf.partner.core.action.entity.cache.CacheAdjustData; import work.slhaf.partner.core.action.entity.cache.CacheAdjustMetaData; @@ -29,10 +30,7 @@ import work.slhaf.partner.module.modules.action.planner.extractor.entity.Extract import work.slhaf.partner.module.modules.action.planner.extractor.entity.ExtractorResult; import work.slhaf.partner.runtime.interaction.data.context.PartnerRunningFlowContext; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.UUID; +import java.util.*; import java.util.concurrent.Callable; /** @@ -163,8 +161,9 @@ public class ActionPlanner extends PreRunningModule { @Override protected HashMap getPromptDataMap(PartnerRunningFlowContext context) { HashMap map = new HashMap<>(); - setupPendingActions(map, context.getUserId()); - setupPreparedActions(map, context.getUuid()); + String userId = context.getUserId(); + setupPendingActions(map, userId); + setupPreparedActions(map, userId); return map; } @@ -179,8 +178,8 @@ public class ActionPlanner extends PreRunningModule { } } - private void setupPreparedActions(HashMap map, String uuid) { - List actionData = actionCapability.listPreparedAction(uuid); + private void setupPreparedActions(HashMap map, String userId) { + List actionData = actionCapability.listPreparedAction(userId); if (actionData == null || actionData.isEmpty()) { map.put("[预备行动] <预备行动信息>", "无预备行动"); return; @@ -229,10 +228,14 @@ public class ActionPlanner extends PreRunningModule { } private ActionData buildMetaActionInfo(EvaluatorResult evaluatorResult) { + LinkedHashMap> actionChain = new LinkedHashMap<>(); + for (MetaAction metaAction : evaluatorResult.getActionChain()) { + actionChain.computeIfAbsent(metaAction.getOrder(), k -> new ArrayList<>()).add(metaAction); + } return switch (evaluatorResult.getType()) { case PLANNING -> { ScheduledActionData actionInfo = new ScheduledActionData(); - actionInfo.setActionChain(evaluatorResult.getActionChain()); + actionInfo.setActionChain(actionChain); actionInfo.setScheduleContent(evaluatorResult.getScheduleContent()); actionInfo.setStatus(ActionData.ActionStatus.PREPARE); actionInfo.setUuid(UUID.randomUUID().toString()); @@ -240,7 +243,7 @@ public class ActionPlanner extends PreRunningModule { } case IMMEDIATE -> { ImmediateActionData actionInfo = new ImmediateActionData(); - actionInfo.setActionChain(evaluatorResult.getActionChain()); + actionInfo.setActionChain(actionChain); actionInfo.setStatus(ActionData.ActionStatus.PREPARE); actionInfo.setUuid(UUID.randomUUID().toString()); yield actionInfo; diff --git a/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/PartnerInteractionAdapter.java b/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/PartnerInteractionAdapter.java index a2223701..133942ce 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/PartnerInteractionAdapter.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/PartnerInteractionAdapter.java @@ -3,6 +3,7 @@ package work.slhaf.partner.runtime.interaction; import work.slhaf.partner.api.agent.runtime.interaction.AgentInteractionAdapter; import work.slhaf.partner.runtime.interaction.data.PartnerInputData; import work.slhaf.partner.runtime.interaction.data.PartnerOutputData; +import work.slhaf.partner.runtime.interaction.data.SpecializedPartnerInputData; import work.slhaf.partner.runtime.interaction.data.context.PartnerRunningFlowContext; public class PartnerInteractionAdapter extends AgentInteractionAdapter { @@ -33,6 +34,10 @@ public class PartnerInteractionAdapter extends AgentInteractionAdapter parsedObject.to(PartnerInputData.class); + case SYSTEM, ASSIST_REQUEST, REFLECTION -> parsedObject.to(SpecializedPartnerInputData.class); + }; userSessions.put(inputData.getUserInfo(), webSocket); // 注册连接 receive(inputData); } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/PartnerInputData.java b/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/PartnerInputData.java index 8e3e2d43..2156fa17 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/PartnerInputData.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/PartnerInputData.java @@ -7,7 +7,8 @@ import work.slhaf.partner.api.agent.runtime.interaction.data.AgentInputData; @EqualsAndHashCode(callSuper = true) @Data public class PartnerInputData extends AgentInputData { - private String userNickName; - private String platform; - private boolean single; + protected String userNickName; + protected String platform; + protected boolean single; + protected PartnerInputType inputType; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/PartnerInputType.java b/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/PartnerInputType.java new file mode 100644 index 00000000..ce81229c --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/PartnerInputType.java @@ -0,0 +1,5 @@ +package work.slhaf.partner.runtime.interaction.data; + +public enum PartnerInputType { + NORMAL, REFLECTION, ASSIST_REQUEST, SYSTEM +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/SpecializedPartnerInputData.java b/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/SpecializedPartnerInputData.java new file mode 100644 index 00000000..d7f6d5e3 --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/SpecializedPartnerInputData.java @@ -0,0 +1,12 @@ +package work.slhaf.partner.runtime.interaction.data; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Map; + +@EqualsAndHashCode(callSuper = true) +@Data +public class SpecializedPartnerInputData extends PartnerInputData { + protected Map payload; +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/SpecializedPayloadConstant.java b/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/SpecializedPayloadConstant.java new file mode 100644 index 00000000..d6d7f360 --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/SpecializedPayloadConstant.java @@ -0,0 +1,7 @@ +package work.slhaf.partner.runtime.interaction.data; + +public class SpecializedPayloadConstant { + public static final String TASK_ID = "taskId"; + public static final String ACTION_ID = "actionId"; + public static final String TYPE = "inputType"; +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/context/PartnerRunningFlowContext.java b/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/context/PartnerRunningFlowContext.java index 74c985ab..05be0182 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/context/PartnerRunningFlowContext.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/context/PartnerRunningFlowContext.java @@ -5,6 +5,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import work.slhaf.partner.api.agent.runtime.interaction.flow.entity.RunningFlowContext; import work.slhaf.partner.module.common.entity.AppendPromptData; +import work.slhaf.partner.runtime.interaction.data.PartnerInputType; import work.slhaf.partner.runtime.interaction.data.context.subcontext.CoreContext; import work.slhaf.partner.runtime.interaction.data.context.subcontext.ModuleContext; @@ -12,6 +13,7 @@ import java.io.Serial; import java.time.LocalDateTime; import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.UUID; @EqualsAndHashCode(callSuper = true) @@ -30,6 +32,9 @@ public class PartnerRunningFlowContext extends RunningFlowContext { protected LocalDateTime dateTime; protected boolean single; + protected PartnerInputType type; + protected Map payload; + protected String input; protected CoreContext coreContext = new CoreContext(); From f9c3cacfeac3f317bb744fe5febef4e6a7a6fb8a Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Tue, 28 Oct 2025 23:23:16 +0800 Subject: [PATCH 005/182] =?UTF-8?q?=E6=8E=A8=E8=BF=9B=20ActionExecutor=20?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E7=9A=84=E5=8A=A8=E6=80=81=E6=8F=92=E6=8B=94?= =?UTF-8?q?=E5=BC=8F=E8=A1=8C=E5=8A=A8=E8=B0=83=E5=BA=A6=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除先前构想的 SpecializedPartnerInputData 及相关类,无论是自反思、向用户求助还是用户主动干预,都应当通过语义识别来作用于对应行动事件,使用固定行动id的机制不足以支撑这种机制 - 在 ActionCore 中新增执行中行动的 phaser 管理逻辑 - 新增几个异常类,适用于行动数据加载的异常情况 - 新增 ActionIdentifier 负责行动干预意图的识别 - --- .../partner/core/action/ActionCapability.java | 12 ++++ .../slhaf/partner/core/action/ActionCore.java | 56 ++++++++++++++++- .../core/action/ActionWatchService.java | 8 +-- .../core/action/entity/ActionData.java | 1 + .../core/action/entity/MetaAction.java | 6 +- .../ActionDataNotFoundException.java | 13 ++++ .../MetaActionNotFoundException.java | 13 ++++ .../slhaf/partner/core/memory/MemoryCore.java | 2 +- .../dispatcher/executor/ActionExecutor.java | 63 ++++++++++--------- .../action/identifier/ActionIdentifier.java | 40 ++++++++++++ .../PartnerInteractionAdapter.java | 5 -- .../runtime/interaction/WebSocketGateway.java | 10 +-- .../interaction/data/PartnerInputData.java | 1 - .../interaction/data/PartnerInputType.java | 5 -- .../data/SpecializedPartnerInputData.java | 12 ---- .../data/SpecializedPayloadConstant.java | 7 --- .../context/PartnerRunningFlowContext.java | 5 -- 17 files changed, 177 insertions(+), 82 deletions(-) create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/core/action/exception/ActionDataNotFoundException.java create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/core/action/exception/MetaActionNotFoundException.java create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/ActionIdentifier.java delete mode 100644 Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/PartnerInputType.java delete mode 100644 Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/SpecializedPartnerInputData.java delete mode 100644 Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/SpecializedPayloadConstant.java diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java index 9a3e8627..5acccffa 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java @@ -1,12 +1,15 @@ package work.slhaf.partner.core.action; +import lombok.NonNull; import work.slhaf.partner.api.agent.factory.capability.annotation.Capability; import work.slhaf.partner.core.action.entity.ActionData; +import work.slhaf.partner.core.action.entity.MetaAction; import work.slhaf.partner.core.action.entity.cache.CacheAdjustData; import java.util.List; import java.util.Set; import java.util.concurrent.ExecutorService; +import java.util.concurrent.Phaser; @Capability(value = "action") public interface ActionCapability { @@ -27,4 +30,13 @@ public interface ActionCapability { ExecutorService getExecutor(ActionCore.ExecutorType type); Set getExistedMetaActions(); + + void putPhaserRecord(Phaser phaser, ActionData actionData); + + void removePhaserRecord(Phaser phaser); + + ActionCore.PhaserRecord getPhaserRecord(String tendency, String source); + + MetaAction loadMetaAction(@NonNull String actionKey); + } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java index b7fe5a7e..da7a269d 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java @@ -1,20 +1,26 @@ package work.slhaf.partner.core.action; +import cn.hutool.core.bean.BeanUtil; +import lombok.NonNull; import lombok.extern.slf4j.Slf4j; import work.slhaf.partner.api.agent.factory.capability.annotation.CapabilityCore; import work.slhaf.partner.api.agent.factory.capability.annotation.CapabilityMethod; import work.slhaf.partner.common.vector.VectorClient; import work.slhaf.partner.core.PartnerCore; import work.slhaf.partner.core.action.entity.ActionData; +import work.slhaf.partner.core.action.entity.MetaAction; import work.slhaf.partner.core.action.entity.MetaActionInfo; import work.slhaf.partner.core.action.entity.cache.ActionCacheData; import work.slhaf.partner.core.action.entity.cache.CacheAdjustData; import work.slhaf.partner.core.action.entity.cache.CacheAdjustMetaData; +import work.slhaf.partner.core.action.exception.ActionDataNotFoundException; +import work.slhaf.partner.core.action.exception.MetaActionNotFoundException; import java.io.IOException; import java.util.*; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.concurrent.Phaser; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import java.util.stream.Collectors; @@ -44,7 +50,11 @@ public class ActionCore extends PartnerCore { private final ExecutorService platformExecutor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()); private final ExecutorService virtualExecutor = Executors.newVirtualThreadPerTaskExecutor(); + /** + * 已存在的行动程序,键为目录名,值为从目录加载的行动程序元信息 + */ private final LinkedHashMap existedMetaActions = new LinkedHashMap<>(); + private final List phaserRecords = new ArrayList<>(); public ActionCore() throws IOException, ClassNotFoundException { new ActionWatchService(existedMetaActions, virtualExecutor).launch(); @@ -67,7 +77,6 @@ public class ActionCore extends PartnerCore { .collect(Collectors.toList()); } - @CapabilityMethod public synchronized void putPendingActions(String userId, ActionData actionData) { pendingActions.computeIfAbsent(userId, k -> { @@ -171,6 +180,48 @@ public class ActionCore extends PartnerCore { return existedMetaActions.keySet(); } + @CapabilityMethod + public synchronized void putPhaserRecord(Phaser phaser, ActionData actionData) { + phaserRecords.add(new PhaserRecord(phaser, actionData)); + } + + @CapabilityMethod + public synchronized void removePhaserRecord(Phaser phaser) { + PhaserRecord remove = null; + for (PhaserRecord record : phaserRecords) { + if (record.phaser.equals(phaser)) { + remove = record; + } + } + + if (remove != null) { + phaserRecords.remove(remove); + } + } + + @CapabilityMethod + public PhaserRecord getPhaserRecord(String tendency, String source) { + for (PhaserRecord record : phaserRecords) { + ActionData data = record.actionData; + if (data.getTendency().equals(tendency) && data.getSource().equals(source)) { + return record; + } + } + throw new ActionDataNotFoundException("未找到对应的 Phaser 记录: tendency=" + tendency + ", source=" + source); + } + + @CapabilityMethod + public MetaAction loadMetaAction(@NonNull String actionKey) { + for (MetaActionInfo actionInfo : existedMetaActions.values()) { + if (actionInfo.getKey().equals(actionKey)) { + MetaAction metaAction = new MetaAction(); + BeanUtil.copyProperties(actionInfo, metaAction); + return metaAction; + } + } + throw new MetaActionNotFoundException("未找到对应的行动程序信息" + actionKey); + } + /** * 命中缓存且评估通过时 * @@ -268,4 +319,7 @@ public class ActionCore extends PartnerCore { public enum ExecutorType { VIRTUAL, PLATFORM } + + public record PhaserRecord(Phaser phaser, ActionData actionData) { + } } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionWatchService.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionWatchService.java index a10cc59d..8af7987b 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionWatchService.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionWatchService.java @@ -21,9 +21,9 @@ import static work.slhaf.partner.common.Constant.Path.ACTION_PROGRAM; @Slf4j class ActionWatchService { - private HashMap registeredPaths = new HashMap<>(); - private LinkedHashMap existedMetaActions; - private ExecutorService virtualExecutor; + private final HashMap registeredPaths = new HashMap<>(); + private final LinkedHashMap existedMetaActions; + private final ExecutorService virtualExecutor; public ActionWatchService(LinkedHashMap existedMetaActions, ExecutorService virtualExecutor) { this.existedMetaActions = existedMetaActions; @@ -114,7 +114,7 @@ class ActionWatchService { private boolean checkComplete(Path thisDir) { File[] files = thisDir.toFile().listFiles(); if (files == null) { - log.error("[{}]当前目录无法访问: [{}]", thisDir); + log.error("当前目录无法访问: [{}]", thisDir); return false; } boolean existedAction = false; diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java index f98be7b0..eadcf315 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java @@ -17,6 +17,7 @@ public abstract class ActionData { protected String result; protected String reason; protected String description; + protected String source; public enum ActionStatus { SUCCESS, FAILED, EXECUTING, WAITING, PREPARE diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java index 6d5f9ab3..fafb6840 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java @@ -26,7 +26,7 @@ public class MetaAction implements Comparable, Runnable { /** * 行动结果,包括执行状态和相应内容(执行结果或者错误信息) */ - private Result result = new Result(); + private final Result result = new Result(); /** * 执行顺序,升序排列 */ @@ -49,7 +49,6 @@ public class MetaAction implements Comparable, Runnable { public void run() { File action = loadFromFile(); if (!action.exists()) { - result = new Result(); result.setSuccess(false); result.setData("Action file not found: " + action.getAbsolutePath()); } @@ -60,7 +59,6 @@ public class MetaAction implements Comparable, Runnable { case SCRIPT -> executeScript(action); } } catch (Exception e) { - result = new Result(); result.setSuccess(false); result.setData(e.getMessage()); } @@ -89,7 +87,7 @@ public class MetaAction implements Comparable, Runnable { @Data public static class Result { private boolean success = true; - private String data; + private String data = null; } } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/exception/ActionDataNotFoundException.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/exception/ActionDataNotFoundException.java new file mode 100644 index 00000000..8fd351bd --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/exception/ActionDataNotFoundException.java @@ -0,0 +1,13 @@ +package work.slhaf.partner.core.action.exception; + +import work.slhaf.partner.api.agent.runtime.exception.AgentRuntimeException; + +public class ActionDataNotFoundException extends AgentRuntimeException { + public ActionDataNotFoundException(String message) { + super(message); + } + + public ActionDataNotFoundException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/exception/MetaActionNotFoundException.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/exception/MetaActionNotFoundException.java new file mode 100644 index 00000000..0c59e0b7 --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/exception/MetaActionNotFoundException.java @@ -0,0 +1,13 @@ +package work.slhaf.partner.core.action.exception; + +import work.slhaf.partner.api.agent.runtime.exception.AgentRuntimeException; + +public class MetaActionNotFoundException extends AgentRuntimeException { + public MetaActionNotFoundException(String message) { + super(message); + } + + public MetaActionNotFoundException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/memory/MemoryCore.java b/Partner-Main/src/main/java/work/slhaf/partner/core/memory/MemoryCore.java index 98c6d4b6..3bd4be03 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/memory/MemoryCore.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/memory/MemoryCore.java @@ -488,7 +488,7 @@ public class MemoryCore extends PartnerCore { return targetParentNode; } - public void updateCacheCounter(List topicPath) { + private void updateCacheCounter(List topicPath) { ConcurrentHashMap, Integer> memoryNodeCacheCounter = cache.memoryNodeCacheCounter; if (memoryNodeCacheCounter.containsKey(topicPath)) { Integer tempCount = memoryNodeCacheCounter.get(topicPath); diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java index 541c3d24..f50dc434 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java @@ -12,7 +12,9 @@ import work.slhaf.partner.core.action.entity.ActionData; import work.slhaf.partner.core.action.entity.ImmediateActionData; import work.slhaf.partner.core.action.entity.MetaAction; -import java.util.*; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Phaser; @@ -26,8 +28,6 @@ public class ActionExecutor extends AgentRunningSubModule phaserRecorder = new HashMap<>(); - @Init public void init() { virtualExecutor = actionCapability.getExecutor(ActionCore.ExecutorType.VIRTUAL); @@ -48,6 +48,9 @@ public class ActionExecutor extends AgentRunningSubModule> actionChain = actionData.getActionChain(); List virtual = new ArrayList<>(); List platform = new ArrayList<>(); + Phaser phaser = new Phaser(); + phaser.register(); + actionCapability.putPhaserRecord(phaser, actionData); actionChain.forEach((k, v) -> { for (MetaAction metaAction : v) { // 根据io类型放入合适的列表 @@ -57,42 +60,44 @@ public class ActionExecutor extends AgentRunningSubModule virtual, List platform, LinkedHashMap> actionChain) { - Phaser phaser = new Phaser(); - phaser.register(); - String groupId = UUID.randomUUID().toString(); - phaserRecorder.put(groupId, new PhaserActionChain(phaser, actionChain)); - runGroupAction(virtual, virtualExecutor, actionChain, phaser); - runGroupAction(platform, platformExecutor, actionChain, phaser); - phaserRecorder.remove(groupId); - phaser.arriveAndAwaitAdvance(); + private void runGroupAction(List virtual, List platform, LinkedHashMap> actionChain, Phaser phaser) { + runGroupAction(virtual, virtualExecutor, phaser); + runGroupAction(platform, platformExecutor, phaser); } - private void runGroupAction(List actions, ExecutorService executor, LinkedHashMap> actionChain, Phaser phaser) { + private void runGroupAction(List actions, ExecutorService executor, Phaser phaser) { for (MetaAction action : actions) { phaser.register(); executor.execute(() -> { - MetaAction.Result result = action.getResult(); - do { - // 该循环对应LLM的调整参数后重试 - if (!result.isSuccess()) { - //TODO LLM决策是重构参数、执行自对话反思、还是选择向用户求助(通过cognationCore暴露方法,可能需要修改其他模块以进行适应),仅重构参数时无需结束当前循环 - // 若使用Phaser作为执行线程与反思、求助等调用流程的同步协调,应当需要额外维护Phaser全局字段,获取到反思结果或者用户反馈后, - // 调用对应的phaser注册任务,在ActionExecutor中动态添加任务至actionChain,同时启动异步执行 - // 而且由于执行与放入的为同一个MetaAction对象,所以执行结果可被当前行动链获取,但virtual、executor两个列表似乎不行,需要重构执行模式,建议将行动链直接重构为LinkedHashMap,order为键 - String input = getInput(result.getData()); + try { + MetaAction.Result result = action.getResult(); + do { + // 该循环对应LLM的调整参数后重试 + if (!result.isSuccess()) { + //TODO LLM决策是重构参数、执行自对话反思、还是选择向用户求助(通过cognationCore暴露方法,可能需要修改其他模块以进行适应),仅重构参数时无需结束当前循环 + // 若使用Phaser作为执行线程与反思、求助等调用流程的同步协调,应当需要额外维护Phaser全局字段,获取到反思结果或者用户反馈后, + // 调用对应的phaser注册任务,在ActionExecutor中动态添加任务至actionChain,同时启动异步执行 + // 而且由于执行与放入的为同一个MetaAction对象,所以执行结果可被当前行动链获取,但virtual、executor两个列表似乎不行,需要重构执行模式,建议将行动链直接重构为LinkedHashMap,order为键 + String input = getInput(result.getData()); - } - action.run(); - } while (!result.isSuccess()); - //TODO 将执行结果写入特定对话角色记忆(cognationCore暴露方法) - phaser.arriveAndDeregister(); + } + action.run(); + } while (!result.isSuccess()); + //TODO 将执行结果写入特定对话角色记忆(cognationCore暴露方法) + } finally { + phaser.arriveAndDeregister(); + } }); } } @@ -112,6 +117,4 @@ public class ActionExecutor extends AgentRunningSubModule> actionChain) { - } } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/ActionIdentifier.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/ActionIdentifier.java new file mode 100644 index 00000000..db5635e2 --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/ActionIdentifier.java @@ -0,0 +1,40 @@ +package work.slhaf.partner.module.modules.action.identifier; + +import work.slhaf.partner.api.agent.factory.module.annotation.AgentModule; +import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.ActivateModel; +import work.slhaf.partner.module.common.module.PreRunningModule; +import work.slhaf.partner.runtime.interaction.data.context.PartnerRunningFlowContext; + +import java.util.HashMap; + +/** + * 负责识别潜在的行动干预信息,作用于正在进行或已存在的行动池中内容 + */ +@AgentModule(name = "action_identifier", order = 2) +public class ActionIdentifier extends PreRunningModule implements ActivateModel { + + @Override + protected void doExecute(PartnerRunningFlowContext context) { + + } + + @Override + public String modelKey() { + return ""; + } + + @Override + public boolean withBasicPrompt() { + return false; + } + + @Override + protected HashMap getPromptDataMap(PartnerRunningFlowContext context) { + return null; + } + + @Override + protected String moduleName() { + return ""; + } +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/PartnerInteractionAdapter.java b/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/PartnerInteractionAdapter.java index 133942ce..a2223701 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/PartnerInteractionAdapter.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/PartnerInteractionAdapter.java @@ -3,7 +3,6 @@ package work.slhaf.partner.runtime.interaction; import work.slhaf.partner.api.agent.runtime.interaction.AgentInteractionAdapter; import work.slhaf.partner.runtime.interaction.data.PartnerInputData; import work.slhaf.partner.runtime.interaction.data.PartnerOutputData; -import work.slhaf.partner.runtime.interaction.data.SpecializedPartnerInputData; import work.slhaf.partner.runtime.interaction.data.context.PartnerRunningFlowContext; public class PartnerInteractionAdapter extends AgentInteractionAdapter { @@ -34,10 +33,6 @@ public class PartnerInteractionAdapter extends AgentInteractionAdapter parsedObject.to(PartnerInputData.class); - case SYSTEM, ASSIST_REQUEST, REFLECTION -> parsedObject.to(SpecializedPartnerInputData.class); - }; + PartnerInputData inputData = JSONObject.parseObject(s, PartnerInputData.class); userSessions.put(inputData.getUserInfo(), webSocket); // 注册连接 receive(inputData); } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/PartnerInputData.java b/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/PartnerInputData.java index 2156fa17..07a26c29 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/PartnerInputData.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/PartnerInputData.java @@ -10,5 +10,4 @@ public class PartnerInputData extends AgentInputData { protected String userNickName; protected String platform; protected boolean single; - protected PartnerInputType inputType; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/PartnerInputType.java b/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/PartnerInputType.java deleted file mode 100644 index ce81229c..00000000 --- a/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/PartnerInputType.java +++ /dev/null @@ -1,5 +0,0 @@ -package work.slhaf.partner.runtime.interaction.data; - -public enum PartnerInputType { - NORMAL, REFLECTION, ASSIST_REQUEST, SYSTEM -} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/SpecializedPartnerInputData.java b/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/SpecializedPartnerInputData.java deleted file mode 100644 index d7f6d5e3..00000000 --- a/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/SpecializedPartnerInputData.java +++ /dev/null @@ -1,12 +0,0 @@ -package work.slhaf.partner.runtime.interaction.data; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.util.Map; - -@EqualsAndHashCode(callSuper = true) -@Data -public class SpecializedPartnerInputData extends PartnerInputData { - protected Map payload; -} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/SpecializedPayloadConstant.java b/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/SpecializedPayloadConstant.java deleted file mode 100644 index d6d7f360..00000000 --- a/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/SpecializedPayloadConstant.java +++ /dev/null @@ -1,7 +0,0 @@ -package work.slhaf.partner.runtime.interaction.data; - -public class SpecializedPayloadConstant { - public static final String TASK_ID = "taskId"; - public static final String ACTION_ID = "actionId"; - public static final String TYPE = "inputType"; -} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/context/PartnerRunningFlowContext.java b/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/context/PartnerRunningFlowContext.java index 05be0182..74c985ab 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/context/PartnerRunningFlowContext.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/runtime/interaction/data/context/PartnerRunningFlowContext.java @@ -5,7 +5,6 @@ import lombok.Data; import lombok.EqualsAndHashCode; import work.slhaf.partner.api.agent.runtime.interaction.flow.entity.RunningFlowContext; import work.slhaf.partner.module.common.entity.AppendPromptData; -import work.slhaf.partner.runtime.interaction.data.PartnerInputType; import work.slhaf.partner.runtime.interaction.data.context.subcontext.CoreContext; import work.slhaf.partner.runtime.interaction.data.context.subcontext.ModuleContext; @@ -13,7 +12,6 @@ import java.io.Serial; import java.time.LocalDateTime; import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.UUID; @EqualsAndHashCode(callSuper = true) @@ -32,9 +30,6 @@ public class PartnerRunningFlowContext extends RunningFlowContext { protected LocalDateTime dateTime; protected boolean single; - protected PartnerInputType type; - protected Map payload; - protected String input; protected CoreContext coreContext = new CoreContext(); From ec4fbb7f198ce942470e19824012c03059346031 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Wed, 29 Oct 2025 23:02:47 +0800 Subject: [PATCH 006/182] =?UTF-8?q?=E8=A1=8C=E5=8A=A8=E5=B9=B2=E9=A2=84?= =?UTF-8?q?=E8=B6=B3=E4=BB=A5=E6=8A=BD=E7=A6=BB=E4=B8=BA=E6=96=B0=E7=9A=84?= =?UTF-8?q?=E5=89=8D=E7=BD=AE=E6=A8=A1=E5=9D=97=EF=BC=8C=E4=BD=86=E4=BB=8D?= =?UTF-8?q?=E5=B1=9E=E4=BA=8E=E2=80=98=E8=A1=8C=E5=8A=A8=E2=80=99=E8=AF=AD?= =?UTF-8?q?=E4=B9=89=EF=BC=8C=E5=A4=A7=E8=87=B4=E6=A1=86=E6=9E=B6=E5=B7=B2?= =?UTF-8?q?=E7=A1=AE=E7=AB=8B=E3=80=82=E5=90=8E=E7=BB=AD=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=E6=97=B6=E5=B9=B6=E5=8F=91=E6=8E=A7=E5=88=B6=E3=80=81=E5=90=84?= =?UTF-8?q?=E7=A7=8D=E5=B9=B2=E9=A2=84=E7=9A=84=E5=8D=8F=E8=B0=83=E4=B8=8E?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E6=97=B6=E6=9C=BA=E9=9C=80=E8=A6=81=E6=B3=A8?= =?UTF-8?q?=E6=84=8F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Identifier.java => ActionInterventor.java} | 19 +++++++++---- .../evaluator/InterventionEvaluator.java | 28 +++++++++++++++++++ .../evaluator/entity/EvaluatorInput.java | 7 +++++ .../evaluator/entity/EvaluatorResult.java | 7 +++++ .../recognizer/InterventionRecognizer.java | 27 ++++++++++++++++++ .../recognizer/entity/InterventionResult.java | 9 ++++++ 6 files changed, 92 insertions(+), 5 deletions(-) rename Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/{ActionIdentifier.java => ActionInterventor.java} (51%) create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/evaluator/InterventionEvaluator.java create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/evaluator/entity/EvaluatorInput.java create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/evaluator/entity/EvaluatorResult.java create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/InterventionRecognizer.java create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/entity/InterventionResult.java diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/ActionIdentifier.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/ActionInterventor.java similarity index 51% rename from Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/ActionIdentifier.java rename to Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/ActionInterventor.java index db5635e2..59e1a4a3 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/ActionIdentifier.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/ActionInterventor.java @@ -1,8 +1,11 @@ package work.slhaf.partner.module.modules.action.identifier; import work.slhaf.partner.api.agent.factory.module.annotation.AgentModule; +import work.slhaf.partner.api.agent.factory.module.annotation.InjectModule; import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.ActivateModel; import work.slhaf.partner.module.common.module.PreRunningModule; +import work.slhaf.partner.module.modules.action.identifier.evaluator.InterventionEvaluator; +import work.slhaf.partner.module.modules.action.identifier.recognizer.InterventionRecognizer; import work.slhaf.partner.runtime.interaction.data.context.PartnerRunningFlowContext; import java.util.HashMap; @@ -11,21 +14,27 @@ import java.util.HashMap; * 负责识别潜在的行动干预信息,作用于正在进行或已存在的行动池中内容 */ @AgentModule(name = "action_identifier", order = 2) -public class ActionIdentifier extends PreRunningModule implements ActivateModel { +public class ActionInterventor extends PreRunningModule implements ActivateModel { + + @InjectModule + private InterventionRecognizer interventionRecognizer; + @InjectModule + private InterventionEvaluator interventionEvaluator; @Override protected void doExecute(PartnerRunningFlowContext context) { - + //综合当前正在进行的行动链信息、用户交互历史、激活的记忆切片,尝试识别出是否存在行动干预意图 + //首先通过recognizer进行快速意图识别,识别成功则步入评估阶段,评估成功则直接作用于目标行动链 } @Override public String modelKey() { - return ""; + return "action_identifier"; } @Override public boolean withBasicPrompt() { - return false; + return true; } @Override @@ -35,6 +44,6 @@ public class ActionIdentifier extends PreRunningModule implements ActivateModel @Override protected String moduleName() { - return ""; + return "[行动干预识别模块]"; } } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/evaluator/InterventionEvaluator.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/evaluator/InterventionEvaluator.java new file mode 100644 index 00000000..abae5166 --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/evaluator/InterventionEvaluator.java @@ -0,0 +1,28 @@ +package work.slhaf.partner.module.modules.action.identifier.evaluator; + +import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule; +import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.ActivateModel; +import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.AgentRunningSubModule; +import work.slhaf.partner.module.modules.action.identifier.evaluator.entity.EvaluatorInput; +import work.slhaf.partner.module.modules.action.identifier.evaluator.entity.EvaluatorResult; + +@AgentSubModule +public class InterventionEvaluator extends AgentRunningSubModule implements ActivateModel { + + @Override + public EvaluatorResult execute(EvaluatorInput data) { + //基于干预意图、记忆切片、交互上下文、已有行动程序综合评估,尝试选取出合适的行动程序,对目标行动链做出调整 + + return null; + } + + @Override + public String modelKey() { + return "intervention_evaluator"; + } + + @Override + public boolean withBasicPrompt() { + return true; + } +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/evaluator/entity/EvaluatorInput.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/evaluator/entity/EvaluatorInput.java new file mode 100644 index 00000000..170138f6 --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/evaluator/entity/EvaluatorInput.java @@ -0,0 +1,7 @@ +package work.slhaf.partner.module.modules.action.identifier.evaluator.entity; + +import lombok.Data; + +@Data +public class EvaluatorInput { +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/evaluator/entity/EvaluatorResult.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/evaluator/entity/EvaluatorResult.java new file mode 100644 index 00000000..37723a9b --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/evaluator/entity/EvaluatorResult.java @@ -0,0 +1,7 @@ +package work.slhaf.partner.module.modules.action.identifier.evaluator.entity; + +import lombok.Data; + +@Data +public class EvaluatorResult { +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/InterventionRecognizer.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/InterventionRecognizer.java new file mode 100644 index 00000000..d68a2619 --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/InterventionRecognizer.java @@ -0,0 +1,27 @@ +package work.slhaf.partner.module.modules.action.identifier.recognizer; + +import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule; +import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.ActivateModel; +import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.AgentRunningSubModule; +import work.slhaf.partner.module.modules.action.identifier.recognizer.entity.InterventionResult; + +@AgentSubModule +public class InterventionRecognizer extends AgentRunningSubModule implements ActivateModel { + + @Override + public InterventionResult execute(String data) { + //使用LLM进行快速意图识别 + + return null; + } + + @Override + public String modelKey() { + return "intervention_recognizer"; + } + + @Override + public boolean withBasicPrompt() { + return false; + } +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/entity/InterventionResult.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/entity/InterventionResult.java new file mode 100644 index 00000000..017e73ee --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/entity/InterventionResult.java @@ -0,0 +1,9 @@ +package work.slhaf.partner.module.modules.action.identifier.recognizer.entity; + +import lombok.Data; + +@Data +public class InterventionResult { + private boolean result; + private String interventionTendency; +} From 746fda1a5e7f8f371cd6d560d93d478d65f1c7e7 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 31 Oct 2025 21:03:26 +0800 Subject: [PATCH 007/182] =?UTF-8?q?=E5=B9=B2=E9=A2=84=E6=84=8F=E5=9B=BE?= =?UTF-8?q?=E6=8F=90=E5=8F=96=E6=A8=A1=E5=9D=97=E5=88=9D=E6=AD=A5=E5=AE=8C?= =?UTF-8?q?=E6=88=90=EF=BC=8CPrompt=20=E5=BE=85=E5=88=B6=E5=AE=9A;=20?= =?UTF-8?q?=E5=9C=A8=20ChatClient=20=E4=B8=AD=E6=B7=BB=E5=8A=A0=E4=BA=86?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E7=9A=84=E8=B6=85=E6=97=B6=E8=AE=BE=E5=AE=9A?= =?UTF-8?q?=EF=BC=8C=E8=B6=85=E6=97=B6=E6=97=B6=E9=97=B4=E5=90=8E=E7=BB=AD?= =?UTF-8?q?=E5=8F=AF=E8=83=BD=E9=9C=80=E8=A6=81=E8=B0=83=E6=95=B4=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 另: 发现很多细节错误,比如“各个后置模块允许执行的条件”、“主模块出现异常时需要如何处理”、“模块Prompt的构建方式、采用格式不统一”等,需要后续进行修复或调整 --- .../slhaf/partner/api/chat/ChatClient.java | 30 +++++--- .../api/chat/constant/ChatConstant.java | 5 +- .../partner/api/chat/pojo/ChatResponse.java | 3 +- .../partner/core/action/ActionCapability.java | 2 + .../slhaf/partner/core/action/ActionCore.java | 5 ++ .../common/module/PostRunningModule.java | 3 +- .../common/module/PreRunningModule.java | 1 - .../action/dispatcher/ActionDispatcher.java | 5 ++ .../action/identifier/ActionInterventor.java | 31 ++++++++ .../evaluator/entity/EvaluatorInput.java | 7 ++ .../recognizer/InterventionRecognizer.java | 72 +++++++++++++++++-- ...nResult.java => MetaRecognizerResult.java} | 6 +- .../recognizer/entity/RecognizerInput.java | 21 ++++++ .../recognizer/entity/RecognizerResult.java | 21 ++++++ .../planner/confirmer/ActionConfirmer.java | 1 + .../modules/memory/updater/MemoryUpdater.java | 5 ++ .../perceive/updater/PerceiveUpdater.java | 5 ++ Partner-Main/src/test/java/NetTest.java | 15 ++++ 18 files changed, 217 insertions(+), 21 deletions(-) rename Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/entity/{InterventionResult.java => MetaRecognizerResult.java} (51%) create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/entity/RecognizerInput.java create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/entity/RecognizerResult.java create mode 100644 Partner-Main/src/test/java/NetTest.java diff --git a/Partner-Api/src/main/java/work/slhaf/partner/api/chat/ChatClient.java b/Partner-Api/src/main/java/work/slhaf/partner/api/chat/ChatClient.java index ac23418e..30cdee08 100644 --- a/Partner-Api/src/main/java/work/slhaf/partner/api/chat/ChatClient.java +++ b/Partner-Api/src/main/java/work/slhaf/partner/api/chat/ChatClient.java @@ -1,10 +1,12 @@ package work.slhaf.partner.api.chat; +import cn.hutool.core.io.IORuntimeException; import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpResponse; import cn.hutool.json.JSONUtil; import lombok.Data; import lombok.NoArgsConstructor; +import lombok.extern.slf4j.Slf4j; import work.slhaf.partner.api.chat.constant.ChatConstant; import work.slhaf.partner.api.chat.pojo.ChatBody; import work.slhaf.partner.api.chat.pojo.ChatResponse; @@ -13,6 +15,7 @@ import work.slhaf.partner.api.chat.pojo.PrimaryChatResponse; import java.util.List; +@Slf4j @Data @NoArgsConstructor public class ChatClient { @@ -34,6 +37,8 @@ public class ChatClient { public ChatResponse runChat(List messages) { HttpRequest request = HttpRequest.post(url); + request.setConnectionTimeout(2000); + request.setReadTimeout(15000); request.header("Content-Type", "application/json"); request.header("Authorization", "Bearer " + apikey); @@ -53,17 +58,26 @@ public class ChatClient { .build(); } - HttpResponse response = request.body(JSONUtil.toJsonStr(body)).execute(); ChatResponse finalResponse; - PrimaryChatResponse primaryChatResponse = JSONUtil.toBean(response.body(), PrimaryChatResponse.class); - finalResponse = ChatResponse.builder() - .type(ChatConstant.Response.SUCCESS) - .message(primaryChatResponse.getChoices().get(0).getMessage().getContent()) - .usageBean(primaryChatResponse.getUsage()) - .build(); + try { + HttpResponse response = request.body(JSONUtil.toJsonStr(body)).execute(); + PrimaryChatResponse primaryChatResponse = JSONUtil.toBean(response.body(), PrimaryChatResponse.class); + finalResponse = ChatResponse.builder() + .status(ChatConstant.ResponseStatus.SUCCESS) + .message(primaryChatResponse.getChoices().get(0).getMessage().getContent()) + .usageBean(primaryChatResponse.getUsage()) + .build(); - response.close(); + response.close(); + } catch (IORuntimeException e) { + log.error("请求超时", e); + finalResponse = ChatResponse.builder() + .message("连接超时") + .status(ChatConstant.ResponseStatus.FAILED) + .usageBean(null) + .build(); + } return finalResponse; } diff --git a/Partner-Api/src/main/java/work/slhaf/partner/api/chat/constant/ChatConstant.java b/Partner-Api/src/main/java/work/slhaf/partner/api/chat/constant/ChatConstant.java index eaa3be2d..c805e40b 100644 --- a/Partner-Api/src/main/java/work/slhaf/partner/api/chat/constant/ChatConstant.java +++ b/Partner-Api/src/main/java/work/slhaf/partner/api/chat/constant/ChatConstant.java @@ -8,8 +8,7 @@ public class ChatConstant { public static final String ASSISTANT = "assistant"; } - public static class Response { - public static final String SUCCESS = "success"; - public static final String ERROR = "error"; + public enum ResponseStatus { + SUCCESS, FAILED } } diff --git a/Partner-Api/src/main/java/work/slhaf/partner/api/chat/pojo/ChatResponse.java b/Partner-Api/src/main/java/work/slhaf/partner/api/chat/pojo/ChatResponse.java index 42f12106..77183f91 100644 --- a/Partner-Api/src/main/java/work/slhaf/partner/api/chat/pojo/ChatResponse.java +++ b/Partner-Api/src/main/java/work/slhaf/partner/api/chat/pojo/ChatResponse.java @@ -4,13 +4,14 @@ import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import work.slhaf.partner.api.chat.constant.ChatConstant; @Data @Builder @AllArgsConstructor @NoArgsConstructor public class ChatResponse { - private String type; + private ChatConstant.ResponseStatus status; private String message; private PrimaryChatResponse.UsageBean usageBean; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java index 5acccffa..90aa7d7e 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java @@ -35,6 +35,8 @@ public interface ActionCapability { void removePhaserRecord(Phaser phaser); + List listPhaserRecords(); + ActionCore.PhaserRecord getPhaserRecord(String tendency, String source); MetaAction loadMetaAction(@NonNull String actionKey); diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java index da7a269d..9bcedec0 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java @@ -222,6 +222,11 @@ public class ActionCore extends PartnerCore { throw new MetaActionNotFoundException("未找到对应的行动程序信息" + actionKey); } + @CapabilityMethod + public List listPhaserRecords() { + return phaserRecords; + } + /** * 命中缓存且评估通过时 * diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/common/module/PostRunningModule.java b/Partner-Main/src/main/java/work/slhaf/partner/module/common/module/PostRunningModule.java index f3c5f01f..dacd83fb 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/common/module/PostRunningModule.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/common/module/PostRunningModule.java @@ -8,7 +8,7 @@ public abstract class PostRunningModule extends AgentRunningModule getPromptDataMap(PartnerRunningFlowContext context) { + return null; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/evaluator/entity/EvaluatorInput.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/evaluator/entity/EvaluatorInput.java index 170138f6..9a80793d 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/evaluator/entity/EvaluatorInput.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/evaluator/entity/EvaluatorInput.java @@ -1,7 +1,14 @@ package work.slhaf.partner.module.modules.action.identifier.evaluator.entity; import lombok.Data; +import work.slhaf.partner.api.chat.pojo.Message; +import work.slhaf.partner.core.memory.pojo.EvaluatedSlice; + +import java.util.List; @Data public class EvaluatorInput { + private String interventionTendency; + private List activatedSlices; + private List recentMessages; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/InterventionRecognizer.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/InterventionRecognizer.java index d68a2619..1420ec5b 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/InterventionRecognizer.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/InterventionRecognizer.java @@ -1,18 +1,82 @@ package work.slhaf.partner.module.modules.action.identifier.recognizer; +import com.alibaba.fastjson2.JSONObject; +import lombok.extern.slf4j.Slf4j; +import work.slhaf.partner.api.agent.factory.capability.annotation.InjectCapability; import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule; import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.ActivateModel; import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.AgentRunningSubModule; -import work.slhaf.partner.module.modules.action.identifier.recognizer.entity.InterventionResult; +import work.slhaf.partner.api.chat.pojo.ChatResponse; +import work.slhaf.partner.core.action.ActionCapability; +import work.slhaf.partner.core.action.ActionCore; +import work.slhaf.partner.core.action.entity.ActionData; +import work.slhaf.partner.module.modules.action.identifier.recognizer.entity.MetaRecognizerResult; +import work.slhaf.partner.module.modules.action.identifier.recognizer.entity.RecognizerInput; +import work.slhaf.partner.module.modules.action.identifier.recognizer.entity.RecognizerResult; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; + +@Slf4j @AgentSubModule -public class InterventionRecognizer extends AgentRunningSubModule implements ActivateModel { +public class InterventionRecognizer extends AgentRunningSubModule implements ActivateModel { + + @InjectCapability + private ActionCapability actionCapability; @Override - public InterventionResult execute(String data) { + public RecognizerResult execute(RecognizerInput input) { //使用LLM进行快速意图识别 + ExecutorService executor = actionCapability.getExecutor(ActionCore.ExecutorType.VIRTUAL); + RecognizerResult recognizerResult = new RecognizerResult(); + Map resultInterventionMap = recognizerResult.getInterventions(); + List executingActions = input.getExecutingActions(); + CountDownLatch countDownLatch = new CountDownLatch(executingActions.size()); + for (ActionCore.PhaserRecord record : executingActions) { + executor.execute(() -> { + try { + String prompt = buildPrompt(record, input); + ChatResponse response = this.singleChat(prompt); + MetaRecognizerResult result = JSONObject.parseObject(response.getMessage(), MetaRecognizerResult.class); + if (result.isOk()) { + synchronized (resultInterventionMap) { + resultInterventionMap.put(result.getIntervention(), record); + } + } + } catch (Exception e) { + log.error("LLM干预意图提取出错", e); + } finally { + countDownLatch.countDown(); + } + }); + } + try { + countDownLatch.await(); + } catch (InterruptedException e) { + log.warn("CountDownLatch阻塞已中断"); + } + return recognizerResult; + } - return null; + private String buildPrompt(ActionCore.PhaserRecord record, RecognizerInput input) { + ActionData actionData = record.actionData(); + JSONObject json = new JSONObject(); + + JSONObject actionInfo = json.putObject("行动信息"); + actionInfo.put("行动倾向", actionData.getStatus()); + actionInfo.put("行动原因", actionData.getReason()); + actionInfo.put("行动描述", actionData.getDescription()); + actionInfo.put("行动状态", actionData.getStatus()); + actionInfo.put("行动来源", actionData.getSource()); + + JSONObject interactionInfo = json.putObject("交互信息"); + interactionInfo.put("用户输入", input.getInput()); + interactionInfo.put("当前对话", input.getRecentMessages()); + interactionInfo.put("近期对话", input.getUserDialogMapStr()); + + return json.toString(); } @Override diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/entity/InterventionResult.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/entity/MetaRecognizerResult.java similarity index 51% rename from Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/entity/InterventionResult.java rename to Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/entity/MetaRecognizerResult.java index 017e73ee..d3d963dd 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/entity/InterventionResult.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/entity/MetaRecognizerResult.java @@ -3,7 +3,7 @@ package work.slhaf.partner.module.modules.action.identifier.recognizer.entity; import lombok.Data; @Data -public class InterventionResult { - private boolean result; - private String interventionTendency; +public class MetaRecognizerResult { + private boolean ok; + private String intervention; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/entity/RecognizerInput.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/entity/RecognizerInput.java new file mode 100644 index 00000000..f4216adf --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/entity/RecognizerInput.java @@ -0,0 +1,21 @@ +package work.slhaf.partner.module.modules.action.identifier.recognizer.entity; + +import lombok.Data; +import work.slhaf.partner.api.chat.pojo.Message; +import work.slhaf.partner.core.action.ActionCore; + +import java.util.List; + +@Data +public class RecognizerInput { + private String input; + private List recentMessages; + /** + * 当前用户对应的近两日对话缓存 + */ + private String userDialogMapStr; + /** + * 正在执行的行动-Phaser记录列表,在Recognizer中结合本次输入并发评估(考虑到不同行动链之间对LLM的影响) + */ + private List executingActions; +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/entity/RecognizerResult.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/entity/RecognizerResult.java new file mode 100644 index 00000000..384d0ed0 --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/entity/RecognizerResult.java @@ -0,0 +1,21 @@ +package work.slhaf.partner.module.modules.action.identifier.recognizer.entity; + +import lombok.Data; +import work.slhaf.partner.core.action.ActionCore; + +import java.util.HashMap; +import java.util.Map; + +@Data +public class RecognizerResult { + + private boolean ok; + + /** + * key: 干预倾向 + *
+ * value: 干预倾向将作用的 phaser 记录 + */ + private Map interventions = new HashMap<>(); + +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/confirmer/ActionConfirmer.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/confirmer/ActionConfirmer.java index 4dbb5a2b..30df6471 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/confirmer/ActionConfirmer.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/confirmer/ActionConfirmer.java @@ -10,6 +10,7 @@ import work.slhaf.partner.module.modules.action.planner.confirmer.entity.Confirm public class ActionConfirmer extends AgentRunningSubModule implements ActivateModel { @Override public ConfirmerResult execute(ConfirmerInput data) { + //TODO 完善确认逻辑 return null; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/memory/updater/MemoryUpdater.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/memory/updater/MemoryUpdater.java index 4b5d1eef..616c1bf8 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/memory/updater/MemoryUpdater.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/memory/updater/MemoryUpdater.java @@ -119,6 +119,11 @@ public class MemoryUpdater extends PostRunningModule { }); } + @Override + protected boolean relyOnMessage() { + return true; + } + private void updateMemory() { log.debug("[MemoryUpdater] 记忆更新流程开始..."); tempMessage = new ArrayList<>(cognationCapability.getChatMessages()); diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/perceive/updater/PerceiveUpdater.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/perceive/updater/PerceiveUpdater.java index 206d6798..649c71d9 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/perceive/updater/PerceiveUpdater.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/perceive/updater/PerceiveUpdater.java @@ -70,6 +70,11 @@ public class PerceiveUpdater extends PostRunningModule { }); } + @Override + protected boolean relyOnMessage() { + return true; + } + private void runRelationExtractorAction(PartnerRunningFlowContext context, ReentrantLock userLock, User user) { RelationExtractResult relationExtractResult = relationExtractor.execute(context); userLock.lock(); diff --git a/Partner-Main/src/test/java/NetTest.java b/Partner-Main/src/test/java/NetTest.java new file mode 100644 index 00000000..0fbb87ea --- /dev/null +++ b/Partner-Main/src/test/java/NetTest.java @@ -0,0 +1,15 @@ +import cn.hutool.http.HttpRequest; +import cn.hutool.http.HttpResponse; +import org.junit.jupiter.api.Test; + +public class NetTest { + @Test + void httpTest() { + HttpRequest request = HttpRequest.get("slhaf.work"); + request.setConnectionTimeout(2); + request.setReadTimeout(2); + HttpResponse execute = request.execute(); + System.out.println(execute.toString()); + execute.close(); + } +} From c3ca4145b85372084b67f1dfa0c05b7522ee1709 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Thu, 6 Nov 2025 22:07:27 +0800 Subject: [PATCH 008/182] =?UTF-8?q?=E6=8E=A8=E8=BF=9B=E8=A1=8C=E5=8A=A8?= =?UTF-8?q?=E5=B9=B2=E9=A2=84=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 完善了大致的执行流程 - 明确并创建了评估与处理所需的数据类及干预类型 - 不同情况的Prompt处理结果、评估和处理的具体流程需要进一步完善 --- .../action/identifier/ActionInterventor.java | 86 +++++++++++++++++-- .../evaluator/entity/EvaluatorInput.java | 3 +- .../evaluator/entity/EvaluatorResult.java | 32 ++++++- .../handler/InterventionHandler.java | 16 ++++ .../handler/entity/HandlerInput.java | 21 +++++ .../handler/entity/InterventionType.java | 5 ++ 6 files changed, 152 insertions(+), 11 deletions(-) create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/handler/InterventionHandler.java create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/handler/entity/HandlerInput.java create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/handler/entity/InterventionType.java diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/ActionInterventor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/ActionInterventor.java index 504444cb..9ae31494 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/ActionInterventor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/ActionInterventor.java @@ -5,16 +5,27 @@ import work.slhaf.partner.api.agent.factory.module.annotation.AgentModule; import work.slhaf.partner.api.agent.factory.module.annotation.InjectModule; import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.ActivateModel; import work.slhaf.partner.core.action.ActionCapability; +import work.slhaf.partner.core.action.ActionCore.PhaserRecord; import work.slhaf.partner.core.cognation.CognationCapability; import work.slhaf.partner.core.memory.MemoryCapability; import work.slhaf.partner.module.common.module.PreRunningModule; import work.slhaf.partner.module.modules.action.identifier.evaluator.InterventionEvaluator; +import work.slhaf.partner.module.modules.action.identifier.evaluator.entity.EvaluatorInput; +import work.slhaf.partner.module.modules.action.identifier.evaluator.entity.EvaluatorResult; +import work.slhaf.partner.module.modules.action.identifier.evaluator.entity.EvaluatorResult.EvaluatedInterventionData; +import work.slhaf.partner.module.modules.action.identifier.handler.InterventionHandler; +import work.slhaf.partner.module.modules.action.identifier.handler.entity.HandlerInput; +import work.slhaf.partner.module.modules.action.identifier.handler.entity.HandlerInput.HandlerInputData; import work.slhaf.partner.module.modules.action.identifier.recognizer.InterventionRecognizer; import work.slhaf.partner.module.modules.action.identifier.recognizer.entity.RecognizerInput; import work.slhaf.partner.module.modules.action.identifier.recognizer.entity.RecognizerResult; import work.slhaf.partner.runtime.interaction.data.context.PartnerRunningFlowContext; import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + /** * 负责识别潜在的行动干预信息,作用于正在进行或已存在的行动池中内容 @@ -26,6 +37,8 @@ public class ActionInterventor extends PreRunningModule implements ActivateModel private InterventionRecognizer interventionRecognizer; @InjectModule private InterventionEvaluator interventionEvaluator; + @InjectModule + private InterventionHandler InterventionHandler; @InjectCapability private ActionCapability actionCapability; @@ -34,24 +47,80 @@ public class ActionInterventor extends PreRunningModule implements ActivateModel @InjectCapability private MemoryCapability memoryCapability; + /** + * 键: 本次调用uuid; + * 值:本次调用对应的prompt; + */ + private Map> interventionPrompt = new HashMap<>(); @Override protected void doExecute(PartnerRunningFlowContext context) { - //综合当前正在进行的行动链信息、用户交互历史、激活的记忆切片,尝试识别出是否存在行动干预意图 - //首先通过recognizer进行快速意图识别,识别成功则步入评估阶段,评估成功则直接作用于目标行动链 - //进行快速意图识别时必须结合近期对话与进行中行动链情况 - RecognizerResult recognizerResult = interventionRecognizer.execute(buildRecognizerInput(context.getUserId(), context.getInput())); + // 综合当前正在进行的行动链信息、用户交互历史、激活的记忆切片,尝试识别出是否存在行动干预意图 + // 首先通过recognizer进行快速意图识别,识别成功则步入评估阶段,评估成功则直接作用于目标行动链 + // 进行快速意图识别时必须结合近期对话与进行中行动链情况 + String uuid = context.getUuid(); + String userId = context.getUserId(); + RecognizerResult recognizerResult = interventionRecognizer + .execute(buildRecognizerInput(userId, context.getInput())); if (!recognizerResult.isOk()) { + // 设置相应prompt + setupNoInterventionPrompt(uuid); return; } - //存在则进一步评估、评估通过则并直接添加行动程序至对应行动链 + // 存在则进一步评估、评估通过则并直接添加行动程序至对应行动链 + Map recognizedInterventions = recognizerResult.getInterventions(); + EvaluatorResult evaluatorResult = interventionEvaluator + .execute(buildEvaluatorInput(recognizedInterventions.keySet(), userId)); + List interventions = evaluatorResult.getDataList(); + if (evaluatorResult.isOk()) { + // 同步写入prompt,异步处理干预行为 + setupInterventionPrompt(uuid, interventions); + InterventionHandler.execute(buildHandlerInput(interventions)); + } else { + // 同步写入prompt + setupInterventionIgnoredPrompt(uuid, interventions); + } + } + + private HandlerInput buildHandlerInput(List interventions) { + HandlerInput input = new HandlerInput(); + List inputDataList = input.getData(); + for(EvaluatedInterventionData interventionData: interventions){ + HandlerInputData inputData = new HandlerInputData(); + inputData.setTendency(interventionData.getTendency()); + inputData.setDescription(interventionData.getDescription()); + inputData.setType(interventionData.getType()); + inputData.setActions(interventionData.getActions()); + inputDataList.add(inputData); + } + return input; + } + + private void setupInterventionIgnoredPrompt(String uuid, List dataList) { + + } + + private void setupInterventionPrompt(String uuid, List dataList) { + + } + + private void setupNoInterventionPrompt(String uuid) { + + } + + private EvaluatorInput buildEvaluatorInput(Set interventionTendencies, String userId) { + EvaluatorInput input = new EvaluatorInput(); + input.setInterventionTendencies(interventionTendencies); + input.setRecentMessages(cognationCapability.getChatMessages()); + input.setActivatedSlices(memoryCapability.getActivatedSlices(userId)); + return input; } private RecognizerInput buildRecognizerInput(String userId, String input) { RecognizerInput recognizerInput = new RecognizerInput(); recognizerInput.setInput(input); recognizerInput.setUserDialogMapStr(memoryCapability.getUserDialogMapStr(userId)); - // TODO 参考的对话列表大小或需调整 + // 参考的对话列表大小或需调整 recognizerInput.setRecentMessages(cognationCapability.getChatMessages()); recognizerInput.setExecutingActions(actionCapability.listPhaserRecords()); return recognizerInput; @@ -64,13 +133,12 @@ public class ActionInterventor extends PreRunningModule implements ActivateModel @Override public boolean withBasicPrompt() { - return true; + return false; } @Override protected HashMap getPromptDataMap(PartnerRunningFlowContext context) { - - return null; + return interventionPrompt.get(context.getUuid()); } @Override diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/evaluator/entity/EvaluatorInput.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/evaluator/entity/EvaluatorInput.java index 9a80793d..aa5e1c0d 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/evaluator/entity/EvaluatorInput.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/evaluator/entity/EvaluatorInput.java @@ -5,10 +5,11 @@ import work.slhaf.partner.api.chat.pojo.Message; import work.slhaf.partner.core.memory.pojo.EvaluatedSlice; import java.util.List; +import java.util.Set; @Data public class EvaluatorInput { - private String interventionTendency; + private Set interventionTendencies; private List activatedSlices; private List recentMessages; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/evaluator/entity/EvaluatorResult.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/evaluator/entity/EvaluatorResult.java index 37723a9b..0b2e6468 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/evaluator/entity/EvaluatorResult.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/evaluator/entity/EvaluatorResult.java @@ -1,7 +1,37 @@ package work.slhaf.partner.module.modules.action.identifier.evaluator.entity; -import lombok.Data; +import java.util.LinkedHashMap; +import java.util.List; +import lombok.Data; +import work.slhaf.partner.module.modules.action.identifier.handler.entity.InterventionType; + +/** + * 干预倾向评估结果,包含评估通过的倾向文本、对行动链的行为、指定操作的行动单元key、未通过的原因 + */ @Data public class EvaluatorResult { + /** + * 是否存在通过的干预倾向 + */ + private boolean ok; + private List dataList; + + @Data + public static class EvaluatedInterventionData { + /** + * 是否通过 + */ + private boolean ok; + private String tendency; + /** + * 描述信息(包括通过、失败原因) + */ + private String description; + private InterventionType type; + /** + * 键为执行顺序,值为行动单元对应的key + */ + private LinkedHashMap actions; + } } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/handler/InterventionHandler.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/handler/InterventionHandler.java new file mode 100644 index 00000000..76331573 --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/handler/InterventionHandler.java @@ -0,0 +1,16 @@ +package work.slhaf.partner.module.modules.action.identifier.handler; + +import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule; +import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.AgentRunningSubModule; +import work.slhaf.partner.module.modules.action.identifier.handler.entity.HandlerInput; + +@AgentSubModule +public class InterventionHandler extends AgentRunningSubModule { + + @Override + public Void execute(HandlerInput data) { + + return null; + } + +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/handler/entity/HandlerInput.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/handler/entity/HandlerInput.java new file mode 100644 index 00000000..d78b8a60 --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/handler/entity/HandlerInput.java @@ -0,0 +1,21 @@ +package work.slhaf.partner.module.modules.action.identifier.handler.entity; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; + +import lombok.Data; + +@Data +public class HandlerInput { + + private List data = new ArrayList<>(); + + @Data + public static class HandlerInputData{ + private String tendency; + private String description; + private InterventionType type; + private LinkedHashMap actions; + } +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/handler/entity/InterventionType.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/handler/entity/InterventionType.java new file mode 100644 index 00000000..821249b5 --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/handler/entity/InterventionType.java @@ -0,0 +1,5 @@ +package work.slhaf.partner.module.modules.action.identifier.handler.entity; + +public enum InterventionType { + APPEND, INSERT, REBUILD, DELETE +} From a1520f117bea6d95efa04b9661f101c7ba30db4b Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 10 Nov 2025 23:02:48 +0800 Subject: [PATCH 009/182] =?UTF-8?q?=E6=8E=A8=E8=BF=9B=E8=A1=8C=E5=8A=A8?= =?UTF-8?q?=E5=B9=B2=E9=A2=84=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 完善了 ActionInterventor 中的具体逻辑以及不同情况下的prompt填充内容; - 调整了 PreRunningModule 中的 getPromptDataMap 方法; - 在 ActionCapability 中新增了检查 actionKey 是否存在的逻辑 --- .../partner/core/action/ActionCapability.java | 4 + .../slhaf/partner/core/action/ActionCore.java | 14 ++++ .../common/entity/AppendPromptData.java | 4 +- .../common/module/PreRunningModule.java | 6 +- .../action/identifier/ActionInterventor.java | 84 ++++++++++++++++--- .../modules/action/planner/ActionPlanner.java | 10 +-- .../memory/selector/MemorySelector.java | 9 +- .../perceive/selector/PerceiveSelector.java | 3 +- .../modules/process/PreprocessExecutor.java | 3 +- 9 files changed, 106 insertions(+), 31 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java index 90aa7d7e..41f97514 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java @@ -4,6 +4,7 @@ import lombok.NonNull; import work.slhaf.partner.api.agent.factory.capability.annotation.Capability; import work.slhaf.partner.core.action.entity.ActionData; import work.slhaf.partner.core.action.entity.MetaAction; +import work.slhaf.partner.core.action.entity.MetaActionInfo; import work.slhaf.partner.core.action.entity.cache.CacheAdjustData; import java.util.List; @@ -41,4 +42,7 @@ public interface ActionCapability { MetaAction loadMetaAction(@NonNull String actionKey); + MetaActionInfo loadMetaActionInfo(@NonNull String actionKey); + + boolean checkExists(String... actionKeys); } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java index 9bcedec0..91906b8f 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java @@ -227,6 +227,20 @@ public class ActionCore extends PartnerCore { return phaserRecords; } + @CapabilityMethod + public MetaActionInfo loadMetaActionInfo(@NonNull String actionKey) { + MetaActionInfo info = existedMetaActions.get(actionKey); + if (info == null) { + throw new MetaActionNotFoundException("未找到对应的行动程序描述信息: " + actionKey); + } + return info; + } + + @CapabilityMethod + public boolean checkExists(String... actionKeys) { + return existedMetaActions.keySet().containsAll(Arrays.asList(actionKeys)); + } + /** * 命中缓存且评估通过时 * diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/common/entity/AppendPromptData.java b/Partner-Main/src/main/java/work/slhaf/partner/module/common/entity/AppendPromptData.java index 050158c0..8abd56b0 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/common/entity/AppendPromptData.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/common/entity/AppendPromptData.java @@ -5,7 +5,7 @@ import lombok.EqualsAndHashCode; import work.slhaf.partner.api.common.entity.PersistableObject; import java.io.Serial; -import java.util.HashMap; +import java.util.Map; @EqualsAndHashCode(callSuper = true) @Data @@ -15,5 +15,5 @@ public class AppendPromptData extends PersistableObject { private static final long serialVersionUID = 1L; private String moduleName; - private HashMap appendedPrompt; + private Map appendedPrompt; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/common/module/PreRunningModule.java b/Partner-Main/src/main/java/work/slhaf/partner/module/common/module/PreRunningModule.java index 2fcfceba..2c591c96 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/common/module/PreRunningModule.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/common/module/PreRunningModule.java @@ -5,7 +5,7 @@ import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.AgentRunn import work.slhaf.partner.module.common.entity.AppendPromptData; import work.slhaf.partner.runtime.interaction.data.context.PartnerRunningFlowContext; -import java.util.HashMap; +import java.util.Map; /** * 前置模块抽象类 @@ -15,7 +15,7 @@ public abstract class PreRunningModule extends AgentRunningModule map = getPromptDataMap(context); + Map map = getPromptDataMap(context); data.setAppendedPrompt(map); context.setAppendedPrompt(data); } @@ -24,7 +24,7 @@ public abstract class PreRunningModule extends AgentRunningModule getPromptDataMap(PartnerRunningFlowContext context); + protected abstract Map getPromptDataMap(PartnerRunningFlowContext context); /** * 用于在CoreModule接收到的模块Prompt中标识模块名称 diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/ActionInterventor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/ActionInterventor.java index 9ae31494..557b1a90 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/ActionInterventor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/ActionInterventor.java @@ -1,5 +1,6 @@ package work.slhaf.partner.module.modules.action.identifier; +import com.alibaba.fastjson2.JSONObject; import work.slhaf.partner.api.agent.factory.capability.annotation.InjectCapability; import work.slhaf.partner.api.agent.factory.module.annotation.AgentModule; import work.slhaf.partner.api.agent.factory.module.annotation.InjectModule; @@ -21,10 +22,8 @@ import work.slhaf.partner.module.modules.action.identifier.recognizer.entity.Rec import work.slhaf.partner.module.modules.action.identifier.recognizer.entity.RecognizerResult; import work.slhaf.partner.runtime.interaction.data.context.PartnerRunningFlowContext; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; +import java.util.stream.Collectors; /** @@ -38,7 +37,7 @@ public class ActionInterventor extends PreRunningModule implements ActivateModel @InjectModule private InterventionEvaluator interventionEvaluator; @InjectModule - private InterventionHandler InterventionHandler; + private InterventionHandler interventionHandler; @InjectCapability private ActionCapability actionCapability; @@ -51,7 +50,7 @@ public class ActionInterventor extends PreRunningModule implements ActivateModel * 键: 本次调用uuid; * 值:本次调用对应的prompt; */ - private Map> interventionPrompt = new HashMap<>(); + private final Map> interventionPrompt = new HashMap<>(); @Override protected void doExecute(PartnerRunningFlowContext context) { @@ -72,20 +71,39 @@ public class ActionInterventor extends PreRunningModule implements ActivateModel EvaluatorResult evaluatorResult = interventionEvaluator .execute(buildEvaluatorInput(recognizedInterventions.keySet(), userId)); List interventions = evaluatorResult.getDataList(); - if (evaluatorResult.isOk()) { + if (evaluatorResult.isOk() && isActionKeysExist(interventions)) { + setupErrorInterventionPrompt(uuid); + } else if (evaluatorResult.isOk()) { // 同步写入prompt,异步处理干预行为 setupInterventionPrompt(uuid, interventions); - InterventionHandler.execute(buildHandlerInput(interventions)); + interventionHandler.execute(buildHandlerInput(interventions)); } else { // 同步写入prompt setupInterventionIgnoredPrompt(uuid, interventions); } } + private void setupErrorInterventionPrompt(String uuid) { + interventionPrompt.put(uuid, Map.of( + "[识别状态] <是否识别到干预已存在行动的意图>", "识别出,但出现了不存在的行动单元key", + "[干预行动] <将对已存在行动做出的行为>", "无行为" + )); + } + + private boolean isActionKeysExist(List interventions) { + for (EvaluatedInterventionData intervention : interventions) { + String[] array = intervention.getActions().values().toArray(new String[0]); + if (!actionCapability.checkExists(array)) { + return false; + } + } + return true; + } + private HandlerInput buildHandlerInput(List interventions) { HandlerInput input = new HandlerInput(); List inputDataList = input.getData(); - for(EvaluatedInterventionData interventionData: interventions){ + for (EvaluatedInterventionData interventionData : interventions) { HandlerInputData inputData = new HandlerInputData(); inputData.setTendency(interventionData.getTendency()); inputData.setDescription(interventionData.getDescription()); @@ -97,15 +115,55 @@ public class ActionInterventor extends PreRunningModule implements ActivateModel } private void setupInterventionIgnoredPrompt(String uuid, List dataList) { - + String s = dataList.stream() + .map(data -> JSONObject.of( + "[干预倾向]", data.getTendency(), + "[未采用原因]", data.getDescription()).toString()) + .collect(Collectors.joining(",", "[", "]")); + interventionPrompt.put(uuid, Map.of( + "[识别状态] <是否识别到干预已存在行动的意图>", "识别到,但都未采用", + "[忽略原因] <各个意图被忽略的原因>", s, + "[干预行动] <将对已存在行动做出的行为>", "无行为" + )); } private void setupInterventionPrompt(String uuid, List dataList) { + List> contents = new ArrayList<>(); + List actions = new ArrayList<>(); + for (EvaluatedInterventionData data : dataList) { + if (!data.isOk()) { + continue; + } + String tendency = data.getTendency(); + contents.add(Map.of( + "[干预倾向]", tendency, + "[干预类型]", data.getType().toString(), + "[行动链变动情况]", getActionChainStr(data.getActions()) + )); + actions.add(tendency); + } + + interventionPrompt.put(uuid, Map.of( + "[识别状态] <是否识别到干预已存在行动的意图>", "识别到,将采用", + "[具体内容] <各个干预意图对应的具体信息>", contents.toString(), + "[干预行动] <将对已存在行动做出的行为>", actions.toString() + )); + } + + private String getActionChainStr(LinkedHashMap actions) { + ArrayList list = new ArrayList<>(); + //虽说actionCapability那边做了异常抛出,但说实话很明显放在这里不好处理啊🤔,还是在前边统一检查一下吧 + actions.forEach((order, actionKey) -> { + list.add(order + ":" + actionCapability.loadMetaActionInfo(actionKey).getDescription()); + }); + return list.toString(); } private void setupNoInterventionPrompt(String uuid) { - + interventionPrompt.put(uuid, Map.of( + "[识别状态] <是否识别到干预已存在行动的意图>", "未识别到干预意图", + "[干预行动] <将对已存在行动做出的行为>", "无行动")); } private EvaluatorInput buildEvaluatorInput(Set interventionTendencies, String userId) { @@ -137,8 +195,8 @@ public class ActionInterventor extends PreRunningModule implements ActivateModel } @Override - protected HashMap getPromptDataMap(PartnerRunningFlowContext context) { - return interventionPrompt.get(context.getUuid()); + protected Map getPromptDataMap(PartnerRunningFlowContext context) { + return interventionPrompt.remove(context.getUuid()); } @Override diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java index dea85a98..2a230e5b 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java @@ -159,7 +159,7 @@ public class ActionPlanner extends PreRunningModule { @Override - protected HashMap getPromptDataMap(PartnerRunningFlowContext context) { + protected Map getPromptDataMap(PartnerRunningFlowContext context) { HashMap map = new HashMap<>(); String userId = context.getUserId(); setupPendingActions(map, userId); @@ -170,22 +170,22 @@ public class ActionPlanner extends PreRunningModule { private void setupPendingActions(HashMap map, String userId) { List actionData = actionCapability.listPendingAction(userId); if (actionData == null || actionData.isEmpty()) { - map.put("[待确认行动] <待确认行动信息>", "无待确认行动"); + map.put("[待确认行动] <等待用户确认的行动信息>", "无待确认行动"); return; } for (int i = 0; i < actionData.size(); i++) { - map.put("[待确认行动 " + (i + 1) + " ]", generateActionStr(actionData.get(i))); + map.put("[待确认行动 " + (i + 1) + " ] <等待用户确认的行动信息>", generateActionStr(actionData.get(i))); } } private void setupPreparedActions(HashMap map, String userId) { List actionData = actionCapability.listPreparedAction(userId); if (actionData == null || actionData.isEmpty()) { - map.put("[预备行动] <预备行动信息>", "无预备行动"); + map.put("[预备行动] <预备执行或放入计划池的行动信息>", "无预备行动"); return; } for (int i = 0; i < actionData.size(); i++) { - map.put("[预备行动 " + (i + 1) + " ]", generateActionStr(actionData.get(i))); + map.put("[预备行动 " + (i + 1) + " ] <预备执行或放入计划池的行动信息>", generateActionStr(actionData.get(i))); } } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/memory/selector/MemorySelector.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/memory/selector/MemorySelector.java index d35bec48..954125ff 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/memory/selector/MemorySelector.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/memory/selector/MemorySelector.java @@ -23,10 +23,7 @@ import work.slhaf.partner.module.modules.memory.selector.extractor.entity.Extrac import work.slhaf.partner.runtime.interaction.data.context.PartnerRunningFlowContext; import java.time.LocalDate; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; +import java.util.*; @EqualsAndHashCode(callSuper = true) @Data @@ -133,7 +130,7 @@ public class MemorySelector extends PreRunningModule { } @Override - protected HashMap getPromptDataMap(PartnerRunningFlowContext context) { + protected Map getPromptDataMap(PartnerRunningFlowContext context) { HashMap map = new HashMap<>(); String userId = context.getUserId(); String dialogMapStr = memoryCapability.getDialogMapStr(); @@ -148,7 +145,7 @@ public class MemorySelector extends PreRunningModule { String sliceStr = memoryCapability.getActivatedSlicesStr(userId); if (sliceStr != null && !sliceStr.isEmpty()) { - map.put("[记忆切片] <你与最新一条消息的发送者的相关回忆, 不会与[记忆缓存]重复, 如果有重复你也可以指出来()>", sliceStr); + map.put("[记忆切片] <你与最新一条消息的发送者的相关回忆, 不会与[记忆缓存]重复, 如果有重复你也可以指出来>", sliceStr); } return map; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/perceive/selector/PerceiveSelector.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/perceive/selector/PerceiveSelector.java index e387e098..d3f12d8e 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/perceive/selector/PerceiveSelector.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/perceive/selector/PerceiveSelector.java @@ -10,6 +10,7 @@ import work.slhaf.partner.module.common.module.PreRunningModule; import work.slhaf.partner.runtime.interaction.data.context.PartnerRunningFlowContext; import java.util.HashMap; +import java.util.Map; @Slf4j @Setter @@ -24,7 +25,7 @@ public class PerceiveSelector extends PreRunningModule { } @Override - protected HashMap getPromptDataMap(PartnerRunningFlowContext context) { + protected Map getPromptDataMap(PartnerRunningFlowContext context) { HashMap map = new HashMap<>(); User user = perceiveCapability.getUser(context.getUserId()); map.put("[关系] <你与最新聊天用户的关系>", user.getRelation()); diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/process/PreprocessExecutor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/process/PreprocessExecutor.java index de7ff1b6..ab4de789 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/process/PreprocessExecutor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/process/PreprocessExecutor.java @@ -15,6 +15,7 @@ import work.slhaf.partner.runtime.interaction.data.context.subcontext.CoreContex import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.HashMap; +import java.util.Map; @EqualsAndHashCode(callSuper = true) @Data @@ -58,7 +59,7 @@ public class PreprocessExecutor extends PreRunningModule { @Override - protected HashMap getPromptDataMap(PartnerRunningFlowContext context) { + protected Map getPromptDataMap(PartnerRunningFlowContext context) { HashMap map = new HashMap<>(); map.put("text", "这部分才是真正的用户输入内容, 就像你之前收到过的输入一样。但...不会是'同一个人'。"); map.put("datetime", "本次用户输入对应的当前时间"); From 264cdb09e51fb3eb08e50804a03d4ea534f41873 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Tue, 11 Nov 2025 16:11:09 +0800 Subject: [PATCH 010/182] =?UTF-8?q?=E6=8E=A8=E8=BF=9B=E8=A1=8C=E5=8A=A8?= =?UTF-8?q?=E5=B9=B2=E9=A2=84=E6=A8=A1=E5=9D=97;=20=E6=8E=A5=E4=B8=8B?= =?UTF-8?q?=E6=9D=A5=E5=B0=86=E8=BF=9B=E4=B8=80=E6=AD=A5=E5=AE=8C=E5=96=84?= =?UTF-8?q?=20InterventionHandler=20=E7=9A=84=E5=85=B7=E4=BD=93=E5=86=85?= =?UTF-8?q?=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 调整相关目录为 interventor - 调整了某些 ActionInterventor 的子模块用到的数据类结构 - 完善了 InterventionEvaluator 的具体逻辑 - 为 InterventionType 添加了注释,并新增了 CANCEL 干预类型 --- .../evaluator/InterventionEvaluator.java | 28 ------ .../handler/InterventionHandler.java | 16 ---- .../handler/entity/InterventionType.java | 5 - .../ActionInterventor.java | 41 +++++---- .../evaluator/InterventionEvaluator.java | 92 +++++++++++++++++++ .../evaluator/entity/EvaluatorInput.java | 7 +- .../evaluator/entity/EvaluatorResult.java | 7 +- .../handler/InterventionHandler.java | 36 ++++++++ .../handler/entity/HandlerInput.java | 4 +- .../handler/entity/InterventionType.java | 28 ++++++ .../recognizer/InterventionRecognizer.java | 8 +- .../entity/MetaRecognizerResult.java | 2 +- .../recognizer/entity/RecognizerInput.java | 2 +- .../recognizer/entity/RecognizerResult.java | 2 +- 14 files changed, 195 insertions(+), 83 deletions(-) delete mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/evaluator/InterventionEvaluator.java delete mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/handler/InterventionHandler.java delete mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/handler/entity/InterventionType.java rename Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/{identifier => interventor}/ActionInterventor.java (81%) create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/InterventionEvaluator.java rename Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/{identifier => interventor}/evaluator/entity/EvaluatorInput.java (55%) rename Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/{identifier => interventor}/evaluator/entity/EvaluatorResult.java (74%) create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/InterventionHandler.java rename Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/{identifier => interventor}/handler/entity/HandlerInput.java (70%) create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/entity/InterventionType.java rename Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/{identifier => interventor}/recognizer/InterventionRecognizer.java (90%) rename Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/{identifier => interventor}/recognizer/entity/MetaRecognizerResult.java (60%) rename Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/{identifier => interventor}/recognizer/entity/RecognizerInput.java (87%) rename Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/{identifier => interventor}/recognizer/entity/RecognizerResult.java (82%) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/evaluator/InterventionEvaluator.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/evaluator/InterventionEvaluator.java deleted file mode 100644 index abae5166..00000000 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/evaluator/InterventionEvaluator.java +++ /dev/null @@ -1,28 +0,0 @@ -package work.slhaf.partner.module.modules.action.identifier.evaluator; - -import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule; -import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.ActivateModel; -import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.AgentRunningSubModule; -import work.slhaf.partner.module.modules.action.identifier.evaluator.entity.EvaluatorInput; -import work.slhaf.partner.module.modules.action.identifier.evaluator.entity.EvaluatorResult; - -@AgentSubModule -public class InterventionEvaluator extends AgentRunningSubModule implements ActivateModel { - - @Override - public EvaluatorResult execute(EvaluatorInput data) { - //基于干预意图、记忆切片、交互上下文、已有行动程序综合评估,尝试选取出合适的行动程序,对目标行动链做出调整 - - return null; - } - - @Override - public String modelKey() { - return "intervention_evaluator"; - } - - @Override - public boolean withBasicPrompt() { - return true; - } -} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/handler/InterventionHandler.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/handler/InterventionHandler.java deleted file mode 100644 index 76331573..00000000 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/handler/InterventionHandler.java +++ /dev/null @@ -1,16 +0,0 @@ -package work.slhaf.partner.module.modules.action.identifier.handler; - -import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule; -import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.AgentRunningSubModule; -import work.slhaf.partner.module.modules.action.identifier.handler.entity.HandlerInput; - -@AgentSubModule -public class InterventionHandler extends AgentRunningSubModule { - - @Override - public Void execute(HandlerInput data) { - - return null; - } - -} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/handler/entity/InterventionType.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/handler/entity/InterventionType.java deleted file mode 100644 index 821249b5..00000000 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/handler/entity/InterventionType.java +++ /dev/null @@ -1,5 +0,0 @@ -package work.slhaf.partner.module.modules.action.identifier.handler.entity; - -public enum InterventionType { - APPEND, INSERT, REBUILD, DELETE -} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/ActionInterventor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/ActionInterventor.java similarity index 81% rename from Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/ActionInterventor.java rename to Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/ActionInterventor.java index 557b1a90..9721e8f8 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/ActionInterventor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/ActionInterventor.java @@ -1,4 +1,4 @@ -package work.slhaf.partner.module.modules.action.identifier; +package work.slhaf.partner.module.modules.action.interventor; import com.alibaba.fastjson2.JSONObject; import work.slhaf.partner.api.agent.factory.capability.annotation.InjectCapability; @@ -10,16 +10,16 @@ import work.slhaf.partner.core.action.ActionCore.PhaserRecord; import work.slhaf.partner.core.cognation.CognationCapability; import work.slhaf.partner.core.memory.MemoryCapability; import work.slhaf.partner.module.common.module.PreRunningModule; -import work.slhaf.partner.module.modules.action.identifier.evaluator.InterventionEvaluator; -import work.slhaf.partner.module.modules.action.identifier.evaluator.entity.EvaluatorInput; -import work.slhaf.partner.module.modules.action.identifier.evaluator.entity.EvaluatorResult; -import work.slhaf.partner.module.modules.action.identifier.evaluator.entity.EvaluatorResult.EvaluatedInterventionData; -import work.slhaf.partner.module.modules.action.identifier.handler.InterventionHandler; -import work.slhaf.partner.module.modules.action.identifier.handler.entity.HandlerInput; -import work.slhaf.partner.module.modules.action.identifier.handler.entity.HandlerInput.HandlerInputData; -import work.slhaf.partner.module.modules.action.identifier.recognizer.InterventionRecognizer; -import work.slhaf.partner.module.modules.action.identifier.recognizer.entity.RecognizerInput; -import work.slhaf.partner.module.modules.action.identifier.recognizer.entity.RecognizerResult; +import work.slhaf.partner.module.modules.action.interventor.evaluator.InterventionEvaluator; +import work.slhaf.partner.module.modules.action.interventor.evaluator.entity.EvaluatorInput; +import work.slhaf.partner.module.modules.action.interventor.evaluator.entity.EvaluatorResult; +import work.slhaf.partner.module.modules.action.interventor.evaluator.entity.EvaluatorResult.EvaluatedInterventionData; +import work.slhaf.partner.module.modules.action.interventor.handler.InterventionHandler; +import work.slhaf.partner.module.modules.action.interventor.handler.entity.HandlerInput; +import work.slhaf.partner.module.modules.action.interventor.handler.entity.HandlerInput.HandlerInputData; +import work.slhaf.partner.module.modules.action.interventor.recognizer.InterventionRecognizer; +import work.slhaf.partner.module.modules.action.interventor.recognizer.entity.RecognizerInput; +import work.slhaf.partner.module.modules.action.interventor.recognizer.entity.RecognizerResult; import work.slhaf.partner.runtime.interaction.data.context.PartnerRunningFlowContext; import java.util.*; @@ -60,23 +60,23 @@ public class ActionInterventor extends PreRunningModule implements ActivateModel String uuid = context.getUuid(); String userId = context.getUserId(); RecognizerResult recognizerResult = interventionRecognizer - .execute(buildRecognizerInput(userId, context.getInput())); + .execute(buildRecognizerInput(userId, context.getInput())); //此处的输入内容携带了所有 PhaserRecord if (!recognizerResult.isOk()) { // 设置相应prompt setupNoInterventionPrompt(uuid); return; } // 存在则进一步评估、评估通过则并直接添加行动程序至对应行动链 - Map recognizedInterventions = recognizerResult.getInterventions(); + Map recognizedInterventions = recognizerResult.getInterventions(); //这里的 PhaserRecord 已包含从 ActionCore 获取到的执行状态下的行动及其Phaser实例 EvaluatorResult evaluatorResult = interventionEvaluator - .execute(buildEvaluatorInput(recognizedInterventions.keySet(), userId)); - List interventions = evaluatorResult.getDataList(); + .execute(buildEvaluatorInput(recognizedInterventions, userId)); + List interventions = evaluatorResult.getDataList(); //这里的 EvaluatedInterventionData 中的 tendency 即为 recognizedInterventions 中的键 if (evaluatorResult.isOk() && isActionKeysExist(interventions)) { setupErrorInterventionPrompt(uuid); } else if (evaluatorResult.isOk()) { - // 同步写入prompt,异步处理干预行为 + // 同步写入prompt,异步处理干预行为,‘异步’在 interventionHandler 中体现 setupInterventionPrompt(uuid, interventions); - interventionHandler.execute(buildHandlerInput(interventions)); + interventionHandler.execute(buildHandlerInput(interventions, recognizedInterventions)); } else { // 同步写入prompt setupInterventionIgnoredPrompt(uuid, interventions); @@ -100,7 +100,7 @@ public class ActionInterventor extends PreRunningModule implements ActivateModel return true; } - private HandlerInput buildHandlerInput(List interventions) { + private HandlerInput buildHandlerInput(List interventions, Map recognizedInterventions) { HandlerInput input = new HandlerInput(); List inputDataList = input.getData(); for (EvaluatedInterventionData interventionData : interventions) { @@ -109,6 +109,7 @@ public class ActionInterventor extends PreRunningModule implements ActivateModel inputData.setDescription(interventionData.getDescription()); inputData.setType(interventionData.getType()); inputData.setActions(interventionData.getActions()); + inputData.setRecord(recognizedInterventions.get(interventionData.getTendency())); inputDataList.add(inputData); } return input; @@ -166,9 +167,9 @@ public class ActionInterventor extends PreRunningModule implements ActivateModel "[干预行动] <将对已存在行动做出的行为>", "无行动")); } - private EvaluatorInput buildEvaluatorInput(Set interventionTendencies, String userId) { + private EvaluatorInput buildEvaluatorInput(Map recognizedInterventions, String userId) { EvaluatorInput input = new EvaluatorInput(); - input.setInterventionTendencies(interventionTendencies); + input.setInterventionTendencies(recognizedInterventions); input.setRecentMessages(cognationCapability.getChatMessages()); input.setActivatedSlices(memoryCapability.getActivatedSlices(userId)); return input; diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/InterventionEvaluator.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/InterventionEvaluator.java new file mode 100644 index 00000000..562ee755 --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/InterventionEvaluator.java @@ -0,0 +1,92 @@ +package work.slhaf.partner.module.modules.action.interventor.evaluator; + +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; + +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; + +import lombok.extern.slf4j.Slf4j; +import work.slhaf.partner.api.agent.factory.capability.annotation.InjectCapability; +import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule; +import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.ActivateModel; +import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.AgentRunningSubModule; +import work.slhaf.partner.api.chat.pojo.ChatResponse; +import work.slhaf.partner.api.chat.pojo.Message; +import work.slhaf.partner.core.action.ActionCapability; +import work.slhaf.partner.core.action.ActionCore.ExecutorType; +import work.slhaf.partner.core.action.ActionCore.PhaserRecord; +import work.slhaf.partner.core.memory.pojo.EvaluatedSlice; +import work.slhaf.partner.module.modules.action.interventor.evaluator.entity.EvaluatorInput; +import work.slhaf.partner.module.modules.action.interventor.evaluator.entity.EvaluatorResult; +import work.slhaf.partner.module.modules.action.interventor.evaluator.entity.EvaluatorResult.EvaluatedInterventionData; + +@Slf4j +@AgentSubModule +public class InterventionEvaluator extends AgentRunningSubModule + implements ActivateModel { + + @InjectCapability + private ActionCapability actionCapability; + + @Override + public EvaluatorResult execute(EvaluatorInput data) { + // 基于干预意图、记忆切片、交互上下文、已有行动程序综合评估,尝试评估并选取出合适的行动程序,交付给 ActionInterventor + EvaluatorResult result = new EvaluatorResult(); + List evaluatedDataList = result.getDataList(); + + Map interventionTendencies = data.getInterventionTendencies(); + Set tendencies = interventionTendencies.keySet(); + ExecutorService executor = actionCapability.getExecutor(ExecutorType.VIRTUAL); + + CountDownLatch latch = new CountDownLatch(tendencies.size()); + tendencies.forEach(tendency -> { + executor.execute(() -> { + try { + String input = buildPrompt(data.getRecentMessages(), data.getActivatedSlices(), + interventionTendencies.get(tendency), tendency); + ChatResponse response = singleChat(input); + EvaluatedInterventionData evaluatedData = JSONObject.parseObject(response.getMessage(), + EvaluatedInterventionData.class); + synchronized (evaluatedDataList) { + evaluatedDataList.add(evaluatedData); + } + } catch (Exception e) { + log.error("干预意图评估出错: " + tendency, e); + } finally { + latch.countDown(); + } + }); + }); + try { + latch.await(); + } catch (InterruptedException e) { + log.warn("CountDownLatch阻塞已中断"); + } + + return result; + } + + private String buildPrompt(List recentMessages, List activatedSlices, + PhaserRecord phaserRecord, String tendency) { + JSONObject json = new JSONObject(); + json.put("干预倾向", tendency); + json.putArray("近期对话").addAll(recentMessages); + json.putArray("参考记忆").addAll(activatedSlices); + json.put("将干预的行动", JSONObject.toJSONString(phaserRecord.actionData())); + return json.toJSONString(); + } + + @Override + public String modelKey() { + return "intervention_evaluator"; + } + + @Override + public boolean withBasicPrompt() { + return false; + } +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/evaluator/entity/EvaluatorInput.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/entity/EvaluatorInput.java similarity index 55% rename from Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/evaluator/entity/EvaluatorInput.java rename to Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/entity/EvaluatorInput.java index aa5e1c0d..af01c874 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/evaluator/entity/EvaluatorInput.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/entity/EvaluatorInput.java @@ -1,15 +1,16 @@ -package work.slhaf.partner.module.modules.action.identifier.evaluator.entity; +package work.slhaf.partner.module.modules.action.interventor.evaluator.entity; import lombok.Data; import work.slhaf.partner.api.chat.pojo.Message; +import work.slhaf.partner.core.action.ActionCore.PhaserRecord; import work.slhaf.partner.core.memory.pojo.EvaluatedSlice; import java.util.List; -import java.util.Set; +import java.util.Map; @Data public class EvaluatorInput { - private Set interventionTendencies; + private Map interventionTendencies; private List activatedSlices; private List recentMessages; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/evaluator/entity/EvaluatorResult.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/entity/EvaluatorResult.java similarity index 74% rename from Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/evaluator/entity/EvaluatorResult.java rename to Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/entity/EvaluatorResult.java index 0b2e6468..eeda3cb6 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/evaluator/entity/EvaluatorResult.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/entity/EvaluatorResult.java @@ -1,10 +1,11 @@ -package work.slhaf.partner.module.modules.action.identifier.evaluator.entity; +package work.slhaf.partner.module.modules.action.interventor.evaluator.entity; +import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import lombok.Data; -import work.slhaf.partner.module.modules.action.identifier.handler.entity.InterventionType; +import work.slhaf.partner.module.modules.action.interventor.handler.entity.InterventionType; /** * 干预倾向评估结果,包含评估通过的倾向文本、对行动链的行为、指定操作的行动单元key、未通过的原因 @@ -15,7 +16,7 @@ public class EvaluatorResult { * 是否存在通过的干预倾向 */ private boolean ok; - private List dataList; + private List dataList = new ArrayList<>(); @Data public static class EvaluatedInterventionData { diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/InterventionHandler.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/InterventionHandler.java new file mode 100644 index 00000000..ade553f0 --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/InterventionHandler.java @@ -0,0 +1,36 @@ +package work.slhaf.partner.module.modules.action.interventor.handler; + +import java.util.List; +import java.util.concurrent.ExecutorService; + +import lombok.extern.slf4j.Slf4j; +import work.slhaf.partner.api.agent.factory.capability.annotation.InjectCapability; +import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule; +import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.AgentRunningSubModule; +import work.slhaf.partner.core.action.ActionCapability; +import work.slhaf.partner.core.action.ActionCore.ExecutorType; +import work.slhaf.partner.module.modules.action.interventor.handler.entity.HandlerInput; +import work.slhaf.partner.module.modules.action.interventor.handler.entity.HandlerInput.HandlerInputData; + +@Slf4j +@AgentSubModule +public class InterventionHandler extends AgentRunningSubModule { + + @InjectCapability + private ActionCapability actionCapability; + + @Override + public Void execute(HandlerInput data) { + ExecutorService executor = actionCapability.getExecutor(ExecutorType.VIRTUAL); + executor.execute(() -> { + log.debug("干预开始执行"); + List dataList = data.getData(); + for (HandlerInputData inputData : dataList) { + log.debug("干预操作: {}, 干预类型: {}",inputData.getTendency(),inputData.getType()); + + } + }); + return null; + } + +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/handler/entity/HandlerInput.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/entity/HandlerInput.java similarity index 70% rename from Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/handler/entity/HandlerInput.java rename to Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/entity/HandlerInput.java index d78b8a60..21beb361 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/handler/entity/HandlerInput.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/entity/HandlerInput.java @@ -1,10 +1,11 @@ -package work.slhaf.partner.module.modules.action.identifier.handler.entity; +package work.slhaf.partner.module.modules.action.interventor.handler.entity; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import lombok.Data; +import work.slhaf.partner.core.action.ActionCore.PhaserRecord; @Data public class HandlerInput { @@ -17,5 +18,6 @@ public class HandlerInput { private String description; private InterventionType type; private LinkedHashMap actions; + private PhaserRecord record; } } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/entity/InterventionType.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/entity/InterventionType.java new file mode 100644 index 00000000..ba1de1cc --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/entity/InterventionType.java @@ -0,0 +1,28 @@ +package work.slhaf.partner.module.modules.action.interventor.handler.entity; + +public enum InterventionType { + /** + * 追加行动: 追加至指定行动链序列之后才执行 + */ + APPEND, + + /** + * 插入行动: 指定行动链序列执行过程中即时新增并执行 + */ + INSERT, + + /** + * 重建行动: 重建指定行动链序列之后的所有行动内容 + */ + REBUILD, + + /** + * 删除行动: 删除指定行动链序列上的指定行动单元 + */ + DELETE, + + /** + * 取消行动链: 中断并取消指定行动链的执行 + */ + CANCEL +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/InterventionRecognizer.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/InterventionRecognizer.java similarity index 90% rename from Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/InterventionRecognizer.java rename to Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/InterventionRecognizer.java index 1420ec5b..6cb694d9 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/InterventionRecognizer.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/InterventionRecognizer.java @@ -1,4 +1,4 @@ -package work.slhaf.partner.module.modules.action.identifier.recognizer; +package work.slhaf.partner.module.modules.action.interventor.recognizer; import com.alibaba.fastjson2.JSONObject; import lombok.extern.slf4j.Slf4j; @@ -10,9 +10,9 @@ import work.slhaf.partner.api.chat.pojo.ChatResponse; import work.slhaf.partner.core.action.ActionCapability; import work.slhaf.partner.core.action.ActionCore; import work.slhaf.partner.core.action.entity.ActionData; -import work.slhaf.partner.module.modules.action.identifier.recognizer.entity.MetaRecognizerResult; -import work.slhaf.partner.module.modules.action.identifier.recognizer.entity.RecognizerInput; -import work.slhaf.partner.module.modules.action.identifier.recognizer.entity.RecognizerResult; +import work.slhaf.partner.module.modules.action.interventor.recognizer.entity.MetaRecognizerResult; +import work.slhaf.partner.module.modules.action.interventor.recognizer.entity.RecognizerInput; +import work.slhaf.partner.module.modules.action.interventor.recognizer.entity.RecognizerResult; import java.util.List; import java.util.Map; diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/entity/MetaRecognizerResult.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/entity/MetaRecognizerResult.java similarity index 60% rename from Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/entity/MetaRecognizerResult.java rename to Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/entity/MetaRecognizerResult.java index d3d963dd..4c81233b 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/entity/MetaRecognizerResult.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/entity/MetaRecognizerResult.java @@ -1,4 +1,4 @@ -package work.slhaf.partner.module.modules.action.identifier.recognizer.entity; +package work.slhaf.partner.module.modules.action.interventor.recognizer.entity; import lombok.Data; diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/entity/RecognizerInput.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/entity/RecognizerInput.java similarity index 87% rename from Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/entity/RecognizerInput.java rename to Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/entity/RecognizerInput.java index f4216adf..4b7c8153 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/entity/RecognizerInput.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/entity/RecognizerInput.java @@ -1,4 +1,4 @@ -package work.slhaf.partner.module.modules.action.identifier.recognizer.entity; +package work.slhaf.partner.module.modules.action.interventor.recognizer.entity; import lombok.Data; import work.slhaf.partner.api.chat.pojo.Message; diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/entity/RecognizerResult.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/entity/RecognizerResult.java similarity index 82% rename from Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/entity/RecognizerResult.java rename to Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/entity/RecognizerResult.java index 384d0ed0..db52d39b 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/identifier/recognizer/entity/RecognizerResult.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/entity/RecognizerResult.java @@ -1,4 +1,4 @@ -package work.slhaf.partner.module.modules.action.identifier.recognizer.entity; +package work.slhaf.partner.module.modules.action.interventor.recognizer.entity; import lombok.Data; import work.slhaf.partner.core.action.ActionCore; From 14a57f0be64622452a70ede2f518c505100e89dd Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sat, 29 Nov 2025 20:56:29 +0800 Subject: [PATCH 011/182] =?UTF-8?q?=E6=8E=A8=E8=BF=9B=E8=A1=8C=E5=8A=A8?= =?UTF-8?q?=E5=B9=B2=E9=A2=84=E6=A8=A1=E5=9D=97,=E5=89=8D=E7=BD=AE?= =?UTF-8?q?=E9=83=A8=E5=88=86=E9=80=BB=E8=BE=91=E5=B7=B2=E5=9F=BA=E6=9C=AC?= =?UTF-8?q?=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在`ActionData`中添加必要注释、新增`executingStage`字段表示当前执行阶段、移除了`WAITING`的状态类型 - 调整并修正了`ActionExecutor`中的`Phaser`阻塞逻辑 - 完善了`ActionInterventor`中`识别 -> 评估 -> 异步执行`的干预逻辑,并将干预结果以 Prompt 形式回写至流程上下文,作为主模块的已知内容 - 调整了干预模块内部的各个数据类的字段结构,适配干预流程 - 完善了`InterventionEvaluator`、`InterventionHandler`、`InterventionRecognizer`等必需的干预子模块 --- .../main/java/work/slhaf/partner/Main.java | 2 +- .../slhaf/partner/core/action/ActionCore.java | 2 +- .../core/action/entity/ActionData.java | 37 ++- .../dispatcher/executor/ActionExecutor.java | 43 ++-- .../action/interventor/ActionInterventor.java | 232 ++++++++++++------ .../entity/InterventionType.java | 2 +- .../interventor/entity/MetaIntervention.java | 21 ++ .../evaluator/InterventionEvaluator.java | 87 ++++--- .../evaluator/entity/EvaluatorInput.java | 4 +- .../evaluator/entity/EvaluatorResult.java | 17 +- .../handler/InterventionHandler.java | 176 ++++++++++++- .../handler/entity/HandlerInput.java | 38 ++- .../recognizer/InterventionRecognizer.java | 69 ++++-- .../recognizer/entity/RecognizerInput.java | 2 + .../recognizer/entity/RecognizerResult.java | 11 +- .../modules/action/planner/ActionPlanner.java | 4 +- 16 files changed, 549 insertions(+), 198 deletions(-) rename Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/{handler => }/entity/InterventionType.java (87%) create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/entity/MetaIntervention.java diff --git a/Partner-Main/src/main/java/work/slhaf/partner/Main.java b/Partner-Main/src/main/java/work/slhaf/partner/Main.java index 5d5e27a0..318b385c 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/Main.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/Main.java @@ -12,7 +12,7 @@ public class Main { .setAgentConfigManager(PartnerAgentConfigManager.class) .setGateway(WebSocketGateway.class) .setAgentExceptionCallback(PartnerExceptionCallback.class) - .addAfterLaunchRunners(() -> VectorClient.load()) + .addAfterLaunchRunners(VectorClient::load) .launch(); } } \ No newline at end of file diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java index 91906b8f..c70813c4 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java @@ -33,7 +33,7 @@ public class ActionCore extends PartnerCore { /** * 持久行动池,以用户id为键存储所有状态的任务 */ - private HashMap> actionPool = new HashMap<>(); + private HashMap> actionPool = new HashMap<>();//TODO 考虑是否取消用户分池 /** * 待确认任务,以userId区分不同用户,因为需要跨请求确认 diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java index eadcf315..6ba26af9 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java @@ -1,7 +1,9 @@ package work.slhaf.partner.core.action.entity; +import cn.hutool.json.JSONObject; import lombok.Data; +import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; @@ -10,16 +12,47 @@ import java.util.List; */ @Data public abstract class ActionData { + /** + * 行动ID + */ protected String uuid; + /** + * 行动倾向 + */ protected String tendency; + + /** + * 行动状态 + */ protected ActionStatus status; - protected LinkedHashMap> actionChain; + /** + * 行动链 + */ + protected LinkedHashMap> actionChain = new LinkedHashMap<>(); + /** + * 行动阶段(当前阶段) + */ + protected int executingStage; + /** + * 行动结果 + */ protected String result; + protected List history = new ArrayList<>(); + + /** + * 行动原因 + */ protected String reason; + /** + * 行动描述 + */ protected String description; + /** + * 行动来源 + */ protected String source; public enum ActionStatus { - SUCCESS, FAILED, EXECUTING, WAITING, PREPARE + SUCCESS, FAILED, EXECUTING, PREPARE } } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java index f50dc434..a1f0f16a 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java @@ -51,50 +51,55 @@ public class ActionExecutor extends AgentRunningSubModule { - for (MetaAction metaAction : v) { - // 根据io类型放入合适的列表 - if (metaAction.isIo()) { - virtual.add(metaAction); - } else { - platform.add(metaAction); + try { + actionChain.forEach((k, v) -> { + for (MetaAction metaAction : v) { + // 根据io类型放入合适的列表 + if (metaAction.isIo()) { + virtual.add(metaAction); + } else { + platform.add(metaAction); + } } - } - runGroupAction(virtual, platform, actionChain, phaser); - virtual.clear(); - platform.clear(); - phaser.arriveAndAwaitAdvance(); - }); - actionCapability.removePhaserRecord(phaser); + runGroupAction(virtual, platform, actionChain, phaser); + phaser.arriveAndAwaitAdvance(); + virtual.clear(); + platform.clear(); + }); + } finally { + phaser.arriveAndDeregister(); + actionCapability.removePhaserRecord(phaser); + } }); } // 使用phaser来承担同组的动态任务新增 - private void runGroupAction(List virtual, List platform, LinkedHashMap> actionChain, Phaser phaser) { + private void runGroupAction(List virtual, List platform, + LinkedHashMap> actionChain, Phaser phaser) { runGroupAction(virtual, virtualExecutor, phaser); runGroupAction(platform, platformExecutor, phaser); } private void runGroupAction(List actions, ExecutorService executor, Phaser phaser) { + phaser.bulkRegister(actions.size()); for (MetaAction action : actions) { - phaser.register(); executor.execute(() -> { try { MetaAction.Result result = action.getResult(); do { // 该循环对应LLM的调整参数后重试 if (!result.isSuccess()) { - //TODO LLM决策是重构参数、执行自对话反思、还是选择向用户求助(通过cognationCore暴露方法,可能需要修改其他模块以进行适应),仅重构参数时无需结束当前循环 + // LLM决策是重构参数、执行自对话反思、还是选择向用户求助(通过cognationCore暴露方法,可能需要修改其他模块以进行适应),仅重构参数时无需结束当前循环 // 若使用Phaser作为执行线程与反思、求助等调用流程的同步协调,应当需要额外维护Phaser全局字段,获取到反思结果或者用户反馈后, // 调用对应的phaser注册任务,在ActionExecutor中动态添加任务至actionChain,同时启动异步执行 // 而且由于执行与放入的为同一个MetaAction对象,所以执行结果可被当前行动链获取,但virtual、executor两个列表似乎不行,需要重构执行模式,建议将行动链直接重构为LinkedHashMap,order为键 String input = getInput(result.getData()); - + // 执行时不可使用`for in`和`forEach`,因为在`Intervention`相关模块存在动态调整 } action.run(); } while (!result.isSuccess()); - //TODO 将执行结果写入特定对话角色记忆(cognationCore暴露方法) + // TODO 将执行结果写入特定对话角色记忆(cognationCore暴露方法) } finally { phaser.arriveAndDeregister(); } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/ActionInterventor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/ActionInterventor.java index 9721e8f8..75cd80e1 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/ActionInterventor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/ActionInterventor.java @@ -1,5 +1,6 @@ package work.slhaf.partner.module.modules.action.interventor; +import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; import work.slhaf.partner.api.agent.factory.capability.annotation.InjectCapability; import work.slhaf.partner.api.agent.factory.module.annotation.AgentModule; @@ -7,24 +8,32 @@ import work.slhaf.partner.api.agent.factory.module.annotation.InjectModule; import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.ActivateModel; import work.slhaf.partner.core.action.ActionCapability; import work.slhaf.partner.core.action.ActionCore.PhaserRecord; +import work.slhaf.partner.core.action.entity.ActionData; import work.slhaf.partner.core.cognation.CognationCapability; import work.slhaf.partner.core.memory.MemoryCapability; import work.slhaf.partner.module.common.module.PreRunningModule; +import work.slhaf.partner.module.modules.action.interventor.entity.InterventionType; +import work.slhaf.partner.module.modules.action.interventor.entity.MetaIntervention; import work.slhaf.partner.module.modules.action.interventor.evaluator.InterventionEvaluator; import work.slhaf.partner.module.modules.action.interventor.evaluator.entity.EvaluatorInput; import work.slhaf.partner.module.modules.action.interventor.evaluator.entity.EvaluatorResult; import work.slhaf.partner.module.modules.action.interventor.evaluator.entity.EvaluatorResult.EvaluatedInterventionData; import work.slhaf.partner.module.modules.action.interventor.handler.InterventionHandler; import work.slhaf.partner.module.modules.action.interventor.handler.entity.HandlerInput; -import work.slhaf.partner.module.modules.action.interventor.handler.entity.HandlerInput.HandlerInputData; +import work.slhaf.partner.module.modules.action.interventor.handler.entity.HandlerInput.ExecutingInterventionData; +import work.slhaf.partner.module.modules.action.interventor.handler.entity.HandlerInput.InterventionData; +import work.slhaf.partner.module.modules.action.interventor.handler.entity.HandlerInput.PreparedInterventionData; import work.slhaf.partner.module.modules.action.interventor.recognizer.InterventionRecognizer; import work.slhaf.partner.module.modules.action.interventor.recognizer.entity.RecognizerInput; import work.slhaf.partner.module.modules.action.interventor.recognizer.entity.RecognizerResult; import work.slhaf.partner.runtime.interaction.data.context.PartnerRunningFlowContext; -import java.util.*; -import java.util.stream.Collectors; - +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Supplier; +import java.util.stream.Stream; /** * 负责识别潜在的行动干预信息,作用于正在进行或已存在的行动池中内容 @@ -57,108 +66,179 @@ public class ActionInterventor extends PreRunningModule implements ActivateModel // 综合当前正在进行的行动链信息、用户交互历史、激活的记忆切片,尝试识别出是否存在行动干预意图 // 首先通过recognizer进行快速意图识别,识别成功则步入评估阶段,评估成功则直接作用于目标行动链 // 进行快速意图识别时必须结合近期对话与进行中行动链情况 + + // 干预意图识别 String uuid = context.getUuid(); String userId = context.getUserId(); RecognizerResult recognizerResult = interventionRecognizer - .execute(buildRecognizerInput(userId, context.getInput())); //此处的输入内容携带了所有 PhaserRecord + .execute(buildRecognizerInput(userId, context.getInput())); // 此处的输入内容携带了所有 PhaserRecord if (!recognizerResult.isOk()) { - // 设置相应prompt setupNoInterventionPrompt(uuid); return; } - // 存在则进一步评估、评估通过则并直接添加行动程序至对应行动链 - Map recognizedInterventions = recognizerResult.getInterventions(); //这里的 PhaserRecord 已包含从 ActionCore 获取到的执行状态下的行动及其Phaser实例 + + // 干预意图评估 EvaluatorResult evaluatorResult = interventionEvaluator - .execute(buildEvaluatorInput(recognizedInterventions, userId)); - List interventions = evaluatorResult.getDataList(); //这里的 EvaluatedInterventionData 中的 tendency 即为 recognizedInterventions 中的键 - if (evaluatorResult.isOk() && isActionKeysExist(interventions)) { - setupErrorInterventionPrompt(uuid); - } else if (evaluatorResult.isOk()) { + .execute(buildEvaluatorInput(recognizerResult, userId)); + List executingDataList = evaluatorResult.getExecutingDataList(); + List preparedDataList = evaluatorResult.getPreparedDataList(); + + // 意图评估结果处理 + if (evaluatorResult.isOk()) { + // 对存在‘异常ActionKey’的评估结果列表进行过滤 + invalidActionKeysFilter(executingDataList); + invalidActionKeysFilter(preparedDataList); + // 同步写入prompt,异步处理干预行为,‘异步’在 interventionHandler 中体现 - setupInterventionPrompt(uuid, interventions); - interventionHandler.execute(buildHandlerInput(interventions, recognizedInterventions)); + setupInterventionPrompt(uuid, executingDataList, preparedDataList); + interventionHandler.execute(buildHandlerInput(executingDataList, preparedDataList, recognizerResult)); } else { - // 同步写入prompt - setupInterventionIgnoredPrompt(uuid, interventions); + setupInterventionIgnoredPrompt(uuid, executingDataList, preparedDataList); } + } - private void setupErrorInterventionPrompt(String uuid) { - interventionPrompt.put(uuid, Map.of( - "[识别状态] <是否识别到干预已存在行动的意图>", "识别出,但出现了不存在的行动单元key", - "[干预行动] <将对已存在行动做出的行为>", "无行为" - )); - } + private void invalidActionKeysFilter(List interventions) { + + List toRemove = new ArrayList<>(); - private boolean isActionKeysExist(List interventions) { for (EvaluatedInterventionData intervention : interventions) { - String[] array = intervention.getActions().values().toArray(new String[0]); - if (!actionCapability.checkExists(array)) { + List interventionData = intervention.getInterventionData(); + List actions = new ArrayList<>(); + for (MetaIntervention metaData : interventionData) { + actions.addAll(metaData.getActions()); + } + // 如果存在异常行动key,则可视为该评估结果存在问题,直接忽略该结果 + if (!actionCapability.checkExists(actions.toArray(String[]::new))) { + toRemove.add(intervention); + } + + // 针对 REBUILD 类型进行特殊校验, REBUILD 类型必须满足所有 MetaIntervention 的类型均为 REBUILD + if (!checkRebuildType(interventionData)) { + toRemove.add(intervention); + } + } + + interventions.removeAll(toRemove); + } + + private boolean checkRebuildType(List interventionData) { + boolean hasRebuild = false; + for (MetaIntervention meta : interventionData) { + if (meta.getType() == InterventionType.REBUILD) { + hasRebuild = true; + } else if (hasRebuild) { + // 已经存在REBUILD类型,但又发现了非REBUILD类型,不合法 return false; } } + return true; } - private HandlerInput buildHandlerInput(List interventions, Map recognizedInterventions) { + /** + * @param executingDataList 对应评估结果中的‘执行中行动’ + * @param preparedDataList 对应评估结果中的‘待执行行动’ + * @param recognizerResult 干预识别结果,包含‘执行中’‘待执行’两类评估结果各自对应的行动数据 + * @return 处理器输入 + */ + private HandlerInput buildHandlerInput(List executingDataList, + List preparedDataList, RecognizerResult recognizerResult) { HandlerInput input = new HandlerInput(); - List inputDataList = input.getData(); - for (EvaluatedInterventionData interventionData : interventions) { - HandlerInputData inputData = new HandlerInputData(); - inputData.setTendency(interventionData.getTendency()); - inputData.setDescription(interventionData.getDescription()); - inputData.setType(interventionData.getType()); - inputData.setActions(interventionData.getActions()); - inputData.setRecord(recognizedInterventions.get(interventionData.getTendency())); - inputDataList.add(inputData); - } + Map executingInterventions = recognizerResult.getExecutingInterventions(); + Map preparedInterventions = recognizerResult.getPreparedInterventions(); + + List executing = setupInputDataList(executingDataList, executingInterventions, + ExecutingInterventionData::new); + List prepared = setupInputDataList(preparedDataList, preparedInterventions, + PreparedInterventionData::new); + + input.setExecuting(executing); + input.setPrepared(prepared); + return input; } - private void setupInterventionIgnoredPrompt(String uuid, List dataList) { - String s = dataList.stream() - .map(data -> JSONObject.of( - "[干预倾向]", data.getTendency(), - "[未采用原因]", data.getDescription()).toString()) - .collect(Collectors.joining(",", "[", "]")); - interventionPrompt.put(uuid, Map.of( - "[识别状态] <是否识别到干预已存在行动的意图>", "识别到,但都未采用", - "[忽略原因] <各个意图被忽略的原因>", s, - "[干预行动] <将对已存在行动做出的行为>", "无行为" - )); + /** + * @param HandlerInput 中 List 对应的泛型 + * @param evaluatedDataList 评估结果列表 + * @param interventionMap 干预识别结果中的 tendency:data 映射 + * @param factory 输入类型构建工厂 + * @return 处理器输入(干预列表) + */ + private List setupInputDataList(List evaluatedDataList, + Map interventionMap, Supplier factory) { + + List result = new ArrayList<>(); + + for (EvaluatedInterventionData interventionData : evaluatedDataList) { + + I data = factory.get(); + + if (data instanceof InterventionData inputData) { + inputData.setTendency(interventionData.getTendency()); + inputData.setDescription(interventionData.getDescription()); + inputData.setInterventions(interventionData.getInterventionData()); + } + + if (data instanceof ExecutingInterventionData inputData) { + inputData.setRecord((PhaserRecord) interventionMap.get(interventionData.getTendency())); + } else if (data instanceof PreparedInterventionData inputData) { + inputData.setActionData((ActionData) interventionMap.get(interventionData.getTendency())); + } + + result.add(data); + } + + return result; } - private void setupInterventionPrompt(String uuid, List dataList) { - List> contents = new ArrayList<>(); - List actions = new ArrayList<>(); - for (EvaluatedInterventionData data : dataList) { + private void setupInterventionIgnoredPrompt(String uuid, List executingDataList, List preparedDataList) { + List total = Stream.concat(executingDataList.stream(), preparedDataList.stream()).toList(); + + JSONArray reasons = new JSONArray(); + + for (EvaluatedInterventionData data : total) { + JSONObject reason = reasons.addObject(); + reason.put("[干预倾向]", data.getTendency()); + reason.put("[未采用原因]", data.getDescription()); + } + + synchronized (interventionPrompt) { + interventionPrompt.put(uuid, Map.of( + "[识别状态] <是否识别到干预已存在行动的意图>", "识别到,但都未采用", + "[忽略原因] <各个意图被忽略的原因>", reasons.toString(), + "[干预行动] <将对已存在行动做出的行为>", "无行为")); + } + } + + private void setupInterventionPrompt(String uuid, List executingDataList, + List preparedDataList) { + JSONArray contents = new JSONArray(); + List temp = Stream.concat(executingDataList.stream(), preparedDataList.stream()).toList(); + + for (EvaluatedInterventionData data : temp) { if (!data.isOk()) { continue; } String tendency = data.getTendency(); - contents.add(Map.of( - "[干预倾向]", tendency, - "[干预类型]", data.getType().toString(), - "[行动链变动情况]", getActionChainStr(data.getActions()) - )); - actions.add(tendency); + JSONObject newElement = contents.addObject(); + newElement.put("[干预倾向]", tendency); + JSONArray changes = newElement.putArray("[行动链变动情况]"); + + for (MetaIntervention intervention : data.getInterventionData()) { + JSONObject change = changes.addObject(); + change.put("[干预类型]", intervention.getType()); + change.put("[干预序号]", intervention.getOrder()); + change.putArray("[干预内容]").addAll(intervention.getActions()); + } } - - interventionPrompt.put(uuid, Map.of( - "[识别状态] <是否识别到干预已存在行动的意图>", "识别到,将采用", - "[具体内容] <各个干预意图对应的具体信息>", contents.toString(), - "[干预行动] <将对已存在行动做出的行为>", actions.toString() - )); - } - - private String getActionChainStr(LinkedHashMap actions) { - ArrayList list = new ArrayList<>(); - //虽说actionCapability那边做了异常抛出,但说实话很明显放在这里不好处理啊🤔,还是在前边统一检查一下吧 - actions.forEach((order, actionKey) -> { - list.add(order + ":" + actionCapability.loadMetaActionInfo(actionKey).getDescription()); - }); - return list.toString(); + synchronized (interventionPrompt) { + interventionPrompt.put(uuid, Map.of( + "[识别状态] <是否识别到干预已存在行动的意图>", "识别到,将采用", + "[干预内容] <将对已存在行动做出的行为>", contents.toString())); + } } private void setupNoInterventionPrompt(String uuid) { @@ -167,9 +247,10 @@ public class ActionInterventor extends PreRunningModule implements ActivateModel "[干预行动] <将对已存在行动做出的行为>", "无行动")); } - private EvaluatorInput buildEvaluatorInput(Map recognizedInterventions, String userId) { + private EvaluatorInput buildEvaluatorInput(RecognizerResult recognizerResult, String userId) { EvaluatorInput input = new EvaluatorInput(); - input.setInterventionTendencies(recognizedInterventions); + input.setExecutingInterventions(recognizerResult.getExecutingInterventions()); + input.setPreparedInterventions(recognizerResult.getPreparedInterventions()); input.setRecentMessages(cognationCapability.getChatMessages()); input.setActivatedSlices(memoryCapability.getActivatedSlices(userId)); return input; @@ -182,6 +263,7 @@ public class ActionInterventor extends PreRunningModule implements ActivateModel // 参考的对话列表大小或需调整 recognizerInput.setRecentMessages(cognationCapability.getChatMessages()); recognizerInput.setExecutingActions(actionCapability.listPhaserRecords()); + recognizerInput.setPreparedActions(actionCapability.listPreparedAction(userId)); return recognizerInput; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/entity/InterventionType.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/entity/InterventionType.java similarity index 87% rename from Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/entity/InterventionType.java rename to Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/entity/InterventionType.java index ba1de1cc..19164c1a 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/entity/InterventionType.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/entity/InterventionType.java @@ -1,4 +1,4 @@ -package work.slhaf.partner.module.modules.action.interventor.handler.entity; +package work.slhaf.partner.module.modules.action.interventor.entity; public enum InterventionType { /** diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/entity/MetaIntervention.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/entity/MetaIntervention.java new file mode 100644 index 00000000..0984548d --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/entity/MetaIntervention.java @@ -0,0 +1,21 @@ +package work.slhaf.partner.module.modules.action.interventor.entity; + +import lombok.Data; + +import java.util.List; + +@Data +public class MetaIntervention { + /** + * 干预数据类型 + */ + private InterventionType type; + /** + * 干预数据对应的行动链序列 + */ + private int order; + /** + * 干预数据所需的行动key列表 + */ + private List actions; +} \ No newline at end of file diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/InterventionEvaluator.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/InterventionEvaluator.java index 562ee755..bccd2154 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/InterventionEvaluator.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/InterventionEvaluator.java @@ -1,14 +1,6 @@ package work.slhaf.partner.module.modules.action.interventor.evaluator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.ExecutorService; - -import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; - import lombok.extern.slf4j.Slf4j; import work.slhaf.partner.api.agent.factory.capability.annotation.InjectCapability; import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule; @@ -19,11 +11,17 @@ import work.slhaf.partner.api.chat.pojo.Message; import work.slhaf.partner.core.action.ActionCapability; import work.slhaf.partner.core.action.ActionCore.ExecutorType; import work.slhaf.partner.core.action.ActionCore.PhaserRecord; +import work.slhaf.partner.core.action.entity.ActionData; import work.slhaf.partner.core.memory.pojo.EvaluatedSlice; import work.slhaf.partner.module.modules.action.interventor.evaluator.entity.EvaluatorInput; import work.slhaf.partner.module.modules.action.interventor.evaluator.entity.EvaluatorResult; import work.slhaf.partner.module.modules.action.interventor.evaluator.entity.EvaluatorResult.EvaluatedInterventionData; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; + @Slf4j @AgentSubModule public class InterventionEvaluator extends AgentRunningSubModule @@ -32,35 +30,26 @@ public class InterventionEvaluator extends AgentRunningSubModule evaluatedDataList = result.getDataList(); - - Map interventionTendencies = data.getInterventionTendencies(); - Set tendencies = interventionTendencies.keySet(); + public EvaluatorResult execute(EvaluatorInput input) { + // 获取必须数据 ExecutorService executor = actionCapability.getExecutor(ExecutorType.VIRTUAL); + Map executingInterventions = input.getExecutingInterventions(); + Map preparedInterventions = input.getPreparedInterventions(); + CountDownLatch latch = new CountDownLatch(executingInterventions.size() + preparedInterventions.size()); + + // 创建结果容器 + EvaluatorResult result = new EvaluatorResult(); + List executingDataList = result.getExecutingDataList(); + List preparedDataList = result.getPreparedDataList(); + + // 并发评估 + evaluateIntervention(executingDataList, executingInterventions, input, executor, latch); + evaluateIntervention(preparedDataList, preparedInterventions, input, executor, latch); - CountDownLatch latch = new CountDownLatch(tendencies.size()); - tendencies.forEach(tendency -> { - executor.execute(() -> { - try { - String input = buildPrompt(data.getRecentMessages(), data.getActivatedSlices(), - interventionTendencies.get(tendency), tendency); - ChatResponse response = singleChat(input); - EvaluatedInterventionData evaluatedData = JSONObject.parseObject(response.getMessage(), - EvaluatedInterventionData.class); - synchronized (evaluatedDataList) { - evaluatedDataList.add(evaluatedData); - } - } catch (Exception e) { - log.error("干预意图评估出错: " + tendency, e); - } finally { - latch.countDown(); - } - }); - }); try { latch.await(); } catch (InterruptedException e) { @@ -70,13 +59,39 @@ public class InterventionEvaluator extends AgentRunningSubModule void evaluateIntervention(List evaluatedDataList, Map interventionMap, EvaluatorInput input, ExecutorService executor, CountDownLatch latch) { + interventionMap.forEach((tendency, data) -> { + executor.execute(() -> { + try { + ActionData actionData = switch (data) { + case PhaserRecord record -> record.actionData(); + case ActionData tempData -> tempData; + default -> null; + }; + String prompt = buildPrompt(input.getRecentMessages(), input.getActivatedSlices(), actionData, tendency); + + ChatResponse response = this.singleChat(prompt); + EvaluatedInterventionData evaluatedData = JSONObject.parseObject(response.getMessage(), + EvaluatedInterventionData.class); + synchronized (evaluatedDataList) { + evaluatedDataList.add(evaluatedData); + } + } catch (Exception e) { + log.error("干预意图评估出错: {}", tendency, e); + } finally { + latch.countDown(); + } + }); + }); + } + private String buildPrompt(List recentMessages, List activatedSlices, - PhaserRecord phaserRecord, String tendency) { + ActionData actionData, String tendency) { JSONObject json = new JSONObject(); json.put("干预倾向", tendency); json.putArray("近期对话").addAll(recentMessages); json.putArray("参考记忆").addAll(activatedSlices); - json.put("将干预的行动", JSONObject.toJSONString(phaserRecord.actionData())); + json.put("将干预的行动", JSONObject.toJSONString(actionData)); return json.toJSONString(); } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/entity/EvaluatorInput.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/entity/EvaluatorInput.java index af01c874..854f257e 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/entity/EvaluatorInput.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/entity/EvaluatorInput.java @@ -3,6 +3,7 @@ package work.slhaf.partner.module.modules.action.interventor.evaluator.entity; import lombok.Data; import work.slhaf.partner.api.chat.pojo.Message; import work.slhaf.partner.core.action.ActionCore.PhaserRecord; +import work.slhaf.partner.core.action.entity.ActionData; import work.slhaf.partner.core.memory.pojo.EvaluatedSlice; import java.util.List; @@ -10,7 +11,8 @@ import java.util.Map; @Data public class EvaluatorInput { - private Map interventionTendencies; + private Map executingInterventions; + private Map preparedInterventions; private List activatedSlices; private List recentMessages; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/entity/EvaluatorResult.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/entity/EvaluatorResult.java index eeda3cb6..5b927992 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/entity/EvaluatorResult.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/entity/EvaluatorResult.java @@ -1,11 +1,9 @@ package work.slhaf.partner.module.modules.action.interventor.evaluator.entity; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; - import lombok.Data; -import work.slhaf.partner.module.modules.action.interventor.handler.entity.InterventionType; +import work.slhaf.partner.module.modules.action.interventor.entity.MetaIntervention; + +import java.util.List; /** * 干预倾向评估结果,包含评估通过的倾向文本、对行动链的行为、指定操作的行动单元key、未通过的原因 @@ -16,7 +14,8 @@ public class EvaluatorResult { * 是否存在通过的干预倾向 */ private boolean ok; - private List dataList = new ArrayList<>(); + private List executingDataList; + private List preparedDataList; @Data public static class EvaluatedInterventionData { @@ -29,10 +28,6 @@ public class EvaluatorResult { * 描述信息(包括通过、失败原因) */ private String description; - private InterventionType type; - /** - * 键为执行顺序,值为行动单元对应的key - */ - private LinkedHashMap actions; + private List interventionData; } } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/InterventionHandler.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/InterventionHandler.java index ade553f0..4d8bb525 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/InterventionHandler.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/InterventionHandler.java @@ -1,16 +1,27 @@ package work.slhaf.partner.module.modules.action.interventor.handler; -import java.util.List; -import java.util.concurrent.ExecutorService; - import lombok.extern.slf4j.Slf4j; import work.slhaf.partner.api.agent.factory.capability.annotation.InjectCapability; import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule; import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.AgentRunningSubModule; import work.slhaf.partner.core.action.ActionCapability; import work.slhaf.partner.core.action.ActionCore.ExecutorType; +import work.slhaf.partner.core.action.ActionCore.PhaserRecord; +import work.slhaf.partner.core.action.entity.ActionData; +import work.slhaf.partner.core.action.entity.ActionData.ActionStatus; +import work.slhaf.partner.core.action.entity.MetaAction; +import work.slhaf.partner.module.modules.action.interventor.entity.InterventionType; +import work.slhaf.partner.module.modules.action.interventor.entity.MetaIntervention; import work.slhaf.partner.module.modules.action.interventor.handler.entity.HandlerInput; -import work.slhaf.partner.module.modules.action.interventor.handler.entity.HandlerInput.HandlerInputData; +import work.slhaf.partner.module.modules.action.interventor.handler.entity.HandlerInput.ExecutingInterventionData; +import work.slhaf.partner.module.modules.action.interventor.handler.entity.HandlerInput.InterventionData; +import work.slhaf.partner.module.modules.action.interventor.handler.entity.HandlerInput.PreparedInterventionData; + +import java.util.Comparator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Phaser; @Slf4j @AgentSubModule @@ -19,18 +30,159 @@ public class InterventionHandler extends AgentRunningSubModule { - log.debug("干预开始执行"); - List dataList = data.getData(); - for (HandlerInputData inputData : dataList) { - log.debug("干预操作: {}, 干预类型: {}",inputData.getTendency(),inputData.getType()); - - } - }); + handle(data.getExecuting(), executor); + handle(data.getPrepared(), executor); return null; } + private void handle(List executing, ExecutorService executor) { + executor.execute(() -> { + executing.forEach(interventionData -> { + // 干预逻辑一致 + // 同步操作不同 + // HandlerAction 抽取同步逻辑 + // 此处进行遍历 intervention + // 根据Intervention类型进行分发 + + List interventions = interventionData.getInterventions(); + if (interventionData instanceof ExecutingInterventionData data) { + handleInterventions(interventions, data.getRecord()); + } else if (interventionData instanceof PreparedInterventionData data) { + handleInterventions(interventions, data.getActionData()); + } + + }); + }); + } + + private void handleInterventions(List interventions, T data) { + // 加载数据 + Phaser phaser = null; + ActionData actionData = switch (data) { + case PhaserRecord record -> { + phaser = record.phaser(); + yield record.actionData(); + } + case ActionData tempData -> tempData; + default -> null; + }; + if (actionData == null) { + return; + } + + // 加锁确保同步 + synchronized (actionData) { + applyInterventions(interventions, actionData, phaser); + } + } + + private void applyInterventions(List interventions, ActionData actionData, Phaser phaser) { + boolean rebuildCleanTag = false; + + interventions.sort(Comparator.comparingInt(MetaIntervention::getOrder)); + + for (MetaIntervention intervention : interventions) { + List actions = intervention.getActions() + .stream() + .map(actionKey -> actionCapability.loadMetaAction(actionKey)) + .toList(); + + switch (intervention.getType()) { + case InterventionType.APPEND -> handleAppend(actionData, intervention.getOrder(), actions); + case InterventionType.INSERT -> handleInsert(actionData, intervention.getOrder(), actions, phaser); + case InterventionType.DELETE -> handleDelete(actionData, intervention.getOrder(), actions); + case InterventionType.CANCEL -> handleCancel(actionData); + case InterventionType.REBUILD -> { + if (!rebuildCleanTag) { + cleanActionData(actionData); + rebuildCleanTag = true; + } + handleRebuild(actionData, intervention.getOrder(), actions); + } + } + } + + } + + /** + * 在未进入执行阶段的行动单元组新增新的行动 + */ + private void handleAppend(ActionData actionData, int order, List actions) { + if (order <= actionData.getExecutingStage()) return; + + actionData.getActionChain().put(order, actions); + } + + /** + * 在未进入执行阶段和正处于行动阶段的行动单元组插入新的行动, 如果插入位置正处于执行阶段, 则启动执行线程, 通过 Phaser 确保同步 + */ + private void handleInsert(ActionData actionData, int order, List actions, Phaser phaser) { + if (order < actionData.getExecutingStage()) return; + + phaser.register(); + try { + LinkedHashMap> actionChain = actionData.getActionChain(); + actionChain.put(order, actions); + + if (order == actionData.getExecutingStage()) { + ExecutorService virtualExecutor = actionCapability.getExecutor(ExecutorType.VIRTUAL); + ExecutorService platformExecutor = actionCapability.getExecutor(ExecutorType.PLATFORM); + ExecutorService executor; + phaser.bulkRegister(actions.size()); + + for (MetaAction action : actions) { + executor = action.isIo() ? virtualExecutor : platformExecutor; + executor.execute(() -> { + try { + action.run(); + } finally { + phaser.arriveAndDeregister(); + } + }); + } + + } + } finally { + phaser.arriveAndDeregister(); + } + } + + private void handleDelete(ActionData actionData, int order, List actions) { + if (order <= actionData.getExecutingStage()) return; + + LinkedHashMap> actionChain = actionData.getActionChain(); + if (actionChain.containsKey(order)) { + actionChain.get(order).removeAll(actions); + if (actionChain.get(order).isEmpty()) { + actionChain.remove(order); + } + } + } + + private void handleCancel(ActionData actionData) { + actionData.setStatus(ActionStatus.FAILED); + actionData.setResult("行动取消"); + } + + private void handleRebuild(ActionData actionData, int order, List actions) { + LinkedHashMap> actionChain = actionData.getActionChain(); + actionChain.put(order, actions); + } + + private void cleanActionData(ActionData actionData) { + actionData.getActionChain().clear(); + actionData.setExecutingStage(0); + actionData.setStatus(ActionStatus.PREPARE); + actionData.getHistory().clear(); + } + } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/entity/HandlerInput.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/entity/HandlerInput.java index 21beb361..39b038ba 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/entity/HandlerInput.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/entity/HandlerInput.java @@ -1,23 +1,39 @@ package work.slhaf.partner.module.modules.action.interventor.handler.entity; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; - import lombok.Data; +import lombok.EqualsAndHashCode; import work.slhaf.partner.core.action.ActionCore.PhaserRecord; +import work.slhaf.partner.core.action.entity.ActionData; +import work.slhaf.partner.module.modules.action.interventor.entity.MetaIntervention; + +import java.util.List; @Data public class HandlerInput { - - private List data = new ArrayList<>(); + + private List executing; + private List prepared; @Data - public static class HandlerInputData{ - private String tendency; - private String description; - private InterventionType type; - private LinkedHashMap actions; + @EqualsAndHashCode(callSuper = true) + public static class ExecutingInterventionData extends InterventionData { private PhaserRecord record; } + + @Data + @EqualsAndHashCode(callSuper = true) + public static class PreparedInterventionData extends InterventionData { + private ActionData actionData; + } + + /** + * 针对一个干预倾向而言,有可能针对一个行动数据做出多种、不同类型的干预操作,即封装为 InterventionData 内部的 MetaIntervention 列表 + */ + @Data + public static abstract class InterventionData { + protected String tendency; + protected String description; + protected List interventions; + } + } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/InterventionRecognizer.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/InterventionRecognizer.java index 6cb694d9..6136d658 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/InterventionRecognizer.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/InterventionRecognizer.java @@ -28,30 +28,21 @@ public class InterventionRecognizer extends AgentRunningSubModule resultInterventionMap = recognizerResult.getInterventions(); List executingActions = input.getExecutingActions(); - CountDownLatch countDownLatch = new CountDownLatch(executingActions.size()); - for (ActionCore.PhaserRecord record : executingActions) { - executor.execute(() -> { - try { - String prompt = buildPrompt(record, input); - ChatResponse response = this.singleChat(prompt); - MetaRecognizerResult result = JSONObject.parseObject(response.getMessage(), MetaRecognizerResult.class); - if (result.isOk()) { - synchronized (resultInterventionMap) { - resultInterventionMap.put(result.getIntervention(), record); - } - } - } catch (Exception e) { - log.error("LLM干预意图提取出错", e); - } finally { - countDownLatch.countDown(); - } - }); - } + List preparedActions = input.getPreparedActions(); + CountDownLatch countDownLatch = new CountDownLatch(executingActions.size() + preparedActions.size()); + + // 创建结果容器 + RecognizerResult recognizerResult = new RecognizerResult(); + Map executingInterventions = recognizerResult.getExecutingInterventions(); + Map preparedInterventions = recognizerResult.getPreparedInterventions(); + + // 执行识别操作 + recognizeIntervention(executingInterventions, executingActions, executor, input, countDownLatch); + recognizeIntervention(preparedInterventions, preparedActions, executor, input, countDownLatch); + try { countDownLatch.await(); } catch (InterruptedException e) { @@ -60,12 +51,40 @@ public class InterventionRecognizer extends AgentRunningSubModule void recognizeIntervention(Map interventionsMap, List actions, ExecutorService executor, RecognizerInput input, CountDownLatch latch) { + for (T data : actions) { + executor.execute(() -> { + try { + String prompt = buildPrompt(data, input); + ChatResponse response = this.singleChat(prompt); + MetaRecognizerResult result = JSONObject.parseObject(response.getMessage(), MetaRecognizerResult.class); + if (result.isOk()) { + synchronized (interventionsMap) { + interventionsMap.put(result.getIntervention(), data); + } + } + } catch (Exception e) { + log.error("LLM干预意图提取出错", e); + } finally { + latch.countDown(); + } + }); + } + } + + private String buildPrompt(T data, RecognizerInput input) { + ActionData actionData = switch (data) { + case ActionCore.PhaserRecord record -> record.actionData(); + case ActionData tempData -> tempData; + default -> null; + }; + if (actionData == null) { + return null; + } JSONObject json = new JSONObject(); JSONObject actionInfo = json.putObject("行动信息"); - actionInfo.put("行动倾向", actionData.getStatus()); + actionInfo.put("行动倾向", actionData.getTendency()); actionInfo.put("行动原因", actionData.getReason()); actionInfo.put("行动描述", actionData.getDescription()); actionInfo.put("行动状态", actionData.getStatus()); diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/entity/RecognizerInput.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/entity/RecognizerInput.java index 4b7c8153..078b8613 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/entity/RecognizerInput.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/entity/RecognizerInput.java @@ -3,6 +3,7 @@ package work.slhaf.partner.module.modules.action.interventor.recognizer.entity; import lombok.Data; import work.slhaf.partner.api.chat.pojo.Message; import work.slhaf.partner.core.action.ActionCore; +import work.slhaf.partner.core.action.entity.ActionData; import java.util.List; @@ -18,4 +19,5 @@ public class RecognizerInput { * 正在执行的行动-Phaser记录列表,在Recognizer中结合本次输入并发评估(考虑到不同行动链之间对LLM的影响) */ private List executingActions; + private List preparedActions; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/entity/RecognizerResult.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/entity/RecognizerResult.java index db52d39b..f7af4f89 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/entity/RecognizerResult.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/entity/RecognizerResult.java @@ -2,6 +2,7 @@ package work.slhaf.partner.module.modules.action.interventor.recognizer.entity; import lombok.Data; import work.slhaf.partner.core.action.ActionCore; +import work.slhaf.partner.core.action.entity.ActionData; import java.util.HashMap; import java.util.Map; @@ -12,10 +13,18 @@ public class RecognizerResult { private boolean ok; /** + *

将被干预的‘执行中行动’

* key: 干预倾向 *
* value: 干预倾向将作用的 phaser 记录 */ - private Map interventions = new HashMap<>(); + private Map executingInterventions = new HashMap<>(); + /** + *

将被干预的‘等待中行动’

+ * key: 干预倾向 + *
+ * value: 干预倾向将作用的行动数据 + */ + private Map preparedInterventions = new HashMap<>(); } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java index 2a230e5b..871168eb 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java @@ -235,7 +235,7 @@ public class ActionPlanner extends PreRunningModule { return switch (evaluatorResult.getType()) { case PLANNING -> { ScheduledActionData actionInfo = new ScheduledActionData(); - actionInfo.setActionChain(actionChain); + actionInfo.getActionChain().putAll(actionChain); actionInfo.setScheduleContent(evaluatorResult.getScheduleContent()); actionInfo.setStatus(ActionData.ActionStatus.PREPARE); actionInfo.setUuid(UUID.randomUUID().toString()); @@ -243,7 +243,7 @@ public class ActionPlanner extends PreRunningModule { } case IMMEDIATE -> { ImmediateActionData actionInfo = new ImmediateActionData(); - actionInfo.setActionChain(actionChain); + actionInfo.getActionChain().putAll(actionChain); actionInfo.setStatus(ActionData.ActionStatus.PREPARE); actionInfo.setUuid(UUID.randomUUID().toString()); yield actionInfo; From f48d559a7b0ce9eb54f9250f6bb83ed049cd643d Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sun, 30 Nov 2025 14:38:50 +0800 Subject: [PATCH 012/182] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BA=86=20ActionInt?= =?UTF-8?q?erventor=20=E4=B8=AD=E6=95=B0=E6=8D=AE=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E7=9A=84=E7=BB=84=E7=BB=87=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../action/interventor/ActionInterventor.java | 288 +++++++++--------- .../modules/action/planner/ActionPlanner.java | 27 +- 2 files changed, 168 insertions(+), 147 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/ActionInterventor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/ActionInterventor.java index 75cd80e1..cf2e5c94 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/ActionInterventor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/ActionInterventor.java @@ -55,6 +55,9 @@ public class ActionInterventor extends PreRunningModule implements ActivateModel @InjectCapability private MemoryCapability memoryCapability; + private final AssemblyHelper assemblyHelper = new AssemblyHelper(); + private final PromptHelper promptHelper = new PromptHelper(); + /** * 键: 本次调用uuid; * 值:本次调用对应的prompt; @@ -71,15 +74,15 @@ public class ActionInterventor extends PreRunningModule implements ActivateModel String uuid = context.getUuid(); String userId = context.getUserId(); RecognizerResult recognizerResult = interventionRecognizer - .execute(buildRecognizerInput(userId, context.getInput())); // 此处的输入内容携带了所有 PhaserRecord + .execute(assemblyHelper.buildRecognizerInput(userId, context.getInput())); // 此处的输入内容携带了所有 PhaserRecord if (!recognizerResult.isOk()) { - setupNoInterventionPrompt(uuid); + promptHelper.setupNoInterventionPrompt(uuid); return; } // 干预意图评估 EvaluatorResult evaluatorResult = interventionEvaluator - .execute(buildEvaluatorInput(recognizerResult, userId)); + .execute(assemblyHelper.buildEvaluatorInput(recognizerResult, userId)); List executingDataList = evaluatorResult.getExecutingDataList(); List preparedDataList = evaluatorResult.getPreparedDataList(); @@ -90,10 +93,10 @@ public class ActionInterventor extends PreRunningModule implements ActivateModel invalidActionKeysFilter(preparedDataList); // 同步写入prompt,异步处理干预行为,‘异步’在 interventionHandler 中体现 - setupInterventionPrompt(uuid, executingDataList, preparedDataList); - interventionHandler.execute(buildHandlerInput(executingDataList, preparedDataList, recognizerResult)); + promptHelper.setupInterventionPrompt(uuid, executingDataList, preparedDataList); + interventionHandler.execute(assemblyHelper.buildHandlerInput(executingDataList, preparedDataList, recognizerResult)); } else { - setupInterventionIgnoredPrompt(uuid, executingDataList, preparedDataList); + promptHelper.setupInterventionIgnoredPrompt(uuid, executingDataList, preparedDataList); } } @@ -136,137 +139,6 @@ public class ActionInterventor extends PreRunningModule implements ActivateModel return true; } - /** - * @param executingDataList 对应评估结果中的‘执行中行动’ - * @param preparedDataList 对应评估结果中的‘待执行行动’ - * @param recognizerResult 干预识别结果,包含‘执行中’‘待执行’两类评估结果各自对应的行动数据 - * @return 处理器输入 - */ - private HandlerInput buildHandlerInput(List executingDataList, - List preparedDataList, RecognizerResult recognizerResult) { - HandlerInput input = new HandlerInput(); - Map executingInterventions = recognizerResult.getExecutingInterventions(); - Map preparedInterventions = recognizerResult.getPreparedInterventions(); - - List executing = setupInputDataList(executingDataList, executingInterventions, - ExecutingInterventionData::new); - List prepared = setupInputDataList(preparedDataList, preparedInterventions, - PreparedInterventionData::new); - - input.setExecuting(executing); - input.setPrepared(prepared); - - return input; - } - - /** - * @param HandlerInput 中 List 对应的泛型 - * @param evaluatedDataList 评估结果列表 - * @param interventionMap 干预识别结果中的 tendency:data 映射 - * @param factory 输入类型构建工厂 - * @return 处理器输入(干预列表) - */ - private List setupInputDataList(List evaluatedDataList, - Map interventionMap, Supplier factory) { - - List result = new ArrayList<>(); - - for (EvaluatedInterventionData interventionData : evaluatedDataList) { - - I data = factory.get(); - - if (data instanceof InterventionData inputData) { - inputData.setTendency(interventionData.getTendency()); - inputData.setDescription(interventionData.getDescription()); - inputData.setInterventions(interventionData.getInterventionData()); - } - - if (data instanceof ExecutingInterventionData inputData) { - inputData.setRecord((PhaserRecord) interventionMap.get(interventionData.getTendency())); - } else if (data instanceof PreparedInterventionData inputData) { - inputData.setActionData((ActionData) interventionMap.get(interventionData.getTendency())); - } - - result.add(data); - } - - return result; - } - - private void setupInterventionIgnoredPrompt(String uuid, List executingDataList, List preparedDataList) { - List total = Stream.concat(executingDataList.stream(), preparedDataList.stream()).toList(); - - JSONArray reasons = new JSONArray(); - - for (EvaluatedInterventionData data : total) { - JSONObject reason = reasons.addObject(); - reason.put("[干预倾向]", data.getTendency()); - reason.put("[未采用原因]", data.getDescription()); - } - - synchronized (interventionPrompt) { - interventionPrompt.put(uuid, Map.of( - "[识别状态] <是否识别到干预已存在行动的意图>", "识别到,但都未采用", - "[忽略原因] <各个意图被忽略的原因>", reasons.toString(), - "[干预行动] <将对已存在行动做出的行为>", "无行为")); - } - } - - private void setupInterventionPrompt(String uuid, List executingDataList, - List preparedDataList) { - JSONArray contents = new JSONArray(); - List temp = Stream.concat(executingDataList.stream(), preparedDataList.stream()).toList(); - - for (EvaluatedInterventionData data : temp) { - if (!data.isOk()) { - continue; - } - String tendency = data.getTendency(); - JSONObject newElement = contents.addObject(); - newElement.put("[干预倾向]", tendency); - JSONArray changes = newElement.putArray("[行动链变动情况]"); - - for (MetaIntervention intervention : data.getInterventionData()) { - JSONObject change = changes.addObject(); - change.put("[干预类型]", intervention.getType()); - change.put("[干预序号]", intervention.getOrder()); - change.putArray("[干预内容]").addAll(intervention.getActions()); - } - } - - synchronized (interventionPrompt) { - interventionPrompt.put(uuid, Map.of( - "[识别状态] <是否识别到干预已存在行动的意图>", "识别到,将采用", - "[干预内容] <将对已存在行动做出的行为>", contents.toString())); - } - } - - private void setupNoInterventionPrompt(String uuid) { - interventionPrompt.put(uuid, Map.of( - "[识别状态] <是否识别到干预已存在行动的意图>", "未识别到干预意图", - "[干预行动] <将对已存在行动做出的行为>", "无行动")); - } - - private EvaluatorInput buildEvaluatorInput(RecognizerResult recognizerResult, String userId) { - EvaluatorInput input = new EvaluatorInput(); - input.setExecutingInterventions(recognizerResult.getExecutingInterventions()); - input.setPreparedInterventions(recognizerResult.getPreparedInterventions()); - input.setRecentMessages(cognationCapability.getChatMessages()); - input.setActivatedSlices(memoryCapability.getActivatedSlices(userId)); - return input; - } - - private RecognizerInput buildRecognizerInput(String userId, String input) { - RecognizerInput recognizerInput = new RecognizerInput(); - recognizerInput.setInput(input); - recognizerInput.setUserDialogMapStr(memoryCapability.getUserDialogMapStr(userId)); - // 参考的对话列表大小或需调整 - recognizerInput.setRecentMessages(cognationCapability.getChatMessages()); - recognizerInput.setExecutingActions(actionCapability.listPhaserRecords()); - recognizerInput.setPreparedActions(actionCapability.listPreparedAction(userId)); - return recognizerInput; - } - @Override public String modelKey() { return "action_identifier"; @@ -286,4 +158,146 @@ public class ActionInterventor extends PreRunningModule implements ActivateModel protected String moduleName() { return "[行动干预识别模块]"; } + + private final class AssemblyHelper { + private AssemblyHelper() { + } + + /** + * @param executingDataList 对应评估结果中的‘执行中行动’ + * @param preparedDataList 对应评估结果中的‘待执行行动’ + * @param recognizerResult 干预识别结果,包含‘执行中’‘待执行’两类评估结果各自对应的行动数据 + * @return 处理器输入 + */ + private HandlerInput buildHandlerInput(List executingDataList, + List preparedDataList, RecognizerResult recognizerResult) { + HandlerInput input = new HandlerInput(); + Map executingInterventions = recognizerResult.getExecutingInterventions(); + Map preparedInterventions = recognizerResult.getPreparedInterventions(); + + List executing = setupInputDataList(executingDataList, executingInterventions, + ExecutingInterventionData::new); + List prepared = setupInputDataList(preparedDataList, preparedInterventions, + PreparedInterventionData::new); + + input.setExecuting(executing); + input.setPrepared(prepared); + + return input; + } + + /** + * @param HandlerInput 中 List 对应的泛型 + * @param evaluatedDataList 评估结果列表 + * @param interventionMap 干预识别结果中的 tendency:data 映射 + * @param factory 输入类型构建工厂 + * @return 处理器输入(干预列表) + */ + private List setupInputDataList(List evaluatedDataList, + Map interventionMap, Supplier factory) { + + List result = new ArrayList<>(); + + for (EvaluatedInterventionData interventionData : evaluatedDataList) { + + I data = factory.get(); + + if (data instanceof InterventionData inputData) { + inputData.setTendency(interventionData.getTendency()); + inputData.setDescription(interventionData.getDescription()); + inputData.setInterventions(interventionData.getInterventionData()); + } + + if (data instanceof ExecutingInterventionData inputData) { + inputData.setRecord((PhaserRecord) interventionMap.get(interventionData.getTendency())); + } else if (data instanceof PreparedInterventionData inputData) { + inputData.setActionData((ActionData) interventionMap.get(interventionData.getTendency())); + } + + result.add(data); + } + + return result; + } + + + private RecognizerInput buildRecognizerInput(String userId, String input) { + RecognizerInput recognizerInput = new RecognizerInput(); + recognizerInput.setInput(input); + recognizerInput.setUserDialogMapStr(memoryCapability.getUserDialogMapStr(userId)); + // 参考的对话列表大小或需调整 + recognizerInput.setRecentMessages(cognationCapability.getChatMessages()); + recognizerInput.setExecutingActions(actionCapability.listPhaserRecords()); + recognizerInput.setPreparedActions(actionCapability.listPreparedAction(userId)); + return recognizerInput; + } + + private EvaluatorInput buildEvaluatorInput(RecognizerResult recognizerResult, String userId) { + EvaluatorInput input = new EvaluatorInput(); + input.setExecutingInterventions(recognizerResult.getExecutingInterventions()); + input.setPreparedInterventions(recognizerResult.getPreparedInterventions()); + input.setRecentMessages(cognationCapability.getChatMessages()); + input.setActivatedSlices(memoryCapability.getActivatedSlices(userId)); + return input; + } + } + + private final class PromptHelper { + private PromptHelper() { + } + + private void setupInterventionIgnoredPrompt(String uuid, List executingDataList, List preparedDataList) { + List total = Stream.concat(executingDataList.stream(), preparedDataList.stream()).toList(); + + JSONArray reasons = new JSONArray(); + + for (EvaluatedInterventionData data : total) { + JSONObject reason = reasons.addObject(); + reason.put("[干预倾向]", data.getTendency()); + reason.put("[未采用原因]", data.getDescription()); + } + + synchronized (interventionPrompt) { + interventionPrompt.put(uuid, Map.of( + "[识别状态] <是否识别到干预已存在行动的意图>", "识别到,但都未采用", + "[忽略原因] <各个意图被忽略的原因>", reasons.toString(), + "[干预行动] <将对已存在行动做出的行为>", "无行为")); + } + } + + private void setupInterventionPrompt(String uuid, List executingDataList, + List preparedDataList) { + JSONArray contents = new JSONArray(); + List temp = Stream.concat(executingDataList.stream(), preparedDataList.stream()).toList(); + + for (EvaluatedInterventionData data : temp) { + if (!data.isOk()) { + continue; + } + String tendency = data.getTendency(); + JSONObject newElement = contents.addObject(); + newElement.put("[干预倾向]", tendency); + JSONArray changes = newElement.putArray("[行动链变动情况]"); + + for (MetaIntervention intervention : data.getInterventionData()) { + JSONObject change = changes.addObject(); + change.put("[干预类型]", intervention.getType()); + change.put("[干预序号]", intervention.getOrder()); + change.putArray("[干预内容]").addAll(intervention.getActions()); + } + } + + synchronized (interventionPrompt) { + interventionPrompt.put(uuid, Map.of( + "[识别状态] <是否识别到干预已存在行动的意图>", "识别到,将采用", + "[干预内容] <将对已存在行动做出的行为>", contents.toString())); + } + } + + private void setupNoInterventionPrompt(String uuid) { + interventionPrompt.put(uuid, Map.of( + "[识别状态] <是否识别到干预已存在行动的意图>", "未识别到干预意图", + "[干预行动] <将对已存在行动做出的行为>", "无行动")); + } + } } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java index 871168eb..babf2848 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java @@ -1,14 +1,15 @@ package work.slhaf.partner.module.modules.action.planner; +import lombok.extern.slf4j.Slf4j; import work.slhaf.partner.api.agent.factory.capability.annotation.InjectCapability; import work.slhaf.partner.api.agent.factory.module.annotation.AfterExecute; import work.slhaf.partner.api.agent.factory.module.annotation.AgentModule; import work.slhaf.partner.api.agent.factory.module.annotation.Init; import work.slhaf.partner.api.agent.factory.module.annotation.InjectModule; import work.slhaf.partner.api.chat.pojo.Message; -import work.slhaf.partner.common.thread.InteractionThreadPoolExecutor; import work.slhaf.partner.common.vector.VectorClient; import work.slhaf.partner.core.action.ActionCapability; +import work.slhaf.partner.core.action.ActionCore; import work.slhaf.partner.core.action.entity.ActionData; import work.slhaf.partner.core.action.entity.ImmediateActionData; import work.slhaf.partner.core.action.entity.MetaAction; @@ -32,10 +33,12 @@ import work.slhaf.partner.runtime.interaction.data.context.PartnerRunningFlowCon import java.util.*; import java.util.concurrent.Callable; +import java.util.concurrent.ExecutorService; /** * 负责针对本次输入生成基础的行动计划,在主模型传达意愿后,执行行动或者放入计划池 */ +@Slf4j @AgentModule(name = "action_planner", order = 2) public class ActionPlanner extends PreRunningModule { @@ -55,21 +58,25 @@ public class ActionPlanner extends PreRunningModule { @InjectModule private ActionConfirmer actionConfirmer; - private InteractionThreadPoolExecutor executor; - private ActionAssemblyHelper assemblyHelper; + private ExecutorService executor; + + private final ActionAssemblyHelper assemblyHelper = new ActionAssemblyHelper(); @Init public void init() { - executor = InteractionThreadPoolExecutor.getInstance(); - assemblyHelper = new ActionAssemblyHelper(); + executor = actionCapability.getExecutor(ActionCore.ExecutorType.VIRTUAL); } @Override protected void doExecute(PartnerRunningFlowContext context) { - List> tasks = new ArrayList<>(); - addConfirmTask(tasks, context); - addNewActionTask(tasks, context); - executor.invokeAll(tasks); + try { + List> tasks = new ArrayList<>(); + addConfirmTask(tasks, context); + addNewActionTask(tasks, context); + executor.invokeAll(tasks); + } catch (Exception e) { + log.error("执行异常", e); + } } /** @@ -200,7 +207,7 @@ public class ActionPlanner extends PreRunningModule { return "[行动模块]"; } - private class ActionAssemblyHelper { + private final class ActionAssemblyHelper { private ActionAssemblyHelper() { } From b3098310b461b4536ba257f70bafe6462f152c32 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sun, 30 Nov 2025 15:16:57 +0800 Subject: [PATCH 013/182] =?UTF-8?q?=E5=AE=8C=E5=96=84=E4=BA=86=20ActionCon?= =?UTF-8?q?firmer=20=E7=9A=84=E9=81=97=E6=BC=8F=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/action/planner/ActionPlanner.java | 7 +- .../planner/confirmer/ActionConfirmer.java | 66 ++++++++++++++++++- .../confirmer/entity/ConfirmerResult.java | 3 +- 3 files changed, 70 insertions(+), 6 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java index babf2848..60b390a2 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java @@ -2,7 +2,6 @@ package work.slhaf.partner.module.modules.action.planner; import lombok.extern.slf4j.Slf4j; import work.slhaf.partner.api.agent.factory.capability.annotation.InjectCapability; -import work.slhaf.partner.api.agent.factory.module.annotation.AfterExecute; import work.slhaf.partner.api.agent.factory.module.annotation.AgentModule; import work.slhaf.partner.api.agent.factory.module.annotation.Init; import work.slhaf.partner.api.agent.factory.module.annotation.InjectModule; @@ -95,11 +94,11 @@ public class ActionPlanner extends PreRunningModule { EvaluatorInput evaluatorInput = assemblyHelper.buildEvaluatorInput(extractorResult, context.getUserId()); List evaluatorResults = actionEvaluator.execute(evaluatorInput); //并发操作均为访问 setupActionInfo(evaluatorResults, context); + updateTendencyCache(evaluatorResults, context.getInput(), extractorResult); return null; }); } - @AfterExecute private void updateTendencyCache(List evaluatorResults, String input, ExtractorResult extractorResult) { if (!VectorClient.status) { return; @@ -132,12 +131,12 @@ public class ActionPlanner extends PreRunningModule { tasks.add(() -> { ConfirmerInput confirmerInput = assemblyHelper.buildConfirmerInput(context); ConfirmerResult result = actionConfirmer.execute(confirmerInput); - setupPendingActionInfo(context, result); + setupConfirmedActionInfo(context, result); return null; }); } - private void setupPendingActionInfo(PartnerRunningFlowContext context, ConfirmerResult result) { + private void setupConfirmedActionInfo(PartnerRunningFlowContext context, ConfirmerResult result) { //TODO 需考虑未确认任务的失效或者拒绝时机,在action core中实现 List uuids = result.getUuids(); if (uuids == null) { diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/confirmer/ActionConfirmer.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/confirmer/ActionConfirmer.java index 30df6471..85484b95 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/confirmer/ActionConfirmer.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/confirmer/ActionConfirmer.java @@ -1,19 +1,83 @@ package work.slhaf.partner.module.modules.action.planner.confirmer; +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; +import lombok.extern.slf4j.Slf4j; +import work.slhaf.partner.api.agent.factory.capability.annotation.InjectCapability; import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule; import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.ActivateModel; import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.AgentRunningSubModule; +import work.slhaf.partner.api.chat.pojo.ChatResponse; +import work.slhaf.partner.api.chat.pojo.Message; +import work.slhaf.partner.core.action.ActionCapability; +import work.slhaf.partner.core.action.ActionCore; +import work.slhaf.partner.core.action.entity.ActionData; import work.slhaf.partner.module.modules.action.planner.confirmer.entity.ConfirmerInput; import work.slhaf.partner.module.modules.action.planner.confirmer.entity.ConfirmerResult; +import java.util.List; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; + +import static work.slhaf.partner.common.util.ExtractUtil.extractJson; + +@Slf4j @AgentSubModule public class ActionConfirmer extends AgentRunningSubModule implements ActivateModel { + + @InjectCapability + private ActionCapability actionCapability; + @Override public ConfirmerResult execute(ConfirmerInput data) { - //TODO 完善确认逻辑 + List actionDataList = data.getActionData(); + ExecutorService executor = actionCapability.getExecutor(ActionCore.ExecutorType.VIRTUAL); + CountDownLatch latch = new CountDownLatch(actionDataList.size()); + + ConfirmerResult result = new ConfirmerResult(); + List uuids = result.getUuids(); + + for (ActionData actionData : actionDataList) { + executor.execute(() -> { + try { + String prompt = buildPrompt(actionData, data.getInput(), data.getRecentMessages()); + ChatResponse response = this.singleChat(prompt); + JSONObject tempResult = JSONObject.parseObject(extractJson(response.getMessage())); + if (tempResult.getBoolean("confirmed")) { + actionData.setStatus(ActionData.ActionStatus.PREPARE); + synchronized (uuids) { + uuids.add(actionData.getUuid()); + } + } + } finally { + latch.countDown(); + } + }); + } + try { + latch.await(); + } catch (InterruptedException e) { + log.warn("CountDownLatch阻塞已中断"); + } return null; } + private String buildPrompt(ActionData data, String input, List recentMessages) { + JSONObject prompt = new JSONObject(); + prompt.put("[用户输入]", input); + + JSONObject actionData = prompt.putObject("[行动数据]"); + actionData.put("[行动倾向]", data.getTendency()); + actionData.put("[行动原因]", data.getReason()); + actionData.put("[行动来源]", data.getSource()); + actionData.put("[行动描述]", data.getDescription()); + + JSONArray messageData = prompt.putArray("[近期对话]"); + messageData.addAll(recentMessages); + + return prompt.toString(); + } + @Override public String modelKey() { return "action-confirmer"; diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/confirmer/entity/ConfirmerResult.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/confirmer/entity/ConfirmerResult.java index d1d73f0b..cf61639d 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/confirmer/entity/ConfirmerResult.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/confirmer/entity/ConfirmerResult.java @@ -2,9 +2,10 @@ package work.slhaf.partner.module.modules.action.planner.confirmer.entity; import lombok.Data; +import java.util.ArrayList; import java.util.List; @Data public class ConfirmerResult { - private List uuids; + private List uuids = new ArrayList<>(); } From c548cceec69211cf331c59085c482d14a8b680c4 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sun, 30 Nov 2025 18:41:42 +0800 Subject: [PATCH 014/182] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20SandboxRunner=20?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=AD=90=E6=A8=A1=E5=9D=97=EF=BC=8C=E8=AF=A5?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E5=B0=86=E5=9C=A8=E6=8C=87=E5=AE=9A=E5=AE=B9?= =?UTF-8?q?=E5=99=A8=E8=BF=90=E8=A1=8C=E6=8C=81=E4=B9=85=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=EF=BC=8C=E4=B8=8E=E5=A4=96=E9=83=A8=E4=B8=BB=E8=BF=9B=E7=A8=8B?= =?UTF-8?q?=E9=80=9A=E4=BF=A1=EF=BC=8C=E5=B0=86=E7=94=A8=E4=BA=8E=E5=90=8E?= =?UTF-8?q?=E7=BB=AD=E6=89=A7=E8=A1=8C`JAR`=E3=80=81`SCRIPT`=E4=B8=A4?= =?UTF-8?q?=E7=B1=BB=E8=A1=8C=E5=8A=A8=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/encodings.xml | 1 + .idea/misc.xml | 1 + .../core/action/entity/ActionData.java | 17 +- .../action/dispatcher/ActionDispatcher.java | 7 +- .../planner/confirmer/ActionConfirmer.java | 2 +- Partner-SandboxRunner/.gitattributes | 2 + Partner-SandboxRunner/.gitignore | 33 ++ .../.mvn/wrapper/maven-wrapper.properties | 3 + Partner-SandboxRunner/mvnw | 295 ++++++++++++++++++ Partner-SandboxRunner/mvnw.cmd | 189 +++++++++++ Partner-SandboxRunner/pom.xml | 88 ++++++ .../executor/PartnerExecutorApplication.java | 13 + .../src/main/resources/application.properties | 1 + .../PartnerExecutorApplicationTests.java | 13 + pom.xml | 4 +- 15 files changed, 663 insertions(+), 6 deletions(-) create mode 100644 Partner-SandboxRunner/.gitattributes create mode 100644 Partner-SandboxRunner/.gitignore create mode 100644 Partner-SandboxRunner/.mvn/wrapper/maven-wrapper.properties create mode 100755 Partner-SandboxRunner/mvnw create mode 100644 Partner-SandboxRunner/mvnw.cmd create mode 100644 Partner-SandboxRunner/pom.xml create mode 100644 Partner-SandboxRunner/src/main/java/work/slhaf/partner/executor/PartnerExecutorApplication.java create mode 100644 Partner-SandboxRunner/src/main/resources/application.properties create mode 100644 Partner-SandboxRunner/src/test/java/work/slhaf/partner/executor/PartnerExecutorApplicationTests.java diff --git a/.idea/encodings.xml b/.idea/encodings.xml index e47da802..210ab4d4 100644 --- a/.idea/encodings.xml +++ b/.idea/encodings.xml @@ -3,6 +3,7 @@ + diff --git a/.idea/misc.xml b/.idea/misc.xml index a0b4e20a..1277c99b 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -27,6 +27,7 @@ diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java index 6ba26af9..a2362e4c 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java @@ -53,6 +53,21 @@ public abstract class ActionData { protected String source; public enum ActionStatus { - SUCCESS, FAILED, EXECUTING, PREPARE + /** + * 执行成功 + */ + SUCCESS, + /** + * 执行失败 + */ + FAILED, + /** + * 执行中 + */ + EXECUTING, + /** + * 预备执行 + */ + PREPARE } } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/ActionDispatcher.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/ActionDispatcher.java index 350722e0..4565b22b 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/ActionDispatcher.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/ActionDispatcher.java @@ -4,8 +4,8 @@ import work.slhaf.partner.api.agent.factory.capability.annotation.InjectCapabili import work.slhaf.partner.api.agent.factory.module.annotation.AgentModule; import work.slhaf.partner.api.agent.factory.module.annotation.Init; import work.slhaf.partner.api.agent.factory.module.annotation.InjectModule; -import work.slhaf.partner.common.thread.InteractionThreadPoolExecutor; import work.slhaf.partner.core.action.ActionCapability; +import work.slhaf.partner.core.action.ActionCore; import work.slhaf.partner.core.action.entity.ActionData; import work.slhaf.partner.core.action.entity.ImmediateActionData; import work.slhaf.partner.core.action.entity.ScheduledActionData; @@ -16,6 +16,7 @@ import work.slhaf.partner.runtime.interaction.data.context.PartnerRunningFlowCon import java.util.ArrayList; import java.util.List; +import java.util.concurrent.ExecutorService; @AgentModule(name = "action_dispatcher", order = 7) public class ActionDispatcher extends PostRunningModule { @@ -28,11 +29,11 @@ public class ActionDispatcher extends PostRunningModule { @InjectModule private ActionScheduler actionScheduler; - private InteractionThreadPoolExecutor executor; + private ExecutorService executor; @Init public void init() { - executor = InteractionThreadPoolExecutor.getInstance(); + executor = actionCapability.getExecutor(ActionCore.ExecutorType.VIRTUAL); } @Override diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/confirmer/ActionConfirmer.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/confirmer/ActionConfirmer.java index 85484b95..693cef18 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/confirmer/ActionConfirmer.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/confirmer/ActionConfirmer.java @@ -59,7 +59,7 @@ public class ActionConfirmer extends AgentRunningSubModule recentMessages) { diff --git a/Partner-SandboxRunner/.gitattributes b/Partner-SandboxRunner/.gitattributes new file mode 100644 index 00000000..3b41682a --- /dev/null +++ b/Partner-SandboxRunner/.gitattributes @@ -0,0 +1,2 @@ +/mvnw text eol=lf +*.cmd text eol=crlf diff --git a/Partner-SandboxRunner/.gitignore b/Partner-SandboxRunner/.gitignore new file mode 100644 index 00000000..667aaef0 --- /dev/null +++ b/Partner-SandboxRunner/.gitignore @@ -0,0 +1,33 @@ +HELP.md +target/ +.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ diff --git a/Partner-SandboxRunner/.mvn/wrapper/maven-wrapper.properties b/Partner-SandboxRunner/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 00000000..c0bcafe9 --- /dev/null +++ b/Partner-SandboxRunner/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,3 @@ +wrapperVersion=3.3.4 +distributionType=only-script +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.11/apache-maven-3.9.11-bin.zip diff --git a/Partner-SandboxRunner/mvnw b/Partner-SandboxRunner/mvnw new file mode 100755 index 00000000..bd8896bf --- /dev/null +++ b/Partner-SandboxRunner/mvnw @@ -0,0 +1,295 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.3.4 +# +# Optional ENV vars +# ----------------- +# JAVA_HOME - location of a JDK home dir, required when download maven via java source +# MVNW_REPOURL - repo url base for downloading maven distribution +# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output +# ---------------------------------------------------------------------------- + +set -euf +[ "${MVNW_VERBOSE-}" != debug ] || set -x + +# OS specific support. +native_path() { printf %s\\n "$1"; } +case "$(uname)" in +CYGWIN* | MINGW*) + [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" + native_path() { cygpath --path --windows "$1"; } + ;; +esac + +# set JAVACMD and JAVACCMD +set_java_home() { + # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched + if [ -n "${JAVA_HOME-}" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACCMD="$JAVA_HOME/jre/sh/javac" + else + JAVACMD="$JAVA_HOME/bin/java" + JAVACCMD="$JAVA_HOME/bin/javac" + + if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then + echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 + echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 + return 1 + fi + fi + else + JAVACMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v java + )" || : + JAVACCMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v javac + )" || : + + if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then + echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 + return 1 + fi + fi +} + +# hash string like Java String::hashCode +hash_string() { + str="${1:-}" h=0 + while [ -n "$str" ]; do + char="${str%"${str#?}"}" + h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) + str="${str#?}" + done + printf %x\\n $h +} + +verbose() { :; } +[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } + +die() { + printf %s\\n "$1" >&2 + exit 1 +} + +trim() { + # MWRAPPER-139: + # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. + # Needed for removing poorly interpreted newline sequences when running in more + # exotic environments such as mingw bash on Windows. + printf "%s" "${1}" | tr -d '[:space:]' +} + +scriptDir="$(dirname "$0")" +scriptName="$(basename "$0")" + +# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties +while IFS="=" read -r key value; do + case "${key-}" in + distributionUrl) distributionUrl=$(trim "${value-}") ;; + distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; + esac +done <"$scriptDir/.mvn/wrapper/maven-wrapper.properties" +[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" + +case "${distributionUrl##*/}" in +maven-mvnd-*bin.*) + MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ + case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in + *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; + :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; + :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; + :Linux*x86_64*) distributionPlatform=linux-amd64 ;; + *) + echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 + distributionPlatform=linux-amd64 + ;; + esac + distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" + ;; +maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; +*) MVN_CMD="mvn${scriptName#mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; +esac + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" +distributionUrlName="${distributionUrl##*/}" +distributionUrlNameMain="${distributionUrlName%.*}" +distributionUrlNameMain="${distributionUrlNameMain%-bin}" +MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" +MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" + +exec_maven() { + unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : + exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" +} + +if [ -d "$MAVEN_HOME" ]; then + verbose "found existing MAVEN_HOME at $MAVEN_HOME" + exec_maven "$@" +fi + +case "${distributionUrl-}" in +*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; +*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; +esac + +# prepare tmp dir +if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then + clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } + trap clean HUP INT TERM EXIT +else + die "cannot create temp dir" +fi + +mkdir -p -- "${MAVEN_HOME%/*}" + +# Download and Install Apache Maven +verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +verbose "Downloading from: $distributionUrl" +verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +# select .zip or .tar.gz +if ! command -v unzip >/dev/null; then + distributionUrl="${distributionUrl%.zip}.tar.gz" + distributionUrlName="${distributionUrl##*/}" +fi + +# verbose opt +__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' +[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v + +# normalize http auth +case "${MVNW_PASSWORD:+has-password}" in +'') MVNW_USERNAME='' MVNW_PASSWORD='' ;; +has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; +esac + +if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then + verbose "Found wget ... using wget" + wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" +elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then + verbose "Found curl ... using curl" + curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" +elif set_java_home; then + verbose "Falling back to use Java to download" + javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" + targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" + cat >"$javaSource" <<-END + public class Downloader extends java.net.Authenticator + { + protected java.net.PasswordAuthentication getPasswordAuthentication() + { + return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); + } + public static void main( String[] args ) throws Exception + { + setDefault( new Downloader() ); + java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); + } + } + END + # For Cygwin/MinGW, switch paths to Windows format before running javac and java + verbose " - Compiling Downloader.java ..." + "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" + verbose " - Running Downloader.java ..." + "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" +fi + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +if [ -n "${distributionSha256Sum-}" ]; then + distributionSha256Result=false + if [ "$MVN_CMD" = mvnd.sh ]; then + echo "Checksum validation is not supported for maven-mvnd." >&2 + echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + elif command -v sha256sum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c - >/dev/null 2>&1; then + distributionSha256Result=true + fi + elif command -v shasum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then + distributionSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 + echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + fi + if [ $distributionSha256Result = false ]; then + echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 + echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 + exit 1 + fi +fi + +# unzip and move +if command -v unzip >/dev/null; then + unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" +else + tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" +fi + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +actualDistributionDir="" + +# First try the expected directory name (for regular distributions) +if [ -d "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" ]; then + if [ -f "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/bin/$MVN_CMD" ]; then + actualDistributionDir="$distributionUrlNameMain" + fi +fi + +# If not found, search for any directory with the Maven executable (for snapshots) +if [ -z "$actualDistributionDir" ]; then + # enable globbing to iterate over items + set +f + for dir in "$TMP_DOWNLOAD_DIR"/*; do + if [ -d "$dir" ]; then + if [ -f "$dir/bin/$MVN_CMD" ]; then + actualDistributionDir="$(basename "$dir")" + break + fi + fi + done + set -f +fi + +if [ -z "$actualDistributionDir" ]; then + verbose "Contents of $TMP_DOWNLOAD_DIR:" + verbose "$(ls -la "$TMP_DOWNLOAD_DIR")" + die "Could not find Maven distribution directory in extracted archive" +fi + +verbose "Found extracted Maven distribution directory: $actualDistributionDir" +printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$actualDistributionDir/mvnw.url" +mv -- "$TMP_DOWNLOAD_DIR/$actualDistributionDir" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" + +clean || : +exec_maven "$@" diff --git a/Partner-SandboxRunner/mvnw.cmd b/Partner-SandboxRunner/mvnw.cmd new file mode 100644 index 00000000..92450f93 --- /dev/null +++ b/Partner-SandboxRunner/mvnw.cmd @@ -0,0 +1,189 @@ +<# : batch portion +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Apache Maven Wrapper startup batch script, version 3.3.4 +@REM +@REM Optional ENV vars +@REM MVNW_REPOURL - repo url base for downloading maven distribution +@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output +@REM ---------------------------------------------------------------------------- + +@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) +@SET __MVNW_CMD__= +@SET __MVNW_ERROR__= +@SET __MVNW_PSMODULEP_SAVE=%PSModulePath% +@SET PSModulePath= +@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( + IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) +) +@SET PSModulePath=%__MVNW_PSMODULEP_SAVE% +@SET __MVNW_PSMODULEP_SAVE= +@SET __MVNW_ARG0_NAME__= +@SET MVNW_USERNAME= +@SET MVNW_PASSWORD= +@IF NOT "%__MVNW_CMD__%"=="" ("%__MVNW_CMD__%" %*) +@echo Cannot start maven from wrapper >&2 && exit /b 1 +@GOTO :EOF +: end batch / begin powershell #> + +$ErrorActionPreference = "Stop" +if ($env:MVNW_VERBOSE -eq "true") { + $VerbosePreference = "Continue" +} + +# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties +$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl +if (!$distributionUrl) { + Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" +} + +switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { + "maven-mvnd-*" { + $USE_MVND = $true + $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" + $MVN_CMD = "mvnd.cmd" + break + } + default { + $USE_MVND = $false + $MVN_CMD = $script -replace '^mvnw','mvn' + break + } +} + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +if ($env:MVNW_REPOURL) { + $MVNW_REPO_PATTERN = if ($USE_MVND -eq $False) { "/org/apache/maven/" } else { "/maven/mvnd/" } + $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace "^.*$MVNW_REPO_PATTERN",'')" +} +$distributionUrlName = $distributionUrl -replace '^.*/','' +$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' + +$MAVEN_M2_PATH = "$HOME/.m2" +if ($env:MAVEN_USER_HOME) { + $MAVEN_M2_PATH = "$env:MAVEN_USER_HOME" +} + +if (-not (Test-Path -Path $MAVEN_M2_PATH)) { + New-Item -Path $MAVEN_M2_PATH -ItemType Directory | Out-Null +} + +$MAVEN_WRAPPER_DISTS = $null +if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) { + $MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists" +} else { + $MAVEN_WRAPPER_DISTS = (Get-Item $MAVEN_M2_PATH).Target[0] + "/wrapper/dists" +} + +$MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain" +$MAVEN_HOME_NAME = ([System.Security.Cryptography.SHA256]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' +$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" + +if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { + Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" + Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" + exit $? +} + +if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { + Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" +} + +# prepare tmp dir +$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile +$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" +$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null +trap { + if ($TMP_DOWNLOAD_DIR.Exists) { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } + } +} + +New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null + +# Download and Install Apache Maven +Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +Write-Verbose "Downloading from: $distributionUrl" +Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +$webclient = New-Object System.Net.WebClient +if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { + $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) +} +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum +if ($distributionSha256Sum) { + if ($USE_MVND) { + Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." + } + Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash + if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { + Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." + } +} + +# unzip and move +Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +$actualDistributionDir = "" + +# First try the expected directory name (for regular distributions) +$expectedPath = Join-Path "$TMP_DOWNLOAD_DIR" "$distributionUrlNameMain" +$expectedMvnPath = Join-Path "$expectedPath" "bin/$MVN_CMD" +if ((Test-Path -Path $expectedPath -PathType Container) -and (Test-Path -Path $expectedMvnPath -PathType Leaf)) { + $actualDistributionDir = $distributionUrlNameMain +} + +# If not found, search for any directory with the Maven executable (for snapshots) +if (!$actualDistributionDir) { + Get-ChildItem -Path "$TMP_DOWNLOAD_DIR" -Directory | ForEach-Object { + $testPath = Join-Path $_.FullName "bin/$MVN_CMD" + if (Test-Path -Path $testPath -PathType Leaf) { + $actualDistributionDir = $_.Name + } + } +} + +if (!$actualDistributionDir) { + Write-Error "Could not find Maven distribution directory in extracted archive" +} + +Write-Verbose "Found extracted Maven distribution directory: $actualDistributionDir" +Rename-Item -Path "$TMP_DOWNLOAD_DIR/$actualDistributionDir" -NewName $MAVEN_HOME_NAME | Out-Null +try { + Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null +} catch { + if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { + Write-Error "fail to move MAVEN_HOME" + } +} finally { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } +} + +Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" diff --git a/Partner-SandboxRunner/pom.xml b/Partner-SandboxRunner/pom.xml new file mode 100644 index 00000000..835877c9 --- /dev/null +++ b/Partner-SandboxRunner/pom.xml @@ -0,0 +1,88 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 4.0.0 + + + work.slhaf + Partner-SandboxRunner + 0.0.1-SNAPSHOT + Partner-SandboxRunner + Partner-SandboxRunner + + + + + + + + + + + + + + + 21 + + + + org.springframework.boot + spring-boot-starter-webmvc + + + org.springframework.boot + spring-boot-starter-websocket + + + + org.projectlombok + lombok + true + + + org.springframework.boot + spring-boot-starter-webmvc-test + test + + + org.springframework.boot + spring-boot-starter-websocket-test + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + org.projectlombok + lombok + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.projectlombok + lombok + + + + + + + + diff --git a/Partner-SandboxRunner/src/main/java/work/slhaf/partner/executor/PartnerExecutorApplication.java b/Partner-SandboxRunner/src/main/java/work/slhaf/partner/executor/PartnerExecutorApplication.java new file mode 100644 index 00000000..a593d858 --- /dev/null +++ b/Partner-SandboxRunner/src/main/java/work/slhaf/partner/executor/PartnerExecutorApplication.java @@ -0,0 +1,13 @@ +package work.slhaf.partner.executor; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class PartnerExecutorApplication { + + public static void main(String[] args) { + SpringApplication.run(PartnerExecutorApplication.class, args); + } + +} diff --git a/Partner-SandboxRunner/src/main/resources/application.properties b/Partner-SandboxRunner/src/main/resources/application.properties new file mode 100644 index 00000000..ebcac2a1 --- /dev/null +++ b/Partner-SandboxRunner/src/main/resources/application.properties @@ -0,0 +1 @@ +spring.application.name=Partner-Executor diff --git a/Partner-SandboxRunner/src/test/java/work/slhaf/partner/executor/PartnerExecutorApplicationTests.java b/Partner-SandboxRunner/src/test/java/work/slhaf/partner/executor/PartnerExecutorApplicationTests.java new file mode 100644 index 00000000..eb26c3e1 --- /dev/null +++ b/Partner-SandboxRunner/src/test/java/work/slhaf/partner/executor/PartnerExecutorApplicationTests.java @@ -0,0 +1,13 @@ +package work.slhaf.partner.executor; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class PartnerExecutorApplicationTests { + + @Test + void contextLoads() { + } + +} diff --git a/pom.xml b/pom.xml index a8783473..ff6ea8a9 100644 --- a/pom.xml +++ b/pom.xml @@ -12,6 +12,7 @@ Partner-Test-Demo Partner-Main Partner-Api + Partner-SandboxRunner @@ -50,7 +51,8 @@ - + work.slhaf.demo.AgentDemoApplication From 3f59719e16554821dbebf6ea1e4090fb9a86ad32 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sun, 30 Nov 2025 22:16:57 +0800 Subject: [PATCH 015/182] =?UTF-8?q?=E8=B0=83=E6=95=B4=20MetaAction=20?= =?UTF-8?q?=E7=9A=84=E6=89=A7=E8=A1=8C=E6=96=B9=E5=BC=8F=EF=BC=8C=E5=B0=86?= =?UTF-8?q?=E4=BA=A4=E7=BB=99=20ActionCapability=E3=80=81SandBoxRunnerClie?= =?UTF-8?q?nt=20=E6=89=A7=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/encodings.xml | 2 +- .../partner/core/action/ActionCapability.java | 2 + .../slhaf/partner/core/action/ActionCore.java | 6 +++ .../core/action/ActionWatchService.java | 1 + .../core/action/SandboxRunnerClient.java | 36 +++++++++++++ .../core/action/entity/MetaAction.java | 52 +++++-------------- .../dispatcher/executor/ActionExecutor.java | 12 +++-- .../handler/InterventionHandler.java | 2 +- 8 files changed, 68 insertions(+), 45 deletions(-) create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/core/action/SandboxRunnerClient.java diff --git a/.idea/encodings.xml b/.idea/encodings.xml index 210ab4d4..d920afab 100644 --- a/.idea/encodings.xml +++ b/.idea/encodings.xml @@ -3,11 +3,11 @@ - + diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java index 41f97514..2bd97016 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java @@ -45,4 +45,6 @@ public interface ActionCapability { MetaActionInfo loadMetaActionInfo(@NonNull String actionKey); boolean checkExists(String... actionKeys); + + void execute(MetaAction metaAction); } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java index c70813c4..bfbbb7f9 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java @@ -55,6 +55,7 @@ public class ActionCore extends PartnerCore { */ private final LinkedHashMap existedMetaActions = new LinkedHashMap<>(); private final List phaserRecords = new ArrayList<>(); + private final SandboxRunnerClient sandboxRunnerClient = new SandboxRunnerClient(); public ActionCore() throws IOException, ClassNotFoundException { new ActionWatchService(existedMetaActions, virtualExecutor).launch(); @@ -241,6 +242,11 @@ public class ActionCore extends PartnerCore { return existedMetaActions.keySet().containsAll(Arrays.asList(actionKeys)); } + @CapabilityMethod + public void execute(MetaAction metaAction) { + sandboxRunnerClient.run(metaAction); + } + /** * 命中缓存且评估通过时 * diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionWatchService.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionWatchService.java index 8af7987b..27c72ff2 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionWatchService.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionWatchService.java @@ -17,6 +17,7 @@ import java.util.concurrent.ExecutorService; import static work.slhaf.partner.common.Constant.Path.ACTION_PROGRAM; +// TODO 后续需迁移至 SandboxRunner,作为容器内的监听逻辑 @SuppressWarnings("unchecked") @Slf4j class ActionWatchService { diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/SandboxRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/SandboxRunnerClient.java new file mode 100644 index 00000000..bb2ff561 --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/SandboxRunnerClient.java @@ -0,0 +1,36 @@ +package work.slhaf.partner.core.action; + +import work.slhaf.partner.core.action.entity.MetaAction; + +import java.nio.file.Path; + +/** + * 基于 Http 与 WebSocket 的沙盒执行器客户端,负责: + *
    + *
  • + * 发送行动单元数据 + *
  • + *
  • + * 实时更新获取已存在行动列表 + *
  • + *
  • + * 向传入的 MetaAction 回写执行结果 + *
  • + *
+ */ +class SandboxRunnerClient { + + public SandboxRunnerClient() { + // 连接沙盒执行器(websocket) + } + + public void run(MetaAction metaAction) { + // 获取已存在行动列表 + Path path = metaAction.checkAndGetPath(); + if (!metaAction.getResult().isSuccess()) { + return; + } + // 调用沙盒执行器 + } + +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java index fafb6840..78c95c2c 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java @@ -2,7 +2,6 @@ package work.slhaf.partner.core.action.entity; import lombok.Data; import org.jetbrains.annotations.NotNull; -import work.slhaf.partner.common.Constant; import java.io.File; import java.nio.file.Path; @@ -10,10 +9,10 @@ import java.nio.file.Path; import static work.slhaf.partner.common.Constant.Path.ACTION_PROGRAM; /** - * 行动链中的单一元素,实现{@link Runnable}接口,封装了调用外部行动程序的必要信息,可被执行 + * 行动链中的单一元素,封装了调用外部行动程序的必要信息与结果容器,可被{@link work.slhaf.partner.core.action.ActionCapability}执行 */ @Data -public class MetaAction implements Comparable, Runnable { +public class MetaAction implements Comparable { /** * 行动key,用于标识与定位行动程序 @@ -40,48 +39,23 @@ public class MetaAction implements Comparable, Runnable { */ private MetaActionType type; - @Override - public int compareTo(@NotNull MetaAction metaAction) { - return this.order - metaAction.order; - } - - @Override - public void run() { - File action = loadFromFile(); + public Path checkAndGetPath() { + Path path = switch (type) { + case PLUGIN -> Path.of(ACTION_PROGRAM, key, "action.jar"); + case SCRIPT -> Path.of(ACTION_PROGRAM, key, "action.py"); + case MCP -> Path.of(ACTION_PROGRAM, key, "action.json"); + }; + File action = path.toFile(); if (!action.exists()) { result.setSuccess(false); result.setData("Action file not found: " + action.getAbsolutePath()); } - try { - switch (type) { - case PLUGIN -> executePlugin(action); - case MCP -> executeMcp(action); - case SCRIPT -> executeScript(action); - } - } catch (Exception e) { - result.setSuccess(false); - result.setData(e.getMessage()); - } + return path; } - private File loadFromFile() { - return switch (type) { - case PLUGIN -> Path.of(Constant.Path.ACTION_PROGRAM, key, "action.jar").toFile(); - case SCRIPT -> Path.of(ACTION_PROGRAM, key, "action.py").toFile(); - case MCP -> Path.of(ACTION_PROGRAM, key, "action.json").toFile(); - }; - } - - private void executePlugin(File actionFile) { - - } - - private void executeMcp(File actionFile) { - - } - - private void executeScript(File actionFile) { - + @Override + public int compareTo(@NotNull MetaAction metaAction) { + return this.order - metaAction.order; } @Data diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java index a1f0f16a..8155d5ca 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java @@ -51,9 +51,12 @@ public class ActionExecutor extends AgentRunningSubModule orderList = new ArrayList<>(actionChain.keySet().stream().toList()); + orderList.sort(Integer::compareTo); try { - actionChain.forEach((k, v) -> { - for (MetaAction metaAction : v) { + for (Integer order : orderList) { + List metaActions = actionChain.get(order); + for (MetaAction metaAction : metaActions) { // 根据io类型放入合适的列表 if (metaAction.isIo()) { virtual.add(metaAction); @@ -65,7 +68,7 @@ public class ActionExecutor extends AgentRunningSubModule { try { - action.run(); + actionCapability.execute(action); } finally { phaser.arriveAndDeregister(); } From 4e32129b313e09a555d2b6e4240b3c26a6b8fab4 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 1 Dec 2025 17:20:54 +0800 Subject: [PATCH 016/182] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=A1=8C=E5=8A=A8?= =?UTF-8?q?=E9=93=BE=E7=BB=93=E6=9E=84=E5=8F=8A=E7=9B=B8=E5=85=B3=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E3=80=81=E9=92=88=E5=AF=B9=20ActionPlanner=20?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E7=BB=84=E4=BB=B6=E5=81=9A=E5=87=BA=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将existedMetaActions的实现由LinkedHashMap替换为HashMap,免去不必要的性能消耗 - 在 ActionCapability 中新增 listAvailableActions 方法用于获取当前存在的可用行动 - 将 ActionData 及相关类中的 LinkedHashMap 替换为普通Map,阶段并发将通过遍历key集合进行,而非针对原始行动链进行遍历 - 在 ActionPlanner 中完善行动链依赖修正逻辑,防止行动单元执行时的输入缺失 - 在 ActionEvaluator 中调整了 Prompt 构建方式 - 调整处理行动链相关代码,移除多余参数,简化方法签名 - 修正 EvaluatorResult 中行动链数据结构为Map,LLM将直接返回初始行动链,后续将加载行动数据并修复行动单元间的依赖关系 - 优化 InterventionHandler、ActionExecutor 等模块中对行动链Map的使用 --- .../partner/core/action/ActionCapability.java | 5 +- .../slhaf/partner/core/action/ActionCore.java | 6 +- .../core/action/ActionWatchService.java | 6 +- .../core/action/entity/ActionData.java | 4 +- .../dispatcher/executor/ActionExecutor.java | 15 ++- .../handler/InterventionHandler.java | 8 +- .../modules/action/planner/ActionPlanner.java | 109 +++++++++++++++--- .../planner/evaluator/ActionEvaluator.java | 38 +++++- .../evaluator/entity/EvaluatorBatchInput.java | 2 + .../evaluator/entity/EvaluatorResult.java | 4 +- 10 files changed, 152 insertions(+), 45 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java index 2bd97016..a887145f 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java @@ -8,7 +8,6 @@ import work.slhaf.partner.core.action.entity.MetaActionInfo; import work.slhaf.partner.core.action.entity.cache.CacheAdjustData; import java.util.List; -import java.util.Set; import java.util.concurrent.ExecutorService; import java.util.concurrent.Phaser; @@ -30,8 +29,6 @@ public interface ActionCapability { ExecutorService getExecutor(ActionCore.ExecutorType type); - Set getExistedMetaActions(); - void putPhaserRecord(Phaser phaser, ActionData actionData); void removePhaserRecord(Phaser phaser); @@ -44,6 +41,8 @@ public interface ActionCapability { MetaActionInfo loadMetaActionInfo(@NonNull String actionKey); + List listAvailableActions(); + boolean checkExists(String... actionKeys); void execute(MetaAction metaAction); diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java index bfbbb7f9..5ecc235c 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java @@ -53,7 +53,7 @@ public class ActionCore extends PartnerCore { /** * 已存在的行动程序,键为目录名,值为从目录加载的行动程序元信息 */ - private final LinkedHashMap existedMetaActions = new LinkedHashMap<>(); + private final Map existedMetaActions = new HashMap<>(); private final List phaserRecords = new ArrayList<>(); private final SandboxRunnerClient sandboxRunnerClient = new SandboxRunnerClient(); @@ -177,8 +177,8 @@ public class ActionCore extends PartnerCore { } @CapabilityMethod - public Set getExistedMetaActions() { - return existedMetaActions.keySet(); + public List listAvailableActions() { + return existedMetaActions.values().stream().toList(); } @CapabilityMethod diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionWatchService.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionWatchService.java index 27c72ff2..9b265f0e 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionWatchService.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionWatchService.java @@ -11,8 +11,8 @@ import java.io.IOException; import java.nio.file.*; import java.nio.file.attribute.BasicFileAttributes; import java.util.HashMap; -import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; import java.util.concurrent.ExecutorService; import static work.slhaf.partner.common.Constant.Path.ACTION_PROGRAM; @@ -23,10 +23,10 @@ import static work.slhaf.partner.common.Constant.Path.ACTION_PROGRAM; class ActionWatchService { private final HashMap registeredPaths = new HashMap<>(); - private final LinkedHashMap existedMetaActions; + private final Map existedMetaActions; private final ExecutorService virtualExecutor; - public ActionWatchService(LinkedHashMap existedMetaActions, ExecutorService virtualExecutor) { + public ActionWatchService(Map existedMetaActions, ExecutorService virtualExecutor) { this.existedMetaActions = existedMetaActions; this.virtualExecutor = virtualExecutor; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java index a2362e4c..cdc63892 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java @@ -4,8 +4,8 @@ import cn.hutool.json.JSONObject; import lombok.Data; import java.util.ArrayList; -import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; /** * 行动模块传递的行动数据,包含行动uuid、倾向、状态、行动链、结果、发起原因、行动描述等信息。 @@ -28,7 +28,7 @@ public abstract class ActionData { /** * 行动链 */ - protected LinkedHashMap> actionChain = new LinkedHashMap<>(); + protected Map> actionChain; /** * 行动阶段(当前阶段) */ diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java index 8155d5ca..e5d143f1 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java @@ -13,8 +13,8 @@ import work.slhaf.partner.core.action.entity.ImmediateActionData; import work.slhaf.partner.core.action.entity.MetaAction; import java.util.ArrayList; -import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; import java.util.concurrent.ExecutorService; import java.util.concurrent.Phaser; @@ -45,7 +45,7 @@ public class ActionExecutor extends AgentRunningSubModule { actionData.setStatus(ActionData.ActionStatus.EXECUTING); - LinkedHashMap> actionChain = actionData.getActionChain(); + Map> actionChain = actionData.getActionChain(); List virtual = new ArrayList<>(); List platform = new ArrayList<>(); Phaser phaser = new Phaser(); @@ -64,7 +64,7 @@ public class ActionExecutor extends AgentRunningSubModule virtual, List platform, - LinkedHashMap> actionChain, Phaser phaser) { + Phaser phaser) { runGroupAction(virtual, virtualExecutor, phaser); runGroupAction(platform, platformExecutor, phaser); } @@ -89,6 +89,9 @@ public class ActionExecutor extends AgentRunningSubModule { try { + //TODO 使用 LLM 填充行动参数信息 + + actionCapability.execute(action); MetaAction.Result result = action.getResult(); do { // 该循环对应LLM的调整参数后重试 @@ -97,7 +100,7 @@ public class ActionExecutor extends AgentRunningSubModule> actionChain = actionData.getActionChain(); + Map> actionChain = actionData.getActionChain(); actionChain.put(order, actions); if (order == actionData.getExecutingStage()) { @@ -159,7 +159,7 @@ public class InterventionHandler extends AgentRunningSubModule actions) { if (order <= actionData.getExecutingStage()) return; - LinkedHashMap> actionChain = actionData.getActionChain(); + Map> actionChain = actionData.getActionChain(); if (actionChain.containsKey(order)) { actionChain.get(order).removeAll(actions); if (actionChain.get(order).isEmpty()) { @@ -174,7 +174,7 @@ public class InterventionHandler extends AgentRunningSubModule actions) { - LinkedHashMap> actionChain = actionData.getActionChain(); + Map> actionChain = actionData.getActionChain(); actionChain.put(order, actions); } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java index 60b390a2..fb834340 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java @@ -1,6 +1,7 @@ package work.slhaf.partner.module.modules.action.planner; import lombok.extern.slf4j.Slf4j; +import org.jetbrains.annotations.NotNull; import work.slhaf.partner.api.agent.factory.capability.annotation.InjectCapability; import work.slhaf.partner.api.agent.factory.module.annotation.AgentModule; import work.slhaf.partner.api.agent.factory.module.annotation.Init; @@ -9,10 +10,7 @@ import work.slhaf.partner.api.chat.pojo.Message; import work.slhaf.partner.common.vector.VectorClient; import work.slhaf.partner.core.action.ActionCapability; import work.slhaf.partner.core.action.ActionCore; -import work.slhaf.partner.core.action.entity.ActionData; -import work.slhaf.partner.core.action.entity.ImmediateActionData; -import work.slhaf.partner.core.action.entity.MetaAction; -import work.slhaf.partner.core.action.entity.ScheduledActionData; +import work.slhaf.partner.core.action.entity.*; import work.slhaf.partner.core.action.entity.cache.CacheAdjustData; import work.slhaf.partner.core.action.entity.cache.CacheAdjustMetaData; import work.slhaf.partner.core.cognation.CognationCapability; @@ -33,6 +31,7 @@ import work.slhaf.partner.runtime.interaction.data.context.PartnerRunningFlowCon import java.util.*; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; +import java.util.concurrent.atomic.AtomicBoolean; /** * 负责针对本次输入生成基础的行动计划,在主模型传达意愿后,执行行动或者放入计划池 @@ -92,14 +91,15 @@ public class ActionPlanner extends PreRunningModule { return null; } EvaluatorInput evaluatorInput = assemblyHelper.buildEvaluatorInput(extractorResult, context.getUserId()); - List evaluatorResults = actionEvaluator.execute(evaluatorInput); //并发操作均为访问 - setupActionInfo(evaluatorResults, context); + List evaluatorResults = actionEvaluator.execute(evaluatorInput); // 并发操作均为访问 + putActionData(evaluatorResults, context); updateTendencyCache(evaluatorResults, context.getInput(), extractorResult); return null; }); } - private void updateTendencyCache(List evaluatorResults, String input, ExtractorResult extractorResult) { + private void updateTendencyCache(List evaluatorResults, String input, + ExtractorResult extractorResult) { if (!VectorClient.status) { return; } @@ -137,7 +137,7 @@ public class ActionPlanner extends PreRunningModule { } private void setupConfirmedActionInfo(PartnerRunningFlowContext context, ConfirmerResult result) { - //TODO 需考虑未确认任务的失效或者拒绝时机,在action core中实现 + // TODO 需考虑未确认任务的失效或者拒绝时机,在action core中实现 List uuids = result.getUuids(); if (uuids == null) { return; @@ -151,10 +151,9 @@ public class ActionPlanner extends PreRunningModule { } } - - private void setupActionInfo(List evaluatorResults, PartnerRunningFlowContext context) { + private void putActionData(List evaluatorResults, PartnerRunningFlowContext context) { for (EvaluatorResult evaluatorResult : evaluatorResults) { - ActionData actionData = assemblyHelper.buildMetaActionInfo(evaluatorResult); + ActionData actionData = assemblyHelper.buildActionData(evaluatorResult); if (evaluatorResult.isNeedConfirm()) { actionCapability.putPendingActions(context.getUserId(), actionData); } else { @@ -163,7 +162,6 @@ public class ActionPlanner extends PreRunningModule { } } - @Override protected Map getPromptDataMap(PartnerRunningFlowContext context) { HashMap map = new HashMap<>(); @@ -233,15 +231,12 @@ public class ActionPlanner extends PreRunningModule { return input; } - private ActionData buildMetaActionInfo(EvaluatorResult evaluatorResult) { - LinkedHashMap> actionChain = new LinkedHashMap<>(); - for (MetaAction metaAction : evaluatorResult.getActionChain()) { - actionChain.computeIfAbsent(metaAction.getOrder(), k -> new ArrayList<>()).add(metaAction); - } + private ActionData buildActionData(EvaluatorResult evaluatorResult) { + Map> actionChain = getActionChain(evaluatorResult); return switch (evaluatorResult.getType()) { case PLANNING -> { ScheduledActionData actionInfo = new ScheduledActionData(); - actionInfo.getActionChain().putAll(actionChain); + actionInfo.setActionChain(actionChain); actionInfo.setScheduleContent(evaluatorResult.getScheduleContent()); actionInfo.setStatus(ActionData.ActionStatus.PREPARE); actionInfo.setUuid(UUID.randomUUID().toString()); @@ -249,7 +244,7 @@ public class ActionPlanner extends PreRunningModule { } case IMMEDIATE -> { ImmediateActionData actionInfo = new ImmediateActionData(); - actionInfo.getActionChain().putAll(actionChain); + actionInfo.setActionChain(actionChain); actionInfo.setStatus(ActionData.ActionStatus.PREPARE); actionInfo.setUuid(UUID.randomUUID().toString()); yield actionInfo; @@ -257,6 +252,82 @@ public class ActionPlanner extends PreRunningModule { }; } + private @NotNull Map> getActionChain(EvaluatorResult evaluatorResult) { + Map> actionChain = new HashMap<>(); + Map> primaryActionChain = evaluatorResult.getPrimaryActionChain(); + fixDependencies(primaryActionChain); + primaryActionChain.forEach((order, actionKeys) -> { + List metaActions = actionKeys.stream() + .map(actionKey -> actionCapability.loadMetaAction(actionKey)) + .toList(); + actionChain.put(order, metaActions); + }); + return actionChain; + } + + private void fixDependencies(Map> primaryActionChain) { + // 先将 primaryActionChain 的节点序号修正为从1开始依次增大 + fixOrder(primaryActionChain); + List fixedOrders = new ArrayList<>(primaryActionChain.keySet().stream().toList()); + AtomicBoolean fixed = new AtomicBoolean(false); + do { + Set tempOrders = new HashSet<>(); + fixedOrders.sort(Integer::compareTo); + for (Integer fixedOrder : fixedOrders) { + int lastOrder = fixedOrder - 1; + List actionKeys = primaryActionChain.get(fixedOrder); + for (String actionKey : actionKeys) { + // 根据 actionKey 加载行动信息,并检查是否存在必需前置依赖 + MetaActionInfo metaActionInfo = actionCapability.loadMetaActionInfo(actionKey); + List preActions = metaActionInfo.getPreActions(); + boolean preActionsExist = preActions != null && !preActions.isEmpty(); + if (!preActionsExist) { + continue; + } + if (!metaActionInfo.isStrictDependencies()) { + continue; + } + if (checkDependenciesExist(lastOrder, preActions, primaryActionChain)) { + continue; + } + + // 如果存在前置依赖,则将其放置在当前order之前的位置, + // 放置位置优先选择已存在的上一节点,如果不存在(行动链的头节点时)则需要向行动链新增order + // 不需要检查行动链的当前节点的已存在 Action 是否为新 Action 的依赖项,因为这些 Action 实际来自 LLM + // 的评估结果,并非作为依赖项存在 + fixed.set(true); + List actionsInChain = primaryActionChain.computeIfAbsent(lastOrder, + list -> new ArrayList<>()); + preActions = new ArrayList<>(preActions); + preActions.removeAll(actionsInChain); + actionsInChain.addAll(preActions); + tempOrders.add(lastOrder); + } + } + fixedOrders.clear(); + fixedOrders.addAll(tempOrders); + } while (fixed.getAndSet(false)); + } + + private void fixOrder(Map> primaryActionChain) { + Map> tempChain = new HashMap<>(primaryActionChain); + primaryActionChain.clear(); + int chainSize = tempChain.size(); + for (int i = 0; i < chainSize; i++) { + primaryActionChain.put(i, tempChain.get(i)); + } + } + + private boolean checkDependenciesExist(int lastOrder, List preActions, + Map> primaryActionChain) { + if (!primaryActionChain.containsKey(lastOrder)) { + return false; + } + List existActions = primaryActionChain.get(lastOrder); + //noinspection SlowListContainsAll + return existActions.containsAll(preActions); + } + private ConfirmerInput buildConfirmerInput(PartnerRunningFlowContext context) { ConfirmerInput confirmerInput = new ConfirmerInput(); confirmerInput.setInput(context.getInput()); diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/evaluator/ActionEvaluator.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/evaluator/ActionEvaluator.java index 5fd56b9b..0ca828aa 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/evaluator/ActionEvaluator.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/evaluator/ActionEvaluator.java @@ -1,24 +1,34 @@ package work.slhaf.partner.module.modules.action.planner.evaluator; import cn.hutool.core.bean.BeanUtil; +import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; +import work.slhaf.partner.api.agent.factory.capability.annotation.InjectCapability; import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule; import work.slhaf.partner.api.agent.factory.module.annotation.Init; import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.ActivateModel; import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.AgentRunningSubModule; import work.slhaf.partner.api.chat.pojo.ChatResponse; import work.slhaf.partner.common.thread.InteractionThreadPoolExecutor; +import work.slhaf.partner.core.action.ActionCapability; +import work.slhaf.partner.core.action.entity.MetaActionInfo; +import work.slhaf.partner.core.memory.pojo.EvaluatedSlice; import work.slhaf.partner.module.modules.action.planner.evaluator.entity.EvaluatorBatchInput; import work.slhaf.partner.module.modules.action.planner.evaluator.entity.EvaluatorInput; import work.slhaf.partner.module.modules.action.planner.evaluator.entity.EvaluatorResult; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.concurrent.Callable; @AgentSubModule public class ActionEvaluator extends AgentRunningSubModule> implements ActivateModel { + @InjectCapability + private ActionCapability actionCapability; + private InteractionThreadPoolExecutor executor; @Init @@ -30,7 +40,7 @@ public class ActionEvaluator extends AgentRunningSubModule execute(EvaluatorInput data) { @@ -39,12 +49,11 @@ public class ActionEvaluator extends AgentRunningSubModule> getTasks(List batchInputs) { List> list = new ArrayList<>(); for (EvaluatorBatchInput batchInput : batchInputs) { list.add(() -> { - ChatResponse response = this.singleChat(JSONObject.toJSONString(batchInput)); + ChatResponse response = this.singleChat(buildPrompt(batchInput)); EvaluatorResult evaluatorResult = JSONObject.parseObject(response.getMessage(), EvaluatorResult.class); evaluatorResult.setTendency(batchInput.getTendency()); return evaluatorResult; @@ -59,11 +68,34 @@ public class ActionEvaluator extends AgentRunningSubModule availableActions = new HashMap<>(); + for (MetaActionInfo metaActionInfo : actionCapability.listAvailableActions()) { + availableActions.put(metaActionInfo.getKey(), metaActionInfo.getDescription()); + } + temp.setAvailableActions(availableActions); list.add(temp); } return list; } + private String buildPrompt(EvaluatorBatchInput batchInput) { + JSONObject prompt = new JSONObject(); + prompt.put("[行动倾向]", batchInput.getTendency()); + + JSONArray memoryData = prompt.putArray("[相关记忆切片]"); + for (EvaluatedSlice evaluatedSlice : batchInput.getActivatedSlices()) { + JSONObject memory = memoryData.addObject(); + memory.put("[日期]", evaluatedSlice.getDate()); + memory.put("[摘要]", evaluatedSlice.getSummary()); + + } + + JSONObject availableActionData = prompt.putObject("[可用行动单元]"); + availableActionData.putAll(batchInput.getAvailableActions()); + + return prompt.toString(); + } + @Override public String modelKey() { return "action_evaluator"; diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/evaluator/entity/EvaluatorBatchInput.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/evaluator/entity/EvaluatorBatchInput.java index 33114b9a..78ee229e 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/evaluator/entity/EvaluatorBatchInput.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/evaluator/entity/EvaluatorBatchInput.java @@ -5,10 +5,12 @@ import work.slhaf.partner.api.chat.pojo.Message; import work.slhaf.partner.core.memory.pojo.EvaluatedSlice; import java.util.List; +import java.util.Map; @Data public class EvaluatorBatchInput { private List recentMessages; private List activatedSlices; + private Map availableActions; private String tendency; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/evaluator/entity/EvaluatorResult.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/evaluator/entity/EvaluatorResult.java index 76289180..1db2a03c 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/evaluator/entity/EvaluatorResult.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/evaluator/entity/EvaluatorResult.java @@ -1,9 +1,9 @@ package work.slhaf.partner.module.modules.action.planner.evaluator.entity; import lombok.Data; -import work.slhaf.partner.core.action.entity.MetaAction; import java.util.List; +import java.util.Map; @Data public class EvaluatorResult { @@ -11,7 +11,7 @@ public class EvaluatorResult { private boolean needConfirm; private ActionType type; private String scheduleContent; - private List actionChain; + private Map> primaryActionChain; private String tendency; public enum ActionType { From 1d315a9b628e260204ab2eb93516cf7e60a9a7d5 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 1 Dec 2025 19:25:21 +0800 Subject: [PATCH 017/182] =?UTF-8?q?ActionExecutor=20=E7=9A=84=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E6=B5=81=E7=A8=8B=E8=A7=84=E5=88=92=E5=AE=8C=E6=AF=95?= =?UTF-8?q?=EF=BC=8C=E5=85=B7=E4=BD=93=E9=80=BB=E8=BE=91=E5=BE=85=E5=A1=AB?= =?UTF-8?q?=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 调整了部分代码分布,移除了某些非必需的转发方法 - 新增几个 TODO 内容,后续工作已明确 这套调度方式看起来真的有些‘探索性质’了。实际上看起来有些像把 ReAct 的逻辑显式地进行了工程实现,不管是修复、依据状态选择行动单元生成还是阶段间针对行动单元的参数提取,在 ReAct Agent 中都是由一个智能体完成的。 但在这里,它要做的事情太多了,再加上 Partner 行动链的干预逻辑、幻觉参数又不可接受所以需要自对话或者用户干预,这些东西交给一个 ReAct 模块恐怕并不合适也不放心。所以这种显式模块划分应该更符合 Partner 行动模块的需求。 这点硬要说的话,应该还是在于‘ReAct 行为’并非 Partner 的全部吧。 不过谁知道呢,也许以后也会变,但这套至少现在看来是更能实现理想行为的 --- .../dispatcher/executor/ActionExecutor.java | 91 +++++++------------ .../dispatcher/executor/ActionRepairer.java | 29 ++++++ .../executor/DynamicActionGenerator.java | 29 ++++++ .../dispatcher/executor/ParamsExtractor.java | 29 ++++++ .../executor/entity/GeneratorInput.java | 7 ++ .../executor/entity/GeneratorResult.java | 7 ++ .../executor/entity/ParamsExtractorInput.java | 8 ++ .../executor/entity/RepairerInput.java | 7 ++ .../executor/entity/RepairerResult.java | 7 ++ .../handler/InterventionHandler.java | 1 + 10 files changed, 159 insertions(+), 56 deletions(-) create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionRepairer.java create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/DynamicActionGenerator.java create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ParamsExtractor.java create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/GeneratorInput.java create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/GeneratorResult.java create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ParamsExtractorInput.java create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/RepairerInput.java create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/RepairerResult.java diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java index e5d143f1..2b06362e 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java @@ -4,7 +4,6 @@ import lombok.extern.slf4j.Slf4j; import work.slhaf.partner.api.agent.factory.capability.annotation.InjectCapability; import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule; import work.slhaf.partner.api.agent.factory.module.annotation.Init; -import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.ActivateModel; import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.AgentRunningSubModule; import work.slhaf.partner.core.action.ActionCapability; import work.slhaf.partner.core.action.ActionCore; @@ -20,7 +19,7 @@ import java.util.concurrent.Phaser; @Slf4j @AgentSubModule -public class ActionExecutor extends AgentRunningSubModule, Void> implements ActivateModel { +public class ActionExecutor extends AgentRunningSubModule, Void> { @InjectCapability private ActionCapability actionCapability; @@ -37,59 +36,49 @@ public class ActionExecutor extends AgentRunningSubModule immediateActions) { for (ImmediateActionData actionData : immediateActions) { - handleActionData(actionData); + virtualExecutor.execute(() -> { + actionData.setStatus(ActionData.ActionStatus.EXECUTING); + Map> actionChain = actionData.getActionChain(); + List virtual = new ArrayList<>(); + List platform = new ArrayList<>(); + Phaser phaser = new Phaser(); + phaser.register(); + actionCapability.putPhaserRecord(phaser, actionData); + List orderList = new ArrayList<>(actionChain.keySet().stream().toList()); + orderList.sort(Integer::compareTo); + try { + for (Integer order : orderList) { + List metaActions = actionChain.get(order); + for (MetaAction metaAction : metaActions) { + // 根据io类型放入合适的列表 + if (metaAction.isIo()) { + virtual.add(metaAction); + } else { + platform.add(metaAction); + } + } + // 使用phaser来承担同组的动态任务新增 + runGroupAction(virtual, virtualExecutor, phaser); + runGroupAction(platform, platformExecutor, phaser); + phaser.arriveAndAwaitAdvance(); + virtual.clear(); + platform.clear(); + } + } finally { + phaser.arriveAndDeregister(); + actionCapability.removePhaserRecord(phaser); + } + }); } return null; } - private void handleActionData(ImmediateActionData actionData) { - virtualExecutor.execute(() -> { - actionData.setStatus(ActionData.ActionStatus.EXECUTING); - Map> actionChain = actionData.getActionChain(); - List virtual = new ArrayList<>(); - List platform = new ArrayList<>(); - Phaser phaser = new Phaser(); - phaser.register(); - actionCapability.putPhaserRecord(phaser, actionData); - List orderList = new ArrayList<>(actionChain.keySet().stream().toList()); - orderList.sort(Integer::compareTo); - try { - for (Integer order : orderList) { - List metaActions = actionChain.get(order); - for (MetaAction metaAction : metaActions) { - // 根据io类型放入合适的列表 - if (metaAction.isIo()) { - virtual.add(metaAction); - } else { - platform.add(metaAction); - } - } - runGroupAction(virtual, platform, phaser); - phaser.arriveAndAwaitAdvance(); - virtual.clear(); - platform.clear(); - } - } finally { - phaser.arriveAndDeregister(); - actionCapability.removePhaserRecord(phaser); - } - }); - - } - - // 使用phaser来承担同组的动态任务新增 - private void runGroupAction(List virtual, List platform, - Phaser phaser) { - runGroupAction(virtual, virtualExecutor, phaser); - runGroupAction(platform, platformExecutor, phaser); - } - private void runGroupAction(List actions, ExecutorService executor, Phaser phaser) { phaser.bulkRegister(actions.size()); for (MetaAction action : actions) { executor.execute(() -> { try { - //TODO 使用 LLM 填充行动参数信息 + //TODO 使用 ParamsExtractor 填充行动参数信息,如果已知内容不足以满足参数需求,则进行行动链调整(ActionRepairer) actionCapability.execute(action); MetaAction.Result result = action.getResult(); @@ -119,14 +108,4 @@ public class ActionExecutor extends AgentRunningSubModule implements ActivateModel { + + @Override + public RepairerResult execute(RepairerInput data) { + return null; + } + + @Override + public String modelKey() { + return ""; + } + + @Override + public boolean withBasicPrompt() { + return false; + } +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/DynamicActionGenerator.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/DynamicActionGenerator.java new file mode 100644 index 00000000..770036db --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/DynamicActionGenerator.java @@ -0,0 +1,29 @@ +package work.slhaf.partner.module.modules.action.dispatcher.executor; + +import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule; +import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.ActivateModel; +import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.AgentRunningSubModule; +import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.GeneratorInput; +import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.GeneratorResult; + +/** + * 负责依据输入内容生成可执行的动态行动单元,并选择是否持久化至 SandboxRunner 容器内 + */ +@AgentSubModule +public class DynamicActionGenerator extends AgentRunningSubModule implements ActivateModel { + + @Override + public GeneratorResult execute(GeneratorInput data) { + return null; + } + + @Override + public String modelKey() { + return ""; + } + + @Override + public boolean withBasicPrompt() { + return false; + } +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ParamsExtractor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ParamsExtractor.java new file mode 100644 index 00000000..f94b1aa6 --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ParamsExtractor.java @@ -0,0 +1,29 @@ +package work.slhaf.partner.module.modules.action.dispatcher.executor; + +import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule; +import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.ActivateModel; +import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.AgentRunningSubModule; +import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.ParamsExtractorInput; + +/** + * 负责依据输入内容进行行动单元的参数信息提取 + */ +@AgentSubModule +public class ParamsExtractor extends AgentRunningSubModule implements ActivateModel { + + @Override + public String[] execute(ParamsExtractorInput data) { + return new String[0]; + } + + @Override + public String modelKey() { + return ""; + } + + @Override + public boolean withBasicPrompt() { + return false; + } + +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/GeneratorInput.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/GeneratorInput.java new file mode 100644 index 00000000..89d52ba8 --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/GeneratorInput.java @@ -0,0 +1,7 @@ +package work.slhaf.partner.module.modules.action.dispatcher.executor.entity; + +import lombok.Data; + +@Data +public class GeneratorInput { +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/GeneratorResult.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/GeneratorResult.java new file mode 100644 index 00000000..6290856d --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/GeneratorResult.java @@ -0,0 +1,7 @@ +package work.slhaf.partner.module.modules.action.dispatcher.executor.entity; + +import lombok.Data; + +@Data +public class GeneratorResult { +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ParamsExtractorInput.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ParamsExtractorInput.java new file mode 100644 index 00000000..b78dd7e0 --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ParamsExtractorInput.java @@ -0,0 +1,8 @@ +package work.slhaf.partner.module.modules.action.dispatcher.executor.entity; + +import lombok.Data; + +@Data +public class ParamsExtractorInput { + +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/RepairerInput.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/RepairerInput.java new file mode 100644 index 00000000..92ffcc6f --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/RepairerInput.java @@ -0,0 +1,7 @@ +package work.slhaf.partner.module.modules.action.dispatcher.executor.entity; + +import lombok.Data; + +@Data +public class RepairerInput { +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/RepairerResult.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/RepairerResult.java new file mode 100644 index 00000000..c8e56ce2 --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/RepairerResult.java @@ -0,0 +1,7 @@ +package work.slhaf.partner.module.modules.action.dispatcher.executor.entity; + +import lombok.Data; + +@Data +public class RepairerResult { +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/InterventionHandler.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/InterventionHandler.java index cc54d0db..e3c8667a 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/InterventionHandler.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/InterventionHandler.java @@ -96,6 +96,7 @@ public class InterventionHandler extends AgentRunningSubModule actionCapability.loadMetaAction(actionKey)) .toList(); + //TODO 需要将干预逻辑下放至 ActionCapability ,因为 ActionExecutor 中也存在干预操作 switch (intervention.getType()) { case InterventionType.APPEND -> handleAppend(actionData, intervention.getOrder(), actions); case InterventionType.INSERT -> handleInsert(actionData, intervention.getOrder(), actions, phaser); From ad973d4230c2200fc21bab291fe8bc2da26d9c13 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Tue, 2 Dec 2025 22:35:53 +0800 Subject: [PATCH 018/182] =?UTF-8?q?=E5=AF=B9=20ActionExecutor=20=E4=B8=8B?= =?UTF-8?q?=E5=AD=90=E6=A8=A1=E5=9D=97=E7=9A=84=E5=8A=9F=E8=83=BD=E5=88=86?= =?UTF-8?q?=E5=B8=83=E3=80=81=E6=9F=90=E4=BA=9B=E5=AE=9E=E4=BD=93=E7=B1=BB?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E4=BA=86=E8=B0=83=E6=95=B4;=20=E5=AE=8C?= =?UTF-8?q?=E5=96=84=E4=BA=86=20ActionExecutor=20=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E5=A4=A7=E8=87=B4=E6=89=A7=E8=A1=8C=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 梳理执行链路时发现 ActionRepairer 的能力明显超出可实现边界,故将其能力进行限定 - 新增 ActionCorrector 负责单组行动执行完毕后,根据意图和执行状况进行行动链修正 - 将 PhaserRecord 拆分为独立实体,未来将封装一部分流程控制逻辑 --- .idea/misc.xml | 13 +-- .../partner/core/action/ActionCapability.java | 7 +- .../slhaf/partner/core/action/ActionCore.java | 13 +-- .../core/action/entity/ActionData.java | 4 + .../core/action/entity/PhaserRecord.java | 20 ++++ .../dispatcher/executor/ActionCorrector.java | 30 ++++++ .../dispatcher/executor/ActionExecutor.java | 92 +++++++++++++++---- .../dispatcher/executor/ActionRepairer.java | 13 ++- .../dispatcher/executor/ParamsExtractor.java | 11 ++- .../executor/entity/CorrectorInput.java | 7 ++ .../executor/entity/CorrectorResult.java | 7 ++ ...xtractorInput.java => ExtractorInput.java} | 2 +- .../executor/entity/ExtractorResult.java | 9 ++ .../executor/entity/RepairerResult.java | 21 +++++ .../action/interventor/ActionInterventor.java | 2 +- .../evaluator/InterventionEvaluator.java | 2 +- .../evaluator/entity/EvaluatorInput.java | 2 +- .../handler/InterventionHandler.java | 2 +- .../handler/entity/HandlerInput.java | 2 +- .../recognizer/InterventionRecognizer.java | 7 +- .../recognizer/entity/RecognizerInput.java | 4 +- .../recognizer/entity/RecognizerResult.java | 4 +- 22 files changed, 224 insertions(+), 50 deletions(-) create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/PhaserRecord.java create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionCorrector.java create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/CorrectorInput.java create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/CorrectorResult.java rename Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/{ParamsExtractorInput.java => ExtractorInput.java} (75%) create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ExtractorResult.java diff --git a/.idea/misc.xml b/.idea/misc.xml index 1277c99b..ff5d8541 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,7 +1,7 @@ - + @@ -11,11 +11,12 @@ - - - - - + + + + + + diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java index a887145f..7c021c06 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java @@ -5,6 +5,7 @@ import work.slhaf.partner.api.agent.factory.capability.annotation.Capability; import work.slhaf.partner.core.action.entity.ActionData; import work.slhaf.partner.core.action.entity.MetaAction; import work.slhaf.partner.core.action.entity.MetaActionInfo; +import work.slhaf.partner.core.action.entity.PhaserRecord; import work.slhaf.partner.core.action.entity.cache.CacheAdjustData; import java.util.List; @@ -29,13 +30,13 @@ public interface ActionCapability { ExecutorService getExecutor(ActionCore.ExecutorType type); - void putPhaserRecord(Phaser phaser, ActionData actionData); + PhaserRecord putPhaserRecord(Phaser phaser, ActionData actionData); void removePhaserRecord(Phaser phaser); - List listPhaserRecords(); + List listPhaserRecords(); - ActionCore.PhaserRecord getPhaserRecord(String tendency, String source); + PhaserRecord getPhaserRecord(String tendency, String source); MetaAction loadMetaAction(@NonNull String actionKey); diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java index 5ecc235c..cd519cf3 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java @@ -10,6 +10,7 @@ import work.slhaf.partner.core.PartnerCore; import work.slhaf.partner.core.action.entity.ActionData; import work.slhaf.partner.core.action.entity.MetaAction; import work.slhaf.partner.core.action.entity.MetaActionInfo; +import work.slhaf.partner.core.action.entity.PhaserRecord; import work.slhaf.partner.core.action.entity.cache.ActionCacheData; import work.slhaf.partner.core.action.entity.cache.CacheAdjustData; import work.slhaf.partner.core.action.entity.cache.CacheAdjustMetaData; @@ -182,15 +183,17 @@ public class ActionCore extends PartnerCore { } @CapabilityMethod - public synchronized void putPhaserRecord(Phaser phaser, ActionData actionData) { - phaserRecords.add(new PhaserRecord(phaser, actionData)); + public synchronized PhaserRecord putPhaserRecord(Phaser phaser, ActionData actionData) { + PhaserRecord record = new PhaserRecord(phaser, actionData); + phaserRecords.add(record); + return record; } @CapabilityMethod public synchronized void removePhaserRecord(Phaser phaser) { PhaserRecord remove = null; for (PhaserRecord record : phaserRecords) { - if (record.phaser.equals(phaser)) { + if (record.phaser().equals(phaser)) { remove = record; } } @@ -203,7 +206,7 @@ public class ActionCore extends PartnerCore { @CapabilityMethod public PhaserRecord getPhaserRecord(String tendency, String source) { for (PhaserRecord record : phaserRecords) { - ActionData data = record.actionData; + ActionData data = record.actionData(); if (data.getTendency().equals(tendency) && data.getSource().equals(source)) { return record; } @@ -345,6 +348,4 @@ public class ActionCore extends PartnerCore { VIRTUAL, PLATFORM } - public record PhaserRecord(Phaser phaser, ActionData actionData) { - } } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java index cdc63892..c56336b4 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java @@ -65,6 +65,10 @@ public abstract class ActionData { * 执行中 */ EXECUTING, + /** + * 暂时中断 + */ + INTERRUPTED, /** * 预备执行 */ diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/PhaserRecord.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/PhaserRecord.java new file mode 100644 index 00000000..7b7b5c88 --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/PhaserRecord.java @@ -0,0 +1,20 @@ +package work.slhaf.partner.core.action.entity; + +import java.util.concurrent.Phaser; + +public record PhaserRecord(Phaser phaser, ActionData actionData) { + + public void fail() { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'fail'"); + } + + + public void interrupt() { + + } + + public void complete() { + + } +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionCorrector.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionCorrector.java new file mode 100644 index 00000000..a040d309 --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionCorrector.java @@ -0,0 +1,30 @@ +package work.slhaf.partner.module.modules.action.dispatcher.executor; + +import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule; +import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.ActivateModel; +import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.AgentRunningSubModule; +import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.CorrectorInput; +import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.CorrectorResult; + +/** + * 负责在单组行动执行后,根据行动意图与结果检查后续行动是否符合目的,必要时直接调整行动链,或发起自对话请求进行干预 + */ +@AgentSubModule +public class ActionCorrector extends AgentRunningSubModule implements ActivateModel { + + @Override + public CorrectorResult execute(CorrectorInput data) { + return null; + } + + @Override + public String modelKey() { + return ""; + } + + @Override + public boolean withBasicPrompt() { + return false; + } + +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java index 2b06362e..0332a6f8 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java @@ -4,12 +4,16 @@ import lombok.extern.slf4j.Slf4j; import work.slhaf.partner.api.agent.factory.capability.annotation.InjectCapability; import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule; import work.slhaf.partner.api.agent.factory.module.annotation.Init; +import work.slhaf.partner.api.agent.factory.module.annotation.InjectModule; import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.AgentRunningSubModule; import work.slhaf.partner.core.action.ActionCapability; import work.slhaf.partner.core.action.ActionCore; import work.slhaf.partner.core.action.entity.ActionData; import work.slhaf.partner.core.action.entity.ImmediateActionData; import work.slhaf.partner.core.action.entity.MetaAction; +import work.slhaf.partner.core.action.entity.PhaserRecord; +import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.*; +import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.RepairerResult.RepairerStatus; import java.util.ArrayList; import java.util.List; @@ -24,9 +28,18 @@ public class ActionExecutor extends AgentRunningSubModule platform = new ArrayList<>(); Phaser phaser = new Phaser(); phaser.register(); - actionCapability.putPhaserRecord(phaser, actionData); + PhaserRecord phaserRecord = actionCapability.putPhaserRecord(phaser, actionData); List orderList = new ArrayList<>(actionChain.keySet().stream().toList()); orderList.sort(Integer::compareTo); try { @@ -58,13 +71,15 @@ public class ActionExecutor extends AgentRunningSubModule actions, ExecutorService executor, Phaser phaser) { + private void runGroupAction(List actions, ExecutorService executor, PhaserRecord phaserRecord) { + Phaser phaser = phaserRecord.phaser(); phaser.bulkRegister(actions.size()); - for (MetaAction action : actions) { + //不可替换为增强for,因为单组的行动单元集合数量是可以被外部干预的 + //noinspection ForLoopReplaceableByForEach + for (int i = 0; i < actions.size(); i++) { + MetaAction action = actions.get(i); executor.execute(() -> { try { - //TODO 使用 ParamsExtractor 填充行动参数信息,如果已知内容不足以满足参数需求,则进行行动链调整(ActionRepairer) - - actionCapability.execute(action); - MetaAction.Result result = action.getResult(); + ExtractorInput extractorInput = assemblyHelper.buildExtractorInput(); + ExtractorResult extractorResult = paramsExtractor.execute(extractorInput); + // 两个循环需考虑最大次数,但为了达到最好融合,次数累计作用于 ActionRepairer 的修复策略选择上更合适 + if (!extractorResult.isOk()) { + // 修复的最终结果是 action 的参数补充完整,然后能够继续行动链 + // 如果无法补充,则该行动行动阶段可能确实有误,实际上应当在 actionRepairer 内部进行处理(行动链调整、自对话或请求用户进行干预) + // 所以无法补充时,行动链所属行动数据的状态需要置为 Interrupted ,等待状态变更,同时使用 Phaser 暂停(阻塞)当前行动链执行过程 + // 这个功能应该交给 PhaserRecord 实现,尽量确保功能一致性 + repairActionParams(action, phaserRecord); + } do { + actionCapability.execute(action); + MetaAction.Result result = action.getResult(); // 该循环对应LLM的调整参数后重试 if (!result.isSuccess()) { // LLM决策是重构参数、执行自对话反思、还是选择向用户求助(通过cognationCore暴露方法,可能需要修改其他模块以进行适应),仅重构参数时无需结束当前循环 // 若使用Phaser作为执行线程与反思、求助等调用流程的同步协调,应当需要额外维护Phaser全局字段,获取到反思结果或者用户反馈后, // 调用对应的phaser注册任务,在ActionExecutor中动态添加任务至actionChain,同时启动异步执行 // 而且由于执行与放入的为同一个MetaAction对象,所以执行结果可被当前行动链获取,但virtual、executor两个列表似乎不行,需要重构执行模式,建议将行动链直接重构为LinkedHashMap,order为键 - String input = buildFixInput(result.getData()); - // 执行时不可使用`for in`和`forEach`,因为在`Intervention`相关模块存在动态调整 + repairActionParams(action, phaserRecord); + } else { + break; } actionCapability.execute(action); - } while (!result.isSuccess()); - // TODO 将执行结果写入特定对话角色记忆(cognationCore暴露方法) - + } while (true); + //TODO 执行结果不再需要写入特定位置,当前的 ActionCapability 内部的行动池已经足以承担这个功能,但这也就意味着行动池或许需要考虑特殊的序列化形式避免内存占用过高,同时也需要在某些模块执行时加上行动结果的挑取作为输入内容 } finally { phaser.arriveAndDeregister(); } @@ -103,9 +130,42 @@ public class ActionExecutor extends AgentRunningSubModule action.setParams(repairerResult.getParams()); + // 修复失败则证明行动链不可行(外部因素,如果本身即不存在满足可能,则应当通过 ADJUST 或者 ACQUIRE 方式选择取消) + case RepairerStatus.FAILED -> phaserRecord.fail(); + // 按照逻辑设定,这里将不可能步入这个分支,除非 ActionRepairer 逻辑有误 + case RepairerStatus.ACQUIRE -> { + phaserRecord.interrupt(); + continue; + } + } + break; + } while (true); + } - return null; + @SuppressWarnings("InnerClassMayBeStatic") + private class AssemblyHelper { + + private AssemblyHelper() { + } + + public RepairerInput buildRepairerInput() { + return null; + } + + public ExtractorInput buildExtractorInput() { + return null; + } + + public CorrectorInput buildCorrectorInput() { + return null; + } } } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionRepairer.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionRepairer.java index 479a5ab6..315d92c1 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionRepairer.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionRepairer.java @@ -7,7 +7,18 @@ import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.Repai import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.RepairerResult; /** - * 负责识别行动链的调整,可通过协调 {@link DynamicActionGenerator} 生成新的行动单元(必要时持久化)、或者依据现有输出结果与已知信息和可选行动单元直接调整行动链、如果当前局部信息无法满足,将发起自对话借助干预模块进行操作或者借助自对话通道向用户发起沟通请求 + * 负责识别行动链的修复 + *
    + *
  1. + * 可通过协调 {@link DynamicActionGenerator} 生成新的行动单元并调用,获取所需的参数信息(必要时持久化); + *
  2. + *
  3. + * 也可以直接调用已存在的行动程序获取信息; + *
  4. + *
  5. + * 如果上述都无法满足,将发起自对话借助干预模块进行操作或者借助自对话通道向用户发起沟通请求,该请求的目的一般为行动程序生成/调用指导或者用户侧的信息补充,后续还需要再走一遍参数修复流程 + *
  6. + *
*/ @AgentSubModule public class ActionRepairer extends AgentRunningSubModule implements ActivateModel { diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ParamsExtractor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ParamsExtractor.java index f94b1aa6..d3eba6ef 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ParamsExtractor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ParamsExtractor.java @@ -3,22 +3,23 @@ package work.slhaf.partner.module.modules.action.dispatcher.executor; import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule; import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.ActivateModel; import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.AgentRunningSubModule; -import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.ParamsExtractorInput; +import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.ExtractorInput; +import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.ExtractorResult; /** * 负责依据输入内容进行行动单元的参数信息提取 */ @AgentSubModule -public class ParamsExtractor extends AgentRunningSubModule implements ActivateModel { +public class ParamsExtractor extends AgentRunningSubModule implements ActivateModel { @Override - public String[] execute(ParamsExtractorInput data) { - return new String[0]; + public ExtractorResult execute(ExtractorInput data) { + return null; } @Override public String modelKey() { - return ""; + return "params_extractor"; } @Override diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/CorrectorInput.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/CorrectorInput.java new file mode 100644 index 00000000..aad21e36 --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/CorrectorInput.java @@ -0,0 +1,7 @@ +package work.slhaf.partner.module.modules.action.dispatcher.executor.entity; + +import lombok.Data; + +@Data +public class CorrectorInput { +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/CorrectorResult.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/CorrectorResult.java new file mode 100644 index 00000000..b65a2269 --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/CorrectorResult.java @@ -0,0 +1,7 @@ +package work.slhaf.partner.module.modules.action.dispatcher.executor.entity; + +import lombok.Data; + +@Data +public class CorrectorResult { +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ParamsExtractorInput.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ExtractorInput.java similarity index 75% rename from Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ParamsExtractorInput.java rename to Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ExtractorInput.java index b78dd7e0..826c1f06 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ParamsExtractorInput.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ExtractorInput.java @@ -3,6 +3,6 @@ package work.slhaf.partner.module.modules.action.dispatcher.executor.entity; import lombok.Data; @Data -public class ParamsExtractorInput { +public class ExtractorInput { } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ExtractorResult.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ExtractorResult.java new file mode 100644 index 00000000..de05dfd5 --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ExtractorResult.java @@ -0,0 +1,9 @@ +package work.slhaf.partner.module.modules.action.dispatcher.executor.entity; + +import lombok.Data; + +@Data +public class ExtractorResult { + private boolean ok; + private String[] params; +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/RepairerResult.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/RepairerResult.java index c8e56ce2..7f046b6d 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/RepairerResult.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/RepairerResult.java @@ -2,6 +2,27 @@ package work.slhaf.partner.module.modules.action.dispatcher.executor.entity; import lombok.Data; +/** + * 行动修复结果,包含行动状态和修复后的参数 + */ @Data public class RepairerResult { + + private RepairerStatus status; + private String[] params; + + public enum RepairerStatus { + /** + * 成功修复: 携带修复后参数; 此种情况对应 Repairer 通过某种方式获取到了完整的参数(调用额外的行动) + */ + OK, + /** + * 发送了自对话请求干预行动,这类一般是补充信息或者提供行动指导,后续必须再步入修复进程,但需要设置层级 + */ + ACQUIRE, + /** + * 修复失败(简单修复、自对话通道均出现错误,正常情况不应该出现) + */ + FAILED + } } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/ActionInterventor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/ActionInterventor.java index cf2e5c94..92f68ba8 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/ActionInterventor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/ActionInterventor.java @@ -7,8 +7,8 @@ import work.slhaf.partner.api.agent.factory.module.annotation.AgentModule; import work.slhaf.partner.api.agent.factory.module.annotation.InjectModule; import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.ActivateModel; import work.slhaf.partner.core.action.ActionCapability; -import work.slhaf.partner.core.action.ActionCore.PhaserRecord; import work.slhaf.partner.core.action.entity.ActionData; +import work.slhaf.partner.core.action.entity.PhaserRecord; import work.slhaf.partner.core.cognation.CognationCapability; import work.slhaf.partner.core.memory.MemoryCapability; import work.slhaf.partner.module.common.module.PreRunningModule; diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/InterventionEvaluator.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/InterventionEvaluator.java index bccd2154..f0391293 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/InterventionEvaluator.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/InterventionEvaluator.java @@ -10,8 +10,8 @@ import work.slhaf.partner.api.chat.pojo.ChatResponse; import work.slhaf.partner.api.chat.pojo.Message; import work.slhaf.partner.core.action.ActionCapability; import work.slhaf.partner.core.action.ActionCore.ExecutorType; -import work.slhaf.partner.core.action.ActionCore.PhaserRecord; import work.slhaf.partner.core.action.entity.ActionData; +import work.slhaf.partner.core.action.entity.PhaserRecord; import work.slhaf.partner.core.memory.pojo.EvaluatedSlice; import work.slhaf.partner.module.modules.action.interventor.evaluator.entity.EvaluatorInput; import work.slhaf.partner.module.modules.action.interventor.evaluator.entity.EvaluatorResult; diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/entity/EvaluatorInput.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/entity/EvaluatorInput.java index 854f257e..ab3345dd 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/entity/EvaluatorInput.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/entity/EvaluatorInput.java @@ -2,8 +2,8 @@ package work.slhaf.partner.module.modules.action.interventor.evaluator.entity; import lombok.Data; import work.slhaf.partner.api.chat.pojo.Message; -import work.slhaf.partner.core.action.ActionCore.PhaserRecord; import work.slhaf.partner.core.action.entity.ActionData; +import work.slhaf.partner.core.action.entity.PhaserRecord; import work.slhaf.partner.core.memory.pojo.EvaluatedSlice; import java.util.List; diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/InterventionHandler.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/InterventionHandler.java index e3c8667a..01eba94e 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/InterventionHandler.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/InterventionHandler.java @@ -6,10 +6,10 @@ import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule; import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.AgentRunningSubModule; import work.slhaf.partner.core.action.ActionCapability; import work.slhaf.partner.core.action.ActionCore.ExecutorType; -import work.slhaf.partner.core.action.ActionCore.PhaserRecord; import work.slhaf.partner.core.action.entity.ActionData; import work.slhaf.partner.core.action.entity.ActionData.ActionStatus; import work.slhaf.partner.core.action.entity.MetaAction; +import work.slhaf.partner.core.action.entity.PhaserRecord; import work.slhaf.partner.module.modules.action.interventor.entity.InterventionType; import work.slhaf.partner.module.modules.action.interventor.entity.MetaIntervention; import work.slhaf.partner.module.modules.action.interventor.handler.entity.HandlerInput; diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/entity/HandlerInput.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/entity/HandlerInput.java index 39b038ba..851e618d 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/entity/HandlerInput.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/entity/HandlerInput.java @@ -2,8 +2,8 @@ package work.slhaf.partner.module.modules.action.interventor.handler.entity; import lombok.Data; import lombok.EqualsAndHashCode; -import work.slhaf.partner.core.action.ActionCore.PhaserRecord; import work.slhaf.partner.core.action.entity.ActionData; +import work.slhaf.partner.core.action.entity.PhaserRecord; import work.slhaf.partner.module.modules.action.interventor.entity.MetaIntervention; import java.util.List; diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/InterventionRecognizer.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/InterventionRecognizer.java index 6136d658..2616da62 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/InterventionRecognizer.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/InterventionRecognizer.java @@ -10,6 +10,7 @@ import work.slhaf.partner.api.chat.pojo.ChatResponse; import work.slhaf.partner.core.action.ActionCapability; import work.slhaf.partner.core.action.ActionCore; import work.slhaf.partner.core.action.entity.ActionData; +import work.slhaf.partner.core.action.entity.PhaserRecord; import work.slhaf.partner.module.modules.action.interventor.recognizer.entity.MetaRecognizerResult; import work.slhaf.partner.module.modules.action.interventor.recognizer.entity.RecognizerInput; import work.slhaf.partner.module.modules.action.interventor.recognizer.entity.RecognizerResult; @@ -30,13 +31,13 @@ public class InterventionRecognizer extends AgentRunningSubModule executingActions = input.getExecutingActions(); + List executingActions = input.getExecutingActions(); List preparedActions = input.getPreparedActions(); CountDownLatch countDownLatch = new CountDownLatch(executingActions.size() + preparedActions.size()); // 创建结果容器 RecognizerResult recognizerResult = new RecognizerResult(); - Map executingInterventions = recognizerResult.getExecutingInterventions(); + Map executingInterventions = recognizerResult.getExecutingInterventions(); Map preparedInterventions = recognizerResult.getPreparedInterventions(); // 执行识别操作 @@ -74,7 +75,7 @@ public class InterventionRecognizer extends AgentRunningSubModule String buildPrompt(T data, RecognizerInput input) { ActionData actionData = switch (data) { - case ActionCore.PhaserRecord record -> record.actionData(); + case PhaserRecord record -> record.actionData(); case ActionData tempData -> tempData; default -> null; }; diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/entity/RecognizerInput.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/entity/RecognizerInput.java index 078b8613..2677aad8 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/entity/RecognizerInput.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/entity/RecognizerInput.java @@ -2,8 +2,8 @@ package work.slhaf.partner.module.modules.action.interventor.recognizer.entity; import lombok.Data; import work.slhaf.partner.api.chat.pojo.Message; -import work.slhaf.partner.core.action.ActionCore; import work.slhaf.partner.core.action.entity.ActionData; +import work.slhaf.partner.core.action.entity.PhaserRecord; import java.util.List; @@ -18,6 +18,6 @@ public class RecognizerInput { /** * 正在执行的行动-Phaser记录列表,在Recognizer中结合本次输入并发评估(考虑到不同行动链之间对LLM的影响) */ - private List executingActions; + private List executingActions; private List preparedActions; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/entity/RecognizerResult.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/entity/RecognizerResult.java index f7af4f89..202b3061 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/entity/RecognizerResult.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/entity/RecognizerResult.java @@ -1,8 +1,8 @@ package work.slhaf.partner.module.modules.action.interventor.recognizer.entity; import lombok.Data; -import work.slhaf.partner.core.action.ActionCore; import work.slhaf.partner.core.action.entity.ActionData; +import work.slhaf.partner.core.action.entity.PhaserRecord; import java.util.HashMap; import java.util.Map; @@ -18,7 +18,7 @@ public class RecognizerResult { *
* value: 干预倾向将作用的 phaser 记录 */ - private Map executingInterventions = new HashMap<>(); + private Map executingInterventions = new HashMap<>(); /** *

将被干预的‘等待中行动’

From 6a351413a152fe13bd1d9617d04bf985c39d5cda Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 5 Dec 2025 21:58:21 +0800 Subject: [PATCH 019/182] =?UTF-8?q?=E6=8E=A8=E8=BF=9B=E8=A1=8C=E5=8A=A8?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E6=A8=A1=E5=9D=97:=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E4=BA=86=20ActionExecutor=20=E4=BB=A5=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E8=A1=8C=E5=8A=A8=E9=93=BE=E5=8A=A8=E6=80=81=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=92=8C=E5=8F=82=E6=95=B0=E6=8F=90=E5=8F=96;=20=E5=AE=8C?= =?UTF-8?q?=E5=96=84=E4=BA=86=20ActionRepairer=E3=80=81ParamsExtractor=20?= =?UTF-8?q?=E7=9A=84=E4=B8=BB=E8=A6=81=E9=80=BB=E8=BE=91;=20=E5=AE=8C?= =?UTF-8?q?=E5=96=84=E4=BA=86=E9=83=A8=E5=88=86=E6=95=B0=E6=8D=AE=E7=B1=BB?= =?UTF-8?q?=E7=9A=84=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 ActionData 中新增 additionalContext 用于存储各个执行阶段临时修复生成的上下文,同样以执行阶段为键 - 调整 ActionExecutor 的输入参数,可传入用户标识,用于执行器调用 ActionRepairer 的修复过程 - 完善了 ActionExecutor 中行动单元的执行与修复逻辑,将支持正常状态推进执行、触发自对话时阻塞当前行动单元、所有修复方式失败时将整个行动数据标为 FAILED - 完善了 ActionExecutor 中各个DTO的构建方法 - 完善了 ParamsExtractor 中的参数提取逻辑 - 在 PhaserRecord 中新增 interrupt 和 complete 方法,将用于后续行动单元的阻塞(ActionExecutor中)与恢复(InterventionHandler中) - 完善了 ActionRepairer 中的修复逻辑,但自对话通道的暴露方式、DynamicActionGenerator 的具体逻辑待完善 --- .../slhaf/partner/core/action/ActionCore.java | 40 ++-- .../core/action/SandboxRunnerClient.java | 18 +- .../core/action/entity/ActionData.java | 5 +- .../core/action/entity/PhaserRecord.java | 6 +- .../action/dispatcher/ActionDispatcher.java | 24 ++- .../dispatcher/executor/ActionExecutor.java | 156 +++++++++++---- .../dispatcher/executor/ActionRepairer.java | 181 +++++++++++++++++- .../dispatcher/executor/ParamsExtractor.java | 48 ++++- .../executor/entity/ActionExecutorInput.java | 18 ++ .../executor/entity/ExtractorInput.java | 26 ++- .../executor/entity/GeneratorResult.java | 2 + .../executor/entity/HistoryAction.java | 10 + .../executor/entity/RepairerInput.java | 12 ++ .../executor/entity/RepairerResult.java | 4 +- .../ActionExecutingFailedException.java | 14 ++ 15 files changed, 477 insertions(+), 87 deletions(-) create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ActionExecutorInput.java create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/HistoryAction.java create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/exception/ActionExecutingFailedException.java diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java index cd519cf3..f1a34332 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java @@ -34,7 +34,7 @@ public class ActionCore extends PartnerCore { /** * 持久行动池,以用户id为键存储所有状态的任务 */ - private HashMap> actionPool = new HashMap<>();//TODO 考虑是否取消用户分池 + private HashMap> actionPool = new HashMap<>();// TODO 考虑是否取消用户分池 /** * 待确认任务,以userId区分不同用户,因为需要跨请求确认 @@ -48,7 +48,8 @@ public class ActionCore extends PartnerCore { private final Lock cacheLock = new ReentrantLock(); - private final ExecutorService platformExecutor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()); + private final ExecutorService platformExecutor = Executors + .newFixedThreadPool(Runtime.getRuntime().availableProcessors()); private final ExecutorService virtualExecutor = Executors.newVirtualThreadPerTaskExecutor(); /** @@ -129,10 +130,11 @@ public class ActionCore extends PartnerCore { return null; } VectorClient vectorClient = VectorClient.INSTANCE; - //计算本次输入的向量 + // 计算本次输入的向量 float[] vector = vectorClient.compute(input); - if (vector == null) return null; - //与现有缓存比对,将匹配到的收集并返回 + if (vector == null) + return null; + // 与现有缓存比对,将匹配到的收集并返回 return actionCache.parallelStream() .filter(ActionCacheData::isActivated) .filter(data -> { @@ -257,10 +259,10 @@ public class ActionCore extends PartnerCore { * @param inputVector 本次输入内容的语义向量 * @param vectorClient 向量客户端 */ - private void adjustMatchAndPassed(List matchAndPassed, float[] inputVector, String - input, VectorClient vectorClient) { + private void adjustMatchAndPassed(List matchAndPassed, float[] inputVector, String input, + VectorClient vectorClient) { matchAndPassed.forEach(adjustData -> { - //获取原始缓存条目 + // 获取原始缓存条目 String tendency = adjustData.getTendency(); ActionCacheData primaryCacheData = selectCacheData(tendency); if (primaryCacheData == null) { @@ -279,7 +281,7 @@ public class ActionCore extends PartnerCore { private void adjustMatchNotPassed(List matchNotPassed, VectorClient vectorClient) { List toRemove = new ArrayList<>(); matchNotPassed.forEach(adjustData -> { - //获取原始缓存条目 + // 获取原始缓存条目 String tendency = adjustData.getTendency(); ActionCacheData primaryCacheData = selectCacheData(tendency); if (primaryCacheData == null) { @@ -299,13 +301,13 @@ public class ActionCore extends PartnerCore { /** * 针对未命中但评估通过的缓存做出调整: *
    - *

    如果存在缓存条目

    - *
  1. - * 若已生效,但此时未匹配到则说明尚未生效或者阈值、向量{@link ActionCacheData#getInputVector()}存在问题,调低阈值,同时带权移动平均 - *
  2. - *
  3. - * 若未生效,则只增加计数并带权移动平均 - *
  4. + *

    如果存在缓存条目

    + *
  5. + * 若已生效,但此时未匹配到则说明尚未生效或者阈值、向量{@link ActionCacheData#getInputVector()}存在问题,调低阈值,同时带权移动平均 + *
  6. + *
  7. + * 若未生效,则只增加计数并带权移动平均 + *
  8. *
* 如果不存在缓存条目,则新增并填充字段 * @@ -314,10 +316,10 @@ public class ActionCore extends PartnerCore { * @param input 本次输入内容 * @param vectorClient 向量客户端 */ - private void adjustNotMatchPassed(List notMatchPassed, float[] inputVector, String - input, VectorClient vectorClient) { + private void adjustNotMatchPassed(List notMatchPassed, float[] inputVector, String input, + VectorClient vectorClient) { notMatchPassed.forEach(adjustData -> { - //获取原始缓存条目 + // 获取原始缓存条目 String tendency = adjustData.getTendency(); ActionCacheData primaryCacheData = selectCacheData(tendency); float[] tendencyVector = vectorClient.compute(tendency); diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/SandboxRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/SandboxRunnerClient.java index bb2ff561..c13f7539 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/SandboxRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/SandboxRunnerClient.java @@ -7,15 +7,15 @@ import java.nio.file.Path; /** * 基于 Http 与 WebSocket 的沙盒执行器客户端,负责: *
    - *
  • - * 发送行动单元数据 - *
  • - *
  • - * 实时更新获取已存在行动列表 - *
  • - *
  • - * 向传入的 MetaAction 回写执行结果 - *
  • + *
  • + * 发送行动单元数据 + *
  • + *
  • + * 实时更新获取已存在行动列表 + *
  • + *
  • + * 向传入的 MetaAction 回写执行结果 + *
  • *
*/ class SandboxRunnerClient { diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java index c56336b4..cecb17ff 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java @@ -38,7 +38,10 @@ public abstract class ActionData { */ protected String result; protected List history = new ArrayList<>(); - + /** + * 修复上下文 + */ + protected Map> additionalContext; /** * 行动原因 */ diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/PhaserRecord.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/PhaserRecord.java index 7b7b5c88..cc3d1805 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/PhaserRecord.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/PhaserRecord.java @@ -1,15 +1,15 @@ package work.slhaf.partner.core.action.entity; +import work.slhaf.partner.core.action.entity.ActionData.ActionStatus; + import java.util.concurrent.Phaser; public record PhaserRecord(Phaser phaser, ActionData actionData) { public void fail() { - // TODO Auto-generated method stub - throw new UnsupportedOperationException("Unimplemented method 'fail'"); + actionData.setStatus(ActionStatus.FAILED); } - public void interrupt() { } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/ActionDispatcher.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/ActionDispatcher.java index 4565b22b..7d611a59 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/ActionDispatcher.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/ActionDispatcher.java @@ -11,6 +11,7 @@ import work.slhaf.partner.core.action.entity.ImmediateActionData; import work.slhaf.partner.core.action.entity.ScheduledActionData; import work.slhaf.partner.module.common.module.PostRunningModule; import work.slhaf.partner.module.modules.action.dispatcher.executor.ActionExecutor; +import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.ActionExecutorInput; import work.slhaf.partner.module.modules.action.dispatcher.scheduler.ActionScheduler; import work.slhaf.partner.runtime.interaction.data.context.PartnerRunningFlowContext; @@ -30,6 +31,7 @@ public class ActionDispatcher extends PostRunningModule { private ActionScheduler actionScheduler; private ExecutorService executor; + private final AssemblyHelper assemblyHelper = new AssemblyHelper(); @Init public void init() { @@ -38,13 +40,14 @@ public class ActionDispatcher extends PostRunningModule { @Override public void doExecute(PartnerRunningFlowContext context) { - //只需要处理prepared action,因为pending action在用户确认后也将变为prepared action - //将PLANNING action放入时间轮中,IMMEDIATE action直接进入并发执行流 - //对于将触发的PLANNING action,理想做法是将执行工具做成执行链的形式,模型的自对话流程、是否通知用户都做成与普通工具同等的通用可选能力,避免绑定固定流程 + // 只需要处理prepared action,因为pending action在用户确认后也将变为prepared action + // 将PLANNING action放入时间轮中,IMMEDIATE action直接进入并发执行流 + // 对于将触发的PLANNING + // action,理想做法是将执行工具做成执行链的形式,模型的自对话流程、是否通知用户都做成与普通工具同等的通用可选能力,避免绑定固定流程 executor.execute(() -> { String userId = context.getUserId(); List preparedActions = actionCapability.listPreparedAction(userId); - //分类成PLANNING和IMMEDIATE两类 + // 分类成PLANNING和IMMEDIATE两类 List scheduledActions = new ArrayList<>(); List immediateActions = new ArrayList<>(); for (ActionData preparedAction : preparedActions) { @@ -54,7 +57,7 @@ public class ActionDispatcher extends PostRunningModule { immediateActions.add(actionInfo); } } - actionExecutor.execute(immediateActions); + actionExecutor.execute(assemblyHelper.buildExecutorInput(immediateActions, userId)); actionScheduler.execute(scheduledActions); }); } @@ -64,4 +67,15 @@ public class ActionDispatcher extends PostRunningModule { return false; } + @SuppressWarnings("InnerClassMayBeStatic") + private class AssemblyHelper { + + public ActionExecutorInput buildExecutorInput(List immediateActions, String userId) { + ActionExecutorInput input = new ActionExecutorInput(); + input.setImmediateActions(immediateActions); + input.setUserId(userId); + return input; + } + + } } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java index 0332a6f8..54de088a 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java @@ -8,12 +8,13 @@ import work.slhaf.partner.api.agent.factory.module.annotation.InjectModule; import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.AgentRunningSubModule; import work.slhaf.partner.core.action.ActionCapability; import work.slhaf.partner.core.action.ActionCore; -import work.slhaf.partner.core.action.entity.ActionData; -import work.slhaf.partner.core.action.entity.ImmediateActionData; -import work.slhaf.partner.core.action.entity.MetaAction; -import work.slhaf.partner.core.action.entity.PhaserRecord; +import work.slhaf.partner.core.action.entity.*; +import work.slhaf.partner.core.action.entity.ActionData.ActionStatus; +import work.slhaf.partner.core.cognation.CognationCapability; +import work.slhaf.partner.core.memory.MemoryCapability; import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.*; import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.RepairerResult.RepairerStatus; +import work.slhaf.partner.module.modules.action.dispatcher.executor.exception.ActionExecutingFailedException; import java.util.ArrayList; import java.util.List; @@ -23,10 +24,14 @@ import java.util.concurrent.Phaser; @Slf4j @AgentSubModule -public class ActionExecutor extends AgentRunningSubModule, Void> { +public class ActionExecutor extends AgentRunningSubModule { @InjectCapability private ActionCapability actionCapability; + @InjectCapability + private MemoryCapability memoryCapability; + @InjectCapability + private CognationCapability cognationCapability; @InjectModule private ParamsExtractor paramsExtractor; @@ -47,9 +52,14 @@ public class ActionExecutor extends AgentRunningSubModule immediateActions) { + public Void execute(ActionExecutorInput input) { + List immediateActions = input.getImmediateActions(); + String userId = input.getUserId(); for (ImmediateActionData actionData : immediateActions) { virtualExecutor.execute(() -> { + if (actionData.getStatus() != ActionData.ActionStatus.PREPARE) { + return; + } actionData.setStatus(ActionData.ActionStatus.EXECUTING); Map> actionChain = actionData.getActionChain(); List virtual = new ArrayList<>(); @@ -61,6 +71,11 @@ public class ActionExecutor extends AgentRunningSubModule metaActions = actionChain.get(order); for (MetaAction metaAction : metaActions) { // 根据io类型放入合适的列表 @@ -71,42 +86,46 @@ public class ActionExecutor extends AgentRunningSubModule actions, ExecutorService executor, PhaserRecord phaserRecord) { + private void runGroupAction(List actions, String userId, ActionData actionData, + ExecutorService executor, + PhaserRecord phaserRecord) { Phaser phaser = phaserRecord.phaser(); phaser.bulkRegister(actions.size()); - //不可替换为增强for,因为单组的行动单元集合数量是可以被外部干预的 - //noinspection ForLoopReplaceableByForEach + // 不可替换为增强for,因为单组的行动单元集合数量是可以被外部干预的 + // noinspection ForLoopReplaceableByForEach for (int i = 0; i < actions.size(); i++) { MetaAction action = actions.get(i); executor.execute(() -> { try { - ExtractorInput extractorInput = assemblyHelper.buildExtractorInput(); - ExtractorResult extractorResult = paramsExtractor.execute(extractorInput); // 两个循环需考虑最大次数,但为了达到最好融合,次数累计作用于 ActionRepairer 的修复策略选择上更合适 - if (!extractorResult.isOk()) { - // 修复的最终结果是 action 的参数补充完整,然后能够继续行动链 - // 如果无法补充,则该行动行动阶段可能确实有误,实际上应当在 actionRepairer 内部进行处理(行动链调整、自对话或请求用户进行干预) - // 所以无法补充时,行动链所属行动数据的状态需要置为 Interrupted ,等待状态变更,同时使用 Phaser 暂停(阻塞)当前行动链执行过程 - // 这个功能应该交给 PhaserRecord 实现,尽量确保功能一致性 - repairActionParams(action, phaserRecord); - } + // 修复的最终结果是 action 的参数补充完整,然后能够继续行动链 + // 如果无法补充,则该行动行动阶段可能确实有误,实际上应当在 actionRepairer 内部进行处理(行动链调整、自对话或请求用户进行干预) + // 所以无法补充时,行动链所属行动数据的状态需要置为 Interrupted ,等待状态变更,同时使用 Phaser 暂停(阻塞)当前行动链执行过程 + // 这个功能应该交给 PhaserRecord 实现,尽量确保功能一致性 + setActionParams(action, phaserRecord, userId); do { actionCapability.execute(action); MetaAction.Result result = action.getResult(); @@ -116,36 +135,66 @@ public class ActionExecutor extends AgentRunningSubModule additionalContext = actionData.getAdditionalContext().get(actionData.getExecutingStage()); do { - RepairerInput repairerInput = assemblyHelper.buildRepairerInput(); + ExtractorInput extractorInput = assemblyHelper.buildExtractorInput(action, userId, actionData, + additionalContext); + ExtractorResult extractorResult = paramsExtractor.execute(extractorInput); + if (extractorResult.isOk()) { + action.setParams(extractorResult.getParams()); + break; + } + RepairerInput repairerInput = assemblyHelper.buildRepairerInput(phaserRecord, action, userId); RepairerResult repairerResult = actionRepairer.execute(repairerInput); switch (repairerResult.getStatus()) { // 修复成功则直接设置参数 - case RepairerStatus.OK -> action.setParams(repairerResult.getParams()); + case RepairerStatus.OK -> additionalContext.addAll(repairerResult.getFixedData()); // 修复失败则证明行动链不可行(外部因素,如果本身即不存在满足可能,则应当通过 ADJUST 或者 ACQUIRE 方式选择取消) - case RepairerStatus.FAILED -> phaserRecord.fail(); - // 按照逻辑设定,这里将不可能步入这个分支,除非 ActionRepairer 逻辑有误 + case RepairerStatus.FAILED -> { + // 此处抛出执行异常,runGroupAction 为并发执行同组动作,此时只是中断了一个行动单元的执行 + // 那么对于其他的行动单元,也需要进行中断处理,仅靠 PhaserRecord 无法完成 + // 或许需要再增加一个集合,用于记录开启的执行线程,然后统一停止 + // 由于行动链的并发特性,所以只需要记录单组行动单元的执行线程,但是如果此时其他的行动单元也触发了额外的线程操作 + // (例如自对话,但此时这些触发自对话的线程本身是正常状态,会被正常中断) + // 也需要避免这些内容出现异常(主要是前置行动模块处针对 ActionData 的操作),应该只需要依据 FAILED 状态阻止操作即可 + // 对于修复和动态生成的行动单元执行,都是同步操作,不再需要额外处理 + // 但考虑到同组行动单元的执行过程,也的确用不到那么多线程中断操作,所以只要收到干预时做好拒绝策略即可 + // 此处的话,由于主要依赖 ActionData 持有的状态防止失败行动数据继续执行,所以不再需要 phaserRecord 进行额外处理 + // 只需要重设 ActionData 状态即可 + actionData.setStatus(ActionData.ActionStatus.FAILED); + throw new ActionExecutingFailedException("行动执行失败"); + } + // 通过自对话通道发起了干预,这里需要调用 phaserRecord 进行一次阻塞 + // 如果通过 phaserRecord 进行阻塞,那么在前置模块的 InterventionHandler 需要额外得知当前 ActionData + // 的内容,这点是可以做到的 + // 如果在 ActionRepairer 内部调用阻塞,还是无法免除同样的逻辑,即 RepairerResult 内容需要携带干预信息,但这些内容最终是在 + // ActionData 中放置的,相当于绕了一层,不太合适 case RepairerStatus.ACQUIRE -> { phaserRecord.interrupt(); - continue; } } - break; } while (true); } @@ -155,15 +204,50 @@ public class ActionExecutor extends AgentRunningSubModule additionalContext) { + ExtractorInput input = new ExtractorInput(); + input.setEvaluatedSlices(memoryCapability.getActivatedSlices(userId)); + input.setRecentMessages(cognationCapability.getChatMessages()); + input.setMetaActionInfo(actionCapability.loadMetaActionInfo(action.getKey())); + input.setHistoryActionResults(getHistoryActionResults(actionData)); + input.setAdditionalContext(additionalContext); + return input; } - public CorrectorInput buildCorrectorInput() { + private List getHistoryActionResults(ActionData actionData) { + int executingStage = actionData.getExecutingStage(); + if (executingStage <= 0) { + return new ArrayList<>(); + } + Map> actionChain = actionData.getActionChain(); + // executingStage 是当前正在执行的阶段,所以只需要获取到前一阶段的结果 + return actionChain.get(executingStage - 1).stream() + .map(metaAction -> { + HistoryAction historyAction = new HistoryAction(); + historyAction.setActionKey(metaAction.getKey()); + historyAction + .setDescription( + actionCapability.loadMetaActionInfo(metaAction.getKey()).getDescription()); + historyAction.setResult(metaAction.getResult().getData()); + return historyAction; + }).toList(); + } + + private CorrectorInput buildCorrectorInput() { return null; } } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionRepairer.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionRepairer.java index 315d92c1..3c5ea80a 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionRepairer.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionRepairer.java @@ -1,31 +1,145 @@ package work.slhaf.partner.module.modules.action.dispatcher.executor; +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; +import com.alibaba.fastjson2.TypeReference; +import lombok.Data; +import lombok.extern.slf4j.Slf4j; +import work.slhaf.partner.api.agent.factory.capability.annotation.InjectCapability; import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule; +import work.slhaf.partner.api.agent.factory.module.annotation.InjectModule; import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.ActivateModel; import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.AgentRunningSubModule; +import work.slhaf.partner.api.chat.pojo.ChatResponse; +import work.slhaf.partner.core.action.ActionCapability; +import work.slhaf.partner.core.action.ActionCore.ExecutorType; +import work.slhaf.partner.core.action.entity.MetaAction; +import work.slhaf.partner.core.cognation.CognationCapability; +import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.GeneratorInput; +import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.GeneratorResult; import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.RepairerInput; import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.RepairerResult; +import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.RepairerResult.RepairerStatus; + +import java.util.List; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.atomic.AtomicInteger; /** * 负责识别行动链的修复 *
    - *
  1. - * 可通过协调 {@link DynamicActionGenerator} 生成新的行动单元并调用,获取所需的参数信息(必要时持久化); - *
  2. - *
  3. - * 也可以直接调用已存在的行动程序获取信息; - *
  4. - *
  5. - * 如果上述都无法满足,将发起自对话借助干预模块进行操作或者借助自对话通道向用户发起沟通请求,该请求的目的一般为行动程序生成/调用指导或者用户侧的信息补充,后续还需要再走一遍参数修复流程 - *
  6. + *
  7. + * 可通过协调 {@link DynamicActionGenerator} 生成新的行动单元并调用,获取所需的参数信息(必要时持久化); + *
  8. + *
  9. + * 也可以直接调用已存在的行动程序获取信息; + *
  10. + *
  11. + * 如果上述都无法满足,将发起自对话借助干预模块进行操作或者借助自对话通道向用户发起沟通请求,该请求的目的一般为行动程序生成/调用指导或者用户侧的信息补充,后续还需要再走一遍参数修复流程 + *
  12. *
*/ +@Slf4j @AgentSubModule public class ActionRepairer extends AgentRunningSubModule implements ActivateModel { + @InjectCapability + private ActionCapability actionCapability; + @InjectCapability + private CognationCapability cognationCapability; + + @InjectModule + private DynamicActionGenerator dynamicActionGenerator; + + private AssembleHelper assembleHelper = new AssembleHelper(); + @Override public RepairerResult execute(RepairerInput data) { - return null; + RepairerResult result; + try { + String prompt = assembleHelper.buildPrompt(data, null); + ChatResponse response = this.singleChat(prompt); + RepairerData repairerData = JSONObject.parseObject(response.getMessage(), RepairerData.class); + result = switch (repairerData.getRepairerType()) { + case ACTION_GENERATION -> + handleActionGeneration(JSONObject.parseObject(repairerData.getData(), GeneratorInput.class)); + case ACTION_INVOCATION -> handleActionInvocation( + JSONObject.parseObject(repairerData.getData(), new TypeReference>() { + })); + case USER_INTERACTION -> handleUserInteraction(repairerData.getData()); + }; + if (!repairerData.getRepairerType().equals(RepairerType.USER_INTERACTION) + && result.getStatus().equals(RepairerResult.RepairerStatus.FAILED)) { + log.warn("常规行动修复失败,将尝试自对话通道"); + prompt = assembleHelper.buildPrompt(data, "常规行动修复失败,请尝试通过自对话通道获取必要的信息以完成行动参数的修复"); + response = this.singleChat(prompt); + repairerData = JSONObject.parseObject(response.getMessage(), RepairerData.class); + handleUserInteraction(repairerData.getData()); + } + } catch (Exception e) { + result = new RepairerResult(); + result.setStatus(RepairerStatus.FAILED); + } + return result; + } + + /** + * 负责根据输入内容进行行动单元的参数信息修复 + * + * @param generatorInput 生成的行动单元参考内容,最好包含行动单元的执行逻辑 + * @return 修复后的行动单元结果 + */ + private RepairerResult handleActionGeneration(GeneratorInput generatorInput) { + RepairerResult result = new RepairerResult(); + GeneratorResult generatorResult = dynamicActionGenerator.execute(generatorInput); + MetaAction tempAction = generatorResult.getTempAction(); + actionCapability.execute(tempAction); + result.getFixedData().add(tempAction.getResult().getData()); + return result; + } + + /** + * 负责根据输入内容进行行动单元的参数信息修复 + * + * @param actionKeys 需要调用的行动单元Key列表 + * @return 修复后的行动单元结果 + */ + private RepairerResult handleActionInvocation(List actionKeys) { + RepairerResult result = new RepairerResult(); + CountDownLatch latch = new CountDownLatch(actionKeys.size()); + ExecutorService virtual = actionCapability.getExecutor(ExecutorType.VIRTUAL); + ExecutorService platform = actionCapability.getExecutor(ExecutorType.PLATFORM); + ExecutorService executor; + AtomicInteger failedCount = new AtomicInteger(0); + for (String key : actionKeys) { + MetaAction action = actionCapability.loadMetaAction(key); + executor = action.isIo() ? virtual : platform; + executor.execute(() -> { + try { + actionCapability.execute(action); + result.getFixedData().add(action.getResult().getData()); + } catch (Exception e) { + log.error("行动单元执行失败: {}", key, e); + failedCount.incrementAndGet(); + } finally { + latch.countDown(); + } + }); + } + if (actionKeys.size() - failedCount.get() > 0) { + result.setStatus(RepairerStatus.OK); + } else { + result.setStatus(RepairerStatus.FAILED); + } + return result; + } + + private RepairerResult handleUserInteraction(String acquireContent) { + RepairerResult result = new RepairerResult(); + result.setStatus(RepairerStatus.ACQUIRE); + // 发送自对话请求 + return result; } @Override @@ -37,4 +151,51 @@ public class ActionRepairer extends AgentRunningSubModule { + JSONObject historyItem = new JSONObject(); + historyItem.put("[行动Key]", historyAction.getActionKey()); + historyItem.put("[行动描述]", historyAction.getDescription()); + historyItem.put("[行动结果]", historyAction.getResult()); + historyData.add(historyItem); + }); + + JSONArray messageData = prompt.putArray("[最近消息列表]"); + messageData.addAll(data.getRecentMessages()); + + if (specialInstruction != null) { + prompt.put("[特殊指令]", specialInstruction); + } + + return prompt.toString(); + } + + } } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ParamsExtractor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ParamsExtractor.java index d3eba6ef..44dfa680 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ParamsExtractor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ParamsExtractor.java @@ -1,20 +1,64 @@ package work.slhaf.partner.module.modules.action.dispatcher.executor; +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; +import lombok.extern.slf4j.Slf4j; import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule; import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.ActivateModel; import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.AgentRunningSubModule; +import work.slhaf.partner.api.chat.pojo.ChatResponse; +import work.slhaf.partner.core.action.entity.MetaActionInfo; import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.ExtractorInput; import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.ExtractorResult; +import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.HistoryAction; + +import java.util.List; /** * 负责依据输入内容进行行动单元的参数信息提取 */ +@Slf4j @AgentSubModule public class ParamsExtractor extends AgentRunningSubModule implements ActivateModel { @Override - public ExtractorResult execute(ExtractorInput data) { - return null; + public ExtractorResult execute(ExtractorInput input) { + String prompt = buildPrompt(input); + ChatResponse response = this.singleChat(prompt); + ExtractorResult result; + try { + result = JSONObject.parseObject(response.getMessage(), ExtractorResult.class); + } catch (Exception e) { + log.error("ParamsExtractor解析结果失败,返回内容:{}", response.getMessage(), e); + result = new ExtractorResult(); + result.setOk(false); + result.setParams(new String[0]); + } + return result; + } + + private String buildPrompt(ExtractorInput input) { + JSONObject prompt = new JSONObject(); + + JSONObject actionData = prompt.putObject("[本次行动信息]"); + MetaActionInfo actionInfo = input.getMetaActionInfo(); + actionData.put("[行动描述]", actionInfo.getDescription()); + actionData.put("[行动参数说明]", actionInfo.getParams()); + + JSONArray historyData = prompt.putArray("[历史行动执行结果]"); + List historyActions = input.getHistoryActionResults(); + for (HistoryAction historyAction : historyActions) { + JSONObject historyItem = new JSONObject(); + historyItem.put("[行动Key]", historyAction.getActionKey()); + historyItem.put("[行动描述]", historyAction.getDescription()); + historyItem.put("[行动结果]", historyAction.getResult()); + historyData.add(historyItem); + } + + JSONArray messageData = prompt.putArray("[最近消息列表]"); + messageData.addAll(input.getRecentMessages()); + + return prompt.toString(); } @Override diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ActionExecutorInput.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ActionExecutorInput.java new file mode 100644 index 00000000..c77f88dc --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ActionExecutorInput.java @@ -0,0 +1,18 @@ +package work.slhaf.partner.module.modules.action.dispatcher.executor.entity; + +import lombok.Data; +import work.slhaf.partner.core.action.entity.ImmediateActionData; + +import java.util.List; + +@Data +public class ActionExecutorInput { + /** + * 用户ID + */ + private String userId; + /** + * 即时行动数据列表 + */ + private List immediateActions; +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ExtractorInput.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ExtractorInput.java index 826c1f06..4a99b457 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ExtractorInput.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ExtractorInput.java @@ -1,8 +1,32 @@ package work.slhaf.partner.module.modules.action.dispatcher.executor.entity; import lombok.Data; +import work.slhaf.partner.api.chat.pojo.Message; +import work.slhaf.partner.core.action.entity.MetaActionInfo; +import work.slhaf.partner.core.memory.pojo.EvaluatedSlice; + +import java.util.List; @Data public class ExtractorInput { - + /** + * 目标 MetaActionInfo + */ + private MetaActionInfo metaActionInfo; + /** + * 可参考的记忆切片 + */ + private List evaluatedSlices; + /** + * 历史行动执行结果 + */ + private List historyActionResults; + /** + * 最近的消息列表 + */ + private List recentMessages; + /** + * 额外的上下文信息(可来自修复器等) + */ + private List additionalContext; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/GeneratorResult.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/GeneratorResult.java index 6290856d..0b8572fb 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/GeneratorResult.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/GeneratorResult.java @@ -1,7 +1,9 @@ package work.slhaf.partner.module.modules.action.dispatcher.executor.entity; import lombok.Data; +import work.slhaf.partner.core.action.entity.MetaAction; @Data public class GeneratorResult { + private MetaAction tempAction; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/HistoryAction.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/HistoryAction.java new file mode 100644 index 00000000..4d0b9a0e --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/HistoryAction.java @@ -0,0 +1,10 @@ +package work.slhaf.partner.module.modules.action.dispatcher.executor.entity; + +import lombok.Data; + +@Data +public class HistoryAction { + private String actionKey; + private String description; + private String result; +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/RepairerInput.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/RepairerInput.java index 92ffcc6f..02e59433 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/RepairerInput.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/RepairerInput.java @@ -1,7 +1,19 @@ package work.slhaf.partner.module.modules.action.dispatcher.executor.entity; import lombok.Data; +import work.slhaf.partner.api.chat.pojo.Message; +import work.slhaf.partner.core.action.entity.PhaserRecord; + +import java.util.List; +import java.util.Map; @Data public class RepairerInput { + + private String userId; + private List recentMessages; + private Map params; + private String actionDescription; + private List historyActionResults; + private PhaserRecord phaserRecord; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/RepairerResult.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/RepairerResult.java index 7f046b6d..c6e2c999 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/RepairerResult.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/RepairerResult.java @@ -2,6 +2,8 @@ package work.slhaf.partner.module.modules.action.dispatcher.executor.entity; import lombok.Data; +import java.util.List; + /** * 行动修复结果,包含行动状态和修复后的参数 */ @@ -9,7 +11,7 @@ import lombok.Data; public class RepairerResult { private RepairerStatus status; - private String[] params; + private List fixedData; public enum RepairerStatus { /** diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/exception/ActionExecutingFailedException.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/exception/ActionExecutingFailedException.java new file mode 100644 index 00000000..f10273d1 --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/exception/ActionExecutingFailedException.java @@ -0,0 +1,14 @@ +package work.slhaf.partner.module.modules.action.dispatcher.executor.exception; + +import work.slhaf.partner.api.agent.runtime.exception.AgentRuntimeException; + +public class ActionExecutingFailedException extends AgentRuntimeException { + + public ActionExecutingFailedException(String message) { + super(message); + } + + public ActionExecutingFailedException(String message, Throwable cause) { + super(message, cause); + } +} From 6e3deced77cdcb10b65f6811725c078c70157dbb Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sun, 7 Dec 2025 20:10:53 +0800 Subject: [PATCH 020/182] =?UTF-8?q?=E6=8E=A8=E8=BF=9B=20ActionExecutor=20?= =?UTF-8?q?=E4=B8=8B=E7=9A=84=20DynamicActionGenerator=20=E5=AD=90?= =?UTF-8?q?=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 完善了 DynamicActionGenerator 的大致逻辑,序列化逻辑待实现 - 补充了 PhaserRecord 中的阻塞逻辑,使用普通的线程sleep操作 - 调整了 MetaAction 中参数形式,由列表替换为 Map,便于执行时填写参数 - 完善了 DynamicActionGenerator 相关的数据类 --- .../core/action/entity/MetaAction.java | 25 +++++--- .../core/action/entity/PhaserRecord.java | 17 +++++- .../dispatcher/executor/ActionExecutor.java | 9 +-- .../dispatcher/executor/ActionRepairer.java | 9 ++- .../executor/DynamicActionGenerator.java | 60 ++++++++++++++++++- .../dispatcher/executor/ParamsExtractor.java | 8 ++- .../executor/entity/ExtractorResult.java | 4 +- .../executor/entity/GeneratorInput.java | 6 ++ 8 files changed, 116 insertions(+), 22 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java index 78c95c2c..c1935052 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java @@ -1,12 +1,14 @@ package work.slhaf.partner.core.action.entity; -import lombok.Data; -import org.jetbrains.annotations.NotNull; +import static work.slhaf.partner.common.Constant.Path.ACTION_PROGRAM; import java.io.File; import java.nio.file.Path; +import java.util.Map; -import static work.slhaf.partner.common.Constant.Path.ACTION_PROGRAM; +import org.jetbrains.annotations.NotNull; + +import lombok.Data; /** * 行动链中的单一元素,封装了调用外部行动程序的必要信息与结果容器,可被{@link work.slhaf.partner.core.action.ActionCapability}执行 @@ -21,7 +23,7 @@ public class MetaAction implements Comparable { /** * 行动程序可接受的参数,由调用处设置 */ - private String[] params; + private Map params; /** * 行动结果,包括执行状态和相应内容(执行结果或者错误信息) */ @@ -36,18 +38,21 @@ public class MetaAction implements Comparable { private boolean io; /** * 行动程序类型,可分为PLUGIN(jar文件)、SCRIPT(Python程序)、MCP(MCP服务) + * . */ private MetaActionType type; + private Path path; + public Path checkAndGetPath() { - Path path = switch (type) { + path = switch (type) { case PLUGIN -> Path.of(ACTION_PROGRAM, key, "action.jar"); case SCRIPT -> Path.of(ACTION_PROGRAM, key, "action.py"); case MCP -> Path.of(ACTION_PROGRAM, key, "action.json"); }; File action = path.toFile(); if (!action.exists()) { - result.setSuccess(false); + result.setStatus(ResultStatus.FAILED); result.setData("Action file not found: " + action.getAbsolutePath()); } return path; @@ -60,8 +65,14 @@ public class MetaAction implements Comparable { @Data public static class Result { - private boolean success = true; + private ResultStatus status = ResultStatus.WAITING; private String data = null; } + public enum ResultStatus { + SUCCESS, + FAILED, + WAITING + } + } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/PhaserRecord.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/PhaserRecord.java index cc3d1805..c0c85289 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/PhaserRecord.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/PhaserRecord.java @@ -10,11 +10,24 @@ public record PhaserRecord(Phaser phaser, ActionData actionData) { actionData.setStatus(ActionStatus.FAILED); } + /** + * 负责将 ActionData 的状态设置为 INTERRUPTED + * 同时循环检查进行阻塞 + */ public void interrupt() { - + actionData.setStatus(ActionStatus.INTERRUPTED); + while (actionData().getStatus() == ActionStatus.INTERRUPTED) { + try { + Thread.sleep(500); + } catch (InterruptedException ignored) { + } + } } + /** + * 将状态重新设置为 EXECUTING ,恢复 interrupt 阻塞状态 + */ public void complete() { - + actionData().setStatus(ActionStatus.EXECUTING); } } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java index 54de088a..5d3138bd 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java @@ -10,6 +10,7 @@ import work.slhaf.partner.core.action.ActionCapability; import work.slhaf.partner.core.action.ActionCore; import work.slhaf.partner.core.action.entity.*; import work.slhaf.partner.core.action.entity.ActionData.ActionStatus; +import work.slhaf.partner.core.action.entity.MetaAction.ResultStatus; import work.slhaf.partner.core.cognation.CognationCapability; import work.slhaf.partner.core.memory.MemoryCapability; import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.*; @@ -110,8 +111,8 @@ public class ActionExecutor extends AgentRunningSubModule actions, String userId, ActionData actionData, - ExecutorService executor, - PhaserRecord phaserRecord) { + ExecutorService executor, + PhaserRecord phaserRecord) { Phaser phaser = phaserRecord.phaser(); phaser.bulkRegister(actions.size()); // 不可替换为增强for,因为单组的行动单元集合数量是可以被外部干预的 @@ -130,7 +131,7 @@ public class ActionExecutor extends AgentRunningSubModule additionalContext) { + List additionalContext) { ExtractorInput input = new ExtractorInput(); input.setEvaluatedSlices(memoryCapability.getActivatedSlices(userId)); input.setRecentMessages(cognationCapability.getChatMessages()); diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionRepairer.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionRepairer.java index 3c5ea80a..086b10eb 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionRepairer.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionRepairer.java @@ -63,7 +63,7 @@ public class ActionRepairer extends AgentRunningSubModule - handleActionGeneration(JSONObject.parseObject(repairerData.getData(), GeneratorInput.class)); + handleActionGeneration(JSONObject.parseObject(repairerData.getData(), GeneratorInput.class)); case ACTION_INVOCATION -> handleActionInvocation( JSONObject.parseObject(repairerData.getData(), new TypeReference>() { })); @@ -127,6 +127,11 @@ public class ActionRepairer extends AgentRunningSubModule 0) { result.setStatus(RepairerStatus.OK); } else { @@ -144,7 +149,7 @@ public class ActionRepairer extends AgentRunningSubModule implements ActivateModel { +public class DynamicActionGenerator extends AgentRunningSubModule + implements ActivateModel { @Override - public GeneratorResult execute(GeneratorInput data) { + public GeneratorResult execute(GeneratorInput input) { + GeneratorResult result = new GeneratorResult(); + // 由于 SCRIPT 类型程序都是在 SandboxRunner 内部的磁盘上加载然后执行的, + // 所以此处的输入内容也只需要指定输入参数、临时key、是否持久化即可,路径将按照指定规则统一构建,不可交给LLM生成 + String prompt = buildPrompt(input); + // 响应结果需要包含几个特殊数据: 依赖项、代码内容、是否序列化、响应数据释义 + ChatResponse response = this.singleChat(prompt); + GeneratorResponseData generatorData = JSONObject + .parseObject(ExtractUtil.extractJson(response.getMessage()), GeneratorResponseData.class); + MetaAction tempAction = buildAction(input); + waitingSerialize(tempAction, generatorData); + result.setTempAction(tempAction); return null; } + /** + * 将临时行动单元序列化至临时文件夹,并设置程序路径、放置在队列中,等待执行状态变化,并根据序列化选项选择是否补充 MetaActionInfo 并持久序列化 + */ + private void waitingSerialize(MetaAction tempAction, GeneratorResponseData generatorData) { + + } + + private MetaAction buildAction(GeneratorInput input) { + MetaAction tempAction = new MetaAction(); + tempAction.setKey(input.getKey()); + tempAction.setParams(input.getParams()); + tempAction.setIo(true); + tempAction.setOrder(-1); + tempAction.setType(MetaActionType.SCRIPT); + return tempAction; + } + + private String buildPrompt(GeneratorInput data) { + JSONObject prompt = new JSONObject(); + prompt.put("[行动描述]", data.getDescription()); + // prompt.putObject("[行动参数]").putAll(data.getParams()); + prompt.putObject("[行动参数描述]").putAll(data.getParamsDescription()); + return prompt.toString(); + } + @Override public String modelKey() { - return ""; + return "dynamic_generator"; } @Override public boolean withBasicPrompt() { return false; } + + @Data + private class GeneratorResponseData { + private List dependencies; + private String code; + private boolean serialize; + private JSONObject responseSchema; + } } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ParamsExtractor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ParamsExtractor.java index 44dfa680..ff527d21 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ParamsExtractor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ParamsExtractor.java @@ -1,7 +1,11 @@ package work.slhaf.partner.module.modules.action.dispatcher.executor; +import java.util.HashMap; +import java.util.List; + import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; + import lombok.extern.slf4j.Slf4j; import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule; import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.ActivateModel; @@ -12,8 +16,6 @@ import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.Extra import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.ExtractorResult; import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.HistoryAction; -import java.util.List; - /** * 负责依据输入内容进行行动单元的参数信息提取 */ @@ -32,7 +34,7 @@ public class ParamsExtractor extends AgentRunningSubModule()); } return result; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ExtractorResult.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ExtractorResult.java index de05dfd5..9ddf9060 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ExtractorResult.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ExtractorResult.java @@ -1,9 +1,11 @@ package work.slhaf.partner.module.modules.action.dispatcher.executor.entity; +import java.util.Map; + import lombok.Data; @Data public class ExtractorResult { private boolean ok; - private String[] params; + private Map params; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/GeneratorInput.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/GeneratorInput.java index 89d52ba8..0d84f40f 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/GeneratorInput.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/GeneratorInput.java @@ -1,7 +1,13 @@ package work.slhaf.partner.module.modules.action.dispatcher.executor.entity; +import java.util.Map; + import lombok.Data; @Data public class GeneratorInput { + private String key; + private Map params; + private String description; + private Map paramsDescription; } From 4b852e0049868e6f7d49b33ff2509b3001b94b62 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 15 Dec 2025 21:54:24 +0800 Subject: [PATCH 021/182] =?UTF-8?q?=E6=8E=A8=E8=BF=9B=20ActionExecutor=20?= =?UTF-8?q?=E4=B8=8B=E7=9A=84=E2=80=98=E8=A1=8C=E5=8A=A8=E7=94=9F=E6=88=90?= =?UTF-8?q?=E4=B8=8E=E6=89=A7=E8=A1=8C=E2=80=99=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 RunnerClient 抽象类,并划分 SandboxRunnerClient、LocalRunnerClient两个子类(内容待完善)。前者负责对接 SandboxRunner 模块,后者直接使用本地作为执行环境(但不推荐)。 - 将 ActionWatchService 划为 LocalRunnerClient 的内部类,负责采用本地执行环境时,监听行动程序变化 - 完善 ActionRepairer 处的修复逻辑 - 调整 MetaAction 中路径获取逻辑 这提交方式真该调整一下了,这阶段推进容易攒太多,但又不好停手。或许阶段目标可以保留,但推进点应该可以细化🤔 --- .../work/slhaf/partner/common/Constant.java | 1 + .../partner/core/action/ActionCapability.java | 3 +- .../slhaf/partner/core/action/ActionCore.java | 11 +- .../core/action/ActionWatchService.java | 192 ----------- .../core/action/SandboxRunnerClient.java | 36 -- .../core/action/entity/GeneratedData.java | 15 + .../core/action/entity/MetaAction.java | 18 +- .../core/action/runner/LocalRunnerClient.java | 320 ++++++++++++++++++ .../core/action/runner/RunnerClient.java | 108 ++++++ .../action/runner/SandboxRunnerClient.java | 54 +++ .../dispatcher/executor/ActionExecutor.java | 7 +- .../dispatcher/executor/ActionRepairer.java | 29 +- .../executor/DynamicActionGenerator.java | 70 ++-- .../dispatcher/executor/ParamsExtractor.java | 7 +- .../executor/entity/ExtractorResult.java | 4 +- .../executor/entity/GeneratorInput.java | 4 +- .../handler/InterventionHandler.java | 22 +- Partner-Main/src/test/java/SystemTest.java | 47 +++ 18 files changed, 652 insertions(+), 296 deletions(-) delete mode 100644 Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionWatchService.java delete mode 100644 Partner-Main/src/main/java/work/slhaf/partner/core/action/SandboxRunnerClient.java create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/GeneratedData.java create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/SandboxRunnerClient.java create mode 100644 Partner-Main/src/test/java/SystemTest.java diff --git a/Partner-Main/src/main/java/work/slhaf/partner/common/Constant.java b/Partner-Main/src/main/java/work/slhaf/partner/common/Constant.java index 0707b3d3..fd7d3985 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/common/Constant.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/common/Constant.java @@ -6,6 +6,7 @@ public final class Constant { public static final String DATA = "./data"; public static final String MEMORY_DATA = DATA + "/memory"; public static final String ACTION_PROGRAM = DATA + "/action"; + public static final String TMP_ACTION_DIR_LOCAL = DATA + "/tmp"; } } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java index 7c021c06..27b55d4c 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java @@ -7,6 +7,7 @@ import work.slhaf.partner.core.action.entity.MetaAction; import work.slhaf.partner.core.action.entity.MetaActionInfo; import work.slhaf.partner.core.action.entity.PhaserRecord; import work.slhaf.partner.core.action.entity.cache.CacheAdjustData; +import work.slhaf.partner.core.action.runner.SandboxRunnerClient; import java.util.List; import java.util.concurrent.ExecutorService; @@ -46,5 +47,5 @@ public interface ActionCapability { boolean checkExists(String... actionKeys); - void execute(MetaAction metaAction); + SandboxRunnerClient runnerClient(); } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java index f1a34332..0dde618a 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java @@ -16,6 +16,8 @@ import work.slhaf.partner.core.action.entity.cache.CacheAdjustData; import work.slhaf.partner.core.action.entity.cache.CacheAdjustMetaData; import work.slhaf.partner.core.action.exception.ActionDataNotFoundException; import work.slhaf.partner.core.action.exception.MetaActionNotFoundException; +import work.slhaf.partner.core.action.runner.RunnerClient; +import work.slhaf.partner.core.action.runner.SandboxRunnerClient; import java.io.IOException; import java.util.*; @@ -57,10 +59,11 @@ public class ActionCore extends PartnerCore { */ private final Map existedMetaActions = new HashMap<>(); private final List phaserRecords = new ArrayList<>(); - private final SandboxRunnerClient sandboxRunnerClient = new SandboxRunnerClient(); + private RunnerClient runnerClient; public ActionCore() throws IOException, ClassNotFoundException { - new ActionWatchService(existedMetaActions, virtualExecutor).launch(); + // TODO 通过 AgentConfigManager指定 + runnerClient = new SandboxRunnerClient(existedMetaActions, virtualExecutor); setupShutdownHook(); } @@ -248,8 +251,8 @@ public class ActionCore extends PartnerCore { } @CapabilityMethod - public void execute(MetaAction metaAction) { - sandboxRunnerClient.run(metaAction); + public RunnerClient runnerClient() { + return runnerClient; } /** diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionWatchService.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionWatchService.java deleted file mode 100644 index 9b265f0e..00000000 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionWatchService.java +++ /dev/null @@ -1,192 +0,0 @@ -package work.slhaf.partner.core.action; - -import lombok.extern.slf4j.Slf4j; -import org.jetbrains.annotations.NotNull; -import work.slhaf.partner.core.action.entity.MetaActionInfo; -import work.slhaf.partner.core.action.exception.ActionInitFailedException; -import work.slhaf.partner.core.action.exception.ActionLoadFailedException; - -import java.io.File; -import java.io.IOException; -import java.nio.file.*; -import java.nio.file.attribute.BasicFileAttributes; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ExecutorService; - -import static work.slhaf.partner.common.Constant.Path.ACTION_PROGRAM; - -// TODO 后续需迁移至 SandboxRunner,作为容器内的监听逻辑 -@SuppressWarnings("unchecked") -@Slf4j -class ActionWatchService { - - private final HashMap registeredPaths = new HashMap<>(); - private final Map existedMetaActions; - private final ExecutorService virtualExecutor; - - public ActionWatchService(Map existedMetaActions, ExecutorService virtualExecutor) { - this.existedMetaActions = existedMetaActions; - this.virtualExecutor = virtualExecutor; - } - - public void launch() { - Path path = Path.of(ACTION_PROGRAM); - scanActions(path.toFile()); - launchActionDirectoryWatcher(path); - } - - private void launchActionDirectoryWatcher(Path path) { - WatchService watchService; - try { - watchService = FileSystems.getDefault().newWatchService(); - setupShutdownHook(watchService); - registerParentToWatch(path, watchService); - registerSubToWatch(path, watchService); - virtualExecutor.execute(registerWatchTask(path, watchService)); - } catch (IOException e) { - throw new ActionInitFailedException("行动程序目录监听器启动失败", e); - } - } - - private void setupShutdownHook(WatchService watchService) { - Runtime.getRuntime().addShutdownHook(new Thread(() -> { - try { - watchService.close(); - } catch (IOException e) { - throw new RuntimeException(e); - } - })); - } - - private Runnable registerWatchTask(Path path, WatchService watchService) { - return () -> { - log.info("行动程序目录监听器已启动"); - while (true) { - WatchKey key; - try { - key = watchService.take(); - List> events = key.pollEvents(); - for (WatchEvent e : events) { - WatchEvent event = (WatchEvent) e; - WatchEvent.Kind kind = event.kind(); - Path context = event.context(); - log.info("行动程序目录变更事件: {} - {}", kind.name(), context.toString()); - Path thisDir = (Path) key.watchable(); - //根据事件发生的目录进行分流,分为父目录事件和子程序事件 - if (thisDir.equals(path)) { - handleParentDirEvent(kind, thisDir, context, watchService); - } else { - handleSubDirEvent(kind, thisDir); - } - } - } catch (InterruptedException e) { - log.info("监听线程被中断,准备退出..."); - Thread.currentThread().interrupt(); // 恢复中断标志 - break; - } catch (ClosedWatchServiceException e) { - log.info("WatchService 已关闭,监听线程退出。"); - break; - } - } - }; - } - - private void handleSubDirEvent(WatchEvent.Kind kind, Path thisDir) { - // path为触发本次行动的文件的路径(当前位于某个action目录下) - // 先判定发生的目录前缀是否匹配(action、desc),否则忽略 - if (kind == StandardWatchEventKinds.ENTRY_CREATE || kind == StandardWatchEventKinds.ENTRY_MODIFY) { - // CREATE、MODIFY 事件将触发一次检测,看当前thisDir中action和desc是否都具备,如果通过则尝试加载(put)。 - boolean complete = checkComplete(thisDir); - if (!complete) return; - try { - MetaActionInfo newActionInfo = new MetaActionInfo(thisDir.toFile()); - existedMetaActions.put(thisDir.toString(), newActionInfo); - } catch (ActionLoadFailedException e) { - log.warn("行动信息重新加载失败,触发行为: {}", kind.name()); - } - } else if (kind == StandardWatchEventKinds.ENTRY_DELETE) { - // DELETE 事件将会把该 MetaActionInfo 从记录中移除 - existedMetaActions.remove(thisDir.toString()); - } - } - - private boolean checkComplete(Path thisDir) { - File[] files = thisDir.toFile().listFiles(); - if (files == null) { - log.error("当前目录无法访问: [{}]", thisDir); - return false; - } - boolean existedAction = false; - boolean existedDesc = false; - for (File file : files) { - String fileName = file.getName(); - String nameWithoutExt = fileName.substring(0, fileName.lastIndexOf('.')); - if (nameWithoutExt.equals("action")) existedAction = true; - else if (nameWithoutExt.equals("desc")) existedDesc = true; - } - return existedAction && existedDesc; - } - - private void handleParentDirEvent(WatchEvent.Kind kind, Path thisDir, Path context, WatchService watchService) { - Path path = Path.of(thisDir.toString(), context.toString()); - // MODIFY 事件不进行处理 - if (kind == StandardWatchEventKinds.ENTRY_CREATE) { - try { - path.register(watchService, - StandardWatchEventKinds.ENTRY_CREATE, - StandardWatchEventKinds.ENTRY_DELETE, - StandardWatchEventKinds.ENTRY_MODIFY); - } catch (IOException e) { - log.error("新增行动程序目录监听失败: {}", path, e); - } - } else if (kind == StandardWatchEventKinds.ENTRY_DELETE) { - WatchKey remove = registeredPaths.remove(path); - remove.cancel(); - } - } - - private void registerSubToWatch(Path path, WatchService watchService) throws IOException { - Files.walkFileTree(path, new SimpleFileVisitor<>() { - @Override - public @NotNull FileVisitResult preVisitDirectory(@NotNull Path dir, @NotNull BasicFileAttributes attrs) throws IOException { - if (dir.getFileName().startsWith(".")) return FileVisitResult.CONTINUE; - WatchKey key = dir.register(watchService, - StandardWatchEventKinds.ENTRY_CREATE, - StandardWatchEventKinds.ENTRY_DELETE, - StandardWatchEventKinds.ENTRY_MODIFY); - registeredPaths.put(dir, key); - return FileVisitResult.CONTINUE; - } - }); - } - - private void registerParentToWatch(Path path, WatchService watchService) throws IOException { - WatchKey key = path.register(watchService, - StandardWatchEventKinds.ENTRY_CREATE, - StandardWatchEventKinds.ENTRY_DELETE, - StandardWatchEventKinds.ENTRY_MODIFY); - registeredPaths.put(path, key); - } - - private void scanActions(File file) { - if (!file.exists() || file.isFile()) { - throw new ActionInitFailedException("未找到行动程序目录: " + file.getAbsolutePath()); - } - File[] files = file.listFiles(); - if (files == null) { - throw new ActionInitFailedException("目录无法访问: " + file.getAbsolutePath()); - } - for (File f : files) { - try { - MetaActionInfo actionInfo = new MetaActionInfo(f); - existedMetaActions.put(f.getName(), actionInfo); - log.info("行动程序[{}]已加载", actionInfo.getKey()); - } catch (ActionLoadFailedException e) { - log.warn("行动程序未加载: {}", e.getMessage()); - } - } - - } -} \ No newline at end of file diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/SandboxRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/SandboxRunnerClient.java deleted file mode 100644 index c13f7539..00000000 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/SandboxRunnerClient.java +++ /dev/null @@ -1,36 +0,0 @@ -package work.slhaf.partner.core.action; - -import work.slhaf.partner.core.action.entity.MetaAction; - -import java.nio.file.Path; - -/** - * 基于 Http 与 WebSocket 的沙盒执行器客户端,负责: - *
    - *
  • - * 发送行动单元数据 - *
  • - *
  • - * 实时更新获取已存在行动列表 - *
  • - *
  • - * 向传入的 MetaAction 回写执行结果 - *
  • - *
- */ -class SandboxRunnerClient { - - public SandboxRunnerClient() { - // 连接沙盒执行器(websocket) - } - - public void run(MetaAction metaAction) { - // 获取已存在行动列表 - Path path = metaAction.checkAndGetPath(); - if (!metaAction.getResult().isSuccess()) { - return; - } - // 调用沙盒执行器 - } - -} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/GeneratedData.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/GeneratedData.java new file mode 100644 index 00000000..512e33c8 --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/GeneratedData.java @@ -0,0 +1,15 @@ +package work.slhaf.partner.core.action.entity; + +import com.alibaba.fastjson2.JSONObject; +import lombok.Data; + +import java.util.List; + +@Data +public class GeneratedData { + private List dependencies; + private String code; + private String codeType; + private boolean serialize; + private JSONObject responseSchema; +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java index c1935052..14bbe1c0 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java @@ -1,14 +1,12 @@ package work.slhaf.partner.core.action.entity; -import static work.slhaf.partner.common.Constant.Path.ACTION_PROGRAM; +import lombok.Data; +import org.jetbrains.annotations.NotNull; -import java.io.File; import java.nio.file.Path; import java.util.Map; -import org.jetbrains.annotations.NotNull; - -import lombok.Data; +import static work.slhaf.partner.common.Constant.Path.ACTION_PROGRAM; /** * 行动链中的单一元素,封装了调用外部行动程序的必要信息与结果容器,可被{@link work.slhaf.partner.core.action.ActionCapability}执行 @@ -27,7 +25,7 @@ public class MetaAction implements Comparable { /** * 行动结果,包括执行状态和相应内容(执行结果或者错误信息) */ - private final Result result = new Result(); + private Result result = new Result(); /** * 执行顺序,升序排列 */ @@ -44,18 +42,12 @@ public class MetaAction implements Comparable { private Path path; - public Path checkAndGetPath() { + public void resetPath() { path = switch (type) { case PLUGIN -> Path.of(ACTION_PROGRAM, key, "action.jar"); case SCRIPT -> Path.of(ACTION_PROGRAM, key, "action.py"); case MCP -> Path.of(ACTION_PROGRAM, key, "action.json"); }; - File action = path.toFile(); - if (!action.exists()) { - result.setStatus(ResultStatus.FAILED); - result.setData("Action file not found: " + action.getAbsolutePath()); - } - return path; } @Override diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java new file mode 100644 index 00000000..46d11aed --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -0,0 +1,320 @@ +package work.slhaf.partner.core.action.runner; + +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; +import lombok.Data; +import lombok.extern.slf4j.Slf4j; +import org.jetbrains.annotations.NotNull; +import work.slhaf.partner.core.action.entity.MetaAction; +import work.slhaf.partner.core.action.entity.MetaActionInfo; +import work.slhaf.partner.core.action.entity.MetaActionType; +import work.slhaf.partner.core.action.exception.ActionInitFailedException; +import work.slhaf.partner.core.action.exception.ActionLoadFailedException; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStreamReader; +import java.nio.file.*; +import java.nio.file.attribute.BasicFileAttributes; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ExecutorService; + +import static work.slhaf.partner.common.Constant.Path.ACTION_PROGRAM; +import static work.slhaf.partner.common.Constant.Path.TMP_ACTION_DIR_LOCAL; + +@Slf4j +public class LocalRunnerClient extends RunnerClient { + + public LocalRunnerClient(Map existedMetaActions, ExecutorService executor) { + super(existedMetaActions, executor); + ActionWatchService watchService = new ActionWatchService(); + watchService.launch(); + } + + @Override + protected RunnerResponse doRun(MetaAction metaAction) { + RunnerResponse response; + try { + // 由于三种方式返回的内容结构变化太大,所以选择油具体执行逻辑返回真正的 Response 对象 + response = switch (metaAction.getType()) { + case MetaActionType.SCRIPT -> doRunWithScript(metaAction); + case MetaActionType.MCP -> doRunWithMcp(metaAction); + case MetaActionType.PLUGIN -> doRunWithPlugin(metaAction); + }; + } catch (Exception e) { + response = new RunnerResponse(); + response.setOk(false); + response.setData(e.getLocalizedMessage()); + } + return response; + } + + private RunnerResponse doRunWithMcp(MetaAction metaAction) { + RunnerResponse response = new RunnerResponse(); + + return response; + } + + private RunnerResponse doRunWithPlugin(MetaAction metaAction) { + RunnerResponse response = new RunnerResponse(); + + return response; + } + + private RunnerResponse doRunWithScript(MetaAction metaAction) { + RunnerResponse response = new RunnerResponse(); + + return response; + } + + @Override + protected Path doBuildTempPath(MetaAction tempAction, String codeType) { + return Path.of(TMP_ACTION_DIR_LOCAL, System.currentTimeMillis() + "-" + tempAction.getKey() + codeType); + } + + @Override + protected void doSerialize(MetaAction tempAction, String code, String codeType) throws IOException { + Path path = tempAction.getPath(); + File file = path.toFile(); + file.createNewFile(); + Files.writeString(path, code); + } + + @Override + public JSONObject listSysDependencies() { + // 先只列出系统/环境的 Python 依赖 + // TODO 在 AgentConfigManager 内配置启用的脚本语言及对应的扩展名 + // 这里的逻辑后续需要替换为“根据 AgentConfigManager 读取到的脚本语言启用情况,遍历并列出当前系统环境依赖” + // 还需要将返回值调整为相应的数据类 + // 后续还需要将不同语言的处理逻辑分散到不同方法内,这里为了验证,先写死在当前方法 + JSONObject sysDependencies = new JSONObject(); + sysDependencies.put("language", "Python"); + JSONArray dependencies = sysDependencies.putArray("dependencies"); + SystemExecResult pyResult = exec("pip", "li", "--format=feeze"); + System.out.println(pyResult); + if (pyResult.isOk()) { + List resultList = pyResult.getResultList(); + for (String result : resultList) { + JSONObject element = dependencies.addObject(); + String[] split = result.split("=="); + element.put("name", split[0]); + element.put("version", split[1]); + } + } else { + JSONObject element = dependencies.addObject(); + element.put("error", pyResult.getTotal()); + } + return sysDependencies; + } + + private SystemExecResult exec(String... command) { + SystemExecResult result = new SystemExecResult(); + + List resultList = new ArrayList<>(); + result.setResultList(resultList); + StringBuilder s = new StringBuilder(); + + try { + Process process = Runtime.getRuntime().exec(command); + BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); + String line; + while ((line = reader.readLine()) != null) { + s.append(line); + resultList.add(line); + } + int exitCode = process.waitFor(); + result.setOk(exitCode == 0); + result.setTotal(s.toString().isEmpty() ? "响应为空" : s.toString()); + } catch (Exception e) { + result.setOk(false); + result.setTotal(e.getLocalizedMessage()); + } + if (result.getTotal().isEmpty()) { + result.setOk(false); + } + return result; + } + + @Data + private static class SystemExecResult { + private boolean ok; + private String total; + private List resultList; + } + + private class ActionWatchService { + + private final HashMap registeredPaths = new HashMap<>(); + + private void launch() { + Path path = Path.of(ACTION_PROGRAM); + scanActions(path.toFile()); + launchActionDirectoryWatcher(path); + } + + private void launchActionDirectoryWatcher(Path path) { + WatchService watchService; + try { + watchService = FileSystems.getDefault().newWatchService(); + setupShutdownHook(watchService); + registerParentToWatch(path, watchService); + registerSubToWatch(path, watchService); + executor.execute(registerWatchTask(path, watchService)); + } catch (IOException e) { + throw new ActionInitFailedException("行动程序目录监听器启动失败", e); + } + } + + private void setupShutdownHook(WatchService watchService) { + Runtime.getRuntime().addShutdownHook(new Thread(() -> { + try { + watchService.close(); + } catch (IOException e) { + throw new RuntimeException(e); + } + })); + } + + private Runnable registerWatchTask(Path path, WatchService watchService) { + return () -> { + log.info("行动程序目录监听器已启动"); + while (true) { + WatchKey key; + try { + key = watchService.take(); + List> events = key.pollEvents(); + for (WatchEvent e : events) { + @SuppressWarnings("unchecked") + WatchEvent event = (WatchEvent) e; + WatchEvent.Kind kind = event.kind(); + Path context = event.context(); + log.info("行动程序目录变更事件: {} - {}", kind.name(), context.toString()); + Path thisDir = (Path) key.watchable(); + // 根据事件发生的目录进行分流,分为父目录事件和子程序事件 + if (thisDir.equals(path)) { + handleParentDirEvent(kind, thisDir, context, watchService); + } else { + handleSubDirEvent(kind, thisDir); + } + } + } catch (InterruptedException e) { + log.info("监听线程被中断,准备退出..."); + Thread.currentThread().interrupt(); // 恢复中断标志 + break; + } catch (ClosedWatchServiceException e) { + log.info("WatchService 已关闭,监听线程退出。"); + break; + } + } + }; + } + + private void handleSubDirEvent(WatchEvent.Kind kind, Path thisDir) { + // path为触发本次行动的文件的路径(当前位于某个action目录下) + // 先判定发生的目录前缀是否匹配(action、desc),否则忽略 + if (kind == StandardWatchEventKinds.ENTRY_CREATE || kind == StandardWatchEventKinds.ENTRY_MODIFY) { + // CREATE、MODIFY 事件将触发一次检测,看当前thisDir中action和desc是否都具备,如果通过则尝试加载(put)。 + boolean complete = checkComplete(thisDir); + if (!complete) + return; + try { + MetaActionInfo newActionInfo = new MetaActionInfo(thisDir.toFile()); + existedMetaActions.put(thisDir.toString(), newActionInfo); + } catch (ActionLoadFailedException e) { + log.warn("行动信息重新加载失败,触发行为: {}", kind.name()); + } + } else if (kind == StandardWatchEventKinds.ENTRY_DELETE) { + // DELETE 事件将会把该 MetaActionInfo 从记录中移除 + existedMetaActions.remove(thisDir.toString()); + } + } + + private boolean checkComplete(Path thisDir) { + File[] files = thisDir.toFile().listFiles(); + if (files == null) { + log.error("当前目录无法访问: [{}]", thisDir); + return false; + } + boolean existedAction = false; + boolean existedDesc = false; + for (File file : files) { + String fileName = file.getName(); + String nameWithoutExt = fileName.substring(0, fileName.lastIndexOf('.')); + if (nameWithoutExt.equals("action")) + existedAction = true; + else if (nameWithoutExt.equals("desc")) + existedDesc = true; + } + return existedAction && existedDesc; + } + + private void handleParentDirEvent(WatchEvent.Kind kind, Path thisDir, Path context, + WatchService watchService) { + Path path = Path.of(thisDir.toString(), context.toString()); + // MODIFY 事件不进行处理 + if (kind == StandardWatchEventKinds.ENTRY_CREATE) { + try { + path.register(watchService, + StandardWatchEventKinds.ENTRY_CREATE, + StandardWatchEventKinds.ENTRY_DELETE, + StandardWatchEventKinds.ENTRY_MODIFY); + } catch (IOException e) { + log.error("新增行动程序目录监听失败: {}", path, e); + } + } else if (kind == StandardWatchEventKinds.ENTRY_DELETE) { + WatchKey remove = registeredPaths.remove(path); + remove.cancel(); + } + } + + private void registerSubToWatch(Path path, WatchService watchService) throws IOException { + Files.walkFileTree(path, new SimpleFileVisitor<>() { + @Override + public @NotNull FileVisitResult preVisitDirectory(@NotNull Path dir, @NotNull BasicFileAttributes attrs) + throws IOException { + if (dir.getFileName().startsWith(".")) + return FileVisitResult.CONTINUE; + WatchKey key = dir.register(watchService, + StandardWatchEventKinds.ENTRY_CREATE, + StandardWatchEventKinds.ENTRY_DELETE, + StandardWatchEventKinds.ENTRY_MODIFY); + registeredPaths.put(dir, key); + return FileVisitResult.CONTINUE; + } + }); + } + + private void registerParentToWatch(Path path, WatchService watchService) throws IOException { + WatchKey key = path.register(watchService, + StandardWatchEventKinds.ENTRY_CREATE, + StandardWatchEventKinds.ENTRY_DELETE, + StandardWatchEventKinds.ENTRY_MODIFY); + registeredPaths.put(path, key); + } + + private void scanActions(File file) { + if (!file.exists() || file.isFile()) { + throw new ActionInitFailedException("未找到行动程序目录: " + file.getAbsolutePath()); + } + File[] files = file.listFiles(); + if (files == null) { + throw new ActionInitFailedException("目录无法访问: " + file.getAbsolutePath()); + } + for (File f : files) { + try { + MetaActionInfo actionInfo = new MetaActionInfo(f); + existedMetaActions.put(f.getName(), actionInfo); + log.info("行动程序[{}]已加载", actionInfo.getKey()); + } catch (ActionLoadFailedException e) { + log.warn("行动程序加载失败", e); + } + } + + } + + } +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java new file mode 100644 index 00000000..92c5799f --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java @@ -0,0 +1,108 @@ +package work.slhaf.partner.core.action.runner; + +import com.alibaba.fastjson2.JSONObject; +import lombok.Data; +import lombok.extern.slf4j.Slf4j; +import work.slhaf.partner.core.action.entity.GeneratedData; +import work.slhaf.partner.core.action.entity.MetaAction; +import work.slhaf.partner.core.action.entity.MetaAction.Result; +import work.slhaf.partner.core.action.entity.MetaAction.ResultStatus; +import work.slhaf.partner.core.action.entity.MetaActionInfo; + +import java.io.IOException; +import java.nio.file.Path; +import java.util.Map; +import java.util.concurrent.ExecutorService; + +@Slf4j +public abstract class RunnerClient { + + protected final Map existedMetaActions; + protected final ExecutorService executor; + + /** + * ActionCore 将注入虚拟线程池 + */ + public RunnerClient(Map existedMetaActions, ExecutorService executor) { + this.existedMetaActions = existedMetaActions; + this.executor = executor; + } + + /** + * 执行行动程序 + */ + public void run(MetaAction metaAction) { + // 获取已存在行动列表 + Result result = metaAction.getResult(); + if (!result.getStatus().equals(ResultStatus.WAITING)) { + return; + } + RunnerResponse response = doRun(metaAction); + result.setData(response.getData()); + result.setStatus(response.isOk() ? ResultStatus.SUCCESS : ResultStatus.FAILED); + } + + //TODO 将执行划分为 MCP、OriginalScript两种类型,SCRIPT、PLUGIN、MCP的分类不再必要 + protected abstract RunnerResponse doRun(MetaAction metaAction); + + /** + * 将临时行动程序放入等待队列,根据其是否需要持久序列化,监听其执行状态,执行成功则持久序列化 + * + * @throws IOException + */ + public Path getPathAndSerialize(MetaAction tempAction, GeneratedData generatedData) throws IOException { + String code = generatedData.getCode(); + String codeType = generatedData.getCodeType(); + + Path path = doBuildTempPath(tempAction, codeType); + tempAction.setPath(path); + doSerialize(tempAction, code, codeType); + if (generatedData.isSerialize()) { + waitingSerialize(tempAction, code, codeType, generatedData.getResponseSchema()); + } + return path; + } + + private void waitingSerialize(MetaAction tempAction, String code, String codeType, JSONObject jsonObject) { + executor.execute(() -> { + Result result = tempAction.getResult(); + while (true) { + switch (result.getStatus()) { + case ResultStatus.WAITING -> { + try { + Thread.sleep(300); + } catch (InterruptedException ignored) { + } + } + case ResultStatus.FAILED -> { + break; + } + case ResultStatus.SUCCESS -> { + tempAction.resetPath(); + try { + doSerialize(tempAction, code, codeType); + } catch (IOException e) { + log.error("行动程序序列化出错: {}", tempAction.getKey(), e); + } + } + } + } + }); + + } + + protected abstract Path doBuildTempPath(MetaAction tempAction, String codeType); + + protected abstract void doSerialize(MetaAction tempAction, String code, String codeType) throws IOException; + + /** + * 列出执行环境下的系统依赖情况 + */ + public abstract JSONObject listSysDependencies(); + + @Data + protected static class RunnerResponse { + private boolean ok; + private String data; + } +} \ No newline at end of file diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/SandboxRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/SandboxRunnerClient.java new file mode 100644 index 00000000..4013a696 --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/SandboxRunnerClient.java @@ -0,0 +1,54 @@ +package work.slhaf.partner.core.action.runner; + +import com.alibaba.fastjson2.JSONObject; +import work.slhaf.partner.core.action.entity.MetaAction; +import work.slhaf.partner.core.action.entity.MetaActionInfo; + +import java.nio.file.Path; +import java.util.Map; +import java.util.concurrent.ExecutorService; + +/** + * 基于 Http 与 WebSocket 的沙盒执行器客户端,负责: + *
    + *
  • + * 发送行动单元数据 + *
  • + *
  • + * 实时更新获取已存在行动列表 + *
  • + *
  • + * 向传入的 MetaAction 回写执行结果 + *
  • + *
+ */ +public class SandboxRunnerClient extends RunnerClient { + + @Override + protected Path doBuildTempPath(MetaAction tempAction, String codeType) { + // TODO Auto-generated method stub + return null; + } + + @Override + protected void doSerialize(MetaAction tempAction, String code, String codeType) { + // TODO Auto-generated method stub + + } + + public SandboxRunnerClient(Map existedMetaActions, ExecutorService executor) { // 连接沙盒执行器(websocket) + super(existedMetaActions, executor); + } + + public RunnerResponse doRun(MetaAction metaAction) { + // 调用沙盒执行器 + return null; + } + + @Override + public JSONObject listSysDependencies() { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java index 5d3138bd..bd01e0f4 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java @@ -11,6 +11,7 @@ import work.slhaf.partner.core.action.ActionCore; import work.slhaf.partner.core.action.entity.*; import work.slhaf.partner.core.action.entity.ActionData.ActionStatus; import work.slhaf.partner.core.action.entity.MetaAction.ResultStatus; +import work.slhaf.partner.core.action.runner.RunnerClient; import work.slhaf.partner.core.cognation.CognationCapability; import work.slhaf.partner.core.memory.MemoryCapability; import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.*; @@ -43,6 +44,7 @@ public class ActionExecutor extends AgentRunningSubModule { try { - actionCapability.execute(action); + runnerClient.run(action); result.getFixedData().add(action.getResult().getData()); } catch (Exception e) { log.error("行动单元执行失败: {}", key, e); diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/DynamicActionGenerator.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/DynamicActionGenerator.java index f31038de..d9d6e854 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/DynamicActionGenerator.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/DynamicActionGenerator.java @@ -1,19 +1,22 @@ package work.slhaf.partner.module.modules.action.dispatcher.executor; -import java.util.List; - import com.alibaba.fastjson2.JSONObject; - -import lombok.Data; +import work.slhaf.partner.api.agent.factory.capability.annotation.InjectCapability; import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule; +import work.slhaf.partner.api.agent.factory.module.annotation.Init; import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.ActivateModel; import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.AgentRunningSubModule; import work.slhaf.partner.api.chat.pojo.ChatResponse; -import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.GeneratorInput; -import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.GeneratorResult; import work.slhaf.partner.common.util.ExtractUtil; +import work.slhaf.partner.core.action.ActionCapability; +import work.slhaf.partner.core.action.entity.GeneratedData; import work.slhaf.partner.core.action.entity.MetaAction; import work.slhaf.partner.core.action.entity.MetaActionType; +import work.slhaf.partner.core.action.runner.RunnerClient; +import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.GeneratorInput; +import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.GeneratorResult; + +import java.nio.file.Path; /** * 负责依据输入内容生成可执行的动态行动单元,并选择是否持久化至 SandboxRunner 容器内 @@ -22,27 +25,38 @@ import work.slhaf.partner.core.action.entity.MetaActionType; public class DynamicActionGenerator extends AgentRunningSubModule implements ActivateModel { + @InjectCapability + private ActionCapability actionCapability; + + private RunnerClient runnerClient; + + @Init + void init() { + runnerClient = actionCapability.runnerClient(); + } + @Override public GeneratorResult execute(GeneratorInput input) { GeneratorResult result = new GeneratorResult(); - // 由于 SCRIPT 类型程序都是在 SandboxRunner 内部的磁盘上加载然后执行的, - // 所以此处的输入内容也只需要指定输入参数、临时key、是否持久化即可,路径将按照指定规则统一构建,不可交给LLM生成 - String prompt = buildPrompt(input); - // 响应结果需要包含几个特殊数据: 依赖项、代码内容、是否序列化、响应数据释义 - ChatResponse response = this.singleChat(prompt); - GeneratorResponseData generatorData = JSONObject - .parseObject(ExtractUtil.extractJson(response.getMessage()), GeneratorResponseData.class); - MetaAction tempAction = buildAction(input); - waitingSerialize(tempAction, generatorData); - result.setTempAction(tempAction); - return null; - } - - /** - * 将临时行动单元序列化至临时文件夹,并设置程序路径、放置在队列中,等待执行状态变化,并根据序列化选项选择是否补充 MetaActionInfo 并持久序列化 - */ - private void waitingSerialize(MetaAction tempAction, GeneratorResponseData generatorData) { - + try { + // 由于 SCRIPT 类型程序都是在 SandboxRunner 内部的磁盘上加载然后执行的, + // 所以此处的输入内容也只需要指定输入参数、临时key、是否持久化即可,路径将按照指定规则统一构建,不可交给LLM生成 + String prompt = buildPrompt(input); + // 响应结果需要包含几个特殊数据: 依赖项、代码内容、是否序列化、响应数据释义 + ChatResponse response = this.singleChat(prompt); + GeneratedData generatorData = JSONObject + .parseObject(ExtractUtil.extractJson(response.getMessage()), GeneratedData.class); + MetaAction tempAction = buildAction(input); + // 将临时行动单元序列化至临时文件夹,并设置程序路径、放置在队列中,等待执行状态变化,并根据序列化选项选择是否补充 MetaActionInfo 并持久序列化 + // 通过 ActionCapability 暴露的接口,序列化至临时文件夹,同时返回Path对象并设置。队列建议交给 SandboxRunner + // 持有,包括监听与序列化线程 + Path path = runnerClient.getPathAndSerialize(tempAction, generatorData); + tempAction.setPath(path); + result.setTempAction(tempAction); + } catch (Exception e) { + result.setTempAction(null); + } + return result; } private MetaAction buildAction(GeneratorInput input) { @@ -72,12 +86,4 @@ public class DynamicActionGenerator extends AgentRunningSubModule dependencies; - private String code; - private boolean serialize; - private JSONObject responseSchema; - } } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ParamsExtractor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ParamsExtractor.java index ff527d21..25a8d5cc 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ParamsExtractor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ParamsExtractor.java @@ -1,11 +1,7 @@ package work.slhaf.partner.module.modules.action.dispatcher.executor; -import java.util.HashMap; -import java.util.List; - import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; - import lombok.extern.slf4j.Slf4j; import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule; import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.ActivateModel; @@ -16,6 +12,9 @@ import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.Extra import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.ExtractorResult; import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.HistoryAction; +import java.util.HashMap; +import java.util.List; + /** * 负责依据输入内容进行行动单元的参数信息提取 */ diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ExtractorResult.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ExtractorResult.java index 9ddf9060..f36bf561 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ExtractorResult.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ExtractorResult.java @@ -1,9 +1,9 @@ package work.slhaf.partner.module.modules.action.dispatcher.executor.entity; -import java.util.Map; - import lombok.Data; +import java.util.Map; + @Data public class ExtractorResult { private boolean ok; diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/GeneratorInput.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/GeneratorInput.java index 0d84f40f..15cc1cb7 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/GeneratorInput.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/GeneratorInput.java @@ -1,9 +1,9 @@ package work.slhaf.partner.module.modules.action.dispatcher.executor.entity; -import java.util.Map; - import lombok.Data; +import java.util.Map; + @Data public class GeneratorInput { private String key; diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/InterventionHandler.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/InterventionHandler.java index 01eba94e..e30897a1 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/InterventionHandler.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/InterventionHandler.java @@ -3,6 +3,7 @@ package work.slhaf.partner.module.modules.action.interventor.handler; import lombok.extern.slf4j.Slf4j; import work.slhaf.partner.api.agent.factory.capability.annotation.InjectCapability; import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule; +import work.slhaf.partner.api.agent.factory.module.annotation.Init; import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.AgentRunningSubModule; import work.slhaf.partner.core.action.ActionCapability; import work.slhaf.partner.core.action.ActionCore.ExecutorType; @@ -10,6 +11,7 @@ import work.slhaf.partner.core.action.entity.ActionData; import work.slhaf.partner.core.action.entity.ActionData.ActionStatus; import work.slhaf.partner.core.action.entity.MetaAction; import work.slhaf.partner.core.action.entity.PhaserRecord; +import work.slhaf.partner.core.action.runner.SandboxRunnerClient; import work.slhaf.partner.module.modules.action.interventor.entity.InterventionType; import work.slhaf.partner.module.modules.action.interventor.entity.MetaIntervention; import work.slhaf.partner.module.modules.action.interventor.handler.entity.HandlerInput; @@ -30,6 +32,13 @@ public class InterventionHandler extends AgentRunningSubModule actionCapability.loadMetaAction(actionKey)) .toList(); - //TODO 需要将干预逻辑下放至 ActionCapability ,因为 ActionExecutor 中也存在干预操作 + // TODO 需要将干预逻辑下放至 ActionCapability ,因为 ActionExecutor 中也存在干预操作 switch (intervention.getType()) { case InterventionType.APPEND -> handleAppend(actionData, intervention.getOrder(), actions); case InterventionType.INSERT -> handleInsert(actionData, intervention.getOrder(), actions, phaser); @@ -118,7 +127,8 @@ public class InterventionHandler extends AgentRunningSubModule actions) { - if (order <= actionData.getExecutingStage()) return; + if (order <= actionData.getExecutingStage()) + return; actionData.getActionChain().put(order, actions); } @@ -127,7 +137,8 @@ public class InterventionHandler extends AgentRunningSubModule actions, Phaser phaser) { - if (order < actionData.getExecutingStage()) return; + if (order < actionData.getExecutingStage()) + return; phaser.register(); try { @@ -144,7 +155,7 @@ public class InterventionHandler extends AgentRunningSubModule { try { - actionCapability.execute(action); + runnerClient.run(action); } finally { phaser.arriveAndDeregister(); } @@ -158,7 +169,8 @@ public class InterventionHandler extends AgentRunningSubModule actions) { - if (order <= actionData.getExecutingStage()) return; + if (order <= actionData.getExecutingStage()) + return; Map> actionChain = actionData.getActionChain(); if (actionChain.containsKey(order)) { diff --git a/Partner-Main/src/test/java/SystemTest.java b/Partner-Main/src/test/java/SystemTest.java new file mode 100644 index 00000000..b618dae8 --- /dev/null +++ b/Partner-Main/src/test/java/SystemTest.java @@ -0,0 +1,47 @@ +import com.alibaba.fastjson2.JSONObject; +import org.junit.jupiter.api.Test; +import work.slhaf.partner.core.action.entity.MetaActionInfo; +import work.slhaf.partner.core.action.runner.LocalRunnerClient; +import work.slhaf.partner.core.action.runner.RunnerClient; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +public class SystemTest { + @Test + void execTest() { + // exec("pwd"); + // exec("ls", "-la"); + String r = exec("pip", "st", "--format=freeze"); + System.out.println(r); + } + + private String exec(String... command) { + StringBuilder s = new StringBuilder(); + ProcessBuilder processBuilder = new ProcessBuilder(command); + try { + Process process = processBuilder.start(); + java.io.InputStream inputStream = process.getInputStream(); + java.util.Scanner scanner = new java.util.Scanner(inputStream).useDelimiter("\\A"); + if (scanner.hasNext()) { + s.append(scanner.next()); + } + } catch (IOException e) { + e.printStackTrace(); + } + return s.toString(); + } + + @Test + void localRunnerClientTest() { + Map existedMetaActions = new HashMap<>(); + ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor(); + RunnerClient client = new LocalRunnerClient(existedMetaActions, executor); + JSONObject res = client.listSysDependencies(); + System.out.println(res.toString()); + } + +} From 628234f6e203d5d7a02d41fcc0aa64c584ecf6e9 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Tue, 16 Dec 2025 10:37:04 +0800 Subject: [PATCH 022/182] refactor(MetaActionType): redefine meta action types into MCP and ORIGIN Context: Previously, SCRIPT and PLUGIN were treated as separate action types, but their semantics are already covered by MCP. However, a generic execution path for locally generated actions is still required, which is represented by ORIGIN. --- .../slhaf/partner/core/action/entity/MetaAction.java | 3 +-- .../partner/core/action/entity/MetaActionType.java | 11 +++++++++-- .../partner/core/action/runner/LocalRunnerClient.java | 3 +-- .../dispatcher/executor/DynamicActionGenerator.java | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java index 14bbe1c0..d4545eb6 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java @@ -44,8 +44,7 @@ public class MetaAction implements Comparable { public void resetPath() { path = switch (type) { - case PLUGIN -> Path.of(ACTION_PROGRAM, key, "action.jar"); - case SCRIPT -> Path.of(ACTION_PROGRAM, key, "action.py"); + case ORIGIN -> path; case MCP -> Path.of(ACTION_PROGRAM, key, "action.json"); }; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaActionType.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaActionType.java index a260141a..5de3a85a 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaActionType.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaActionType.java @@ -1,5 +1,12 @@ package work.slhaf.partner.core.action.entity; public enum MetaActionType { - PLUGIN, MCP, SCRIPT -} \ No newline at end of file + /** + * 将调用的 MCP 工具,可包括远程、本地任意服务 + */ + MCP, + /** + * 适用于‘临时生成’的行动程序,在生成后根据序列化选项及执行情况,进行持久化 + */ + ORIGIN +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 46d11aed..08257d3c 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -41,9 +41,8 @@ public class LocalRunnerClient extends RunnerClient { try { // 由于三种方式返回的内容结构变化太大,所以选择油具体执行逻辑返回真正的 Response 对象 response = switch (metaAction.getType()) { - case MetaActionType.SCRIPT -> doRunWithScript(metaAction); case MetaActionType.MCP -> doRunWithMcp(metaAction); - case MetaActionType.PLUGIN -> doRunWithPlugin(metaAction); + case MetaActionType.ORIGIN -> doRunWithOrigin(metaAction); }; } catch (Exception e) { response = new RunnerResponse(); diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/DynamicActionGenerator.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/DynamicActionGenerator.java index d9d6e854..1677f2c8 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/DynamicActionGenerator.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/DynamicActionGenerator.java @@ -65,7 +65,7 @@ public class DynamicActionGenerator extends AgentRunningSubModule Date: Tue, 16 Dec 2025 10:47:23 +0800 Subject: [PATCH 023/182] refactor(RunnerClient): restructure serialization and temp execution paths Context: Following the consolidation of action types into ORIGIN and MCP, the serialization logic needs to be separated into dedicated methods. These methods are invoked by DynamicActionGenerator. --- .../work/slhaf/partner/common/Constant.java | 2 +- .../partner/core/action/entity/McpData.java | 5 ++ .../core/action/runner/LocalRunnerClient.java | 32 ++++++----- .../core/action/runner/RunnerClient.java | 55 ++----------------- .../action/runner/SandboxRunnerClient.java | 31 ++++++----- .../executor/DynamicActionGenerator.java | 13 +++-- 6 files changed, 55 insertions(+), 83 deletions(-) create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/McpData.java diff --git a/Partner-Main/src/main/java/work/slhaf/partner/common/Constant.java b/Partner-Main/src/main/java/work/slhaf/partner/common/Constant.java index fd7d3985..4ca7bb11 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/common/Constant.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/common/Constant.java @@ -6,7 +6,7 @@ public final class Constant { public static final String DATA = "./data"; public static final String MEMORY_DATA = DATA + "/memory"; public static final String ACTION_PROGRAM = DATA + "/action"; - public static final String TMP_ACTION_DIR_LOCAL = DATA + "/tmp"; + public static final String TMP_ACTION_DIR_LOCAL = ACTION_PROGRAM + "/tmp"; } } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/McpData.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/McpData.java new file mode 100644 index 00000000..aa8121a7 --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/McpData.java @@ -0,0 +1,5 @@ +package work.slhaf.partner.core.action.entity; + +public class McpData { + +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 08257d3c..fd2185ed 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -5,6 +5,8 @@ import com.alibaba.fastjson2.JSONObject; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.jetbrains.annotations.NotNull; + +import work.slhaf.partner.core.action.entity.McpData; import work.slhaf.partner.core.action.entity.MetaAction; import work.slhaf.partner.core.action.entity.MetaActionInfo; import work.slhaf.partner.core.action.entity.MetaActionType; @@ -52,37 +54,36 @@ public class LocalRunnerClient extends RunnerClient { return response; } + private RunnerResponse doRunWithOrigin(MetaAction metaAction) { + RunnerResponse response = new RunnerResponse(); + + return response; + } + private RunnerResponse doRunWithMcp(MetaAction metaAction) { RunnerResponse response = new RunnerResponse(); return response; } - private RunnerResponse doRunWithPlugin(MetaAction metaAction) { - RunnerResponse response = new RunnerResponse(); - - return response; - } - - private RunnerResponse doRunWithScript(MetaAction metaAction) { - RunnerResponse response = new RunnerResponse(); - - return response; - } - @Override - protected Path doBuildTempPath(MetaAction tempAction, String codeType) { + public Path buildTmpPath(MetaAction tempAction, String codeType) { return Path.of(TMP_ACTION_DIR_LOCAL, System.currentTimeMillis() + "-" + tempAction.getKey() + codeType); } @Override - protected void doSerialize(MetaAction tempAction, String code, String codeType) throws IOException { + public void tmpSerialize(MetaAction tempAction, String code, String codeType) throws IOException { Path path = tempAction.getPath(); File file = path.toFile(); file.createNewFile(); Files.writeString(path, code); } + @Override + public void persistSerialize(MetaActionInfo metaActionInfo, McpData mcpData) { + throw new UnsupportedOperationException("Unimplemented method 'doPersistSerialize'"); + } + @Override public JSONObject listSysDependencies() { // 先只列出系统/环境的 Python 依赖 @@ -252,7 +253,7 @@ public class LocalRunnerClient extends RunnerClient { } private void handleParentDirEvent(WatchEvent.Kind kind, Path thisDir, Path context, - WatchService watchService) { + WatchService watchService) { Path path = Path.of(thisDir.toString(), context.toString()); // MODIFY 事件不进行处理 if (kind == StandardWatchEventKinds.ENTRY_CREATE) { @@ -316,4 +317,5 @@ public class LocalRunnerClient extends RunnerClient { } } + } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java index 92c5799f..da80db13 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java @@ -3,7 +3,7 @@ package work.slhaf.partner.core.action.runner; import com.alibaba.fastjson2.JSONObject; import lombok.Data; import lombok.extern.slf4j.Slf4j; -import work.slhaf.partner.core.action.entity.GeneratedData; +import work.slhaf.partner.core.action.entity.McpData; import work.slhaf.partner.core.action.entity.MetaAction; import work.slhaf.partner.core.action.entity.MetaAction.Result; import work.slhaf.partner.core.action.entity.MetaAction.ResultStatus; @@ -42,58 +42,13 @@ public abstract class RunnerClient { result.setStatus(response.isOk() ? ResultStatus.SUCCESS : ResultStatus.FAILED); } - //TODO 将执行划分为 MCP、OriginalScript两种类型,SCRIPT、PLUGIN、MCP的分类不再必要 protected abstract RunnerResponse doRun(MetaAction metaAction); - /** - * 将临时行动程序放入等待队列,根据其是否需要持久序列化,监听其执行状态,执行成功则持久序列化 - * - * @throws IOException - */ - public Path getPathAndSerialize(MetaAction tempAction, GeneratedData generatedData) throws IOException { - String code = generatedData.getCode(); - String codeType = generatedData.getCodeType(); + public abstract Path buildTmpPath(MetaAction tempAction, String codeType); - Path path = doBuildTempPath(tempAction, codeType); - tempAction.setPath(path); - doSerialize(tempAction, code, codeType); - if (generatedData.isSerialize()) { - waitingSerialize(tempAction, code, codeType, generatedData.getResponseSchema()); - } - return path; - } + public abstract void tmpSerialize(MetaAction tempAction, String code, String codeType) throws IOException; - private void waitingSerialize(MetaAction tempAction, String code, String codeType, JSONObject jsonObject) { - executor.execute(() -> { - Result result = tempAction.getResult(); - while (true) { - switch (result.getStatus()) { - case ResultStatus.WAITING -> { - try { - Thread.sleep(300); - } catch (InterruptedException ignored) { - } - } - case ResultStatus.FAILED -> { - break; - } - case ResultStatus.SUCCESS -> { - tempAction.resetPath(); - try { - doSerialize(tempAction, code, codeType); - } catch (IOException e) { - log.error("行动程序序列化出错: {}", tempAction.getKey(), e); - } - } - } - } - }); - - } - - protected abstract Path doBuildTempPath(MetaAction tempAction, String codeType); - - protected abstract void doSerialize(MetaAction tempAction, String code, String codeType) throws IOException; + public abstract void persistSerialize(MetaActionInfo metaActionInfo, McpData mcpData); /** * 列出执行环境下的系统依赖情况 @@ -105,4 +60,4 @@ public abstract class RunnerClient { private boolean ok; private String data; } -} \ No newline at end of file +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/SandboxRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/SandboxRunnerClient.java index 4013a696..86bdd6b5 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/SandboxRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/SandboxRunnerClient.java @@ -1,9 +1,12 @@ package work.slhaf.partner.core.action.runner; import com.alibaba.fastjson2.JSONObject; + +import work.slhaf.partner.core.action.entity.McpData; import work.slhaf.partner.core.action.entity.MetaAction; import work.slhaf.partner.core.action.entity.MetaActionInfo; +import java.io.IOException; import java.nio.file.Path; import java.util.Map; import java.util.concurrent.ExecutorService; @@ -24,18 +27,6 @@ import java.util.concurrent.ExecutorService; */ public class SandboxRunnerClient extends RunnerClient { - @Override - protected Path doBuildTempPath(MetaAction tempAction, String codeType) { - // TODO Auto-generated method stub - return null; - } - - @Override - protected void doSerialize(MetaAction tempAction, String code, String codeType) { - // TODO Auto-generated method stub - - } - public SandboxRunnerClient(Map existedMetaActions, ExecutorService executor) { // 连接沙盒执行器(websocket) super(existedMetaActions, executor); } @@ -47,8 +38,22 @@ public class SandboxRunnerClient extends RunnerClient { @Override public JSONObject listSysDependencies() { - // TODO Auto-generated method stub return null; } + @Override + public Path buildTmpPath(MetaAction tempAction, String codeType) { + throw new UnsupportedOperationException("Unimplemented method 'buildTmpPath'"); + } + + @Override + public void tmpSerialize(MetaAction tempAction, String code, String codeType) throws IOException { + throw new UnsupportedOperationException("Unimplemented method 'tmpSerialize'"); + } + + @Override + public void persistSerialize(MetaActionInfo metaActionInfo, McpData mcpData) { + throw new UnsupportedOperationException("Unimplemented method 'persistSerialize'"); + } + } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/DynamicActionGenerator.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/DynamicActionGenerator.java index 1677f2c8..763ebe7f 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/DynamicActionGenerator.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/DynamicActionGenerator.java @@ -16,8 +16,6 @@ import work.slhaf.partner.core.action.runner.RunnerClient; import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.GeneratorInput; import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.GeneratorResult; -import java.nio.file.Path; - /** * 负责依据输入内容生成可执行的动态行动单元,并选择是否持久化至 SandboxRunner 容器内 */ @@ -50,8 +48,11 @@ public class DynamicActionGenerator extends AgentRunningSubModule Date: Tue, 16 Dec 2025 19:58:08 +0800 Subject: [PATCH 024/182] chore(test): organize experimental tests and test resources --- Partner-Main/data/log/partner.log | 54 +++++++++---------- .../test/java/{ => experimental}/NetTest.java | 2 + .../java/{ => experimental}/OnnxTest.java | 2 + .../{ => experimental}/ReflectionTest.java | 2 + .../test/java/{ => experimental}/RegexTest.kt | 2 + .../{ => experimental}/SelfAwarenessTest.java | 2 + .../java/{ => experimental}/SystemTest.java | 2 + .../{ => experimental}/ThreadPoolTest.java | 2 + .../timewheel/TimeWheelTest.kt | 0 .../text/relation_input_test.json | 0 .../text/relation_output_test.json | 0 .../src/test/java/resources/text/test.json | 18 +++++++ 12 files changed, 59 insertions(+), 27 deletions(-) rename Partner-Main/src/test/java/{ => experimental}/NetTest.java (94%) rename Partner-Main/src/test/java/{ => experimental}/OnnxTest.java (99%) rename Partner-Main/src/test/java/{ => experimental}/ReflectionTest.java (96%) rename Partner-Main/src/test/java/{ => experimental}/RegexTest.kt (98%) rename Partner-Main/src/test/java/{ => experimental}/SelfAwarenessTest.java (99%) rename Partner-Main/src/test/java/{ => experimental}/SystemTest.java (98%) rename Partner-Main/src/test/java/{ => experimental}/ThreadPoolTest.java (97%) rename Partner-Main/src/test/java/{ => experimental}/timewheel/TimeWheelTest.kt (100%) rename Partner-Main/src/test/java/{ => resources}/text/relation_input_test.json (100%) rename Partner-Main/src/test/java/{ => resources}/text/relation_output_test.json (100%) create mode 100644 Partner-Main/src/test/java/resources/text/test.json diff --git a/Partner-Main/data/log/partner.log b/Partner-Main/data/log/partner.log index cf72c2ab..eb2dca02 100644 --- a/Partner-Main/data/log/partner.log +++ b/Partner-Main/data/log/partner.log @@ -67,45 +67,45 @@ 2025-10-16 19:28:19 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading huggingface library from: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 2025-10-16 19:28:19 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading native library: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64/libtokenizers.so 2025-10-16 19:28:19 [main] WARN a.d.h.t.HuggingFaceTokenizer - maxLength is not explicitly specified, use modelMaxLength: 512 -2025-10-16 19:28:19 [main] INFO OnnxTest - [0.51123345, 0.43754324, 0.22250144, -0.49621642, -0.59625536, -0.24450612, 0.5863322, 0.46978277, 0.5778739, 0.6761688, -0.0854191, 0.36117497, -0.24092007, -0.19524571, -0.7976704, -0.044580948, -0.53635055, -0.11370213, -1.1403378, 0.2129236, -0.34120926, 0.001864681, -1.3665671, -0.22030343, -0.830733, 0.099989876, 0.4966247, -0.066141784, 0.41148925, 0.729914, -0.29459542, 0.29208705, -0.3367949, -1.0972055, -0.024628287, -0.6583721, 1.253141, -0.61462474, -0.518246, -0.53295904, 0.12913027, 0.04108283, 0.55130756, -0.8039789, -1.2061563, -0.34272343, 0.27257943, -0.13096467, 0.18428354, 0.2605311, 0.057498857, 0.7461083, 0.1835212, 0.021440782, -0.20071763, 0.04362084, -1.3614484, -0.1095237, -1.0870106, 0.40957803, 0.7201999, 0.98604536, 0.39732328, -1.3224756, 0.40671548, 0.406975, 0.50348455, 0.22034347, 0.5530567, 0.25672144, -0.6594347, 0.96159023, 0.07775575, -0.7792945, -1.0163779, 0.36998796, 0.5171132, 0.79771215, -0.5552498, 0.80050594, 0.14805704, 0.2997373, 0.26703542, 0.08637628, -1.4002664, -0.813782, 0.25788978, 0.5414073, -0.46593362, -0.027594358, 0.29689378, 0.65353656, -0.31033817, 0.08076967, 0.76214606, 0.8415609, -0.3084258, -0.32594687, -0.72558767, -0.3289697, 1.0932022, 0.87115157, -0.89196694, -0.18925445, -0.9785898, -0.2336246, -0.9026102, 0.088704094, -0.7258216, -0.6594782, 0.09606822, 1.0850618, 0.0013394654, 0.38363743, -0.3874976, 0.20100841, -0.4128504, 0.74124134, -0.6654147, -0.5718573, 0.27072686, -0.046442233, -0.2115764, -0.7070531, -0.9749727, -0.4404279, -1.3043284, 0.93771523, 0.30211914, -0.59651214, 0.12527934, 0.089207426, 0.51316845, 0.8074455, -0.5485792, 0.07305289, 0.10457601, 0.24046482, 0.5214334, -1.1262523, 0.16574118, 0.01661903, -0.72924286, 1.7897038, 0.7391656, 0.26545036, -0.24889244, 0.019522466, -0.38037547, 0.9288784, -0.90373176, -0.2429637, 0.13991763, 0.4122005, -0.6420515, -0.045609288, -0.055985063, 0.121364415, 0.28139967, -0.0052891895, -0.106420964, 0.56713265, -0.46813145, 0.19711205, -0.58464926, 0.3698026, -0.2838148, 0.12638272, 0.01481974, -0.2993888, 0.14940853, -0.4162319, -0.045515813, -0.07729791, 0.47421545, 0.46603337, 0.62959045, 0.1828863, 0.2002228, 0.07522717, -0.50393486, 0.37032261, -0.35638678, 0.8902856, -0.033868957, 0.100021124, 0.43048963, 0.3153236, -0.6283139, -0.24138638, 0.81751156, 0.2257601, -1.2130985, 0.44707552, 0.0037308559, 0.5666142, -0.8444263, 1.204924, -0.65543765, -1.9701289, -0.8207577, 0.08641613, -0.4112931, -0.20802015, 0.87505317, -0.13793634, 0.07145847, 0.31840786, -0.092020944, -0.80500084, 0.58076894, 0.117715076, -0.67379886, 0.45848575, 0.4390001, -0.7055742, -0.712911, 0.33785975, 0.42191327, 0.121282555, 0.13419384, 0.17775199, 0.5506595, 0.67962146, 0.4780363, -0.03222577, -0.8667363, 0.8303137, -0.541459, 0.062450707, 0.03477095, 0.49735057, -0.3892, 0.8767689, -0.06756614, 0.35541242, 0.94193155, 0.8131012, 0.58299375, 0.1854296, -0.60147816, 0.4282838, 0.5299751, 0.7330451, -0.3257398, -0.58661395, 0.5521986, -0.606695, 0.44539154, 0.41345364, -0.023682468, 1.0244411, 0.8901564, -0.025144015, -0.6341725, -0.4240578, 0.31344998, 1.0556707, -0.7415066, -0.32343262, 0.1841922, 0.36124998, 0.5530684, 0.29907, -0.02951768, 0.19808297, 0.08838599, 0.05037989, -0.049141884, -1.1747736, 0.03532947, 0.07290274, -0.7062243, -0.027512219, -0.5645471, -0.034089435, 0.4769841, -0.5791185, -0.062474817, -0.5574461, -0.07675014, -0.58530134, 0.5648111, 0.7009718, 0.19080682, -0.37462634, -0.38008162, -0.8266342, -0.56594104, 0.6085925, -0.8169755, 0.2305794, 0.022104293, -0.32453218, 0.029340252, 0.12966694, -0.35197243, 1.0937076, -0.08106287, -0.630723, -0.07665277, 0.09807674, -0.15652439, -0.032777905, -0.59978753, 0.7365465, 0.8591844, -0.16815796, 0.8361499, 0.27674484, -0.3099411, 0.60480386, 0.23437774, -0.7338224, -0.9829839, 0.67439365, 0.742201, 0.42505273, -0.68957865, -0.47552192, -0.5682225, -0.5110189, -0.28437212, -0.565194, -0.19356139, 0.63973606, -0.014390081, -1.646161, 0.2918704, -0.4594489, -0.8228203, -0.16133638, 0.07148346, 0.9419251, -0.019150853, -0.4403408, -0.56392926, 0.12463045, 0.24700657, -0.19791731, 0.6058087, -0.5370069, -0.051276788, 0.9354616, -0.055462413, 0.050041005, -0.6077635, -0.68125796, -0.13532986, 0.36517376, -0.019653555, -0.03586552, -0.1600579, 0.67996794, -0.25741813, 0.9547673, -0.910809, -0.009982694, 0.7332152, -0.20394151, -0.09925252, 0.5988749, 0.10125684, -0.2892084, 0.09639569, -0.9270706, -0.14898436, 0.23913115, 0.7453801, -1.0168681, 0.80838275, -0.27111107, -0.14699328, -0.68104225, 0.19166322, -0.79916215, 0.43923154, 0.16553934, 0.33551145, -0.5704513, -0.070023894, -0.3918103, -0.17701462, 1.6619401, 0.674843, 0.23895527, 0.80687135, -0.01851894, -0.34060583, -0.58362544, -0.96381485, -0.19843449, 1.6370385, -0.44541967, -0.13564552, -1.7383175, 0.94101083, 0.4386875, 0.8844557, 0.7002662, -0.72894764, -0.6103935, -0.32648364, 0.054746274, -0.6872155, 0.18739484, -1.0520368, 0.6648933, -0.2648567, -0.06654116, -1.3043286, 0.22864798, -0.10361338, 0.594177, 0.5787685, 0.1750473, -0.0105097145, 0.91527426, 0.25346497, -0.27341178, -1.1472199, -0.31140554, -0.49403697, -0.13216135, 0.7429359, -0.57663065, -0.5814875, -0.46789917, 0.62059444, 1.0459176, 0.105841815, -0.8354111, -0.09153462, -0.4892223, -0.9736461, 0.03827665, 0.6993418, -0.5639835, 0.3098794, -0.8142145, 0.047523424, -0.21321937, -0.034833632, -0.010952409, -0.041929975, -0.28044957, 0.060209088, 0.50224316, -0.046635136, -0.85428065, 0.73049414, -1.4654225, 0.11870827, -0.66137636, 0.27924734, -0.7339802, -0.42894232, 0.17209588, 1.1703713, -0.1511008, -0.27938917, -0.13280374, 0.86497086, -0.4407706, -0.3784376, 1.2453586, -0.21126446, -0.15996158, 0.48933926, -0.27048388, -0.2984165, 0.7081715, 0.58110875, -0.06946933, -0.27087092, -0.23854852, 0.36320952, 0.3962092, 0.11321919, 0.10443739, -0.56340504, 0.49124345, 0.6088691, -0.70054543, -0.09448326, -1.4692224, 0.24175254, -0.18142638, 0.3656459, 0.3561722, 0.39745298, 0.35550624, -0.25403917, -0.8084114, -0.3391734, -0.14518976, -0.31460696, -0.8502122, -0.20892489, 0.040290922, 0.36273193, -0.76562995, -0.80031925, 0.060696647, -0.15262939, -0.061190173, -0.09423466, 0.6150074, -0.5358167, 0.3251421, 0.28123394, 0.7587028, -0.4789124, -0.10876167, -0.18576714, 0.49481302, -0.09939133, 0.20352225, -0.5852573, 0.6395335, -0.3011577, -0.8522485, -0.31254715, 0.5950347, -0.26513442, 0.70972127, 0.43091288, -0.041825093, -0.2292053, -0.6451991, -0.34200215, -0.41545817, -0.2689111, -0.9946734, -0.25178003, 0.6669945, 0.17163065, -0.15006264, -0.9421287, -0.019158833, -0.6975499, 0.438868, -0.6849216, 0.03262051, -0.44509438, 0.64882565, -0.5953382, 1.1495787, -0.8011461, 0.20847918, 0.1251037, 0.32168102, -0.21917565, 1.0629005, -0.92278206, -0.37890035, 0.4195118, -0.21815889, 0.2514746, 0.6282729, -0.14128427, 0.050928507, -0.35163182, -0.06737878, -0.9663225, -0.4687798, -0.59459, 0.21002933, 0.048163563, 0.48905462, 0.14316124, 0.028260775, 1.2529061, 0.14390653, -0.21695222, -0.7194682, -0.66993797, -0.70739895, -0.5410352, 0.8340246, -0.2935943, -0.23657572, -0.4150082, 0.20044121, 0.6332451, -0.4892323, -0.016682208, 1.8937812, 0.7091852, 0.14414868, -0.9804469, 1.2162073, 0.17216161, -0.50498605, -0.34003568, 0.16963801, -0.33994526, 0.0731189, -0.41613013, -0.94484633, -0.815923, -0.5739614, 0.94484705, 0.31987455, 0.14467219, -0.14761059, -0.7047535, -1.0639687, 0.40880874, 1.3001518, -0.23591296, 1.0019474, 0.69951487, 0.33188945, 1.2750803, -0.47983044, 0.033220377, 0.12004468, 0.9492074, 0.9103111, -0.052080557, 0.58394325, 0.8401497, -1.830512, -1.4265813, -0.17748688, -0.061487965, -0.1359964, -0.88339686, -0.37029758, -0.13061845, -0.2954845, 0.2814227, 0.25465572, -0.19771555, 0.09913704, -0.15107808, 0.011260349, -0.14225599, -0.11415321, 1.0593241, -0.7078028, 0.5747197, -0.4055798, -0.18129641, -0.47820956, 0.1952592, 0.22990699, 0.5002197, 0.10373032, 0.628042, 0.06865163, 1.0157357, -0.6903584, -0.15411828, 0.6126792, -1.4284332, -1.3705213, -0.07465902, -0.11910443, -0.13134138, 0.41676903, -0.21215296, -0.028965306, 0.3505228, 0.047843248, 0.30888152, -1.1421498, -0.08647778, -1.1076055, -0.78975534, -0.05059923, 0.058172554, 0.27877957, 0.3418617, 0.27528864, -0.0043393373, -0.425253, 0.21216352, 0.02201505, 0.46995455, -0.35277224, 1.1497868, -0.7000632, -0.49699458, -0.36768207, -0.08427355, -0.106513396, -0.15144402, -0.6940467, -0.6297557, 0.4525672, 1.2141936, -0.12161607, 0.24308786, -0.1425119, -0.38016897, 0.91598785, -0.41090524, 0.14860485, 0.28929144, 0.21543092, -0.84538454, 0.0807224, -0.2773164, 0.5301908, -0.7331233, 0.49941978, 0.5512182, -0.5476493, -0.18183059, -0.77233905, -0.15702356, -1.1651708, -0.21300837, 0.018835044, 0.32697025, 0.34967226, 0.51722765, 0.09109617, 0.61710453, 0.062239163, 0.056631085, 0.06611446, 0.46277747, 0.13079983, 0.08349137, -0.17646214, 0.26698142, 0.046738572, 0.6847735, 0.38814327, 0.014033079, -0.04680039, 0.292931, -0.8164349, 0.3852389, 0.19666976, 0.37969127, -0.23450008, 0.45247716, 0.4581556, -0.9366612, 0.5417323, -0.055298187, -0.6215795, 1.218463, -1.3511043, -0.7937524, 0.008464169, -0.9959098, 0.7161945, -0.25348237, -0.68490624, 0.39310396, 0.3586596, -0.7416965, -0.18592128, 0.30235815, 0.63015443, -0.33157557, -0.89634436, -0.5073603, 0.27419057, 0.112835586, 0.471214, -0.9042775, -0.41822886, 0.71185523, 0.6571464, 0.33782732, 0.15355957, -0.1364721, -1.0384371, 0.64586115, 0.5162391, 0.52103496, -1.1132919, 0.1564614, -0.35837764, 0.7777977, -0.5688318, -0.19020915, 0.12580645, 0.23848471, 0.050079808, 1.4870666, 0.74930036, 0.11167382, 0.51369834, 0.0912603, 0.03457948, 0.97924113, -0.2526727, -0.6790167, 1.0118998, 0.17009932, 0.59963554, 0.38631436, 0.5874571, 0.35385707, -0.49165446, -0.43353337, 0.29959297, 0.90330774, 0.008084901, 0.19826728, 0.035730332, -0.26280853, 0.49997848, -0.3445545, 0.25782338, -0.29269776, -0.7271916, -1.1451478, -0.3687011, 1.2749437, 0.28989944, -0.010594554, 0.20570764, -0.039815754, 0.7760036, 0.83210295, -0.37314057, 0.34827492, 0.33832714, 0.2549089, 0.3180246, 0.15750375, 0.37374565, 0.29076517, -1.084236, -0.2536879, 0.09893724, 0.167326, -0.42620236, -0.06183477, -0.85039747, 0.7655713, 0.5407811, 0.135566, 0.61822957, -0.658225, 0.060597345, -1.0510322, 0.29207668, -0.40406957, -0.06383139, 0.8471315, -0.3460373, 0.0568925, 0.42080507, 0.50762975, 0.29434744, -0.07577321, 0.5478096, 0.31866163, 0.77027106, 0.5869493, -0.4031725, 0.34900978, 0.03501825, -0.60266703, -0.12610222, 0.48031133, -0.843012, 0.4924527, -0.8623877, -0.6477808, 0.22316428, 0.52191186, -0.42713517, -0.4163384, 0.02406159, 0.19311489, -0.8280169, 0.7257932, 0.5891742, 0.6126962, -0.107232764, -0.07629745, -0.50356364, 0.6316943, 0.1606891, -0.70639515, -0.12811224, -0.4105088, -0.08755256, -0.40668, -0.5366433, -0.30879006, 0.10060625, 0.28111058, -0.71532774, -0.3630196, 0.59962934, 0.15385062, 0.36727977, -0.45993006, 0.22452451, -0.23574719, 1.6684455, -0.043385856, 1.6276766, -0.16736466, -0.12352954, 1.0252162, -0.27102458, 0.59440255, 0.26338896, -0.2930035, -0.61721444, 0.6569015, -0.34776017, -0.38311705, -0.4351132, 0.751855, -0.44927332, 0.28445652, -1.4778186, -0.5496483, -0.834149, -1.1146356, -0.8802563, 1.0398924, -0.14450291, -0.022082053, -0.009103067, -0.8312893, 3.564548, 0.31639445, 0.43401474, 0.63638914, 0.048858773, -0.24585214, 0.42760444, -0.627559, 0.36051834, -0.75384, 0.3967399, 0.078143656, 0.12599553, 0.86665404, 0.050567865, 0.92432106, -1.5632179, 0.19709128, 0.12208514, -0.078961484, -0.91890043, 0.23671533, 0.47289363, 0.19900943, 0.7240069, 0.16399404, 1.1182141, -1.0169126, -0.1350502, -0.46091932, 1.2807544, 0.35965964, 0.21481083, -0.3007364, -0.39301196, 0.9101389, 0.1932972, 0.15104347, 0.14832743, 0.27131686, -0.067170985, -0.6418764, 0.50354594, 0.25878644, -0.0033070669, 0.70426977, -0.6287618, 0.31597823, 0.45087764, -0.04529953, 0.8379618, -0.3591785, 0.56057227, -0.5669976, -0.84720474, -0.052068297, -0.16401154, 0.30864736, -0.8251212, 0.22997884, -0.28843462, 0.20421404, -0.10270865, 0.12777951, -0.34080166, 0.28729475, 0.63097245, 0.62922233, -0.23039082, -0.9737556, -0.37730604, 0.021021312, -0.18025522, -1.0727465, 0.0019658804, 1.0562756, -1.0607209, 0.55097324, -0.095470026, -0.16923568, 0.29799882, 0.13360816, -0.015510071, -0.3002998, 0.29892552, 0.5038376, 0.07581481, -0.25795814, -0.26878086, -0.018943973, 1.1134932, 0.84816736, 0.07172927, -0.119864315, 0.16197601, 0.55967194, -0.1490119, 0.35443506, -0.12817872, -0.7264169, 0.35164982, 0.5088061, 0.36944637, 0.75947386, 0.22153465, -0.0902444, 0.35916293, -0.22257099, -0.6245021, -0.66597265, -0.2242328, -0.47101194, -0.09299229, -1.0377257, -0.21733049, -0.32486138, -0.23556301, -0.9277732, 0.023987524, -0.5385696, -0.002912309, 0.6834146, 0.06879748, 0.26568368, 1.1300062, -0.17972237, 0.1250636, -0.06957579, -0.9457501, -0.10762876, -0.7763465, 1.5165349, -0.51138073, -0.53803205, -0.7513938, -0.16054633, -0.057135716, 0.56398803, -0.7251428, -0.9011231, -1.1330264, -0.009565931, -0.46391025, -0.3945485, -0.019825712, -0.214825, 0.662374, 0.4089401, -0.25013703, -0.11175172, -0.3359659, -0.73787993, -0.44064045, -0.95422965, 0.24658713, 0.5482323, 0.44154587, 0.15066868, -0.90368706, 0.16147381, 0.23279902, 0.41150323, -0.14870353, 0.4448821, 0.3361582, -0.5416869, 0.66956925, 9.3244016E-4, -0.58035725, -0.9133776, -0.21026349, 0.47709528, 0.559402, -0.096517116, 0.34964085, 0.021026324, -0.052352354, 0.2260392, 0.083108045, -0.82103014, -0.49560097, 0.13991357, 0.72335935, -0.22744378, -0.17416112, -0.06924981, 0.1720519, -0.056980915, -0.0040308535, 0.4777559, 0.34662804, -0.6132766, -0.1805803, -0.58219105, -0.5035861, 0.743928, 0.62252325, -0.43229088, 0.42164406, -0.7834892, 0.19773507, -0.68034565, 0.15410969, -0.46971694, -0.5955516, 0.23321742, 0.61164176, -0.10516539, 0.581982, -0.7406695, 0.31757313, -0.69854766, 0.9880034, -0.84722793, -0.7633326, 0.4578721, 0.10518447, 0.16203061, -0.6790652, -0.47155732, -0.38882074, -0.9170391, 1.0266749, -0.17550212, -0.4792506, -0.0668991, 0.39064267, 0.0947658, 0.8043089, -0.22434905, -0.313821, 0.052670494, -0.048851267, 0.32592362, -0.860603, 0.2698992, 0.3433336, -0.21785763, 1.5819844, 0.88469046, 0.07691138, 0.09752565, -0.42556408, -0.04519853, 0.87291956, -0.6176682, -0.2865502, 0.20136131, 0.36512914, -0.3311012, -0.30614272, -0.26107365, 0.1894452, 0.32637066, 0.35523584, -0.06667226, 0.10347664, -0.11940256, -0.10296476, -0.38421103, 0.6074242, 0.18352178, 0.015820663, -0.14712866, -0.20719282, 0.6038181, -0.15472703, -0.039784297, 0.059039198, 0.4398168, 0.68517715, 0.592921, -0.48001018, 0.29964036, 0.059656337, -0.36691985, -0.11802984, -0.16027823, 0.8514473, 0.061800294, -0.24240336, -0.00616711, -0.2318474, -0.27456677, -0.20014185, 0.39548382, 0.08403352, -0.6075959, 0.7013164, -0.24715367, 0.7730584, -0.5263237, 0.6818461, -0.4345966, -1.9885256, -0.57651246, 0.3897464, -0.22896479, 0.029132985, 0.62822366, -0.3221436, -0.24454945, -0.13972506, 0.07538301, -0.43282226, 0.29167226, 0.26169014, -0.22840403, 0.12716646, 0.5241455, -0.67354554, -0.23412356, 0.1583346, 0.09397203, -0.6005605, -0.062070902, 0.519738, 0.56230676, 0.19490737, 0.09140409, 0.2827071, -0.7554103, 0.9776802, -0.28762445, -0.16992666, -0.27326876, 0.5205804, -0.39026648, 0.8100204, 0.2251311, 0.3743077, 0.41226578, 0.28279757, 0.10248689, 0.78833973, -0.39051318, -0.035605595, 0.6300383, 0.67743725, -0.18472652, -0.3580135, 0.14300483, -0.36656314, 0.09548992, 0.6840508, 0.53377825, 1.0797411, 1.0701865, -0.14112248, -0.1359908, -0.52505445, 0.2282274, 0.8130599, 0.10876868, -0.5497892, -0.06409781, -0.12850465, -0.08437914, -0.348632, -0.55334604, -0.057698317, -0.020369263, 0.0053720847, 0.16307293, -0.8254809, -0.10885659, -0.54735035, -0.9688062, -0.2985726, -0.051860273, -0.13334262, 0.35509858, -0.8054574, -0.28351018, -0.68802255, 0.17037089, -0.7018103, 0.8101351, 0.96281683, -0.053284153, -0.42187208, -0.41856027, -0.7051473, -0.43084157, 0.46245623, -0.6828755, 0.13075721, -0.12911314, -0.28247756, 0.683695, 0.07331526, 0.008655533, 1.0331321, 0.41872248, -0.43458146, 0.11952154, 0.4864054, -0.4770374, -0.672267, -0.7951411, 0.90124786, 0.38761422, -0.06815794, 0.4979946, 0.3519773, -0.51443356, 0.47134402, 0.32008561, -0.52492595, -0.5968779, 0.91214985, 0.62872326, 0.25207788, -0.78720355, -0.65435094, -0.3022893, -0.026059672, 0.03250689, -0.4841232, -0.21127056, 0.94293606, -0.31384826, -1.024962, 0.4258807, -0.5591192, -0.85103065, 0.07572705, -0.029542465, 0.9386782, -0.01834616, -0.41138232, -0.41427138, 0.080845095, -0.021675527, -0.25335732, 0.85154873, -0.83299226, 0.010143421, 0.7232927, 0.60553235, 0.1309088, -0.3839781, -0.5941144, -0.45264992, 0.38672507, 0.21139218, 0.34125578, -0.30670395, 0.5510206, 0.19656421, 0.7967939, -0.61074483, 0.032774314, 0.4495337, -0.4416033, 0.04436638, 0.19213377, 0.25077653, -0.1421333, -0.07981576, -0.80517834, -0.44514215, 0.12253037, 0.5937313, -0.7326427, 0.7710463, -0.47982028, -0.026294831, -0.27366686, 0.59971505, -0.88799405, 0.34242895, 0.011235021, 0.68797493, -0.31184798, -0.2491819, -0.39411223, -0.37572742, 1.597634, 0.5555229, 0.53293955, 0.85264903, -0.014117359, -0.04914263, -0.32758757, -0.42537898, 0.016268618, 1.7822325, 0.014657244, -0.33223224, -1.4506384, 0.8279289, 0.63178736, 0.70278394, 0.16083482, -0.11632228, -0.42550898, 0.2825111, 0.050327733, -0.62059164, 0.24553949, -0.84764546, 0.5793387, -0.19014005, 0.18559122, -0.60808384, -0.22480549, -0.10949272, 0.4119357, 0.48874575, 0.10797066, 0.14826402, 0.95159596, 0.1007035, -0.28172037, -0.78677756, -0.2911378, -0.39184836, 0.18129729, 0.14663315, -0.6903422, -0.6197286, -0.22756599, 0.4553, 0.7559648, -0.19024116, -0.7333675, -0.22558317, -0.10755519, -0.8364387, -0.24587573, 0.61560297, -0.116256624, 0.09515799, -0.61133057, -0.60270244, 0.11373564, -0.478234, 0.054566797, 0.21379222, -0.20055366, 0.4200289, 0.38137415, 0.57250637, -0.8365286, 0.46541566, -1.5011121, 0.007360235, -0.7604555, 0.0025998056, -0.5833547, -0.07466688, 0.39678958, 0.96836436, -0.2345093, -0.18433093, 0.3012629, 0.2799663, -0.70134974, -0.48911846, 0.7690916, -0.06511322, -0.49618146, 0.3662134, -0.6264914, -0.22856562, 0.24773872, 0.3183567, 0.13739681, 0.07009312, 0.23409715, 0.34881467, -0.33139125, 0.28852808, -0.095444344, -0.51926076, 0.51465845, 0.2062692, -0.5242261, -0.46329415, -0.9741153, 0.06456158, 0.030457906, 0.14805505, 0.17728561, 0.27969873, 0.4174524, -0.53553534, -0.050896656, -0.7748257, 0.07999295, -0.064726844, -0.6482009, -0.16539901, 0.52794135, 0.2680578, -0.54837555, -0.846483, -0.1018344, 0.2759287, 0.01647371, -0.30559725, 0.77830505, -0.42698085, 0.22914001, 0.29629123, 0.9014104, -0.6857988, -0.02880317, -0.27855328, 0.5116826, -0.09280562, -0.026375346, -0.82933587, 0.29830056, 0.10016385, -0.9599105, 0.06670639, 0.32166743, -0.12561196, 1.15202, 0.17707397, -0.08005495, -0.039337177, -0.2968356, -0.12169429, -0.36883074, 0.2049313, -0.6679535, 0.031608433, 0.52695143, 0.007821337, -0.1485552, -0.62809414, 0.13040474, -0.15451281, 0.54773754, -0.4706813, 0.24263154, -0.1301415, 0.67641205, -0.62720996, 0.8313544, -0.7381075, -0.14358105, 0.3762475, 0.62239164, -0.045437563, 0.9459873, -0.8233303, -0.7147683, 0.46758357, -0.52135533, 0.06063361, 0.56855184, -0.507306, -0.036665827, -0.6302179, 0.07766994, -0.942735, -0.5909925, -0.2635432, 0.5478883, -0.07890162, 0.32488316, 0.26487243, 0.46853012, 1.1034807, -0.06512659, 0.33847657, -0.61609834, 0.06321365, -0.22743702, -0.87944865, 0.37845594, -0.020726902, -0.59833187, -0.42895967, -0.11077006, 1.0032699, -0.1725022, 0.32639518, 1.6419518, 0.21870343, 0.1484011, -0.7495263, 0.5773338, 0.1948407, -0.26478645, 0.31931522, -0.02530934, -0.18381046, 0.039240766, -0.3821348, -0.880036, -0.40542898, -0.5050127, 1.0508015, 0.6978597, 0.27783167, 0.43318307, -0.686163, -0.95909375, 0.39126918, 0.736118, 0.010625005, 0.4478026, 0.5347271, -0.28854454, 0.7788674, -0.65132344, 0.028316252, -0.24979532, 0.3684371, 0.8357179, -0.35869396, 0.24370271, 0.33024335, -1.4370449, -1.2778331, 0.19882585, -0.017336432, -0.4316948, -1.2735684, -0.26503587, -0.015060261, -0.6085152, 0.22704697, 0.26457584, -0.42646304, 0.03879311, -0.19615118, 0.44677356, -0.32433823, -0.084605284, 1.198679, -0.51367915, 0.36138633, -0.26781407, -0.25285503, 0.10098021, -0.24817827, -0.18135414, -0.17848538, 0.35427713, 0.521286, -0.02674108, 0.4217017, -0.08987662, 0.25608358, 0.50207585, -0.98633564, -1.0628304, -0.3846806, 0.022207262, -0.1283618, 0.37523708, -0.24025467, 0.5153696, 0.46323073, 0.13989824, 0.1561494, -0.77944976, -0.44046345, -0.63301426, -0.34989792, 0.13549271, 0.006190121, 0.24559984, 0.31742877, 0.1545193, -0.44265345, -0.08644013, 0.28001422, 0.15021466, 0.85503155, -0.76575583, 0.86318636, -0.55829847, -0.25753778, -0.7185067, -0.085994214, -0.18091784, 0.446105, -0.77112305, -0.4430915, 0.2551184, 1.1472955, -0.40047967, 0.35478163, -0.4045759, -0.48856065, 0.7408055, -0.13986495, 0.09953445, 0.2774477, 0.2467106, -0.42283788, 0.21039721, 0.10461013, 0.31418386, -0.6786972, 0.964533, 0.6333979, -0.42829648, -0.2897507, -0.9437793, 0.067182526, -0.99148446, -0.31607157, -0.5791597, 0.04460093, 0.2817655, 0.21890405, -0.0091788955, 0.614969, 0.21509607, 0.26194388, -0.028229192, 0.6323737, 0.3229837, -5.941242E-4, 0.1451681, 0.3452308, 0.26828063, 0.82891965, 0.6615142, 0.15845887, -0.1930975, 0.32330292, -0.49461275, 0.33965734, 0.5015075, 0.22370936, -0.038758203, 0.33031383, 0.64308834, -0.22973657, 0.40101275, 0.1735294, -0.62445706, 0.63983095, -1.0835669, -0.59931755, -0.25685513, -1.0129862, 0.148363, -0.3387562, -0.7876695, 0.36497584, 0.4875883, -0.46318775, -0.30246222, 0.24639976, 0.3614344, -0.4353444, -0.7491151, 0.03876262, 0.014877375, 0.5000705, 0.48863775, -0.5708522, -0.29530814, 0.39000627, 0.18866692, 0.13831648, -0.38619447, -0.5484635, -1.1455809, 0.14575654, 0.41666955, 0.17747879, -0.8406549, 0.13223548, -0.45904288, 1.1353003, -0.26693252, -0.12810816, 0.37510347, -0.29213232, -0.43941584, 0.9184803, 0.6855956, 0.2599459, 0.6948795, -0.0708392, -0.12901774, 0.55323, -0.5387498, -0.716477, 0.42386472, 0.12503567, 0.6216118, 0.10394464, 0.8343109, 0.65234077, -0.41163832, -0.39263293, -0.108594045, 0.4115751, 0.16237709, 0.28965876, -0.07473482, -0.23911166, 0.2871039, -0.6131977, 0.513528, -0.11655871, -0.6466727, -1.1273916, -0.19115873, 1.4469596, -0.020101145, -0.11192806, 0.01993516, 0.26601622, 1.1657052, 1.008147, -0.6360585, 0.12956598, 0.9011077, 0.26741764, 0.13538633, -0.082566485, 0.21531783, 0.26441088, -1.1124214, -0.27627683, 0.34551474, 0.15321879, -0.21587288, -0.29057226, -0.5665258, 1.2804754, 0.5072227, 0.2061311, 0.39224344, -0.48967192, 0.2075164, -1.2929554, 0.22832677, -1.1763334, 0.05883432, 0.5320689, -0.19186282, -0.067902, 0.5984157, 0.33769348, 0.24878782, 0.11002658, 0.33792466, 0.547646, 0.7538705, 0.59686947, -0.19582872, 0.39902282, -0.3311249, -0.74637324, -0.14266883, 0.43165115, -0.6139184, 0.29811418, -0.7535113, -0.30266273, 0.53370935, 0.36760342, -0.5749821, -0.68662786, -0.2779321, 0.37260574, -1.1336465, 0.6302474, 0.47815326, 0.9866135, -0.14947067, -0.033082485, -0.2046695, 0.20482336, -0.21032988, -0.52653766, 0.0245497, -0.47625363, -0.12423223, -0.12356821, -0.32638925, -0.0979994, 0.0010491088, 0.29562947, -0.6457077, -0.10971795, 0.06126561, 0.8076332, 0.2573005, -0.21695858, 0.46280462, -0.5214897, 1.3339914, 0.23493724, 1.6153331, 0.18739215, -0.35449666, 0.6756968, -0.35441598, 0.49293745, -0.08351409, -0.24639843, -0.57777464, 0.98248875, 0.0011553783, -0.68022805, -0.1735664, 0.5991789, -0.5056995, 0.28030026, -1.3956647, -0.29886672, -1.040315, -0.6200091, -0.55999726, 0.4394985, 0.25020325, -0.030757431, 0.41339186, -0.99428976, 4.134183, 0.21829394, 0.2768517, 0.24642767, 0.027245255, 0.22640549, 0.47818106, -0.79617405, 0.4751648, -0.4929724, 0.5096883, 0.14533526, 0.087542474, 0.42481625, -0.26212215, 0.94900197, -0.995192, 0.37323165, 0.48663512, 0.16938138, -0.9202455, 0.32618392, 0.3355089, -0.12735334, 0.39952835, -0.4738593, 0.17960149, -0.8438873, -0.15847224, -0.28993642, 1.529727, -0.06471403, 0.040852357, 0.038847372, -0.25056893, 1.0816733, -0.30027992, 0.33796108, 0.057108454, 0.27828, -0.07463636, -0.7907264, 0.89314646, 0.11971448, -0.2797623, 0.56961, -0.5983841, 0.07197225, 0.6231197, -0.16240701, 0.8118333, -0.10884293, 0.36955264, -0.30067077, -0.54466736, 0.23035151, -0.11903405, 0.15843613, -0.9551723, -0.008313894, -0.09104793, -0.34124452, 0.019560076, 0.22333694, -0.46288738, -0.06519584, 0.8732297, 0.4417033, -0.3591715, -0.79684395, -0.18898311, -0.00398656, -0.32608062, -0.624982, -0.43221474, 0.7961611, -1.0244153, 0.6864666, -0.38873324, -0.66227776, 0.18808874, -0.2118657, 0.12453443, -0.20756744, 0.2250452, 0.5361353, -0.38134813, -0.12358688, -0.50916564, 0.06882605, 0.5491102, 0.6088567, 0.043271434, 0.034038477, -0.14568043, 0.34731272, 0.27437162, 0.4291449, -0.5072562, -0.6460547, -0.17843097, 0.4998613, 0.4862506, 0.48174888, 0.43009067, -0.07885784, 0.25953156, -0.44193333, -0.2746965, -0.72802746, -0.24735373, -0.46056688, -0.08113882, -1.2671432, 0.05059053, -0.43514493, 0.09988372, -1.3890023, -0.5439976, -0.5726784, 0.042483523, 0.45590004, -0.12616622, 0.629282, 0.96405625, -0.42434147, 0.29803038, -0.16519342, -0.9395849, -0.230326, -0.83917814, 1.4581625, -0.57237923, -0.5016961, -0.5101177, 0.03989938, -0.16089517, 0.91115934, -0.69840354, -1.4957484, -0.25355923, 0.24498278, -0.03987664, 0.28695616, 0.33610544, 0.42031482, 0.26267177, 0.26665464, -0.036663882, -0.3205201, 0.08044999, -1.3707422, -0.10242602, -1.2773657, 0.44744903, 0.4707493, 1.1146326, 0.52519447, -1.0453299, 0.22108254, 0.3916083, 0.51568663, 0.2354028, 0.50902164, 0.15007426, -0.6983879, 1.0460291, 0.11031413, -0.68165857, -0.867732, 0.08759557, 0.32828143, 0.90392447, -0.74337864, 0.6990192, 0.12273654, 0.1353184, 0.41217592, 0.24795906, -1.3185968, -0.7651147, 0.103916384, 0.6086596, -0.29084563, 0.022982366, 0.28086853, 0.55208766, -0.31949097, -0.01541844, 0.81749123, 0.83401155, -0.14799729, -0.33081663, -0.8713344, -0.20599653, 1.2038018, 0.81881714, -0.62137777, -0.08521465, -0.9437865, -0.19047725, -0.9235109, 0.07554969, -0.54554856, -0.72309697, 0.10257645, 1.2262453, 0.11698446, 0.5399791, -0.6098297, 0.077516764, -0.1635267, 0.7329004, -0.6491352, -0.43532693, 0.13268438, -0.062738866, -0.037672497, -0.6150539, -0.792422, -0.32316244, -1.1831503, 0.8048623, 0.43596715, -0.80266297, 0.20404984, 0.040005, 0.51196873, 0.61864376, -0.3671871, 0.039022297, 0.08777553, 0.34561458, 0.48366174, -1.1842922, 0.108419, 0.09672105, -0.4544338, 1.6715314, 0.8024864, 0.38295293, 0.11245011, -0.13004047, -0.25588313, 0.9442645, -1.106852, -0.3146361, 0.17383303, 0.26125604, -0.836142, -0.2676666, 0.09179972, -0.11250311, 0.35692418, -0.074471295, -0.117300734, 0.47520566, -0.5543069, 0.32387045, -0.66126156, 0.395984, -0.23777974, 0.31760883, -6.269303E-5, -0.42587698, 0.3092674, -0.26971295, 0.12728855, -0.09048116, 0.3214799, 0.6557833, 0.40655518, -0.043354645, 0.23725055, 0.05158411, -0.5487681, 0.47276476, -0.42214486, 0.96318287, 0.101917736, 0.04613815, 0.37172058, 0.35901445, -0.55353534, -0.28215954, 0.646838, 0.055748854, -0.94629276, 0.52053577, -0.096165426, 0.68151516, -0.86083305, 1.2210809, -0.61603034, -1.8547043, -0.70553493, 0.08560893, -0.32475078, -0.07537295, 0.9242262, -0.3031748, -0.039215017, 0.48975095, 0.07386944, -0.635114, 0.5792452, 0.11396569, -0.79614615, 0.47500247, 0.22382374, -0.7640738, -0.7832393, 0.32251167, 0.2957459, 0.19379763, 0.1966333, 0.19957598, 0.47575438, 0.72345144, 0.2891014, -0.07611428, -0.7970295, 0.68839777, -0.65931904, 0.18129885, -0.1070019, 0.4440913, -0.3229485, 0.87062204, 0.0016378155, 0.34254807, 1.0556462, 0.9242675, 0.3841158, 0.19424327, -0.5399717, 0.45922905, 0.4348209, 0.7463028, -0.23992652, -0.60218215, 0.26373464, -0.48176405, 0.3577192, 0.30109936, 0.18007952, 0.97340673, 0.8311445, -0.091018654, -0.43556908, -0.47817314, 0.24427673, 0.86847204, -0.63367134, -0.1392084, 0.20880738, 0.29605484, 0.5102095, 0.0539689, 0.025343515, 0.24565774, 0.20760463, -0.14849266, 0.07748646, -1.0975155, -0.2468316, 0.049564585, -0.81448174, 0.07844066, -0.5533479, -0.12086342, 0.34281364, -0.47970983, 0.012860723, -0.20691025, -0.09066814, -0.6537314, 0.488608, 0.72847027, 0.43217465, -0.3573188, -0.2835165, -0.7994006, -0.60978246, 0.6759259, -0.74162185, 0.021587722, 0.2148367, -0.31782195, 0.15477072, 0.073249355, -0.2504549, 0.9304441, -0.109614864, -0.39431396, -0.13444294, 0.113385625, -0.17943051, -0.13110475, -0.6351985, 0.8168083, 0.7287063, 0.046382003, 0.78491753, 0.12041721, -0.44125587, 0.65859365, 0.1417125, -0.62944174, -0.8578431, 0.5297364, 0.5970799, 0.32134923, -0.6988253, -0.3988505, -0.53683966, -0.5645854, -0.26411146, -0.54879487, -0.08550332, 0.5523895, 0.09527285, -1.4829303, 0.42620313, -0.32207206, -0.80331665, -0.14081834, 0.14321318, 1.0547477, -0.014484324, -0.3733287, -0.6547246, -0.22136927, 0.23872378, -0.114890546, 0.52663624, -0.36137518, -0.10336557, 0.84902483, 0.24802007, 0.2428974, -0.55062777, -0.898774, -0.086360104, 0.42273575, 0.01069665, 0.03268071, -0.22184242, 0.68654114, -0.31356922, 0.99203634, -0.8053663, 0.024493441, 0.52120054, -0.14788416, 0.16501157, 0.71239144, 0.10519813, -0.23112617, -0.30074418, -0.7945606, -0.32828715, 0.1546241, 0.71328896, -0.8631298, 0.6879144, -0.25349656, -0.15505737, -0.52401733, 0.026135508, -0.91197675, 0.4897887, 0.2553321, 0.38357615, -0.5817329, 0.10147074, -0.14365219, -0.07878406, 1.460639, 0.76415765, 0.44990405, 0.9951974, -0.10996676, -0.43003532, -0.6043866, -0.97104216, -0.10857196, 1.7999303, -0.2487742, -0.23330228, -1.9624965, 0.8282924, 0.3562973, 0.99590814, 0.710325, -0.74927074, -0.47313, -0.23652235, 0.17110118, -0.64118886, 0.18618682, -1.0815334, 0.4417191, -0.27619588, 0.13438608, -1.2182668, 0.09222232, -0.046028994, 0.5128414, 0.6309838, 0.17811278, 0.08257908, 0.82218415, 0.24052832, -0.3043413, -1.1845739, -0.31409425, -0.5495012, -0.102475435, 0.6949858, -0.60669345, -0.5356563, -0.12042385, 0.51972234, 0.9788067, 0.27975333, -0.6509743, 0.08709107, -0.3396774, -1.0324789, 0.21493271, 0.64101464, -0.4424937, 0.35320687, -0.8626394, 0.018576376, -0.14504273, 0.0675314, -0.09590454, 0.14231923, -0.32527098, 0.15347226, 0.50280917, -0.12097482, -0.93272054, 0.6082158, -1.5437937, -0.07995024, -0.6858374, 0.39547303, -0.5739462, -0.52489924, 0.041147597, 1.3033543, -0.17370999, -0.22331943, -0.12098679, 0.7863538, -0.6103873, -0.3908378, 1.0210451, -0.33337703, -0.335317, 0.679813, -0.03252794, -0.46655637, 0.58323187, 0.526237, -0.17061844, -0.47416002, -0.35893548, 0.4063307, 0.32042253, -0.0637602, 0.13230446, -0.44979116, 0.5168601, 0.33988982, -0.7665607, 0.0853706, -1.2825401, 0.35769534, -0.21235913, 0.25373393, 0.2737563, 0.4383112, 0.26156312, -0.18157701, -0.82445776, -0.54746836, -0.19033858, -0.14472756, -0.8237075, -0.20849845, 0.09290561, 0.45805925, -0.60196894, -0.9694583, 0.22632071, -0.15821098, -0.07559876, -0.13461533, 0.6933839, -0.32768452, 0.3443336, 0.31391212, 0.9203925, -0.36575687, -0.20933554, -0.31347826, 0.5546571, -0.016795274, -0.092404574, -0.5469727, 0.6365913, -0.43841305, -0.8389967, -0.036488578, 0.61133695, -0.3538103, 0.76916534, 0.2602567, 0.04585594, -0.20960002, -0.69782466, -0.073778585, -0.4628681, -0.31100827, -1.194452, -0.15880762, 0.61074346, 0.01697435, 0.08602919, -1.0204202, -0.1064734, -0.5719034, 0.3842537, -0.61645734, 0.005817363, -0.5069963, 0.73048353, -0.58076227, 1.1014149, -1.002687, 0.26485753, 0.001325082, 0.23775855, -0.1090179, 0.8222375, -0.8824368, -0.60530984, 0.38780227, -0.18472426, 0.18662238, 0.6539168, -0.08568022, 0.0025433525, -0.35558033, 0.019322174, -0.88901633, -0.6802375, -0.69873244, 0.29876226, 0.03279008, 0.41753015, 0.15544944, 0.136213, 1.1869895, 0.13588208, -0.24654882, -0.68050987, -0.6760854, -0.6779837, -0.68511623, 0.96097136, -0.5064433, 0.005498264, -0.47417802, 0.14546248, 0.7594362, -0.367512, -0.098296344, 1.961263, 0.35767633, 0.03230954, -0.69004714, 1.1331533, 0.27895185, -0.49140096, -0.07016089, 0.16740261, -0.34845498, 0.25857598, -0.37114236, -0.92653924, -0.78350365, -0.41225216, 0.69445866, 0.34486955, 0.093205795, -0.066756755, -0.64549917, -1.1127244, 0.37053987, 1.1387469, -0.23592287, 0.80528295, 0.63944227, 0.54414797, 1.0815576, -0.5668222, 0.089382716, 0.13776606, 0.9200868, 0.8992326, -0.27931058, 0.48805022, 0.82883877, -1.7794003, -1.3662231, -0.16744435, 0.084341876, -0.107593, -1.017171, -0.3791846, -0.14377698, -0.27979684, 0.51328593, 0.26247755, -0.27690327, 0.076862276, 0.0780327, -0.07342488, -0.061520025, 0.0024008472, 0.8332128, -0.6966219, 0.4901986, -0.24039306, -0.14298935, -0.24950793, 0.12527625, 0.29839414, 0.7389395, 0.15047178, 0.58706343, 0.12560952, 1.0310695, -0.5962883, -0.18943071, 0.6150714, -1.2840291, -1.3595079, -0.15191634, -0.25942472, -0.17627351, 0.3720213, -0.10289232, 0.056950808, 0.3213657, 0.3321522, 0.053539947, -1.0371126, -0.052774735, -0.87331986, -0.7267541, 0.051209338, 0.1441378, 0.31906247, 0.46871975, 0.18395185, -0.0692848, -0.42856544, 0.01773473, -0.1260064, 0.71401536, -0.27404174, 1.3056145, -0.61608034, -0.3932829, -0.24632904, 0.010613654, -0.21523128, -0.08095754, -0.4983497, -0.626685, 0.64032483, 1.0719864, -0.35518745, 0.31677714, -0.09860298, -0.29361737, 0.98726356, -0.28703505, 0.37888417, 0.2140752, 0.36996755, -0.71319747, 0.2214708, -0.3875488, 0.37793255, -0.7721462, 0.6461019, 0.6115026, -0.5304169, -0.17443098, -0.70448905, -0.021181267, -1.0428503, -0.34047216, -0.06293756, 0.17875059, 0.28179625, 0.44505474, 0.16711755, 0.6964868, 0.2429418, -0.048931554, 0.101600535, 0.29270682, 0.14754868, 0.040776677, -0.2830106, 0.24993977, 0.18217126, 0.5031197, 0.6458861, 0.08088947, -0.06821887, 0.2294434, -0.6025328, 0.4214955, 0.02959657, 0.31607035, 0.048564933, 0.36561626, 0.4328048, -1.0279614, 0.5526877, -0.3101868, -0.7041938, 1.2670145, -1.0038794, -0.7538339, -0.051289015, -0.99725854, 0.54648906, -0.11038782, -0.8033994, 0.31729695, 0.11359299, -0.5800839, -0.29594612, 0.130738, 0.6961497, -0.31145877, -0.6745281, -0.3327659, 0.3130085, 0.12843235, 0.3653333, -0.8100079, -0.22264737, 0.5917342, 0.86295915, 0.3166489, 0.16683327, -0.26316214, -0.8232067, 0.5095601, 0.20595878, 0.45409048, -0.8229478, 0.10812789, -0.47012043, 0.8713862, -0.64504915, -0.24139825, 0.0829124, 0.30529198, -0.04502464, 1.3450638, 0.87469786, 0.1282358, 0.21878737, 0.5608324, -0.023736248, 0.8814906, -0.2450681, -0.64366734, 0.987674, 0.47663254, 0.72472185, 0.20790745, 0.4268311, 0.3406033, -0.40542594, -0.44307786, 0.21143325, 1.1998398, -0.04269371, 0.032475434, -0.028270632, -0.28937843, 0.63828766, -0.4257946, 0.30673802, -0.20225716, -0.8918963, -1.081641, -0.446235, 1.3505905, 0.28334346, -0.113350704, 0.10584864, 0.13026781, 0.9782037, 1.2069069, -0.59382397, 0.13534994, 0.20910484, 0.3964433, -0.08584341, -0.18862218, 0.29279798, 0.10304643, -1.0189443, -0.48712122, 0.089892246, 0.40033635, -0.43739498, -0.09577835, -0.8914217, 0.5634942, 0.46147624, 0.18333669, 0.5018127, -0.57141834, 0.22123447, -0.984082, 0.73240864, -0.42637298, 0.14858729, 0.58898765, -0.41788393, 0.15860158, 0.5590106, 0.5476727, 0.38015527, -0.06930857, 0.63783866, 0.19000062, 0.5320519, 0.85254997, -0.25869924, 0.36578634, 0.059271112, -0.82330275, -0.10596946, 0.32942462, -1.0458459, 0.47975013, -0.9814856, -0.54931, 0.12817167, 0.4720524, -0.60098046, -0.5558935, -0.07903196, 0.08017051, -1.0334187, 0.72646886, 0.28693724, 0.6514715, 0.017122403, 0.059414208, -0.43003318, 0.61294556, 0.15250102, -0.6344637, -0.124711365, -0.40405872, -0.21501787, -0.5084465, -0.6109873, -0.29131338, 0.21077976, 0.4723583, -0.6350576, -0.42727095, 0.3745004, 0.2436617, 0.16013308, -0.266916, 0.41006523, -0.13443582, 1.4617592, -0.09403017, 1.6679444, -0.113599226, -0.1766919, 1.1128019, -0.4637022, 0.6026775, 0.3295456, -0.26246035, -0.58322674, 0.63749, -0.29790995, -0.4552287, -0.34962073, 0.4757661, -0.38596824, 0.40881908, -1.6522696, -0.56499016, -0.9354418, -1.0565773, -0.9105244, 1.0067492, 0.12771598, -0.004504431, 0.23984769, -0.66904426, 3.6624045, 0.2592154, 0.27187067, 0.5508017, -0.10568046, -0.2670927, 0.5288961, -0.6268612, 0.20718782, -0.9910453, 0.4760573, 0.0844937, 0.11704531, 0.7277677, 0.06835682, 0.9558804, -1.4853053, -2.8017908E-4, 0.11895311, -0.11955248, -1.2167906, 0.5527989, 0.5219648, 0.25548583, 0.5149375, 0.123984054, 1.0438063, -1.0745394, -0.09779909, -0.5746613, 1.2606201, 0.4869489, 0.02342626, -0.30612367, -0.4081654, 0.54757965, 0.18535367, 0.089302, 0.14784724, 0.33126256, -0.024330921, -0.46541923, 0.44284585, 0.052763782, 0.093688585, 0.49122953, -0.9165186, 0.34113777, 0.31382066, -0.054380115, 0.8466793, -0.28731346, 0.28629318, -0.57786727, -0.5250714, -0.15221663, 0.029823096, 0.40237293, -0.7914292, 0.24210334, -0.42463204, 0.25620586, -0.21277969, -0.050531507, -0.18733416, 0.16404244, 0.696484, 0.25563902, -0.18624108, -0.8773365, -0.56324744, 0.31544864, -0.31330204, -0.8109294, -0.13510668, 0.9721738, -1.0318075, 0.26569387, 0.038234264, -0.31428084, 0.22263722, 0.06329511, -0.15759473, -0.36926627, 0.17948699, 0.5136905, 0.01984401, -0.19416128, -0.38064262, -0.37309346, 1.102059, 0.7792553, 0.060157903, -0.108390525, 0.11017364, 0.3994228, 0.09555158, 0.5825012, -0.60580367, -1.0827808, -0.1576766, 0.7572717, 0.51690817, 0.76832026, 0.5623794, -0.5242806, 0.10713714, -0.28198227, -0.3057894, -0.4436093, 0.0508234, -0.67036074, -0.50983393, -1.126107, 0.10048007, -0.28169256, 0.06555464, -1.1903594, -0.55183387, -0.4405081, -0.17009944, 0.5612562, 0.047636222, 0.37082034, 0.65144277, -0.21440561, 0.19920659, -0.08983047, -1.3184719, -0.21471508, -0.77892214, 1.0248505, -0.60647166, -0.48059314, -0.38415653, 0.33976716, 0.0074042156, 0.3431964, -0.7637138, -1.562081, 0.21412212, 0.41796106, -0.21860333, -0.036963142, -0.15398574, -0.067759186, 0.6621827, 0.14345872, -0.10131864, -0.15699252, 0.3062003, -0.93177044, 0.110051446, -1.2522842, 0.80647933, 0.19306532, 0.93869627, 0.41989905, -1.2128512, 0.048087396, 0.43417054, 0.51452124, 0.22957322, 0.6538078, 0.045719445, -0.49581295, 0.6129913, 0.2330572, -0.76418656, -0.59514874, 0.10234557, 0.34008834, 0.93430877, -0.7938407, 0.3488256, -0.095158495, 0.39193368, 0.32834923, -0.1460364, -1.1935029, -0.7402658, -0.06672922, 0.34790787, -0.24937785, -0.09675882, 0.54674053, 0.29830703, -0.25361973, 0.26495603, 0.8386657, 0.93270355, -0.30766344, 0.10872549, -0.54271966, -0.2646044, 0.80850345, 0.80533385, -0.3436443, -0.15843843, -1.1156524, -0.37078837, -0.9744277, 0.38333637, -0.7051673, -0.4906921, 0.054198608, 1.0482272, -0.16283801, 0.28291935, -0.2076324, 0.24571949, -0.42660946, 0.6194447, -0.5943218, -0.2044191, 0.80598855, 0.033541154, -0.16847873, -0.4267447, -0.5693771, -0.32211003, -0.80143666, 0.52846223, 0.42857355, -0.2879928, 0.25050047, 0.05486901, -0.059970193, 1.0365646, -0.21031526, -0.2751096, 0.4085902, 0.5967447, 0.46310297, -1.244204, 0.2939693, -0.06727497, -0.65307546, 1.6378098, 0.6602727, 0.3331953, -0.5972358, -0.16830699, -0.4092154, 0.9061645, -0.70522636, -0.30478314, 0.21947536, 0.30807325, -0.5290096, -0.021191731, -0.048273534, 0.052654807, 0.4325883, -0.002106417, 0.22604083, 0.6506453, -0.4128863, 0.06486968, -0.5109035, 0.6262629, -0.59054273, 0.54796576, -0.078081556, -0.22457956, 0.10496932, -0.7126875, -0.07178986, -0.014613241, 0.25202245, 0.6094514, 0.7096744, 0.17859364, -0.07159945, -0.10782984, -1.0702442, 0.2905703, -0.06708715, 0.73710424, 0.025326883, -0.04851279, 0.2838625, 0.100776896, -0.47360796, -0.23008478, 0.7629225, 0.4038585, -1.1927986, 0.7186655, 0.17397834, 0.66196936, -0.3637218, 1.0107775, -0.55020744, -1.4909959, -0.56990623, 0.30201685, -0.20511222, 0.2730165, 0.73218584, 0.048040986, -0.044010743, -0.15303451, -0.17348513, -0.39569393, 0.6480931, 0.10182218, -0.5377528, -0.012679113, -0.007665368, -0.65783006, -0.6718512, 0.36023977, 0.50482917, 0.112826176, -0.16764028, 0.09783888, 0.54286546, 0.82194656, 0.32949015, -0.10446587, -0.66156757, 0.44045573, -0.6881772, -0.12748857, 0.011206888, 0.5880827, -0.3310844, 0.60313576, 0.24298477, 0.18763687, 0.6665168, 0.8176408, 0.63851047, 0.7703525, -0.38874447, 0.29319334, 0.21659724, 0.67248577, -0.04747004, -0.75138336, -0.032682426, -0.58525085, 0.6164005, 0.5252805, 0.067715034, 0.77593464, 0.5756692, 0.01080169, -0.5409408, -0.18088111, 0.28055167, 0.7370628, -0.061915897, -0.14930114, 0.42736712, 0.07878585, 0.6338375, 0.028980128, -0.018971909, 0.24936385, -0.10556009, -0.007052973, -0.08535256, -1.1767282, -0.25823215, -0.16164792, -0.59529424, -0.04154039, -0.43678924, 0.16663226, 0.3614608, -0.4110936, -0.12785242, -0.561177, -0.49575725, -0.53649414, 0.55716574, 0.9938018, 0.3834205, -0.4088232, -0.16438262, -0.8488413, -0.68160176, 0.48920587, -0.35171676, 0.17286812, 0.14482836, -0.4438081, 0.34934083, -0.11522612, -0.18400648, 0.9550849, 0.19140965, -0.25227302, 0.060297303, -0.0070842654, -0.15262157, -0.484868, -0.6926102, 0.84828264, 0.91567695, 0.0016165003, 0.6874639, 0.023342803, -0.5647343, 0.4872593, 0.36987463, -0.53967863, -0.7367035, 0.6690624, 0.36760825, 0.41536736, -0.70216143, -0.78941077, -0.46292698, -0.32272416, 0.00408322, -0.569716, -0.0982589, 0.7778945, -0.22264656, -1.2859204, 0.14981261, -0.4571321, -0.84205663, -0.3931107, -0.13485941, 0.7186496, -0.11406441, -0.19351138, -0.3396683, -0.12722772, 0.0022645625, -0.023715228, 0.7800383, -0.23587298, 0.32181016, 0.6075423, 0.20606756, 0.08583229, -0.3835686, -0.76363343, 0.11516355, 0.26286107, 0.15805645, 0.010979824, -0.28352818, 0.42406383, -0.06747039, 0.7641131, -0.8182565, -0.031834044, 0.59817415, -0.556535, -0.13097134, 0.45006514, 0.45921433, 0.18680452, -0.2353987, -0.39224648, -0.20950153, 0.44744873, 0.7575571, -0.99211806, 1.0048358, -0.21880436, -0.29180026, -0.4883183, 0.11914819, -0.45420957, 0.5537008, 0.038552634, 0.28215736, -0.6505611, -0.05639731, -0.22432365, -0.0753257, 1.534879, 0.6527801, 0.33230194, 0.5043558, -0.17230092, -0.5368485, -0.60196584, -0.972783, -0.35474154, 1.5653621, 0.13357976, -0.23607488, -1.9256357, 0.99502707, 0.56387746, 0.95426637, 0.44848073, -0.6578555, -0.5840174, -0.21664485, -0.06438644, -0.6586791, 0.713435, -0.7542643, 0.4121706, -0.47967133, -0.5214753, -0.86162406, -0.41749653, 0.16635127, 0.67231923, 0.63377875, 0.060160317, -0.16357699, 0.70590246, 0.24508043, -0.31862876, -1.0028367, -0.1415234, -0.4981313, -0.07634404, 0.5626511, -0.5439674, -0.41470236, -0.32987338, 0.38528684, 0.8707138, 0.61265385, -0.7561777, -0.058350243, -0.29060918, -0.8828205, -0.32191333, 0.7171919, -0.6715127, 0.25353637, -0.85777193, -0.22826701, -0.10268143, -0.3677761, -0.21263666, 0.39470083, -0.50553197, 0.104695916, 0.38097295, 0.37870398, -0.7951013, 0.5898909, -1.4096434, 0.18723375, -0.67144465, 0.08446455, -0.32043055, -0.21069425, 0.060452625, 0.89954424, -0.33245453, 0.060212478, -0.16919714, 0.51581824, -0.46913767, -0.43260145, 0.8914732, -0.17595634, -0.39337397, 0.5862695, -0.165371, -0.41703492, 0.2300126, 0.8531972, 6.863475E-4, 0.018732369, -0.19274993, 0.11807219, 0.16294602, -0.13752386, 0.17776681, -0.7283606, 0.5255629, 0.21245965, -0.61398387, -0.019701332, -1.1922736, 0.072056726, -0.15926456, 0.06668207, 0.6565079, 0.3800544, 0.2927567, -0.18829279, -0.47632927, -0.5828585, -0.2932791, -0.32696068, -0.44982386, -0.1601027, 0.23962039, 0.35986, -0.6936998, -0.4130165, -0.028386503, 0.1189172, -0.23614475, -0.13688965, 0.8730439, -0.3260798, 0.6230809, -0.009794818, 0.64238536, -0.30446264, -0.1213474, -0.21677762, 0.64032716, -0.09058951, 0.32761735, -0.8952577, 0.7286184, -0.28435072, -1.0795968, 0.07461093, 0.5260262, 0.081124514, 1.1400597, 0.20557263, -0.22531477, -0.013032559, -0.63784456, -0.25429648, -0.43621144, -0.25980812, -0.68846905, 0.018888742, 0.40777546, 0.31415194, -0.06978384, -0.83367103, -0.47623697, -0.50554305, 0.050676435, -0.54136133, 0.09123197, -0.46119207, 0.8309509, -0.9467837, 1.3522601, -0.56323236, 0.04193849, -0.083614424, 0.65520114, -0.07264876, 1.2610217, -0.6354654, -0.54056776, 0.70698595, 0.00911441, 0.20147234, 0.8186352, -0.38808322, -0.081993535, -0.18767877, 0.27850354, -0.8085504, -0.6826043, -0.70434916, 0.28125268, -0.00417158, 0.1764245, 0.1252622, 0.13679127, 1.1405021, -0.16482627, -0.04663332, -0.58190393, -0.45656186, -0.49414352, -0.6545142, 0.7316151, -0.75474155, -0.13049766, -0.78929186, -0.1713476, 0.68869865, -0.1354918, -0.12297894, 1.374426, 0.53188884, -0.19543867, -0.7560643, 0.7825549, -0.20464867, -0.6691693, -0.024741076, 0.15538393, -0.20939259, 0.09335803, -0.32170793, -0.9581545, -0.3086296, -0.45974192, 0.9343871, 0.28155223, 0.026325535, 0.3607343, -0.51085424, -0.68860966, 0.51546973, 0.9578018, -0.32939222, 0.88570464, 0.8727469, 0.282832, 1.3196431, -0.46789652, 0.18751012, -0.009741772, 0.7062707, 0.7235945, -0.44040543, 0.32659394, 0.82885027, -1.513391, -1.0347612, -0.31969503, -0.17150323, -0.31322023, -1.0168256, -0.39043573, -0.32385135, -0.62966126, 0.4967361, 0.14318325, -0.02364469, -0.18822855, 0.36839056, 0.31844568, -0.25449395, 0.2378134, 1.1323748, -0.57734036, 0.57482517, -0.25512508, -0.3082748, -0.19442557, -0.1397948, -0.37038362, 0.7746373, 0.19150639, 0.057238307, -0.5009022, 0.7646541, -0.3515749, -0.1592197, 0.671271, -1.4349705, -0.87009597, -0.58153695, -0.0132568665, -0.26201454, 0.46259606, -0.24323648, 0.4780776, 0.24452041, 0.022693053, 0.21807481, -1.0536666, -0.3690221, -0.9724109, -0.5958498, 0.2780582, 0.17680575, 0.30712324, 0.33505383, 0.24084339, 0.3497074, -0.066905096, -0.046884567, -0.19839972, 0.49531293, -0.1463247, 0.68853134, -0.57161236, -0.5265372, -0.46173963, -0.29136887, -0.09823992, -0.25131285, -0.49662158, -0.29860687, 0.4173069, 0.61001307, -0.23230451, 0.33880717, -0.38124043, -0.62723, 0.7280858, -0.41596067, 0.12235218, -0.046359077, 0.1374916, -1.0030403, 0.076998085, 0.010334268, 0.16277502, -0.75184274, -0.045661084, 0.6897451, -0.5234157, -0.20258962, -0.35811937, -0.16314638, -1.2877578, -0.29840237, 0.11212779, 0.1864383, 0.30804637, 0.47436863, 0.07938605, 0.23727947, 0.15619943, 0.15607107, 0.3661412, 0.19492516, 0.52977335, 0.14330177, -0.39681092, 0.1595948, -0.17317334, 0.92330325, 0.95668155, 0.16457509, -0.082535796, 0.33720917, -0.6979915, -0.18996246, -0.18736917, 0.0076782946, 0.04778067, 0.4375449, 0.4449576, -0.5646165, 0.4824912, -0.73924667, -0.41778222, 1.228386, -1.4113506, -0.5091015, 0.018879347, -1.0306215, 0.3441526, -0.29703033, -0.76199734, 0.48998946, 0.0538232, -0.6444448, -0.55421084, 0.46473855, 0.41143027, 0.023548841, -0.5623564, -0.15067895, 0.5425395, 0.02348781, 0.33763394, -0.99986434, -0.40732938, 0.64412487, 0.61347324, 0.1844104, 0.060828157, 0.19362581, -0.89388067, 0.44956368, 0.61369896, 0.52955574, -0.93781817, 0.3274699, -0.2934738, 0.886754, -0.7060228, -0.09946883, 0.28589666, 0.38918224, 0.019775577, 0.8416462, 0.60078466, 0.22841358, 0.7777619, 0.048576668, 0.12920377, 0.708591, -0.17719474, -0.62505966, 1.0092452, 0.61805975, 0.53742653, 0.11385523, 0.30024686, 0.50781274, -0.65055555, -0.3315245, 0.089441545, 0.6801583, -0.055591352, 0.5085515, 0.080202654, -0.6231575, 0.7095781, -0.09222566, -0.0023482144, -0.2301088, -0.78504163, -0.89850014, -0.61895406, 1.4755174, 0.44006103, 0.3736515, 0.2789185, 0.3126807, 1.0981504, 0.5982582, -0.5319362, 0.2933641, 0.59055275, 0.449096, 0.09719907, 0.23644274, 0.4262668, 0.19561322, -0.99225354, -0.27452955, 0.0054776296, 0.42809853, -0.3454189, 0.024061855, -0.7582559, 0.4612135, 0.5061168, 0.16127184, 0.2933835, -0.74961704, -0.08755819, -1.038512, 0.52964205, -0.6356245, -0.039177597, 0.8408139, -0.43552092, -0.22568429, 0.6004227, 0.5666311, 0.34723854, 0.17451535, 0.46295786, 0.57787806, 0.5428326, 0.93625444, 0.25844303, 0.71137315, -0.17457405, -0.9393191, -0.0062135123, 0.7324282, -0.8502125, 0.21925573, -0.6307975, -0.40189654, 0.27061498, 0.65880245, -0.59898424, -0.7496212, 0.03331019, 0.19341184, -0.50549847, 0.76212996, 0.35790926, 0.7870286, -0.0400087, 0.055058934, -0.5947467, 0.26547173, 0.13392746, -1.1119648, -0.17382655, -0.5744398, 0.111572, -0.59631276, -0.62594944, -0.097791016, -0.35199642, 0.2313174, -0.58278424, -0.08641501, 0.34744838, 0.34512728, 0.500954, -0.7685111, 0.46870387, -0.10193086, 1.6084917, -0.03636925, 1.4086537, -0.063865475, -0.0015128739, 0.92001283, -0.38939625, 0.45528454, 0.31051323, 0.1577892, -0.5681765, 0.7005183, -0.5051335, -0.34040785, -0.28615594, 0.8032139, -0.46363586, 0.21622391, -1.2667955, -0.29988098, -0.81864244, -0.8201505, -1.1678752, 0.75056106, 0.098227546, -0.010810759, -0.014191384, -0.42939845, 3.9035187, 0.15681595, 0.2582419, 0.4887771, 0.1525703, -0.02428957, 0.66500604, -0.5359085, 0.22960104, -0.7852579, 0.15039048, 0.06367845, 0.3528753, 0.9337709, -0.20073745, 1.0146337, -1.0692636, -0.24778748, 0.23142752, -0.14437445, -1.2041767, 0.28693214, 0.37165838, -0.035585634, 0.52149665, -0.11201562, 0.60554165, -1.043031, 0.06837402, -0.4101506, 0.8253852, 0.12620798, 0.22745697, -0.13505921, -0.45202237, 1.1835434, 0.25073954, 0.1395775, 0.10847205, 0.25401965, -0.37892976, -0.6354462, 0.36379182, 0.1980045, 0.09259137, 0.7982754, -1.1515712, -0.24035174, 0.6636571, -0.15318638, 0.58441776, -0.48915377, 0.5170015, -0.2060879, -0.7129818, -0.1414245, -0.43068886, 0.18446523, -0.9598793, -0.2197116, -0.19919111, 0.12266955, -0.10918245, 0.35740358, -0.3485523, -0.22071102, 0.5921739, 0.5802294, -0.22553721, -0.7331374, -0.5409138, 0.4591624, -0.25060326, -0.6027513, 0.1528463, 1.0014454, -0.9771162, 0.30428672, -0.31012374, -0.36872467, -0.45164657, 0.3022587, -0.3332075, -0.05958897, 0.5864512, 0.29134268, -0.2936555, 0.14974032, -0.21069044, -0.21046856, 1.0327365, 0.87497103, -0.29114136, -0.12409274, 0.30638078, -0.008108355, -0.074863106, 0.1823267, -0.92456347, -1.2252402, 0.023988292, 0.29588172, 0.28956586, 0.92870545, 0.6245167, -0.17748761, 0.49881747, -0.0013700202, -0.6062493, -0.5211433, -0.044155214, -0.58735853, -0.3184926, -1.1066936, 0.31925192, 0.055742487, -0.11290029, -1.2357664, -0.013144705, -0.5662862, 0.06639056, 0.35374135, 0.38557136, 0.20628467, 0.5110246, -0.42163143, 0.12925106, -0.24695382, -1.1608903, -0.15010446, -0.3606254, 1.2112582, -0.5199689, -0.24509984, -0.57505196, 0.06266602, -0.05476774, 0.5543311, -0.6631306, -0.90839344, 0.056663997, 0.39264026, 0.006514296, -0.03379453, -0.06360012, 0.2962194, 0.43456346, 0.29512823, 0.15175281, 0.034137387, -0.15923557, -0.86211294, 0.07326408, -0.80600816, 0.67977273, 0.49671376, 0.6821382, 0.27394387, -1.536363, 0.57825166, 0.7842151, 0.2394658, 0.09236379, 0.6696022, 0.22107342, -0.5844541, 0.68800783, 0.35063517, -0.7489135, -0.84657335, 0.13539974, 0.011126772, 0.83486915, -0.3726464, 0.38500214, 0.15931323, 0.24204169, 0.31334576, -0.38999516, -1.0564649, -0.8066621, 0.32243422, 0.08050046, -0.100161314, 0.1417718, 0.26810834, 0.27799317, -0.24338469, -0.1273042, 0.47630495, 0.761901, -0.31447634, 0.0041330475, -0.6132874, -0.35413107, 0.50921535, 0.92908055, -0.7377505, 0.17884433, -0.97206813, -0.31223825, -1.1257086, 0.054560035, -0.5985438, -0.5419079, 0.34310243, 1.1592656, 0.12414108, 0.6306039, -0.29405472, 0.36001867, -0.26069996, 0.6843612, -0.69717747, -0.25637287, 0.7413816, -0.09426433, 0.007948817, -0.05839423, -0.37699413, -0.54838955, -0.5196219, 0.7450251, 0.5604553, -0.19528422, 0.153679, -0.037510846, 0.21829069, 0.63829726, -0.11303048, 0.0413495, 0.42149734, 0.5452131, 0.12912615, -0.9724758, 0.47631884, -0.11178413, -0.78062665, 1.6786276, 0.88644165, 0.25348303, -0.57685983, -0.10731165, -0.6602384, 0.66389215, -0.7689, 0.1496639, 0.6415253, 0.500464, -0.24878055, -0.07939838, 0.13462633, 0.013040431, 0.73763734, 0.06980479, -0.18928413, 0.6980672, -0.33711007, 0.115530476, -0.61564434, 0.2487322, -0.04897301, 0.13430814, -0.2164018, -0.3666767, -0.095899746, -0.44386792, -0.17055167, -0.036105186, 0.43075958, 0.534845, 0.17878997, 0.06367618, -0.05834858, -0.2430348, -0.6089918, -0.047322188, 0.080885276, 0.5262991, -0.21075973, 0.10692868, 0.13799505, 0.08237328, -0.60258526, -0.51029414, 0.716713, 0.27913976, -1.1312143, 0.69941586, 0.08650997, 0.6624551, -0.70263344, 1.0370399, -0.4800526, -1.3264769, -0.5724056, 0.48490354, -0.36758322, 0.14180458, 1.0191479, -0.16142865, -0.15934804, -0.06126994, -0.12419982, -0.2052495, 0.46710333, 0.25446153, -0.09749228, 0.2416552, 0.13107337, -0.62425584, -0.4665196, 0.41823313, 0.017742202, -0.11604845, -0.014583001, -0.04743681, 0.48962507, 0.5726147, -0.15344103, -0.043124318, -0.4611046, 0.5476682, -0.6814534, -0.13700399, -0.25768772, 0.47459337, -0.5468129, 0.964742, 0.26113805, 0.29224998, 0.69866586, 0.5390306, 0.23548684, 0.5616739, -0.4996161, -0.0531639, 0.15483534, 0.3004987, -0.15385841, -0.6523655, 0.52095807, -0.61126125, 0.29399925, 0.022592522, 0.0036164224, 0.9010767, 0.66380125, 0.22740883, -0.8602492, 0.067954, 0.3547017, 0.4408105, -0.13458662, -0.23914078, 0.20854351, 0.24268481, 0.46751034, 0.36705163, 0.043406673, 0.036361203, 0.05552602, -0.071449906, 0.041502196, -1.2105745, -0.028304726, -0.039797705, -0.66858214, -0.088372126, -0.5237669, 0.16090764, -0.04407379, -0.6910071, 0.054006502, -0.28989974, -0.24306267, -0.61034966, 0.5553436, 0.6809772, 0.096716136, -0.51710796, -0.098939195, -0.3180539, -0.32514825, 0.38779578, -0.7734561, 0.15372227, 0.087640285, -0.4327031, 0.096745, -0.06493625, 0.029305357, 1.0426801, 0.116323724, -0.46691078, 0.011199217, 0.1469512, -0.108034305, -0.24094029, -1.0067587, 0.86667746, 0.681321, -0.34006357, 0.6885098, 0.21300186, -0.55701715, 0.582534, 0.26671684, -0.28656054, -0.7581177, 0.83850646, 0.6659291, 0.63540286, -0.82415324, -0.76791, -0.42685413, -0.1978186, 0.1188646, -0.35998422, -0.4153101, 0.63527155, 0.012389898, -1.5216818, 0.10454872, -0.15033387, -1.1138442, -0.363461, -0.31349632, 0.73108214, -0.13952224, -0.29330423, -0.40340406, 0.19570658, -0.13253699, -0.15259932, 0.8772184, -0.6289534, 0.24124396, 0.8863129, 0.013752261, 0.11636713, -0.2878188, -0.6748302, 0.26673093, 0.074429825, 0.18423261, 0.33583167, -0.31168482, 0.18303514, -0.110326886, 1.0521882, -0.8914687, -0.041218713, 0.7925176, -0.38259062, 0.0699002, 0.39020306, 0.3406126, -0.025504138, 0.030163972, -0.8205811, 0.27958557, 0.42331424, 0.7152617, -0.5693195, 0.79709387, -0.052060973, -0.2502512, -0.5891158, 0.43469584, -0.41373527, 0.6146908, 0.076879665, 0.31544682, -0.5227765, 0.08362824, -0.23998299, -0.06326865, 0.977748, 0.699623, 0.34662923, 0.4053547, -0.57229793, -0.360397, -0.68081236, -0.89546853, -0.38550287, 1.4982802, 0.1295377, 0.03139779, -1.4845395, 0.6942864, 0.52807, 0.8333225, 0.49081743, -0.3854397, -0.5561076, -0.2873355, 0.35955435, -0.40604037, 0.3067069, -0.9793556, 0.54424125, 0.05487563, -0.17266905, -1.1705602, 0.23105747, -0.096690014, 0.66326594, 0.50486475, -0.104512066, -0.17203951, 0.84721786, 0.010612169, -0.2766949, -0.7051157, -0.4017008, -0.63575864, 0.06809341, 0.36169913, -0.83321065, -0.3977779, -0.75799507, 0.45688114, 0.8228988, 0.3614043, -0.3872057, -0.23848563, -0.2693749, -0.90534234, 0.062407956, 0.79575527, -0.28577504, 0.11576642, -0.85940045, -0.2364341, 0.09936187, -0.6178453, -0.2623395, 0.4881133, -0.96528625, -0.002703242, 0.32168373, 0.23600036, -0.5019947, 0.62138635, -1.4865868, -0.15790486, -0.6669983, 0.06801675, -0.5628619, -0.31371945, 0.6114257, 0.96458405, -0.064005196, -0.219717, -0.09132044, 0.547687, -0.633611, -0.21194346, 0.5262808, -0.2213456, -0.47458994, 0.39729577, -0.15099177, -0.43005282, 0.53780806, 0.54377115, -0.124503836, -0.3869376, -0.4276981, -0.017099984, 0.10659635, 0.023432303, -0.023488503, -0.5943924, 0.44783092, 0.21988973, -0.2587016, 0.054121852, -0.98205125, 0.66049236, -0.1100941, 0.40253222, 0.4989391, 0.18264665, 0.024417441, -0.1577205, -0.33052993, -0.40380287, -0.3190465, -0.432463, -0.36828405, -0.5821203, -0.027871974, 0.3407156, -1.0126361, -0.44199046, -0.089746, 0.19934487, 0.24793631, 0.07480049, 0.3483074, -0.468999, 0.49423718, -0.024303712, 0.7697083, -0.5001096, 0.02921876, -0.2797136, 0.5004291, -0.19378904, 0.33850992, -0.5845366, 0.54080933, -0.4231968, -0.8276037, -0.21587685, 0.4471876, 0.17945103, 0.8905926, 0.45168063, 0.120928615, -0.19128208, -0.9465436, -0.4261623, -0.56029624, -0.15703607, -0.70728654, -0.37483913, 0.49776262, 0.25170207, 0.12126787, -1.2433228, 0.06759076, -0.42357254, 0.37723503, -0.37966526, 0.16530818, -0.6875407, 0.6304193, -1.0195813, 1.1075277, -0.78990626, 0.39701256, 0.0069374703, 0.7567582, -0.09521173, 0.67897403, -0.46449107, -0.7232551, 0.6319999, 0.13682938, 0.38638604, 0.4707066, -0.36580908, 0.2677807, 0.34033567, -0.1596111, -0.9749413, -0.37226206, -0.6223806, 0.2617854, 0.103502214, -0.008744709, 0.051227644, 0.351737, 1.1481045, 0.14042997, -0.5311719, -0.49255943, -0.8199234, -0.64042944, -0.21486312, 0.6096419, -0.52185607, -0.2824444, -0.79940456, 0.1712943, 0.4599559, -0.08197235, 0.35854346, 1.6623292, 0.45101458, -0.066510625, -1.0427458, 0.62489176, -0.22252423, -0.5163516, 0.07532082, 0.13290837, 0.13375865, -0.16612516, -0.15780056, -0.94008225, -0.29751578, -0.57456505, 1.1763555, -0.05414252, 0.37103045, 0.19796538, -0.43615937, -0.68003327, 0.3122042, 1.2015585, -0.24554463, 0.8153871, 0.7607808, 0.059229776, 1.3229659, -0.24295142, 0.17053288, 0.048269182, 0.9410707, 0.9070906, 0.06965003, 0.27366185, 0.8945579, -1.2575924, -1.2471954, -0.5133816, -0.03719949, -0.040453598, -0.6262046, -0.22496824, -0.5460526, -0.6761229, 0.38598374, 0.30903018, 0.3048585, 0.05681765, 1.035404, 0.3265798, -0.65159935, 0.012538631, 1.1262999, -0.5801894, 0.6140626, 0.030489383, -0.20633727, -0.091095164, 0.07008093, 0.20600188, 0.42286634, 0.24940234, 0.336841, -0.28344682, 0.15419483, -0.45846593, -0.2657172, 0.30148643, -0.9636932, -0.83163893, -0.15322179, -0.083657995, -0.24991873, 0.2650725, -0.21684909, 0.45393792, 0.2698332, 0.0074559078, 0.4958383, -0.61557376, -0.25072846, -1.2557454, -0.6115327, -0.24550119, -0.04877276, 0.06557663, 0.3164962, 0.2010736, 0.20483038, 0.098864615, 0.4129772, 0.24178419, 0.45724168, -0.4674123, 0.8200659, -0.50947297, -0.449177, -0.30873096, -0.00341261, -0.05515168, -0.5907586, -0.33790907, -0.651591, 0.40981805, 0.7774349, -0.11609654, 0.120979905, -0.17329918, -0.36349046, 0.5757807, -0.30231762, 0.16941534, 0.18787259, 0.016418763, -0.9578842, -0.080765896, -0.023937378, 0.13233513, -0.6668092, -0.18915473, 0.6900721, -0.81779176, -0.3249238, -0.19014584, -0.26334095, -0.9522248, -0.020303745, -0.1590526, 0.45100468, 0.30653527, 0.19623548, 0.3372883, 0.4808515, 0.053027716, 0.039079703, 0.063242614, 0.1595489, 0.36108032, -0.06620808, -0.37538713, 0.023618475, 0.01085633, 0.69008404, 0.27196503, -0.04092282, -0.2127317, 0.2757614, -0.30057618, 0.18570052, -0.19186738, 0.3087836, -0.25180426, 0.26582882, 0.4608781, -0.21650104, 0.2283323, -0.31646472, -0.692105, 1.3698722, -1.257715, -0.45968327, 0.08766882, -0.62902015, 0.52597046, -0.24926928, -0.85368836, 0.53539294, 0.18897045, -0.8144592, -0.24593538, 0.45442003, 0.43394864, -0.021025106, -0.56448966, -0.48068237, 0.57226974, -0.1455751, 0.3920177, -0.805578, -0.3599915, 0.36887014, 0.40636414, -0.38607797, 0.25946122, -0.5041137, -0.7237108, 0.20406774, 0.26659763, 0.50632215, -1.1882919, 0.31482235, -0.16788547, 1.0427362, -0.30384532, 0.25440946, 0.36111465, -0.04078348, -0.08545423, 0.92903745, 0.4287195, 0.38892937, 0.6466388, 0.011067346, 0.10231955, 0.72308904, -0.13572344, -0.31354204, 0.68488604, 0.4170978, 0.42884508, 0.10300704, 0.7566359, 0.17373186, -0.41658837, -0.43844083, -0.086458325, 0.52654135, -0.043467827, 0.6249003, -0.25258037, -0.729916, 0.6514588, -0.21865344, 0.05354707, -0.038330674, -1.0014257, -0.64724433, -0.36293414, 1.4632056, 0.2517041, 0.034037836, 0.24289103, 0.09087169, 0.8479298, 0.55847895, -0.71819776, 0.22156405, 0.59628755, 0.092399985, -0.04420072, -0.3075664, 0.30672166, -0.07358368, -0.9896834, -0.030702464, 0.45216998, 0.23109157, -0.3755612, 0.16779788, -0.6244628, 0.7411318, 0.24217345, 0.17737857, 0.48295784, -0.8859237, -0.24001184, -0.75387233, 0.67960876, -0.83024853, -0.14399245, 0.8452935, -0.3518325, -0.047979936, -0.02630499, 0.5509351, 0.4625635, -0.16918442, 0.30742225, 0.16386184, 0.67220664, 0.6280037, 0.28628358, 0.5660928, -0.1181638, -0.7434205, 0.20981479, 0.30287597, -0.69003713, 0.2184324, -0.76819944, -0.6346251, -0.08185301, 0.4818785, -0.51540446, -0.41744098, -0.09777721, -0.13589545, -0.60600513, 0.5247147, 0.3843186, 0.7094564, -0.16184524, -0.10725272, -0.4548275, 0.19113028, -0.047529392, -1.2795435, 0.17554286, -0.11416066, 0.13803561, -0.15642008, -0.6183412, -0.09616114, -0.37894952, 0.41909993, -0.662439, -0.114946306, 0.24334419, 0.22668067, 0.12224765, -0.63632286, 0.09084573, -0.23651299, 1.572324, 0.2178188, 1.1743072, 0.07571864, -0.1768858, 0.46413594, -0.48011255, 0.60569423, 0.15971124, 0.15805168, -0.9414262, 0.52399147, -0.007178193, -0.5215467, -0.59056896, 0.8559839, -0.2467039, -0.12033293, -0.9019515, -0.59779, -0.7349234, -0.8292922, -0.8635217, 0.5185263, -0.14540526, -0.26934415, 0.09875953, -1.1647751, 4.1182427, 0.46481997, 0.20087855, 0.9354643, 0.105424814, -0.004540026, 0.31147802, -0.6534193, 0.49501762, -0.45092684, 0.26379517, 0.448524, 0.34865677, 0.33569512, -0.016880259, 0.931842, -1.0148392, 0.20927775, 0.27847856, 0.15899846, -1.0693281, 0.1423664, 0.25981626, -0.025161192, 0.37412122, -0.29079884, 0.65601414, -1.0225062, -0.09605144, -0.14980899, 1.4953828, -0.1718415, 0.4066242, -0.08655246, -0.24063088, 1.2393714, 0.30284256, 0.36995012, 0.13408722, 0.30496278, -0.46151608, -0.6467823, 0.6863592, 0.3977234, 0.24254265, 0.30088937, -0.91632855, 0.22041345, 0.21627867, 0.036953487, 0.8198882, -0.38644162, 0.5111023, -0.6528836, -0.05132746, -0.048061155, -0.6670724, 0.32652795, -0.93728834, 0.17837188, -0.07624923, 0.18451518, -0.23230648, 0.34793568, -0.30258647, 0.12964638, 0.51428103, 0.8286943, -0.33250588, -0.6536644, -0.5854663, 0.42078778, 0.0033747032, -1.1266797, 0.10867215, 0.7423345, -0.83774376, 0.77926403, -0.058730222, -0.47217268, -0.092801005, 0.33792138, -0.05150798, -0.31443495, 0.27053922, 0.27824974, -0.11275067, -0.09057309, -0.2926527, 0.06173639, 1.3071758, 0.4730829, -0.14173776, -0.5784081, 0.2668654, 0.23815082, 0.28242433, 0.4774975, -0.54650855, -1.0264833, -0.47225332, 0.8703695, 0.63991624, 0.74452734, 0.42014164, -0.03533741, 0.06514102, -0.09643583, -0.8522862, -1.026076, 0.2499778, -0.42779097, -0.22190364, -0.076258555, 0.44808066, -0.71214545, -0.33959672, -1.3720645, 0.32767367, -0.713407, 0.7200092, 0.54970694, 0.038314663, 0.31601653, 0.82536983, -0.3402146, -0.15020594, -0.38107064, -1.594133, -0.20284157, -0.5158298, 1.4197085, -0.8124861, -0.42961958, -0.9616828, -0.31844, 0.09133983, 0.83976585, -0.69099605, -0.7764937, -0.5044535, -0.021224841, -1.0946624, 0.061164968, -0.008315772, -0.09962118, 0.7529673, 0.13280208, 0.32369834, -0.018207334, 0.30298617, -1.3468391, -0.010767452, -1.2652732, 0.3044045, 0.6346315, 0.41673356, 0.3533945, -1.4007373, 0.73925, 0.4769547, 0.45146942, -0.17096666, 0.53908443, 0.1459171, -0.5496129, 0.8112877, 0.22813308, -0.86315006, -1.0600767, 0.49666116, 0.6343291, 0.9384711, -0.67448175, 0.65366536, 0.12925006, 0.32494718, 0.7210598, -0.119817495, -1.8780767, -1.1060218, 0.26940116, 0.8603358, -0.37159148, 0.22237892, -0.026965573, 1.4551806, -0.04102008, 0.18953791, 1.2205132, 1.3830074, -0.6203029, 0.105550446, -0.9172137, -0.2631466, 1.2078451, 1.1561841, -0.88699704, 0.33485472, -1.1039261, -0.15662864, -0.8889108, -0.021704465, -0.7190207, -0.4444397, -0.09743556, 1.0252041, 0.27867004, 0.47697592, -0.25137198, 0.8654594, -0.5946547, 1.1985759, -0.7184543, -0.37799215, 0.8081364, 0.13715135, 0.03568732, -0.6331051, -0.65091616, -0.63724107, -1.1073422, 0.83576024, 0.01433241, -0.25773996, 0.19880387, 0.26008373, 0.12768374, 1.1019219, -0.48458183, 0.046535883, -0.06099293, 0.5994473, 0.82844126, -1.4832599, 0.76427746, 0.2744197, -0.63113993, 3.4523046, 1.0266101, 0.27708215, -0.41686982, -0.5191848, -0.06873581, 1.3051794, -1.1570866, -0.13528334, 0.36869058, 1.023516, -0.06851939, -0.42901027, -0.061269097, 0.34303978, 0.78846973, -0.10224266, -0.26698807, 0.36766642, -0.052483615, 0.30429786, -0.5263308, 0.8598371, -0.22671875, 0.18051147, -0.08662229, -0.3279599, 0.2018461, -0.6478263, -0.17370462, 0.13946049, 0.68857074, 0.7604215, 0.66072303, -0.2236945, 0.0344449, 0.39498496, -0.86348784, 0.2021577, -0.554239, 1.241565, -0.19903407, 0.096936144, 0.6406258, -0.34654585, -0.73143643, -0.13212292, 0.64585644, 0.20416865, -1.3674644, 0.81159735, -0.53180194, 0.44403616, -0.4629941, 0.8237217, -0.6575767, -1.9094594, -1.0068313, 0.1886729, -0.54099613, -0.31080106, 0.52114534, -0.4064729, -0.3517636, 0.52113307, -0.37713295, -0.54287195, 0.90217155, 0.75736386, -0.057880785, 0.65335006, 0.5185984, -0.6316754, -1.008395, 0.5784696, 0.15871945, -0.096895896, 0.030775126, 0.019246973, 0.635904, 0.7580727, 0.603296, -0.39326644, -0.775648, 0.6632834, -0.76522464, -0.15057506, 0.13213232, 0.8701612, -0.051690824, 0.886158, 0.059451666, 0.39455524, 1.1942627, 0.80077326, 0.30792174, 0.72980845, -0.58946186, 0.11602919, 0.6559696, 0.8268997, -0.20558739, -0.9376819, 0.4666886, -0.6281039, 0.45548218, 0.08520936, 0.19750595, 1.5127107, 0.83545053, 0.3510535, -0.8958543, -0.75617564, 0.894642, 1.4720694, -0.1355076, -0.6986217, 0.29143137, 0.34363377, 0.18577126, 0.26836568, -0.13981187, 0.19420178, -0.1310125, 0.106808856, -0.11584908, -1.3767927, -0.048521705, -0.12314682, -0.70627797, 0.10515572, -0.5317391, 0.5002598, 0.422907, -1.0648339, -0.11869705, -0.93817717, -0.47067133, -1.0766637, 0.7890926, 1.0871282, 0.077466965, -0.022941213, -0.34052557, -0.46262902, -0.21314916, 0.63874835, -0.8034802, -0.12524417, -0.2280509, -0.45375586, 0.11442453, 0.17320183, -0.16676669, 1.2585441, -0.26324847, -1.0815029, 0.48728508, 0.40939358, -0.2852892, -0.01987523, -1.0332665, 1.4922973, 1.2905895, -0.3012445, 1.1206418, 0.58634394, -0.5885947, 1.027236, 0.5461434, -0.56589985, -2.160386, 0.9977782, 1.4122514, 0.35012767, -0.8348484, -0.91156083, -0.44733608, 0.06918893, 0.073672324, -0.49986246, -0.36920917, 1.2300003, -0.028686464, -1.9602597, 0.3586868, -0.5751905, -1.2226559, -0.160415, -0.45962837, 0.7730631, 0.15213728, -0.40129295, -0.3763386, 0.25027445, -0.017731309, -0.35444453, 1.0308242, -0.68111396, 0.027753418, 1.1759561, 0.1284143, -0.1538926, -0.06069766, -0.5967487, -0.46134785, 0.65801346, 0.38983122, -0.13866639, -0.1946084, 0.39163414, -0.05783741, 1.3692302, -1.1921241, 0.12407765, 0.62342554, -0.22950053, -0.15749526, 0.42076403, -0.15916803, -0.6903404, 0.38964617, -0.96953917, 0.1617446, 0.15616782, 0.94165206, -0.7990292, 1.0704751, -0.3479437, 0.014394938, -0.27818298, -0.2686414, -0.8608855, 1.1030215, 0.30865127, 0.56293905, -0.5808595, -0.09553954, -0.5470532, -0.24101052, 1.7932336, 0.5933583, 0.22850809, 0.6440879, -0.13777807, -0.40607083, -0.14935976, -1.0655402, -0.08556904, 1.5463837, -0.2037431, -0.049918488, -1.948359, 1.3937284, 0.8913616, 0.6618716, 0.29112825, -0.9333397, -0.64939773, -0.1519076, 0.43093035, -0.90897346, 0.23105648, -1.6697718, 0.80526376, -0.10556382, -0.29879344, -1.1856492, -0.08865876, -0.3910298, 0.99155366, 0.05003587, -0.25817716, -0.203244, 1.0919954, 0.43314368, -0.36503968, -1.4359604, -0.27645838, -0.82746905, 0.27085295, 0.6530822, -1.179947, -0.5469275, -0.8221712, 0.4316565, 0.8877416, -0.22656713, -0.9242201, -0.30603468, -0.2247964, -0.8370084, -0.35373253, 0.91914237, -0.030093975, 0.6547502, -1.4251751, -0.17141008, -0.10287389, -0.16700989, -0.17503524, 0.30245206, -0.10866988, 0.11191217, 0.87262994, -0.3063119, -0.8902056, 0.56295437, -1.9272543, -0.0981302, -0.67028433, 0.23364708, -0.6498273, -0.37664372, 0.23457718, 1.4059585, -0.1313058, -0.30622694, -0.021324791, 0.7439346, -1.2513928, -0.34206432, 1.3767378, -0.2954388, -0.5523714, 0.60395724, -0.29732507, -0.2831665, 0.24392214, 0.5988505, 0.0795792, -0.29516765, -0.25286347, 0.10891355, -0.043641455, -0.21956724, -0.1222059, -0.90728974, 0.46377242, 0.49633765, -0.20564441, -0.520319, -1.6375936, -0.0139881335, -0.4310044, 0.5800617, 0.28061712, 0.47284612, -0.07800144, -0.51974624, -0.5967198, -0.2567559, -0.40850466, -0.36360377, -0.61648047, -0.5654142, 0.48337257, 0.21692866, -1.1690227, -0.53939724, 0.2567819, 0.52827764, -0.27963173, -0.038007528, 0.5720037, -0.8600977, 0.13065897, 0.19105779, 0.9926014, -0.50321037, -0.4309987, 0.19077024, 0.7039192, -0.09141481, 0.84667844, -0.77341396, 0.5661096, 0.15038273, -1.0883207, -0.30914208, 0.39496368, -0.06485534, 1.641904, 0.6762734, -0.3347199, -0.8617406, -0.6995804, -0.19845611, -0.5784028, -0.47562283, -1.4047565, -1.0122284, 1.0451913, 0.3910407, 0.21691439, -0.5442791, 0.3343481, -0.33234861, 0.66286534, -0.6073909, -0.23710439, -0.8782153, 0.6301357, -0.78039706, 1.0811063, -0.94600165, 0.50099385, -0.20203432, 0.8153803, 0.4326697, 0.9829363, -1.1359497, -0.5724925, 0.46652472, 0.020673493, 0.17816944, 0.64396065, -0.95867497, 0.8279188, -0.80351615, -0.085244454, -1.0182021, -0.48280728, -0.68415624, 0.26940063, 0.17725682, 0.6659137, 0.343051, -0.036139507, 1.9253529, 0.330179, -0.18667798, -0.7256044, -0.5135883, -0.6487113, -0.8936575, 0.7452832, -0.12287533, -0.11825, -0.70136374, 0.14688696, 1.4273101, -0.15633577, 0.6255618, 2.1027944, 0.8671121, -0.36143222, -1.1867063, 1.1065185, 0.8098748, -0.45667458, -0.24226767, 0.0025809854, -0.25722653, 0.19070284, -0.5484266, -0.6555022, -1.0337746, -0.42591894, 1.7423811, 0.654865, 0.64011616, 0.16377617, -1.2083119, -1.4860584, 0.70743257, 1.1795193, 0.07058562, 0.8440395, 1.0345922, 0.28286603, 1.0439405, -0.31949413, 0.6272188, -0.19404978, 1.5465806, 0.8578423, -0.27853975, 0.66072625, 1.2355281, -2.0446782, -1.7492697, 0.0030216204, -0.56266546, -0.6697648, -0.68279344, -0.35443568, -0.54446316, -0.6759806, 0.1435076, 0.28134957, -0.15788919, 0.24428463, 0.014099263, 0.46920812, -0.85195917, 0.0012707915, 1.3709744, -1.0901219, 0.64788854, -0.14823869, -0.085778356, 0.13496846, -0.24483931, 0.4524359, -0.034560725, 0.63981885, 0.35658672, -0.30224392, 1.0347067, -0.85791016, -0.14240645, 0.79247826, -1.1686097, -1.586391, -0.8209819, -0.119535595, -0.2052218, 0.34335265, -0.6570797, -0.2210782, 0.6748208, -0.09502657, 0.24686556, -1.2017366, -0.63983685, -1.5916613, -1.184105, -0.123895474, -0.03346053, 0.2209342, 0.61311907, 0.3206372, -0.118494704, -0.3988993, 0.3909913, -0.36862627, 0.5302286, -0.6324911, 0.94080716, -0.6024734, -0.38162777, -0.4316226, -0.3143518, -0.36463666, -0.20017555, -0.8736055, -0.9380112, 0.45671174, 1.5155923, -0.09486201, 0.9695505, -0.13833332, -0.6298378, 0.8931586, -0.6301222, -0.26646182, 0.46902105, 0.13617973, -1.3055613, 0.30406374, -0.09564643, 0.10455055, -1.0269212, 0.12177908, 1.1355569, -0.6378392, -0.6559861, -0.78072715, -0.68091595, -1.3237638, -0.4806199, -0.16236575, 0.22558266, 0.4245454, 0.6258281, 0.2573674, 0.92344415, 0.108896874, 0.4044994, 0.06719699, 0.66419035, 0.34098536, 0.58486176, -0.41998512, 0.5359888, 0.61129946, 0.5190456, 0.983025, 0.310331, -0.32300448, 0.35044804, -0.97328913, -0.06142584, -0.34457424, 0.42320502, -0.2103809, 0.94158864, 0.751986, -0.41664547, 0.5273929, -0.023898497, -0.58526397, 0.91506046, -1.587615, -0.62792873, 0.20285669, -1.3050082, 0.62498814, -0.4249226, -1.0144218, 0.409593, 0.27104688, -0.9462727, -0.24467865, 0.86334205, 0.45995265, -0.12513909, -0.70971626, -0.19246241, 0.042387776, 0.07669194, 0.115074575, -1.269335, -0.09286548, 0.54315686, 0.34751275, 0.06670852, 0.14310578, 0.02031393, -1.4052739, 0.34125116, 0.34491134, 0.47022027, -0.80838424, 0.43571746, -0.5313221, 0.8576949, -0.2583056, -0.1817374, 0.4537858, -0.14710322, -0.4226152, 1.6146483, 0.88158476, -0.3151336, 1.2690797, 0.11899912, 0.3866578, 0.76637596, 1.5090572, -0.67779464, 0.9428768, 0.6889142, 0.6410521, 0.28004602, 0.7718466, 0.7421934, -0.28616107, -0.914406, 0.18280843, 0.77757883, -0.37666446, 0.607708, -0.28850508, -0.14639486, 1.0358485, -0.57612544, -0.03077536, -0.09469912, -0.5002359, -1.5291424, -0.5715195, 1.1232437, 0.032881796, 0.24273214, 0.114872776, 0.21159294, 0.86429787, 1.2115531, -0.53747576, 0.5324311, 1.046557, 0.3009321, 0.33693448, 0.033356756, 0.44364536, -0.02425829, -1.4809191, -0.15717486, 0.19116181, -0.09143227, -0.27159914, -0.10439899, -0.74533814, 0.82421553, -0.20139456, -0.0032766405, 0.9916576, -1.0329632, 0.19601333, -1.2602824, 0.2017543, -0.64100575, -0.35785395, 1.0780927, -0.14836146, 0.018262547, 0.9442348, 0.83696884, 0.6329565, -0.093982756, 0.7140547, 0.21587613, 1.2869248, 0.60281265, -0.47821552, 0.43734503, 0.25959963, -0.16328156, -0.12055825, 0.4622288, -0.9157813, 0.5098907, -0.31852883, -1.0538068, 0.63930315, 1.0165753, -0.8952555, -1.1551671, -0.07045259, 0.33253628, -1.4805075, 0.5346395, 0.40822038, 0.78947777, 0.056913875, -0.23994705, -0.47662988, 0.12904635, -0.3096597, -1.2386975, 0.027118616, -0.297474, -0.34640983, -0.7081305, -0.987574, -0.4112696, -0.16663915, -0.14638874, -1.0458425, 0.054047197, 0.99362266, 0.47721052, 0.39771488, -0.4090625, 0.1835733, 0.006618239, 1.8029044, -0.5752119, 1.7840273, 0.14250731, -0.8179414, 1.0404874, -0.7235668, 0.43460107, -0.17297104, -0.66153497, -0.53459716, 1.4169344, -0.25907004, -1.0876834, -0.121780336, 0.9376321, 0.087307006, 0.1502156, -1.3873982, -0.47126013, -0.72027636, -1.0648152, -1.0333831, 0.28081003, 0.0047804266, -0.41970125, 0.12368576, -1.0056207, 1.314159, 0.8322662, 0.50192, 0.6606601, 0.19176152, 0.22359805, 0.6299454, -0.8784206, 0.8435247, -0.62076545, 0.46503085, 0.4955411, 0.47523603, 0.59475726, -0.15033536, 1.5292126, -1.6526178, 0.77440363, 0.21343376, -0.1102623, -0.8003335, 0.12464988, 0.1694136, -0.092712775, 1.1573013, 0.26682746, 0.8170211, -1.0412548, 0.09060685, -0.18826349, 1.1423111, 0.03361123, 0.54229814, -0.31807727, -0.034259863, 1.3871967, -0.05026304, 0.28581905, 0.11886263, 0.7556672, 0.09417425, -1.0077528, 0.9749789, 0.031945437, 0.1542672, 0.44604713, -1.1202078, 0.24686609, 0.5521793, -0.26565984, 1.3768492, -0.41607288, 0.89860183, -0.9901299, -0.55397356, 0.3160442, -0.2748052, -0.028745566, -0.60326695, 0.1855664, 0.014004639, 0.043385062, -0.3658645, 0.21059687, -0.45689726, 0.2032052, 0.73326206, 0.35434416, 0.019100547, -1.4163734, -0.44338754, 0.26873967, -0.5155286, -1.3091766, 0.083646804, 1.3032191, -1.2324255, 0.9689458, -0.50306034, -0.13216153, -0.31209743, 0.42126146, 0.24715918, -0.36722437, 0.8198192, 0.7839475, -0.4742727, -0.23958692, -0.53167427, 0.36589828, 1.4970611, 1.1297909, -0.09345523, -0.7373089, -0.6823638] -2025-10-16 19:28:19 [main] INFO OnnxTest - ------------------------ -2025-10-16 19:28:19 [main] INFO OnnxTest - tokenizer加载耗时: 4070 -2025-10-16 19:28:19 [main] INFO OnnxTest - tokenizer计算耗时: 1 -2025-10-16 19:28:19 [main] INFO OnnxTest - 模型加载耗时: 587 -2025-10-16 19:28:19 [main] INFO OnnxTest - 模型数据准备耗时: 2 -2025-10-16 19:28:19 [main] INFO OnnxTest - 模型计算耗时: 14 +2025-10-16 19:28:19 [main] INFO experimental.OnnxTest - [0.51123345, 0.43754324, 0.22250144, -0.49621642, -0.59625536, -0.24450612, 0.5863322, 0.46978277, 0.5778739, 0.6761688, -0.0854191, 0.36117497, -0.24092007, -0.19524571, -0.7976704, -0.044580948, -0.53635055, -0.11370213, -1.1403378, 0.2129236, -0.34120926, 0.001864681, -1.3665671, -0.22030343, -0.830733, 0.099989876, 0.4966247, -0.066141784, 0.41148925, 0.729914, -0.29459542, 0.29208705, -0.3367949, -1.0972055, -0.024628287, -0.6583721, 1.253141, -0.61462474, -0.518246, -0.53295904, 0.12913027, 0.04108283, 0.55130756, -0.8039789, -1.2061563, -0.34272343, 0.27257943, -0.13096467, 0.18428354, 0.2605311, 0.057498857, 0.7461083, 0.1835212, 0.021440782, -0.20071763, 0.04362084, -1.3614484, -0.1095237, -1.0870106, 0.40957803, 0.7201999, 0.98604536, 0.39732328, -1.3224756, 0.40671548, 0.406975, 0.50348455, 0.22034347, 0.5530567, 0.25672144, -0.6594347, 0.96159023, 0.07775575, -0.7792945, -1.0163779, 0.36998796, 0.5171132, 0.79771215, -0.5552498, 0.80050594, 0.14805704, 0.2997373, 0.26703542, 0.08637628, -1.4002664, -0.813782, 0.25788978, 0.5414073, -0.46593362, -0.027594358, 0.29689378, 0.65353656, -0.31033817, 0.08076967, 0.76214606, 0.8415609, -0.3084258, -0.32594687, -0.72558767, -0.3289697, 1.0932022, 0.87115157, -0.89196694, -0.18925445, -0.9785898, -0.2336246, -0.9026102, 0.088704094, -0.7258216, -0.6594782, 0.09606822, 1.0850618, 0.0013394654, 0.38363743, -0.3874976, 0.20100841, -0.4128504, 0.74124134, -0.6654147, -0.5718573, 0.27072686, -0.046442233, -0.2115764, -0.7070531, -0.9749727, -0.4404279, -1.3043284, 0.93771523, 0.30211914, -0.59651214, 0.12527934, 0.089207426, 0.51316845, 0.8074455, -0.5485792, 0.07305289, 0.10457601, 0.24046482, 0.5214334, -1.1262523, 0.16574118, 0.01661903, -0.72924286, 1.7897038, 0.7391656, 0.26545036, -0.24889244, 0.019522466, -0.38037547, 0.9288784, -0.90373176, -0.2429637, 0.13991763, 0.4122005, -0.6420515, -0.045609288, -0.055985063, 0.121364415, 0.28139967, -0.0052891895, -0.106420964, 0.56713265, -0.46813145, 0.19711205, -0.58464926, 0.3698026, -0.2838148, 0.12638272, 0.01481974, -0.2993888, 0.14940853, -0.4162319, -0.045515813, -0.07729791, 0.47421545, 0.46603337, 0.62959045, 0.1828863, 0.2002228, 0.07522717, -0.50393486, 0.37032261, -0.35638678, 0.8902856, -0.033868957, 0.100021124, 0.43048963, 0.3153236, -0.6283139, -0.24138638, 0.81751156, 0.2257601, -1.2130985, 0.44707552, 0.0037308559, 0.5666142, -0.8444263, 1.204924, -0.65543765, -1.9701289, -0.8207577, 0.08641613, -0.4112931, -0.20802015, 0.87505317, -0.13793634, 0.07145847, 0.31840786, -0.092020944, -0.80500084, 0.58076894, 0.117715076, -0.67379886, 0.45848575, 0.4390001, -0.7055742, -0.712911, 0.33785975, 0.42191327, 0.121282555, 0.13419384, 0.17775199, 0.5506595, 0.67962146, 0.4780363, -0.03222577, -0.8667363, 0.8303137, -0.541459, 0.062450707, 0.03477095, 0.49735057, -0.3892, 0.8767689, -0.06756614, 0.35541242, 0.94193155, 0.8131012, 0.58299375, 0.1854296, -0.60147816, 0.4282838, 0.5299751, 0.7330451, -0.3257398, -0.58661395, 0.5521986, -0.606695, 0.44539154, 0.41345364, -0.023682468, 1.0244411, 0.8901564, -0.025144015, -0.6341725, -0.4240578, 0.31344998, 1.0556707, -0.7415066, -0.32343262, 0.1841922, 0.36124998, 0.5530684, 0.29907, -0.02951768, 0.19808297, 0.08838599, 0.05037989, -0.049141884, -1.1747736, 0.03532947, 0.07290274, -0.7062243, -0.027512219, -0.5645471, -0.034089435, 0.4769841, -0.5791185, -0.062474817, -0.5574461, -0.07675014, -0.58530134, 0.5648111, 0.7009718, 0.19080682, -0.37462634, -0.38008162, -0.8266342, -0.56594104, 0.6085925, -0.8169755, 0.2305794, 0.022104293, -0.32453218, 0.029340252, 0.12966694, -0.35197243, 1.0937076, -0.08106287, -0.630723, -0.07665277, 0.09807674, -0.15652439, -0.032777905, -0.59978753, 0.7365465, 0.8591844, -0.16815796, 0.8361499, 0.27674484, -0.3099411, 0.60480386, 0.23437774, -0.7338224, -0.9829839, 0.67439365, 0.742201, 0.42505273, -0.68957865, -0.47552192, -0.5682225, -0.5110189, -0.28437212, -0.565194, -0.19356139, 0.63973606, -0.014390081, -1.646161, 0.2918704, -0.4594489, -0.8228203, -0.16133638, 0.07148346, 0.9419251, -0.019150853, -0.4403408, -0.56392926, 0.12463045, 0.24700657, -0.19791731, 0.6058087, -0.5370069, -0.051276788, 0.9354616, -0.055462413, 0.050041005, -0.6077635, -0.68125796, -0.13532986, 0.36517376, -0.019653555, -0.03586552, -0.1600579, 0.67996794, -0.25741813, 0.9547673, -0.910809, -0.009982694, 0.7332152, -0.20394151, -0.09925252, 0.5988749, 0.10125684, -0.2892084, 0.09639569, -0.9270706, -0.14898436, 0.23913115, 0.7453801, -1.0168681, 0.80838275, -0.27111107, -0.14699328, -0.68104225, 0.19166322, -0.79916215, 0.43923154, 0.16553934, 0.33551145, -0.5704513, -0.070023894, -0.3918103, -0.17701462, 1.6619401, 0.674843, 0.23895527, 0.80687135, -0.01851894, -0.34060583, -0.58362544, -0.96381485, -0.19843449, 1.6370385, -0.44541967, -0.13564552, -1.7383175, 0.94101083, 0.4386875, 0.8844557, 0.7002662, -0.72894764, -0.6103935, -0.32648364, 0.054746274, -0.6872155, 0.18739484, -1.0520368, 0.6648933, -0.2648567, -0.06654116, -1.3043286, 0.22864798, -0.10361338, 0.594177, 0.5787685, 0.1750473, -0.0105097145, 0.91527426, 0.25346497, -0.27341178, -1.1472199, -0.31140554, -0.49403697, -0.13216135, 0.7429359, -0.57663065, -0.5814875, -0.46789917, 0.62059444, 1.0459176, 0.105841815, -0.8354111, -0.09153462, -0.4892223, -0.9736461, 0.03827665, 0.6993418, -0.5639835, 0.3098794, -0.8142145, 0.047523424, -0.21321937, -0.034833632, -0.010952409, -0.041929975, -0.28044957, 0.060209088, 0.50224316, -0.046635136, -0.85428065, 0.73049414, -1.4654225, 0.11870827, -0.66137636, 0.27924734, -0.7339802, -0.42894232, 0.17209588, 1.1703713, -0.1511008, -0.27938917, -0.13280374, 0.86497086, -0.4407706, -0.3784376, 1.2453586, -0.21126446, -0.15996158, 0.48933926, -0.27048388, -0.2984165, 0.7081715, 0.58110875, -0.06946933, -0.27087092, -0.23854852, 0.36320952, 0.3962092, 0.11321919, 0.10443739, -0.56340504, 0.49124345, 0.6088691, -0.70054543, -0.09448326, -1.4692224, 0.24175254, -0.18142638, 0.3656459, 0.3561722, 0.39745298, 0.35550624, -0.25403917, -0.8084114, -0.3391734, -0.14518976, -0.31460696, -0.8502122, -0.20892489, 0.040290922, 0.36273193, -0.76562995, -0.80031925, 0.060696647, -0.15262939, -0.061190173, -0.09423466, 0.6150074, -0.5358167, 0.3251421, 0.28123394, 0.7587028, -0.4789124, -0.10876167, -0.18576714, 0.49481302, -0.09939133, 0.20352225, -0.5852573, 0.6395335, -0.3011577, -0.8522485, -0.31254715, 0.5950347, -0.26513442, 0.70972127, 0.43091288, -0.041825093, -0.2292053, -0.6451991, -0.34200215, -0.41545817, -0.2689111, -0.9946734, -0.25178003, 0.6669945, 0.17163065, -0.15006264, -0.9421287, -0.019158833, -0.6975499, 0.438868, -0.6849216, 0.03262051, -0.44509438, 0.64882565, -0.5953382, 1.1495787, -0.8011461, 0.20847918, 0.1251037, 0.32168102, -0.21917565, 1.0629005, -0.92278206, -0.37890035, 0.4195118, -0.21815889, 0.2514746, 0.6282729, -0.14128427, 0.050928507, -0.35163182, -0.06737878, -0.9663225, -0.4687798, -0.59459, 0.21002933, 0.048163563, 0.48905462, 0.14316124, 0.028260775, 1.2529061, 0.14390653, -0.21695222, -0.7194682, -0.66993797, -0.70739895, -0.5410352, 0.8340246, -0.2935943, -0.23657572, -0.4150082, 0.20044121, 0.6332451, -0.4892323, -0.016682208, 1.8937812, 0.7091852, 0.14414868, -0.9804469, 1.2162073, 0.17216161, -0.50498605, -0.34003568, 0.16963801, -0.33994526, 0.0731189, -0.41613013, -0.94484633, -0.815923, -0.5739614, 0.94484705, 0.31987455, 0.14467219, -0.14761059, -0.7047535, -1.0639687, 0.40880874, 1.3001518, -0.23591296, 1.0019474, 0.69951487, 0.33188945, 1.2750803, -0.47983044, 0.033220377, 0.12004468, 0.9492074, 0.9103111, -0.052080557, 0.58394325, 0.8401497, -1.830512, -1.4265813, -0.17748688, -0.061487965, -0.1359964, -0.88339686, -0.37029758, -0.13061845, -0.2954845, 0.2814227, 0.25465572, -0.19771555, 0.09913704, -0.15107808, 0.011260349, -0.14225599, -0.11415321, 1.0593241, -0.7078028, 0.5747197, -0.4055798, -0.18129641, -0.47820956, 0.1952592, 0.22990699, 0.5002197, 0.10373032, 0.628042, 0.06865163, 1.0157357, -0.6903584, -0.15411828, 0.6126792, -1.4284332, -1.3705213, -0.07465902, -0.11910443, -0.13134138, 0.41676903, -0.21215296, -0.028965306, 0.3505228, 0.047843248, 0.30888152, -1.1421498, -0.08647778, -1.1076055, -0.78975534, -0.05059923, 0.058172554, 0.27877957, 0.3418617, 0.27528864, -0.0043393373, -0.425253, 0.21216352, 0.02201505, 0.46995455, -0.35277224, 1.1497868, -0.7000632, -0.49699458, -0.36768207, -0.08427355, -0.106513396, -0.15144402, -0.6940467, -0.6297557, 0.4525672, 1.2141936, -0.12161607, 0.24308786, -0.1425119, -0.38016897, 0.91598785, -0.41090524, 0.14860485, 0.28929144, 0.21543092, -0.84538454, 0.0807224, -0.2773164, 0.5301908, -0.7331233, 0.49941978, 0.5512182, -0.5476493, -0.18183059, -0.77233905, -0.15702356, -1.1651708, -0.21300837, 0.018835044, 0.32697025, 0.34967226, 0.51722765, 0.09109617, 0.61710453, 0.062239163, 0.056631085, 0.06611446, 0.46277747, 0.13079983, 0.08349137, -0.17646214, 0.26698142, 0.046738572, 0.6847735, 0.38814327, 0.014033079, -0.04680039, 0.292931, -0.8164349, 0.3852389, 0.19666976, 0.37969127, -0.23450008, 0.45247716, 0.4581556, -0.9366612, 0.5417323, -0.055298187, -0.6215795, 1.218463, -1.3511043, -0.7937524, 0.008464169, -0.9959098, 0.7161945, -0.25348237, -0.68490624, 0.39310396, 0.3586596, -0.7416965, -0.18592128, 0.30235815, 0.63015443, -0.33157557, -0.89634436, -0.5073603, 0.27419057, 0.112835586, 0.471214, -0.9042775, -0.41822886, 0.71185523, 0.6571464, 0.33782732, 0.15355957, -0.1364721, -1.0384371, 0.64586115, 0.5162391, 0.52103496, -1.1132919, 0.1564614, -0.35837764, 0.7777977, -0.5688318, -0.19020915, 0.12580645, 0.23848471, 0.050079808, 1.4870666, 0.74930036, 0.11167382, 0.51369834, 0.0912603, 0.03457948, 0.97924113, -0.2526727, -0.6790167, 1.0118998, 0.17009932, 0.59963554, 0.38631436, 0.5874571, 0.35385707, -0.49165446, -0.43353337, 0.29959297, 0.90330774, 0.008084901, 0.19826728, 0.035730332, -0.26280853, 0.49997848, -0.3445545, 0.25782338, -0.29269776, -0.7271916, -1.1451478, -0.3687011, 1.2749437, 0.28989944, -0.010594554, 0.20570764, -0.039815754, 0.7760036, 0.83210295, -0.37314057, 0.34827492, 0.33832714, 0.2549089, 0.3180246, 0.15750375, 0.37374565, 0.29076517, -1.084236, -0.2536879, 0.09893724, 0.167326, -0.42620236, -0.06183477, -0.85039747, 0.7655713, 0.5407811, 0.135566, 0.61822957, -0.658225, 0.060597345, -1.0510322, 0.29207668, -0.40406957, -0.06383139, 0.8471315, -0.3460373, 0.0568925, 0.42080507, 0.50762975, 0.29434744, -0.07577321, 0.5478096, 0.31866163, 0.77027106, 0.5869493, -0.4031725, 0.34900978, 0.03501825, -0.60266703, -0.12610222, 0.48031133, -0.843012, 0.4924527, -0.8623877, -0.6477808, 0.22316428, 0.52191186, -0.42713517, -0.4163384, 0.02406159, 0.19311489, -0.8280169, 0.7257932, 0.5891742, 0.6126962, -0.107232764, -0.07629745, -0.50356364, 0.6316943, 0.1606891, -0.70639515, -0.12811224, -0.4105088, -0.08755256, -0.40668, -0.5366433, -0.30879006, 0.10060625, 0.28111058, -0.71532774, -0.3630196, 0.59962934, 0.15385062, 0.36727977, -0.45993006, 0.22452451, -0.23574719, 1.6684455, -0.043385856, 1.6276766, -0.16736466, -0.12352954, 1.0252162, -0.27102458, 0.59440255, 0.26338896, -0.2930035, -0.61721444, 0.6569015, -0.34776017, -0.38311705, -0.4351132, 0.751855, -0.44927332, 0.28445652, -1.4778186, -0.5496483, -0.834149, -1.1146356, -0.8802563, 1.0398924, -0.14450291, -0.022082053, -0.009103067, -0.8312893, 3.564548, 0.31639445, 0.43401474, 0.63638914, 0.048858773, -0.24585214, 0.42760444, -0.627559, 0.36051834, -0.75384, 0.3967399, 0.078143656, 0.12599553, 0.86665404, 0.050567865, 0.92432106, -1.5632179, 0.19709128, 0.12208514, -0.078961484, -0.91890043, 0.23671533, 0.47289363, 0.19900943, 0.7240069, 0.16399404, 1.1182141, -1.0169126, -0.1350502, -0.46091932, 1.2807544, 0.35965964, 0.21481083, -0.3007364, -0.39301196, 0.9101389, 0.1932972, 0.15104347, 0.14832743, 0.27131686, -0.067170985, -0.6418764, 0.50354594, 0.25878644, -0.0033070669, 0.70426977, -0.6287618, 0.31597823, 0.45087764, -0.04529953, 0.8379618, -0.3591785, 0.56057227, -0.5669976, -0.84720474, -0.052068297, -0.16401154, 0.30864736, -0.8251212, 0.22997884, -0.28843462, 0.20421404, -0.10270865, 0.12777951, -0.34080166, 0.28729475, 0.63097245, 0.62922233, -0.23039082, -0.9737556, -0.37730604, 0.021021312, -0.18025522, -1.0727465, 0.0019658804, 1.0562756, -1.0607209, 0.55097324, -0.095470026, -0.16923568, 0.29799882, 0.13360816, -0.015510071, -0.3002998, 0.29892552, 0.5038376, 0.07581481, -0.25795814, -0.26878086, -0.018943973, 1.1134932, 0.84816736, 0.07172927, -0.119864315, 0.16197601, 0.55967194, -0.1490119, 0.35443506, -0.12817872, -0.7264169, 0.35164982, 0.5088061, 0.36944637, 0.75947386, 0.22153465, -0.0902444, 0.35916293, -0.22257099, -0.6245021, -0.66597265, -0.2242328, -0.47101194, -0.09299229, -1.0377257, -0.21733049, -0.32486138, -0.23556301, -0.9277732, 0.023987524, -0.5385696, -0.002912309, 0.6834146, 0.06879748, 0.26568368, 1.1300062, -0.17972237, 0.1250636, -0.06957579, -0.9457501, -0.10762876, -0.7763465, 1.5165349, -0.51138073, -0.53803205, -0.7513938, -0.16054633, -0.057135716, 0.56398803, -0.7251428, -0.9011231, -1.1330264, -0.009565931, -0.46391025, -0.3945485, -0.019825712, -0.214825, 0.662374, 0.4089401, -0.25013703, -0.11175172, -0.3359659, -0.73787993, -0.44064045, -0.95422965, 0.24658713, 0.5482323, 0.44154587, 0.15066868, -0.90368706, 0.16147381, 0.23279902, 0.41150323, -0.14870353, 0.4448821, 0.3361582, -0.5416869, 0.66956925, 9.3244016E-4, -0.58035725, -0.9133776, -0.21026349, 0.47709528, 0.559402, -0.096517116, 0.34964085, 0.021026324, -0.052352354, 0.2260392, 0.083108045, -0.82103014, -0.49560097, 0.13991357, 0.72335935, -0.22744378, -0.17416112, -0.06924981, 0.1720519, -0.056980915, -0.0040308535, 0.4777559, 0.34662804, -0.6132766, -0.1805803, -0.58219105, -0.5035861, 0.743928, 0.62252325, -0.43229088, 0.42164406, -0.7834892, 0.19773507, -0.68034565, 0.15410969, -0.46971694, -0.5955516, 0.23321742, 0.61164176, -0.10516539, 0.581982, -0.7406695, 0.31757313, -0.69854766, 0.9880034, -0.84722793, -0.7633326, 0.4578721, 0.10518447, 0.16203061, -0.6790652, -0.47155732, -0.38882074, -0.9170391, 1.0266749, -0.17550212, -0.4792506, -0.0668991, 0.39064267, 0.0947658, 0.8043089, -0.22434905, -0.313821, 0.052670494, -0.048851267, 0.32592362, -0.860603, 0.2698992, 0.3433336, -0.21785763, 1.5819844, 0.88469046, 0.07691138, 0.09752565, -0.42556408, -0.04519853, 0.87291956, -0.6176682, -0.2865502, 0.20136131, 0.36512914, -0.3311012, -0.30614272, -0.26107365, 0.1894452, 0.32637066, 0.35523584, -0.06667226, 0.10347664, -0.11940256, -0.10296476, -0.38421103, 0.6074242, 0.18352178, 0.015820663, -0.14712866, -0.20719282, 0.6038181, -0.15472703, -0.039784297, 0.059039198, 0.4398168, 0.68517715, 0.592921, -0.48001018, 0.29964036, 0.059656337, -0.36691985, -0.11802984, -0.16027823, 0.8514473, 0.061800294, -0.24240336, -0.00616711, -0.2318474, -0.27456677, -0.20014185, 0.39548382, 0.08403352, -0.6075959, 0.7013164, -0.24715367, 0.7730584, -0.5263237, 0.6818461, -0.4345966, -1.9885256, -0.57651246, 0.3897464, -0.22896479, 0.029132985, 0.62822366, -0.3221436, -0.24454945, -0.13972506, 0.07538301, -0.43282226, 0.29167226, 0.26169014, -0.22840403, 0.12716646, 0.5241455, -0.67354554, -0.23412356, 0.1583346, 0.09397203, -0.6005605, -0.062070902, 0.519738, 0.56230676, 0.19490737, 0.09140409, 0.2827071, -0.7554103, 0.9776802, -0.28762445, -0.16992666, -0.27326876, 0.5205804, -0.39026648, 0.8100204, 0.2251311, 0.3743077, 0.41226578, 0.28279757, 0.10248689, 0.78833973, -0.39051318, -0.035605595, 0.6300383, 0.67743725, -0.18472652, -0.3580135, 0.14300483, -0.36656314, 0.09548992, 0.6840508, 0.53377825, 1.0797411, 1.0701865, -0.14112248, -0.1359908, -0.52505445, 0.2282274, 0.8130599, 0.10876868, -0.5497892, -0.06409781, -0.12850465, -0.08437914, -0.348632, -0.55334604, -0.057698317, -0.020369263, 0.0053720847, 0.16307293, -0.8254809, -0.10885659, -0.54735035, -0.9688062, -0.2985726, -0.051860273, -0.13334262, 0.35509858, -0.8054574, -0.28351018, -0.68802255, 0.17037089, -0.7018103, 0.8101351, 0.96281683, -0.053284153, -0.42187208, -0.41856027, -0.7051473, -0.43084157, 0.46245623, -0.6828755, 0.13075721, -0.12911314, -0.28247756, 0.683695, 0.07331526, 0.008655533, 1.0331321, 0.41872248, -0.43458146, 0.11952154, 0.4864054, -0.4770374, -0.672267, -0.7951411, 0.90124786, 0.38761422, -0.06815794, 0.4979946, 0.3519773, -0.51443356, 0.47134402, 0.32008561, -0.52492595, -0.5968779, 0.91214985, 0.62872326, 0.25207788, -0.78720355, -0.65435094, -0.3022893, -0.026059672, 0.03250689, -0.4841232, -0.21127056, 0.94293606, -0.31384826, -1.024962, 0.4258807, -0.5591192, -0.85103065, 0.07572705, -0.029542465, 0.9386782, -0.01834616, -0.41138232, -0.41427138, 0.080845095, -0.021675527, -0.25335732, 0.85154873, -0.83299226, 0.010143421, 0.7232927, 0.60553235, 0.1309088, -0.3839781, -0.5941144, -0.45264992, 0.38672507, 0.21139218, 0.34125578, -0.30670395, 0.5510206, 0.19656421, 0.7967939, -0.61074483, 0.032774314, 0.4495337, -0.4416033, 0.04436638, 0.19213377, 0.25077653, -0.1421333, -0.07981576, -0.80517834, -0.44514215, 0.12253037, 0.5937313, -0.7326427, 0.7710463, -0.47982028, -0.026294831, -0.27366686, 0.59971505, -0.88799405, 0.34242895, 0.011235021, 0.68797493, -0.31184798, -0.2491819, -0.39411223, -0.37572742, 1.597634, 0.5555229, 0.53293955, 0.85264903, -0.014117359, -0.04914263, -0.32758757, -0.42537898, 0.016268618, 1.7822325, 0.014657244, -0.33223224, -1.4506384, 0.8279289, 0.63178736, 0.70278394, 0.16083482, -0.11632228, -0.42550898, 0.2825111, 0.050327733, -0.62059164, 0.24553949, -0.84764546, 0.5793387, -0.19014005, 0.18559122, -0.60808384, -0.22480549, -0.10949272, 0.4119357, 0.48874575, 0.10797066, 0.14826402, 0.95159596, 0.1007035, -0.28172037, -0.78677756, -0.2911378, -0.39184836, 0.18129729, 0.14663315, -0.6903422, -0.6197286, -0.22756599, 0.4553, 0.7559648, -0.19024116, -0.7333675, -0.22558317, -0.10755519, -0.8364387, -0.24587573, 0.61560297, -0.116256624, 0.09515799, -0.61133057, -0.60270244, 0.11373564, -0.478234, 0.054566797, 0.21379222, -0.20055366, 0.4200289, 0.38137415, 0.57250637, -0.8365286, 0.46541566, -1.5011121, 0.007360235, -0.7604555, 0.0025998056, -0.5833547, -0.07466688, 0.39678958, 0.96836436, -0.2345093, -0.18433093, 0.3012629, 0.2799663, -0.70134974, -0.48911846, 0.7690916, -0.06511322, -0.49618146, 0.3662134, -0.6264914, -0.22856562, 0.24773872, 0.3183567, 0.13739681, 0.07009312, 0.23409715, 0.34881467, -0.33139125, 0.28852808, -0.095444344, -0.51926076, 0.51465845, 0.2062692, -0.5242261, -0.46329415, -0.9741153, 0.06456158, 0.030457906, 0.14805505, 0.17728561, 0.27969873, 0.4174524, -0.53553534, -0.050896656, -0.7748257, 0.07999295, -0.064726844, -0.6482009, -0.16539901, 0.52794135, 0.2680578, -0.54837555, -0.846483, -0.1018344, 0.2759287, 0.01647371, -0.30559725, 0.77830505, -0.42698085, 0.22914001, 0.29629123, 0.9014104, -0.6857988, -0.02880317, -0.27855328, 0.5116826, -0.09280562, -0.026375346, -0.82933587, 0.29830056, 0.10016385, -0.9599105, 0.06670639, 0.32166743, -0.12561196, 1.15202, 0.17707397, -0.08005495, -0.039337177, -0.2968356, -0.12169429, -0.36883074, 0.2049313, -0.6679535, 0.031608433, 0.52695143, 0.007821337, -0.1485552, -0.62809414, 0.13040474, -0.15451281, 0.54773754, -0.4706813, 0.24263154, -0.1301415, 0.67641205, -0.62720996, 0.8313544, -0.7381075, -0.14358105, 0.3762475, 0.62239164, -0.045437563, 0.9459873, -0.8233303, -0.7147683, 0.46758357, -0.52135533, 0.06063361, 0.56855184, -0.507306, -0.036665827, -0.6302179, 0.07766994, -0.942735, -0.5909925, -0.2635432, 0.5478883, -0.07890162, 0.32488316, 0.26487243, 0.46853012, 1.1034807, -0.06512659, 0.33847657, -0.61609834, 0.06321365, -0.22743702, -0.87944865, 0.37845594, -0.020726902, -0.59833187, -0.42895967, -0.11077006, 1.0032699, -0.1725022, 0.32639518, 1.6419518, 0.21870343, 0.1484011, -0.7495263, 0.5773338, 0.1948407, -0.26478645, 0.31931522, -0.02530934, -0.18381046, 0.039240766, -0.3821348, -0.880036, -0.40542898, -0.5050127, 1.0508015, 0.6978597, 0.27783167, 0.43318307, -0.686163, -0.95909375, 0.39126918, 0.736118, 0.010625005, 0.4478026, 0.5347271, -0.28854454, 0.7788674, -0.65132344, 0.028316252, -0.24979532, 0.3684371, 0.8357179, -0.35869396, 0.24370271, 0.33024335, -1.4370449, -1.2778331, 0.19882585, -0.017336432, -0.4316948, -1.2735684, -0.26503587, -0.015060261, -0.6085152, 0.22704697, 0.26457584, -0.42646304, 0.03879311, -0.19615118, 0.44677356, -0.32433823, -0.084605284, 1.198679, -0.51367915, 0.36138633, -0.26781407, -0.25285503, 0.10098021, -0.24817827, -0.18135414, -0.17848538, 0.35427713, 0.521286, -0.02674108, 0.4217017, -0.08987662, 0.25608358, 0.50207585, -0.98633564, -1.0628304, -0.3846806, 0.022207262, -0.1283618, 0.37523708, -0.24025467, 0.5153696, 0.46323073, 0.13989824, 0.1561494, -0.77944976, -0.44046345, -0.63301426, -0.34989792, 0.13549271, 0.006190121, 0.24559984, 0.31742877, 0.1545193, -0.44265345, -0.08644013, 0.28001422, 0.15021466, 0.85503155, -0.76575583, 0.86318636, -0.55829847, -0.25753778, -0.7185067, -0.085994214, -0.18091784, 0.446105, -0.77112305, -0.4430915, 0.2551184, 1.1472955, -0.40047967, 0.35478163, -0.4045759, -0.48856065, 0.7408055, -0.13986495, 0.09953445, 0.2774477, 0.2467106, -0.42283788, 0.21039721, 0.10461013, 0.31418386, -0.6786972, 0.964533, 0.6333979, -0.42829648, -0.2897507, -0.9437793, 0.067182526, -0.99148446, -0.31607157, -0.5791597, 0.04460093, 0.2817655, 0.21890405, -0.0091788955, 0.614969, 0.21509607, 0.26194388, -0.028229192, 0.6323737, 0.3229837, -5.941242E-4, 0.1451681, 0.3452308, 0.26828063, 0.82891965, 0.6615142, 0.15845887, -0.1930975, 0.32330292, -0.49461275, 0.33965734, 0.5015075, 0.22370936, -0.038758203, 0.33031383, 0.64308834, -0.22973657, 0.40101275, 0.1735294, -0.62445706, 0.63983095, -1.0835669, -0.59931755, -0.25685513, -1.0129862, 0.148363, -0.3387562, -0.7876695, 0.36497584, 0.4875883, -0.46318775, -0.30246222, 0.24639976, 0.3614344, -0.4353444, -0.7491151, 0.03876262, 0.014877375, 0.5000705, 0.48863775, -0.5708522, -0.29530814, 0.39000627, 0.18866692, 0.13831648, -0.38619447, -0.5484635, -1.1455809, 0.14575654, 0.41666955, 0.17747879, -0.8406549, 0.13223548, -0.45904288, 1.1353003, -0.26693252, -0.12810816, 0.37510347, -0.29213232, -0.43941584, 0.9184803, 0.6855956, 0.2599459, 0.6948795, -0.0708392, -0.12901774, 0.55323, -0.5387498, -0.716477, 0.42386472, 0.12503567, 0.6216118, 0.10394464, 0.8343109, 0.65234077, -0.41163832, -0.39263293, -0.108594045, 0.4115751, 0.16237709, 0.28965876, -0.07473482, -0.23911166, 0.2871039, -0.6131977, 0.513528, -0.11655871, -0.6466727, -1.1273916, -0.19115873, 1.4469596, -0.020101145, -0.11192806, 0.01993516, 0.26601622, 1.1657052, 1.008147, -0.6360585, 0.12956598, 0.9011077, 0.26741764, 0.13538633, -0.082566485, 0.21531783, 0.26441088, -1.1124214, -0.27627683, 0.34551474, 0.15321879, -0.21587288, -0.29057226, -0.5665258, 1.2804754, 0.5072227, 0.2061311, 0.39224344, -0.48967192, 0.2075164, -1.2929554, 0.22832677, -1.1763334, 0.05883432, 0.5320689, -0.19186282, -0.067902, 0.5984157, 0.33769348, 0.24878782, 0.11002658, 0.33792466, 0.547646, 0.7538705, 0.59686947, -0.19582872, 0.39902282, -0.3311249, -0.74637324, -0.14266883, 0.43165115, -0.6139184, 0.29811418, -0.7535113, -0.30266273, 0.53370935, 0.36760342, -0.5749821, -0.68662786, -0.2779321, 0.37260574, -1.1336465, 0.6302474, 0.47815326, 0.9866135, -0.14947067, -0.033082485, -0.2046695, 0.20482336, -0.21032988, -0.52653766, 0.0245497, -0.47625363, -0.12423223, -0.12356821, -0.32638925, -0.0979994, 0.0010491088, 0.29562947, -0.6457077, -0.10971795, 0.06126561, 0.8076332, 0.2573005, -0.21695858, 0.46280462, -0.5214897, 1.3339914, 0.23493724, 1.6153331, 0.18739215, -0.35449666, 0.6756968, -0.35441598, 0.49293745, -0.08351409, -0.24639843, -0.57777464, 0.98248875, 0.0011553783, -0.68022805, -0.1735664, 0.5991789, -0.5056995, 0.28030026, -1.3956647, -0.29886672, -1.040315, -0.6200091, -0.55999726, 0.4394985, 0.25020325, -0.030757431, 0.41339186, -0.99428976, 4.134183, 0.21829394, 0.2768517, 0.24642767, 0.027245255, 0.22640549, 0.47818106, -0.79617405, 0.4751648, -0.4929724, 0.5096883, 0.14533526, 0.087542474, 0.42481625, -0.26212215, 0.94900197, -0.995192, 0.37323165, 0.48663512, 0.16938138, -0.9202455, 0.32618392, 0.3355089, -0.12735334, 0.39952835, -0.4738593, 0.17960149, -0.8438873, -0.15847224, -0.28993642, 1.529727, -0.06471403, 0.040852357, 0.038847372, -0.25056893, 1.0816733, -0.30027992, 0.33796108, 0.057108454, 0.27828, -0.07463636, -0.7907264, 0.89314646, 0.11971448, -0.2797623, 0.56961, -0.5983841, 0.07197225, 0.6231197, -0.16240701, 0.8118333, -0.10884293, 0.36955264, -0.30067077, -0.54466736, 0.23035151, -0.11903405, 0.15843613, -0.9551723, -0.008313894, -0.09104793, -0.34124452, 0.019560076, 0.22333694, -0.46288738, -0.06519584, 0.8732297, 0.4417033, -0.3591715, -0.79684395, -0.18898311, -0.00398656, -0.32608062, -0.624982, -0.43221474, 0.7961611, -1.0244153, 0.6864666, -0.38873324, -0.66227776, 0.18808874, -0.2118657, 0.12453443, -0.20756744, 0.2250452, 0.5361353, -0.38134813, -0.12358688, -0.50916564, 0.06882605, 0.5491102, 0.6088567, 0.043271434, 0.034038477, -0.14568043, 0.34731272, 0.27437162, 0.4291449, -0.5072562, -0.6460547, -0.17843097, 0.4998613, 0.4862506, 0.48174888, 0.43009067, -0.07885784, 0.25953156, -0.44193333, -0.2746965, -0.72802746, -0.24735373, -0.46056688, -0.08113882, -1.2671432, 0.05059053, -0.43514493, 0.09988372, -1.3890023, -0.5439976, -0.5726784, 0.042483523, 0.45590004, -0.12616622, 0.629282, 0.96405625, -0.42434147, 0.29803038, -0.16519342, -0.9395849, -0.230326, -0.83917814, 1.4581625, -0.57237923, -0.5016961, -0.5101177, 0.03989938, -0.16089517, 0.91115934, -0.69840354, -1.4957484, -0.25355923, 0.24498278, -0.03987664, 0.28695616, 0.33610544, 0.42031482, 0.26267177, 0.26665464, -0.036663882, -0.3205201, 0.08044999, -1.3707422, -0.10242602, -1.2773657, 0.44744903, 0.4707493, 1.1146326, 0.52519447, -1.0453299, 0.22108254, 0.3916083, 0.51568663, 0.2354028, 0.50902164, 0.15007426, -0.6983879, 1.0460291, 0.11031413, -0.68165857, -0.867732, 0.08759557, 0.32828143, 0.90392447, -0.74337864, 0.6990192, 0.12273654, 0.1353184, 0.41217592, 0.24795906, -1.3185968, -0.7651147, 0.103916384, 0.6086596, -0.29084563, 0.022982366, 0.28086853, 0.55208766, -0.31949097, -0.01541844, 0.81749123, 0.83401155, -0.14799729, -0.33081663, -0.8713344, -0.20599653, 1.2038018, 0.81881714, -0.62137777, -0.08521465, -0.9437865, -0.19047725, -0.9235109, 0.07554969, -0.54554856, -0.72309697, 0.10257645, 1.2262453, 0.11698446, 0.5399791, -0.6098297, 0.077516764, -0.1635267, 0.7329004, -0.6491352, -0.43532693, 0.13268438, -0.062738866, -0.037672497, -0.6150539, -0.792422, -0.32316244, -1.1831503, 0.8048623, 0.43596715, -0.80266297, 0.20404984, 0.040005, 0.51196873, 0.61864376, -0.3671871, 0.039022297, 0.08777553, 0.34561458, 0.48366174, -1.1842922, 0.108419, 0.09672105, -0.4544338, 1.6715314, 0.8024864, 0.38295293, 0.11245011, -0.13004047, -0.25588313, 0.9442645, -1.106852, -0.3146361, 0.17383303, 0.26125604, -0.836142, -0.2676666, 0.09179972, -0.11250311, 0.35692418, -0.074471295, -0.117300734, 0.47520566, -0.5543069, 0.32387045, -0.66126156, 0.395984, -0.23777974, 0.31760883, -6.269303E-5, -0.42587698, 0.3092674, -0.26971295, 0.12728855, -0.09048116, 0.3214799, 0.6557833, 0.40655518, -0.043354645, 0.23725055, 0.05158411, -0.5487681, 0.47276476, -0.42214486, 0.96318287, 0.101917736, 0.04613815, 0.37172058, 0.35901445, -0.55353534, -0.28215954, 0.646838, 0.055748854, -0.94629276, 0.52053577, -0.096165426, 0.68151516, -0.86083305, 1.2210809, -0.61603034, -1.8547043, -0.70553493, 0.08560893, -0.32475078, -0.07537295, 0.9242262, -0.3031748, -0.039215017, 0.48975095, 0.07386944, -0.635114, 0.5792452, 0.11396569, -0.79614615, 0.47500247, 0.22382374, -0.7640738, -0.7832393, 0.32251167, 0.2957459, 0.19379763, 0.1966333, 0.19957598, 0.47575438, 0.72345144, 0.2891014, -0.07611428, -0.7970295, 0.68839777, -0.65931904, 0.18129885, -0.1070019, 0.4440913, -0.3229485, 0.87062204, 0.0016378155, 0.34254807, 1.0556462, 0.9242675, 0.3841158, 0.19424327, -0.5399717, 0.45922905, 0.4348209, 0.7463028, -0.23992652, -0.60218215, 0.26373464, -0.48176405, 0.3577192, 0.30109936, 0.18007952, 0.97340673, 0.8311445, -0.091018654, -0.43556908, -0.47817314, 0.24427673, 0.86847204, -0.63367134, -0.1392084, 0.20880738, 0.29605484, 0.5102095, 0.0539689, 0.025343515, 0.24565774, 0.20760463, -0.14849266, 0.07748646, -1.0975155, -0.2468316, 0.049564585, -0.81448174, 0.07844066, -0.5533479, -0.12086342, 0.34281364, -0.47970983, 0.012860723, -0.20691025, -0.09066814, -0.6537314, 0.488608, 0.72847027, 0.43217465, -0.3573188, -0.2835165, -0.7994006, -0.60978246, 0.6759259, -0.74162185, 0.021587722, 0.2148367, -0.31782195, 0.15477072, 0.073249355, -0.2504549, 0.9304441, -0.109614864, -0.39431396, -0.13444294, 0.113385625, -0.17943051, -0.13110475, -0.6351985, 0.8168083, 0.7287063, 0.046382003, 0.78491753, 0.12041721, -0.44125587, 0.65859365, 0.1417125, -0.62944174, -0.8578431, 0.5297364, 0.5970799, 0.32134923, -0.6988253, -0.3988505, -0.53683966, -0.5645854, -0.26411146, -0.54879487, -0.08550332, 0.5523895, 0.09527285, -1.4829303, 0.42620313, -0.32207206, -0.80331665, -0.14081834, 0.14321318, 1.0547477, -0.014484324, -0.3733287, -0.6547246, -0.22136927, 0.23872378, -0.114890546, 0.52663624, -0.36137518, -0.10336557, 0.84902483, 0.24802007, 0.2428974, -0.55062777, -0.898774, -0.086360104, 0.42273575, 0.01069665, 0.03268071, -0.22184242, 0.68654114, -0.31356922, 0.99203634, -0.8053663, 0.024493441, 0.52120054, -0.14788416, 0.16501157, 0.71239144, 0.10519813, -0.23112617, -0.30074418, -0.7945606, -0.32828715, 0.1546241, 0.71328896, -0.8631298, 0.6879144, -0.25349656, -0.15505737, -0.52401733, 0.026135508, -0.91197675, 0.4897887, 0.2553321, 0.38357615, -0.5817329, 0.10147074, -0.14365219, -0.07878406, 1.460639, 0.76415765, 0.44990405, 0.9951974, -0.10996676, -0.43003532, -0.6043866, -0.97104216, -0.10857196, 1.7999303, -0.2487742, -0.23330228, -1.9624965, 0.8282924, 0.3562973, 0.99590814, 0.710325, -0.74927074, -0.47313, -0.23652235, 0.17110118, -0.64118886, 0.18618682, -1.0815334, 0.4417191, -0.27619588, 0.13438608, -1.2182668, 0.09222232, -0.046028994, 0.5128414, 0.6309838, 0.17811278, 0.08257908, 0.82218415, 0.24052832, -0.3043413, -1.1845739, -0.31409425, -0.5495012, -0.102475435, 0.6949858, -0.60669345, -0.5356563, -0.12042385, 0.51972234, 0.9788067, 0.27975333, -0.6509743, 0.08709107, -0.3396774, -1.0324789, 0.21493271, 0.64101464, -0.4424937, 0.35320687, -0.8626394, 0.018576376, -0.14504273, 0.0675314, -0.09590454, 0.14231923, -0.32527098, 0.15347226, 0.50280917, -0.12097482, -0.93272054, 0.6082158, -1.5437937, -0.07995024, -0.6858374, 0.39547303, -0.5739462, -0.52489924, 0.041147597, 1.3033543, -0.17370999, -0.22331943, -0.12098679, 0.7863538, -0.6103873, -0.3908378, 1.0210451, -0.33337703, -0.335317, 0.679813, -0.03252794, -0.46655637, 0.58323187, 0.526237, -0.17061844, -0.47416002, -0.35893548, 0.4063307, 0.32042253, -0.0637602, 0.13230446, -0.44979116, 0.5168601, 0.33988982, -0.7665607, 0.0853706, -1.2825401, 0.35769534, -0.21235913, 0.25373393, 0.2737563, 0.4383112, 0.26156312, -0.18157701, -0.82445776, -0.54746836, -0.19033858, -0.14472756, -0.8237075, -0.20849845, 0.09290561, 0.45805925, -0.60196894, -0.9694583, 0.22632071, -0.15821098, -0.07559876, -0.13461533, 0.6933839, -0.32768452, 0.3443336, 0.31391212, 0.9203925, -0.36575687, -0.20933554, -0.31347826, 0.5546571, -0.016795274, -0.092404574, -0.5469727, 0.6365913, -0.43841305, -0.8389967, -0.036488578, 0.61133695, -0.3538103, 0.76916534, 0.2602567, 0.04585594, -0.20960002, -0.69782466, -0.073778585, -0.4628681, -0.31100827, -1.194452, -0.15880762, 0.61074346, 0.01697435, 0.08602919, -1.0204202, -0.1064734, -0.5719034, 0.3842537, -0.61645734, 0.005817363, -0.5069963, 0.73048353, -0.58076227, 1.1014149, -1.002687, 0.26485753, 0.001325082, 0.23775855, -0.1090179, 0.8222375, -0.8824368, -0.60530984, 0.38780227, -0.18472426, 0.18662238, 0.6539168, -0.08568022, 0.0025433525, -0.35558033, 0.019322174, -0.88901633, -0.6802375, -0.69873244, 0.29876226, 0.03279008, 0.41753015, 0.15544944, 0.136213, 1.1869895, 0.13588208, -0.24654882, -0.68050987, -0.6760854, -0.6779837, -0.68511623, 0.96097136, -0.5064433, 0.005498264, -0.47417802, 0.14546248, 0.7594362, -0.367512, -0.098296344, 1.961263, 0.35767633, 0.03230954, -0.69004714, 1.1331533, 0.27895185, -0.49140096, -0.07016089, 0.16740261, -0.34845498, 0.25857598, -0.37114236, -0.92653924, -0.78350365, -0.41225216, 0.69445866, 0.34486955, 0.093205795, -0.066756755, -0.64549917, -1.1127244, 0.37053987, 1.1387469, -0.23592287, 0.80528295, 0.63944227, 0.54414797, 1.0815576, -0.5668222, 0.089382716, 0.13776606, 0.9200868, 0.8992326, -0.27931058, 0.48805022, 0.82883877, -1.7794003, -1.3662231, -0.16744435, 0.084341876, -0.107593, -1.017171, -0.3791846, -0.14377698, -0.27979684, 0.51328593, 0.26247755, -0.27690327, 0.076862276, 0.0780327, -0.07342488, -0.061520025, 0.0024008472, 0.8332128, -0.6966219, 0.4901986, -0.24039306, -0.14298935, -0.24950793, 0.12527625, 0.29839414, 0.7389395, 0.15047178, 0.58706343, 0.12560952, 1.0310695, -0.5962883, -0.18943071, 0.6150714, -1.2840291, -1.3595079, -0.15191634, -0.25942472, -0.17627351, 0.3720213, -0.10289232, 0.056950808, 0.3213657, 0.3321522, 0.053539947, -1.0371126, -0.052774735, -0.87331986, -0.7267541, 0.051209338, 0.1441378, 0.31906247, 0.46871975, 0.18395185, -0.0692848, -0.42856544, 0.01773473, -0.1260064, 0.71401536, -0.27404174, 1.3056145, -0.61608034, -0.3932829, -0.24632904, 0.010613654, -0.21523128, -0.08095754, -0.4983497, -0.626685, 0.64032483, 1.0719864, -0.35518745, 0.31677714, -0.09860298, -0.29361737, 0.98726356, -0.28703505, 0.37888417, 0.2140752, 0.36996755, -0.71319747, 0.2214708, -0.3875488, 0.37793255, -0.7721462, 0.6461019, 0.6115026, -0.5304169, -0.17443098, -0.70448905, -0.021181267, -1.0428503, -0.34047216, -0.06293756, 0.17875059, 0.28179625, 0.44505474, 0.16711755, 0.6964868, 0.2429418, -0.048931554, 0.101600535, 0.29270682, 0.14754868, 0.040776677, -0.2830106, 0.24993977, 0.18217126, 0.5031197, 0.6458861, 0.08088947, -0.06821887, 0.2294434, -0.6025328, 0.4214955, 0.02959657, 0.31607035, 0.048564933, 0.36561626, 0.4328048, -1.0279614, 0.5526877, -0.3101868, -0.7041938, 1.2670145, -1.0038794, -0.7538339, -0.051289015, -0.99725854, 0.54648906, -0.11038782, -0.8033994, 0.31729695, 0.11359299, -0.5800839, -0.29594612, 0.130738, 0.6961497, -0.31145877, -0.6745281, -0.3327659, 0.3130085, 0.12843235, 0.3653333, -0.8100079, -0.22264737, 0.5917342, 0.86295915, 0.3166489, 0.16683327, -0.26316214, -0.8232067, 0.5095601, 0.20595878, 0.45409048, -0.8229478, 0.10812789, -0.47012043, 0.8713862, -0.64504915, -0.24139825, 0.0829124, 0.30529198, -0.04502464, 1.3450638, 0.87469786, 0.1282358, 0.21878737, 0.5608324, -0.023736248, 0.8814906, -0.2450681, -0.64366734, 0.987674, 0.47663254, 0.72472185, 0.20790745, 0.4268311, 0.3406033, -0.40542594, -0.44307786, 0.21143325, 1.1998398, -0.04269371, 0.032475434, -0.028270632, -0.28937843, 0.63828766, -0.4257946, 0.30673802, -0.20225716, -0.8918963, -1.081641, -0.446235, 1.3505905, 0.28334346, -0.113350704, 0.10584864, 0.13026781, 0.9782037, 1.2069069, -0.59382397, 0.13534994, 0.20910484, 0.3964433, -0.08584341, -0.18862218, 0.29279798, 0.10304643, -1.0189443, -0.48712122, 0.089892246, 0.40033635, -0.43739498, -0.09577835, -0.8914217, 0.5634942, 0.46147624, 0.18333669, 0.5018127, -0.57141834, 0.22123447, -0.984082, 0.73240864, -0.42637298, 0.14858729, 0.58898765, -0.41788393, 0.15860158, 0.5590106, 0.5476727, 0.38015527, -0.06930857, 0.63783866, 0.19000062, 0.5320519, 0.85254997, -0.25869924, 0.36578634, 0.059271112, -0.82330275, -0.10596946, 0.32942462, -1.0458459, 0.47975013, -0.9814856, -0.54931, 0.12817167, 0.4720524, -0.60098046, -0.5558935, -0.07903196, 0.08017051, -1.0334187, 0.72646886, 0.28693724, 0.6514715, 0.017122403, 0.059414208, -0.43003318, 0.61294556, 0.15250102, -0.6344637, -0.124711365, -0.40405872, -0.21501787, -0.5084465, -0.6109873, -0.29131338, 0.21077976, 0.4723583, -0.6350576, -0.42727095, 0.3745004, 0.2436617, 0.16013308, -0.266916, 0.41006523, -0.13443582, 1.4617592, -0.09403017, 1.6679444, -0.113599226, -0.1766919, 1.1128019, -0.4637022, 0.6026775, 0.3295456, -0.26246035, -0.58322674, 0.63749, -0.29790995, -0.4552287, -0.34962073, 0.4757661, -0.38596824, 0.40881908, -1.6522696, -0.56499016, -0.9354418, -1.0565773, -0.9105244, 1.0067492, 0.12771598, -0.004504431, 0.23984769, -0.66904426, 3.6624045, 0.2592154, 0.27187067, 0.5508017, -0.10568046, -0.2670927, 0.5288961, -0.6268612, 0.20718782, -0.9910453, 0.4760573, 0.0844937, 0.11704531, 0.7277677, 0.06835682, 0.9558804, -1.4853053, -2.8017908E-4, 0.11895311, -0.11955248, -1.2167906, 0.5527989, 0.5219648, 0.25548583, 0.5149375, 0.123984054, 1.0438063, -1.0745394, -0.09779909, -0.5746613, 1.2606201, 0.4869489, 0.02342626, -0.30612367, -0.4081654, 0.54757965, 0.18535367, 0.089302, 0.14784724, 0.33126256, -0.024330921, -0.46541923, 0.44284585, 0.052763782, 0.093688585, 0.49122953, -0.9165186, 0.34113777, 0.31382066, -0.054380115, 0.8466793, -0.28731346, 0.28629318, -0.57786727, -0.5250714, -0.15221663, 0.029823096, 0.40237293, -0.7914292, 0.24210334, -0.42463204, 0.25620586, -0.21277969, -0.050531507, -0.18733416, 0.16404244, 0.696484, 0.25563902, -0.18624108, -0.8773365, -0.56324744, 0.31544864, -0.31330204, -0.8109294, -0.13510668, 0.9721738, -1.0318075, 0.26569387, 0.038234264, -0.31428084, 0.22263722, 0.06329511, -0.15759473, -0.36926627, 0.17948699, 0.5136905, 0.01984401, -0.19416128, -0.38064262, -0.37309346, 1.102059, 0.7792553, 0.060157903, -0.108390525, 0.11017364, 0.3994228, 0.09555158, 0.5825012, -0.60580367, -1.0827808, -0.1576766, 0.7572717, 0.51690817, 0.76832026, 0.5623794, -0.5242806, 0.10713714, -0.28198227, -0.3057894, -0.4436093, 0.0508234, -0.67036074, -0.50983393, -1.126107, 0.10048007, -0.28169256, 0.06555464, -1.1903594, -0.55183387, -0.4405081, -0.17009944, 0.5612562, 0.047636222, 0.37082034, 0.65144277, -0.21440561, 0.19920659, -0.08983047, -1.3184719, -0.21471508, -0.77892214, 1.0248505, -0.60647166, -0.48059314, -0.38415653, 0.33976716, 0.0074042156, 0.3431964, -0.7637138, -1.562081, 0.21412212, 0.41796106, -0.21860333, -0.036963142, -0.15398574, -0.067759186, 0.6621827, 0.14345872, -0.10131864, -0.15699252, 0.3062003, -0.93177044, 0.110051446, -1.2522842, 0.80647933, 0.19306532, 0.93869627, 0.41989905, -1.2128512, 0.048087396, 0.43417054, 0.51452124, 0.22957322, 0.6538078, 0.045719445, -0.49581295, 0.6129913, 0.2330572, -0.76418656, -0.59514874, 0.10234557, 0.34008834, 0.93430877, -0.7938407, 0.3488256, -0.095158495, 0.39193368, 0.32834923, -0.1460364, -1.1935029, -0.7402658, -0.06672922, 0.34790787, -0.24937785, -0.09675882, 0.54674053, 0.29830703, -0.25361973, 0.26495603, 0.8386657, 0.93270355, -0.30766344, 0.10872549, -0.54271966, -0.2646044, 0.80850345, 0.80533385, -0.3436443, -0.15843843, -1.1156524, -0.37078837, -0.9744277, 0.38333637, -0.7051673, -0.4906921, 0.054198608, 1.0482272, -0.16283801, 0.28291935, -0.2076324, 0.24571949, -0.42660946, 0.6194447, -0.5943218, -0.2044191, 0.80598855, 0.033541154, -0.16847873, -0.4267447, -0.5693771, -0.32211003, -0.80143666, 0.52846223, 0.42857355, -0.2879928, 0.25050047, 0.05486901, -0.059970193, 1.0365646, -0.21031526, -0.2751096, 0.4085902, 0.5967447, 0.46310297, -1.244204, 0.2939693, -0.06727497, -0.65307546, 1.6378098, 0.6602727, 0.3331953, -0.5972358, -0.16830699, -0.4092154, 0.9061645, -0.70522636, -0.30478314, 0.21947536, 0.30807325, -0.5290096, -0.021191731, -0.048273534, 0.052654807, 0.4325883, -0.002106417, 0.22604083, 0.6506453, -0.4128863, 0.06486968, -0.5109035, 0.6262629, -0.59054273, 0.54796576, -0.078081556, -0.22457956, 0.10496932, -0.7126875, -0.07178986, -0.014613241, 0.25202245, 0.6094514, 0.7096744, 0.17859364, -0.07159945, -0.10782984, -1.0702442, 0.2905703, -0.06708715, 0.73710424, 0.025326883, -0.04851279, 0.2838625, 0.100776896, -0.47360796, -0.23008478, 0.7629225, 0.4038585, -1.1927986, 0.7186655, 0.17397834, 0.66196936, -0.3637218, 1.0107775, -0.55020744, -1.4909959, -0.56990623, 0.30201685, -0.20511222, 0.2730165, 0.73218584, 0.048040986, -0.044010743, -0.15303451, -0.17348513, -0.39569393, 0.6480931, 0.10182218, -0.5377528, -0.012679113, -0.007665368, -0.65783006, -0.6718512, 0.36023977, 0.50482917, 0.112826176, -0.16764028, 0.09783888, 0.54286546, 0.82194656, 0.32949015, -0.10446587, -0.66156757, 0.44045573, -0.6881772, -0.12748857, 0.011206888, 0.5880827, -0.3310844, 0.60313576, 0.24298477, 0.18763687, 0.6665168, 0.8176408, 0.63851047, 0.7703525, -0.38874447, 0.29319334, 0.21659724, 0.67248577, -0.04747004, -0.75138336, -0.032682426, -0.58525085, 0.6164005, 0.5252805, 0.067715034, 0.77593464, 0.5756692, 0.01080169, -0.5409408, -0.18088111, 0.28055167, 0.7370628, -0.061915897, -0.14930114, 0.42736712, 0.07878585, 0.6338375, 0.028980128, -0.018971909, 0.24936385, -0.10556009, -0.007052973, -0.08535256, -1.1767282, -0.25823215, -0.16164792, -0.59529424, -0.04154039, -0.43678924, 0.16663226, 0.3614608, -0.4110936, -0.12785242, -0.561177, -0.49575725, -0.53649414, 0.55716574, 0.9938018, 0.3834205, -0.4088232, -0.16438262, -0.8488413, -0.68160176, 0.48920587, -0.35171676, 0.17286812, 0.14482836, -0.4438081, 0.34934083, -0.11522612, -0.18400648, 0.9550849, 0.19140965, -0.25227302, 0.060297303, -0.0070842654, -0.15262157, -0.484868, -0.6926102, 0.84828264, 0.91567695, 0.0016165003, 0.6874639, 0.023342803, -0.5647343, 0.4872593, 0.36987463, -0.53967863, -0.7367035, 0.6690624, 0.36760825, 0.41536736, -0.70216143, -0.78941077, -0.46292698, -0.32272416, 0.00408322, -0.569716, -0.0982589, 0.7778945, -0.22264656, -1.2859204, 0.14981261, -0.4571321, -0.84205663, -0.3931107, -0.13485941, 0.7186496, -0.11406441, -0.19351138, -0.3396683, -0.12722772, 0.0022645625, -0.023715228, 0.7800383, -0.23587298, 0.32181016, 0.6075423, 0.20606756, 0.08583229, -0.3835686, -0.76363343, 0.11516355, 0.26286107, 0.15805645, 0.010979824, -0.28352818, 0.42406383, -0.06747039, 0.7641131, -0.8182565, -0.031834044, 0.59817415, -0.556535, -0.13097134, 0.45006514, 0.45921433, 0.18680452, -0.2353987, -0.39224648, -0.20950153, 0.44744873, 0.7575571, -0.99211806, 1.0048358, -0.21880436, -0.29180026, -0.4883183, 0.11914819, -0.45420957, 0.5537008, 0.038552634, 0.28215736, -0.6505611, -0.05639731, -0.22432365, -0.0753257, 1.534879, 0.6527801, 0.33230194, 0.5043558, -0.17230092, -0.5368485, -0.60196584, -0.972783, -0.35474154, 1.5653621, 0.13357976, -0.23607488, -1.9256357, 0.99502707, 0.56387746, 0.95426637, 0.44848073, -0.6578555, -0.5840174, -0.21664485, -0.06438644, -0.6586791, 0.713435, -0.7542643, 0.4121706, -0.47967133, -0.5214753, -0.86162406, -0.41749653, 0.16635127, 0.67231923, 0.63377875, 0.060160317, -0.16357699, 0.70590246, 0.24508043, -0.31862876, -1.0028367, -0.1415234, -0.4981313, -0.07634404, 0.5626511, -0.5439674, -0.41470236, -0.32987338, 0.38528684, 0.8707138, 0.61265385, -0.7561777, -0.058350243, -0.29060918, -0.8828205, -0.32191333, 0.7171919, -0.6715127, 0.25353637, -0.85777193, -0.22826701, -0.10268143, -0.3677761, -0.21263666, 0.39470083, -0.50553197, 0.104695916, 0.38097295, 0.37870398, -0.7951013, 0.5898909, -1.4096434, 0.18723375, -0.67144465, 0.08446455, -0.32043055, -0.21069425, 0.060452625, 0.89954424, -0.33245453, 0.060212478, -0.16919714, 0.51581824, -0.46913767, -0.43260145, 0.8914732, -0.17595634, -0.39337397, 0.5862695, -0.165371, -0.41703492, 0.2300126, 0.8531972, 6.863475E-4, 0.018732369, -0.19274993, 0.11807219, 0.16294602, -0.13752386, 0.17776681, -0.7283606, 0.5255629, 0.21245965, -0.61398387, -0.019701332, -1.1922736, 0.072056726, -0.15926456, 0.06668207, 0.6565079, 0.3800544, 0.2927567, -0.18829279, -0.47632927, -0.5828585, -0.2932791, -0.32696068, -0.44982386, -0.1601027, 0.23962039, 0.35986, -0.6936998, -0.4130165, -0.028386503, 0.1189172, -0.23614475, -0.13688965, 0.8730439, -0.3260798, 0.6230809, -0.009794818, 0.64238536, -0.30446264, -0.1213474, -0.21677762, 0.64032716, -0.09058951, 0.32761735, -0.8952577, 0.7286184, -0.28435072, -1.0795968, 0.07461093, 0.5260262, 0.081124514, 1.1400597, 0.20557263, -0.22531477, -0.013032559, -0.63784456, -0.25429648, -0.43621144, -0.25980812, -0.68846905, 0.018888742, 0.40777546, 0.31415194, -0.06978384, -0.83367103, -0.47623697, -0.50554305, 0.050676435, -0.54136133, 0.09123197, -0.46119207, 0.8309509, -0.9467837, 1.3522601, -0.56323236, 0.04193849, -0.083614424, 0.65520114, -0.07264876, 1.2610217, -0.6354654, -0.54056776, 0.70698595, 0.00911441, 0.20147234, 0.8186352, -0.38808322, -0.081993535, -0.18767877, 0.27850354, -0.8085504, -0.6826043, -0.70434916, 0.28125268, -0.00417158, 0.1764245, 0.1252622, 0.13679127, 1.1405021, -0.16482627, -0.04663332, -0.58190393, -0.45656186, -0.49414352, -0.6545142, 0.7316151, -0.75474155, -0.13049766, -0.78929186, -0.1713476, 0.68869865, -0.1354918, -0.12297894, 1.374426, 0.53188884, -0.19543867, -0.7560643, 0.7825549, -0.20464867, -0.6691693, -0.024741076, 0.15538393, -0.20939259, 0.09335803, -0.32170793, -0.9581545, -0.3086296, -0.45974192, 0.9343871, 0.28155223, 0.026325535, 0.3607343, -0.51085424, -0.68860966, 0.51546973, 0.9578018, -0.32939222, 0.88570464, 0.8727469, 0.282832, 1.3196431, -0.46789652, 0.18751012, -0.009741772, 0.7062707, 0.7235945, -0.44040543, 0.32659394, 0.82885027, -1.513391, -1.0347612, -0.31969503, -0.17150323, -0.31322023, -1.0168256, -0.39043573, -0.32385135, -0.62966126, 0.4967361, 0.14318325, -0.02364469, -0.18822855, 0.36839056, 0.31844568, -0.25449395, 0.2378134, 1.1323748, -0.57734036, 0.57482517, -0.25512508, -0.3082748, -0.19442557, -0.1397948, -0.37038362, 0.7746373, 0.19150639, 0.057238307, -0.5009022, 0.7646541, -0.3515749, -0.1592197, 0.671271, -1.4349705, -0.87009597, -0.58153695, -0.0132568665, -0.26201454, 0.46259606, -0.24323648, 0.4780776, 0.24452041, 0.022693053, 0.21807481, -1.0536666, -0.3690221, -0.9724109, -0.5958498, 0.2780582, 0.17680575, 0.30712324, 0.33505383, 0.24084339, 0.3497074, -0.066905096, -0.046884567, -0.19839972, 0.49531293, -0.1463247, 0.68853134, -0.57161236, -0.5265372, -0.46173963, -0.29136887, -0.09823992, -0.25131285, -0.49662158, -0.29860687, 0.4173069, 0.61001307, -0.23230451, 0.33880717, -0.38124043, -0.62723, 0.7280858, -0.41596067, 0.12235218, -0.046359077, 0.1374916, -1.0030403, 0.076998085, 0.010334268, 0.16277502, -0.75184274, -0.045661084, 0.6897451, -0.5234157, -0.20258962, -0.35811937, -0.16314638, -1.2877578, -0.29840237, 0.11212779, 0.1864383, 0.30804637, 0.47436863, 0.07938605, 0.23727947, 0.15619943, 0.15607107, 0.3661412, 0.19492516, 0.52977335, 0.14330177, -0.39681092, 0.1595948, -0.17317334, 0.92330325, 0.95668155, 0.16457509, -0.082535796, 0.33720917, -0.6979915, -0.18996246, -0.18736917, 0.0076782946, 0.04778067, 0.4375449, 0.4449576, -0.5646165, 0.4824912, -0.73924667, -0.41778222, 1.228386, -1.4113506, -0.5091015, 0.018879347, -1.0306215, 0.3441526, -0.29703033, -0.76199734, 0.48998946, 0.0538232, -0.6444448, -0.55421084, 0.46473855, 0.41143027, 0.023548841, -0.5623564, -0.15067895, 0.5425395, 0.02348781, 0.33763394, -0.99986434, -0.40732938, 0.64412487, 0.61347324, 0.1844104, 0.060828157, 0.19362581, -0.89388067, 0.44956368, 0.61369896, 0.52955574, -0.93781817, 0.3274699, -0.2934738, 0.886754, -0.7060228, -0.09946883, 0.28589666, 0.38918224, 0.019775577, 0.8416462, 0.60078466, 0.22841358, 0.7777619, 0.048576668, 0.12920377, 0.708591, -0.17719474, -0.62505966, 1.0092452, 0.61805975, 0.53742653, 0.11385523, 0.30024686, 0.50781274, -0.65055555, -0.3315245, 0.089441545, 0.6801583, -0.055591352, 0.5085515, 0.080202654, -0.6231575, 0.7095781, -0.09222566, -0.0023482144, -0.2301088, -0.78504163, -0.89850014, -0.61895406, 1.4755174, 0.44006103, 0.3736515, 0.2789185, 0.3126807, 1.0981504, 0.5982582, -0.5319362, 0.2933641, 0.59055275, 0.449096, 0.09719907, 0.23644274, 0.4262668, 0.19561322, -0.99225354, -0.27452955, 0.0054776296, 0.42809853, -0.3454189, 0.024061855, -0.7582559, 0.4612135, 0.5061168, 0.16127184, 0.2933835, -0.74961704, -0.08755819, -1.038512, 0.52964205, -0.6356245, -0.039177597, 0.8408139, -0.43552092, -0.22568429, 0.6004227, 0.5666311, 0.34723854, 0.17451535, 0.46295786, 0.57787806, 0.5428326, 0.93625444, 0.25844303, 0.71137315, -0.17457405, -0.9393191, -0.0062135123, 0.7324282, -0.8502125, 0.21925573, -0.6307975, -0.40189654, 0.27061498, 0.65880245, -0.59898424, -0.7496212, 0.03331019, 0.19341184, -0.50549847, 0.76212996, 0.35790926, 0.7870286, -0.0400087, 0.055058934, -0.5947467, 0.26547173, 0.13392746, -1.1119648, -0.17382655, -0.5744398, 0.111572, -0.59631276, -0.62594944, -0.097791016, -0.35199642, 0.2313174, -0.58278424, -0.08641501, 0.34744838, 0.34512728, 0.500954, -0.7685111, 0.46870387, -0.10193086, 1.6084917, -0.03636925, 1.4086537, -0.063865475, -0.0015128739, 0.92001283, -0.38939625, 0.45528454, 0.31051323, 0.1577892, -0.5681765, 0.7005183, -0.5051335, -0.34040785, -0.28615594, 0.8032139, -0.46363586, 0.21622391, -1.2667955, -0.29988098, -0.81864244, -0.8201505, -1.1678752, 0.75056106, 0.098227546, -0.010810759, -0.014191384, -0.42939845, 3.9035187, 0.15681595, 0.2582419, 0.4887771, 0.1525703, -0.02428957, 0.66500604, -0.5359085, 0.22960104, -0.7852579, 0.15039048, 0.06367845, 0.3528753, 0.9337709, -0.20073745, 1.0146337, -1.0692636, -0.24778748, 0.23142752, -0.14437445, -1.2041767, 0.28693214, 0.37165838, -0.035585634, 0.52149665, -0.11201562, 0.60554165, -1.043031, 0.06837402, -0.4101506, 0.8253852, 0.12620798, 0.22745697, -0.13505921, -0.45202237, 1.1835434, 0.25073954, 0.1395775, 0.10847205, 0.25401965, -0.37892976, -0.6354462, 0.36379182, 0.1980045, 0.09259137, 0.7982754, -1.1515712, -0.24035174, 0.6636571, -0.15318638, 0.58441776, -0.48915377, 0.5170015, -0.2060879, -0.7129818, -0.1414245, -0.43068886, 0.18446523, -0.9598793, -0.2197116, -0.19919111, 0.12266955, -0.10918245, 0.35740358, -0.3485523, -0.22071102, 0.5921739, 0.5802294, -0.22553721, -0.7331374, -0.5409138, 0.4591624, -0.25060326, -0.6027513, 0.1528463, 1.0014454, -0.9771162, 0.30428672, -0.31012374, -0.36872467, -0.45164657, 0.3022587, -0.3332075, -0.05958897, 0.5864512, 0.29134268, -0.2936555, 0.14974032, -0.21069044, -0.21046856, 1.0327365, 0.87497103, -0.29114136, -0.12409274, 0.30638078, -0.008108355, -0.074863106, 0.1823267, -0.92456347, -1.2252402, 0.023988292, 0.29588172, 0.28956586, 0.92870545, 0.6245167, -0.17748761, 0.49881747, -0.0013700202, -0.6062493, -0.5211433, -0.044155214, -0.58735853, -0.3184926, -1.1066936, 0.31925192, 0.055742487, -0.11290029, -1.2357664, -0.013144705, -0.5662862, 0.06639056, 0.35374135, 0.38557136, 0.20628467, 0.5110246, -0.42163143, 0.12925106, -0.24695382, -1.1608903, -0.15010446, -0.3606254, 1.2112582, -0.5199689, -0.24509984, -0.57505196, 0.06266602, -0.05476774, 0.5543311, -0.6631306, -0.90839344, 0.056663997, 0.39264026, 0.006514296, -0.03379453, -0.06360012, 0.2962194, 0.43456346, 0.29512823, 0.15175281, 0.034137387, -0.15923557, -0.86211294, 0.07326408, -0.80600816, 0.67977273, 0.49671376, 0.6821382, 0.27394387, -1.536363, 0.57825166, 0.7842151, 0.2394658, 0.09236379, 0.6696022, 0.22107342, -0.5844541, 0.68800783, 0.35063517, -0.7489135, -0.84657335, 0.13539974, 0.011126772, 0.83486915, -0.3726464, 0.38500214, 0.15931323, 0.24204169, 0.31334576, -0.38999516, -1.0564649, -0.8066621, 0.32243422, 0.08050046, -0.100161314, 0.1417718, 0.26810834, 0.27799317, -0.24338469, -0.1273042, 0.47630495, 0.761901, -0.31447634, 0.0041330475, -0.6132874, -0.35413107, 0.50921535, 0.92908055, -0.7377505, 0.17884433, -0.97206813, -0.31223825, -1.1257086, 0.054560035, -0.5985438, -0.5419079, 0.34310243, 1.1592656, 0.12414108, 0.6306039, -0.29405472, 0.36001867, -0.26069996, 0.6843612, -0.69717747, -0.25637287, 0.7413816, -0.09426433, 0.007948817, -0.05839423, -0.37699413, -0.54838955, -0.5196219, 0.7450251, 0.5604553, -0.19528422, 0.153679, -0.037510846, 0.21829069, 0.63829726, -0.11303048, 0.0413495, 0.42149734, 0.5452131, 0.12912615, -0.9724758, 0.47631884, -0.11178413, -0.78062665, 1.6786276, 0.88644165, 0.25348303, -0.57685983, -0.10731165, -0.6602384, 0.66389215, -0.7689, 0.1496639, 0.6415253, 0.500464, -0.24878055, -0.07939838, 0.13462633, 0.013040431, 0.73763734, 0.06980479, -0.18928413, 0.6980672, -0.33711007, 0.115530476, -0.61564434, 0.2487322, -0.04897301, 0.13430814, -0.2164018, -0.3666767, -0.095899746, -0.44386792, -0.17055167, -0.036105186, 0.43075958, 0.534845, 0.17878997, 0.06367618, -0.05834858, -0.2430348, -0.6089918, -0.047322188, 0.080885276, 0.5262991, -0.21075973, 0.10692868, 0.13799505, 0.08237328, -0.60258526, -0.51029414, 0.716713, 0.27913976, -1.1312143, 0.69941586, 0.08650997, 0.6624551, -0.70263344, 1.0370399, -0.4800526, -1.3264769, -0.5724056, 0.48490354, -0.36758322, 0.14180458, 1.0191479, -0.16142865, -0.15934804, -0.06126994, -0.12419982, -0.2052495, 0.46710333, 0.25446153, -0.09749228, 0.2416552, 0.13107337, -0.62425584, -0.4665196, 0.41823313, 0.017742202, -0.11604845, -0.014583001, -0.04743681, 0.48962507, 0.5726147, -0.15344103, -0.043124318, -0.4611046, 0.5476682, -0.6814534, -0.13700399, -0.25768772, 0.47459337, -0.5468129, 0.964742, 0.26113805, 0.29224998, 0.69866586, 0.5390306, 0.23548684, 0.5616739, -0.4996161, -0.0531639, 0.15483534, 0.3004987, -0.15385841, -0.6523655, 0.52095807, -0.61126125, 0.29399925, 0.022592522, 0.0036164224, 0.9010767, 0.66380125, 0.22740883, -0.8602492, 0.067954, 0.3547017, 0.4408105, -0.13458662, -0.23914078, 0.20854351, 0.24268481, 0.46751034, 0.36705163, 0.043406673, 0.036361203, 0.05552602, -0.071449906, 0.041502196, -1.2105745, -0.028304726, -0.039797705, -0.66858214, -0.088372126, -0.5237669, 0.16090764, -0.04407379, -0.6910071, 0.054006502, -0.28989974, -0.24306267, -0.61034966, 0.5553436, 0.6809772, 0.096716136, -0.51710796, -0.098939195, -0.3180539, -0.32514825, 0.38779578, -0.7734561, 0.15372227, 0.087640285, -0.4327031, 0.096745, -0.06493625, 0.029305357, 1.0426801, 0.116323724, -0.46691078, 0.011199217, 0.1469512, -0.108034305, -0.24094029, -1.0067587, 0.86667746, 0.681321, -0.34006357, 0.6885098, 0.21300186, -0.55701715, 0.582534, 0.26671684, -0.28656054, -0.7581177, 0.83850646, 0.6659291, 0.63540286, -0.82415324, -0.76791, -0.42685413, -0.1978186, 0.1188646, -0.35998422, -0.4153101, 0.63527155, 0.012389898, -1.5216818, 0.10454872, -0.15033387, -1.1138442, -0.363461, -0.31349632, 0.73108214, -0.13952224, -0.29330423, -0.40340406, 0.19570658, -0.13253699, -0.15259932, 0.8772184, -0.6289534, 0.24124396, 0.8863129, 0.013752261, 0.11636713, -0.2878188, -0.6748302, 0.26673093, 0.074429825, 0.18423261, 0.33583167, -0.31168482, 0.18303514, -0.110326886, 1.0521882, -0.8914687, -0.041218713, 0.7925176, -0.38259062, 0.0699002, 0.39020306, 0.3406126, -0.025504138, 0.030163972, -0.8205811, 0.27958557, 0.42331424, 0.7152617, -0.5693195, 0.79709387, -0.052060973, -0.2502512, -0.5891158, 0.43469584, -0.41373527, 0.6146908, 0.076879665, 0.31544682, -0.5227765, 0.08362824, -0.23998299, -0.06326865, 0.977748, 0.699623, 0.34662923, 0.4053547, -0.57229793, -0.360397, -0.68081236, -0.89546853, -0.38550287, 1.4982802, 0.1295377, 0.03139779, -1.4845395, 0.6942864, 0.52807, 0.8333225, 0.49081743, -0.3854397, -0.5561076, -0.2873355, 0.35955435, -0.40604037, 0.3067069, -0.9793556, 0.54424125, 0.05487563, -0.17266905, -1.1705602, 0.23105747, -0.096690014, 0.66326594, 0.50486475, -0.104512066, -0.17203951, 0.84721786, 0.010612169, -0.2766949, -0.7051157, -0.4017008, -0.63575864, 0.06809341, 0.36169913, -0.83321065, -0.3977779, -0.75799507, 0.45688114, 0.8228988, 0.3614043, -0.3872057, -0.23848563, -0.2693749, -0.90534234, 0.062407956, 0.79575527, -0.28577504, 0.11576642, -0.85940045, -0.2364341, 0.09936187, -0.6178453, -0.2623395, 0.4881133, -0.96528625, -0.002703242, 0.32168373, 0.23600036, -0.5019947, 0.62138635, -1.4865868, -0.15790486, -0.6669983, 0.06801675, -0.5628619, -0.31371945, 0.6114257, 0.96458405, -0.064005196, -0.219717, -0.09132044, 0.547687, -0.633611, -0.21194346, 0.5262808, -0.2213456, -0.47458994, 0.39729577, -0.15099177, -0.43005282, 0.53780806, 0.54377115, -0.124503836, -0.3869376, -0.4276981, -0.017099984, 0.10659635, 0.023432303, -0.023488503, -0.5943924, 0.44783092, 0.21988973, -0.2587016, 0.054121852, -0.98205125, 0.66049236, -0.1100941, 0.40253222, 0.4989391, 0.18264665, 0.024417441, -0.1577205, -0.33052993, -0.40380287, -0.3190465, -0.432463, -0.36828405, -0.5821203, -0.027871974, 0.3407156, -1.0126361, -0.44199046, -0.089746, 0.19934487, 0.24793631, 0.07480049, 0.3483074, -0.468999, 0.49423718, -0.024303712, 0.7697083, -0.5001096, 0.02921876, -0.2797136, 0.5004291, -0.19378904, 0.33850992, -0.5845366, 0.54080933, -0.4231968, -0.8276037, -0.21587685, 0.4471876, 0.17945103, 0.8905926, 0.45168063, 0.120928615, -0.19128208, -0.9465436, -0.4261623, -0.56029624, -0.15703607, -0.70728654, -0.37483913, 0.49776262, 0.25170207, 0.12126787, -1.2433228, 0.06759076, -0.42357254, 0.37723503, -0.37966526, 0.16530818, -0.6875407, 0.6304193, -1.0195813, 1.1075277, -0.78990626, 0.39701256, 0.0069374703, 0.7567582, -0.09521173, 0.67897403, -0.46449107, -0.7232551, 0.6319999, 0.13682938, 0.38638604, 0.4707066, -0.36580908, 0.2677807, 0.34033567, -0.1596111, -0.9749413, -0.37226206, -0.6223806, 0.2617854, 0.103502214, -0.008744709, 0.051227644, 0.351737, 1.1481045, 0.14042997, -0.5311719, -0.49255943, -0.8199234, -0.64042944, -0.21486312, 0.6096419, -0.52185607, -0.2824444, -0.79940456, 0.1712943, 0.4599559, -0.08197235, 0.35854346, 1.6623292, 0.45101458, -0.066510625, -1.0427458, 0.62489176, -0.22252423, -0.5163516, 0.07532082, 0.13290837, 0.13375865, -0.16612516, -0.15780056, -0.94008225, -0.29751578, -0.57456505, 1.1763555, -0.05414252, 0.37103045, 0.19796538, -0.43615937, -0.68003327, 0.3122042, 1.2015585, -0.24554463, 0.8153871, 0.7607808, 0.059229776, 1.3229659, -0.24295142, 0.17053288, 0.048269182, 0.9410707, 0.9070906, 0.06965003, 0.27366185, 0.8945579, -1.2575924, -1.2471954, -0.5133816, -0.03719949, -0.040453598, -0.6262046, -0.22496824, -0.5460526, -0.6761229, 0.38598374, 0.30903018, 0.3048585, 0.05681765, 1.035404, 0.3265798, -0.65159935, 0.012538631, 1.1262999, -0.5801894, 0.6140626, 0.030489383, -0.20633727, -0.091095164, 0.07008093, 0.20600188, 0.42286634, 0.24940234, 0.336841, -0.28344682, 0.15419483, -0.45846593, -0.2657172, 0.30148643, -0.9636932, -0.83163893, -0.15322179, -0.083657995, -0.24991873, 0.2650725, -0.21684909, 0.45393792, 0.2698332, 0.0074559078, 0.4958383, -0.61557376, -0.25072846, -1.2557454, -0.6115327, -0.24550119, -0.04877276, 0.06557663, 0.3164962, 0.2010736, 0.20483038, 0.098864615, 0.4129772, 0.24178419, 0.45724168, -0.4674123, 0.8200659, -0.50947297, -0.449177, -0.30873096, -0.00341261, -0.05515168, -0.5907586, -0.33790907, -0.651591, 0.40981805, 0.7774349, -0.11609654, 0.120979905, -0.17329918, -0.36349046, 0.5757807, -0.30231762, 0.16941534, 0.18787259, 0.016418763, -0.9578842, -0.080765896, -0.023937378, 0.13233513, -0.6668092, -0.18915473, 0.6900721, -0.81779176, -0.3249238, -0.19014584, -0.26334095, -0.9522248, -0.020303745, -0.1590526, 0.45100468, 0.30653527, 0.19623548, 0.3372883, 0.4808515, 0.053027716, 0.039079703, 0.063242614, 0.1595489, 0.36108032, -0.06620808, -0.37538713, 0.023618475, 0.01085633, 0.69008404, 0.27196503, -0.04092282, -0.2127317, 0.2757614, -0.30057618, 0.18570052, -0.19186738, 0.3087836, -0.25180426, 0.26582882, 0.4608781, -0.21650104, 0.2283323, -0.31646472, -0.692105, 1.3698722, -1.257715, -0.45968327, 0.08766882, -0.62902015, 0.52597046, -0.24926928, -0.85368836, 0.53539294, 0.18897045, -0.8144592, -0.24593538, 0.45442003, 0.43394864, -0.021025106, -0.56448966, -0.48068237, 0.57226974, -0.1455751, 0.3920177, -0.805578, -0.3599915, 0.36887014, 0.40636414, -0.38607797, 0.25946122, -0.5041137, -0.7237108, 0.20406774, 0.26659763, 0.50632215, -1.1882919, 0.31482235, -0.16788547, 1.0427362, -0.30384532, 0.25440946, 0.36111465, -0.04078348, -0.08545423, 0.92903745, 0.4287195, 0.38892937, 0.6466388, 0.011067346, 0.10231955, 0.72308904, -0.13572344, -0.31354204, 0.68488604, 0.4170978, 0.42884508, 0.10300704, 0.7566359, 0.17373186, -0.41658837, -0.43844083, -0.086458325, 0.52654135, -0.043467827, 0.6249003, -0.25258037, -0.729916, 0.6514588, -0.21865344, 0.05354707, -0.038330674, -1.0014257, -0.64724433, -0.36293414, 1.4632056, 0.2517041, 0.034037836, 0.24289103, 0.09087169, 0.8479298, 0.55847895, -0.71819776, 0.22156405, 0.59628755, 0.092399985, -0.04420072, -0.3075664, 0.30672166, -0.07358368, -0.9896834, -0.030702464, 0.45216998, 0.23109157, -0.3755612, 0.16779788, -0.6244628, 0.7411318, 0.24217345, 0.17737857, 0.48295784, -0.8859237, -0.24001184, -0.75387233, 0.67960876, -0.83024853, -0.14399245, 0.8452935, -0.3518325, -0.047979936, -0.02630499, 0.5509351, 0.4625635, -0.16918442, 0.30742225, 0.16386184, 0.67220664, 0.6280037, 0.28628358, 0.5660928, -0.1181638, -0.7434205, 0.20981479, 0.30287597, -0.69003713, 0.2184324, -0.76819944, -0.6346251, -0.08185301, 0.4818785, -0.51540446, -0.41744098, -0.09777721, -0.13589545, -0.60600513, 0.5247147, 0.3843186, 0.7094564, -0.16184524, -0.10725272, -0.4548275, 0.19113028, -0.047529392, -1.2795435, 0.17554286, -0.11416066, 0.13803561, -0.15642008, -0.6183412, -0.09616114, -0.37894952, 0.41909993, -0.662439, -0.114946306, 0.24334419, 0.22668067, 0.12224765, -0.63632286, 0.09084573, -0.23651299, 1.572324, 0.2178188, 1.1743072, 0.07571864, -0.1768858, 0.46413594, -0.48011255, 0.60569423, 0.15971124, 0.15805168, -0.9414262, 0.52399147, -0.007178193, -0.5215467, -0.59056896, 0.8559839, -0.2467039, -0.12033293, -0.9019515, -0.59779, -0.7349234, -0.8292922, -0.8635217, 0.5185263, -0.14540526, -0.26934415, 0.09875953, -1.1647751, 4.1182427, 0.46481997, 0.20087855, 0.9354643, 0.105424814, -0.004540026, 0.31147802, -0.6534193, 0.49501762, -0.45092684, 0.26379517, 0.448524, 0.34865677, 0.33569512, -0.016880259, 0.931842, -1.0148392, 0.20927775, 0.27847856, 0.15899846, -1.0693281, 0.1423664, 0.25981626, -0.025161192, 0.37412122, -0.29079884, 0.65601414, -1.0225062, -0.09605144, -0.14980899, 1.4953828, -0.1718415, 0.4066242, -0.08655246, -0.24063088, 1.2393714, 0.30284256, 0.36995012, 0.13408722, 0.30496278, -0.46151608, -0.6467823, 0.6863592, 0.3977234, 0.24254265, 0.30088937, -0.91632855, 0.22041345, 0.21627867, 0.036953487, 0.8198882, -0.38644162, 0.5111023, -0.6528836, -0.05132746, -0.048061155, -0.6670724, 0.32652795, -0.93728834, 0.17837188, -0.07624923, 0.18451518, -0.23230648, 0.34793568, -0.30258647, 0.12964638, 0.51428103, 0.8286943, -0.33250588, -0.6536644, -0.5854663, 0.42078778, 0.0033747032, -1.1266797, 0.10867215, 0.7423345, -0.83774376, 0.77926403, -0.058730222, -0.47217268, -0.092801005, 0.33792138, -0.05150798, -0.31443495, 0.27053922, 0.27824974, -0.11275067, -0.09057309, -0.2926527, 0.06173639, 1.3071758, 0.4730829, -0.14173776, -0.5784081, 0.2668654, 0.23815082, 0.28242433, 0.4774975, -0.54650855, -1.0264833, -0.47225332, 0.8703695, 0.63991624, 0.74452734, 0.42014164, -0.03533741, 0.06514102, -0.09643583, -0.8522862, -1.026076, 0.2499778, -0.42779097, -0.22190364, -0.076258555, 0.44808066, -0.71214545, -0.33959672, -1.3720645, 0.32767367, -0.713407, 0.7200092, 0.54970694, 0.038314663, 0.31601653, 0.82536983, -0.3402146, -0.15020594, -0.38107064, -1.594133, -0.20284157, -0.5158298, 1.4197085, -0.8124861, -0.42961958, -0.9616828, -0.31844, 0.09133983, 0.83976585, -0.69099605, -0.7764937, -0.5044535, -0.021224841, -1.0946624, 0.061164968, -0.008315772, -0.09962118, 0.7529673, 0.13280208, 0.32369834, -0.018207334, 0.30298617, -1.3468391, -0.010767452, -1.2652732, 0.3044045, 0.6346315, 0.41673356, 0.3533945, -1.4007373, 0.73925, 0.4769547, 0.45146942, -0.17096666, 0.53908443, 0.1459171, -0.5496129, 0.8112877, 0.22813308, -0.86315006, -1.0600767, 0.49666116, 0.6343291, 0.9384711, -0.67448175, 0.65366536, 0.12925006, 0.32494718, 0.7210598, -0.119817495, -1.8780767, -1.1060218, 0.26940116, 0.8603358, -0.37159148, 0.22237892, -0.026965573, 1.4551806, -0.04102008, 0.18953791, 1.2205132, 1.3830074, -0.6203029, 0.105550446, -0.9172137, -0.2631466, 1.2078451, 1.1561841, -0.88699704, 0.33485472, -1.1039261, -0.15662864, -0.8889108, -0.021704465, -0.7190207, -0.4444397, -0.09743556, 1.0252041, 0.27867004, 0.47697592, -0.25137198, 0.8654594, -0.5946547, 1.1985759, -0.7184543, -0.37799215, 0.8081364, 0.13715135, 0.03568732, -0.6331051, -0.65091616, -0.63724107, -1.1073422, 0.83576024, 0.01433241, -0.25773996, 0.19880387, 0.26008373, 0.12768374, 1.1019219, -0.48458183, 0.046535883, -0.06099293, 0.5994473, 0.82844126, -1.4832599, 0.76427746, 0.2744197, -0.63113993, 3.4523046, 1.0266101, 0.27708215, -0.41686982, -0.5191848, -0.06873581, 1.3051794, -1.1570866, -0.13528334, 0.36869058, 1.023516, -0.06851939, -0.42901027, -0.061269097, 0.34303978, 0.78846973, -0.10224266, -0.26698807, 0.36766642, -0.052483615, 0.30429786, -0.5263308, 0.8598371, -0.22671875, 0.18051147, -0.08662229, -0.3279599, 0.2018461, -0.6478263, -0.17370462, 0.13946049, 0.68857074, 0.7604215, 0.66072303, -0.2236945, 0.0344449, 0.39498496, -0.86348784, 0.2021577, -0.554239, 1.241565, -0.19903407, 0.096936144, 0.6406258, -0.34654585, -0.73143643, -0.13212292, 0.64585644, 0.20416865, -1.3674644, 0.81159735, -0.53180194, 0.44403616, -0.4629941, 0.8237217, -0.6575767, -1.9094594, -1.0068313, 0.1886729, -0.54099613, -0.31080106, 0.52114534, -0.4064729, -0.3517636, 0.52113307, -0.37713295, -0.54287195, 0.90217155, 0.75736386, -0.057880785, 0.65335006, 0.5185984, -0.6316754, -1.008395, 0.5784696, 0.15871945, -0.096895896, 0.030775126, 0.019246973, 0.635904, 0.7580727, 0.603296, -0.39326644, -0.775648, 0.6632834, -0.76522464, -0.15057506, 0.13213232, 0.8701612, -0.051690824, 0.886158, 0.059451666, 0.39455524, 1.1942627, 0.80077326, 0.30792174, 0.72980845, -0.58946186, 0.11602919, 0.6559696, 0.8268997, -0.20558739, -0.9376819, 0.4666886, -0.6281039, 0.45548218, 0.08520936, 0.19750595, 1.5127107, 0.83545053, 0.3510535, -0.8958543, -0.75617564, 0.894642, 1.4720694, -0.1355076, -0.6986217, 0.29143137, 0.34363377, 0.18577126, 0.26836568, -0.13981187, 0.19420178, -0.1310125, 0.106808856, -0.11584908, -1.3767927, -0.048521705, -0.12314682, -0.70627797, 0.10515572, -0.5317391, 0.5002598, 0.422907, -1.0648339, -0.11869705, -0.93817717, -0.47067133, -1.0766637, 0.7890926, 1.0871282, 0.077466965, -0.022941213, -0.34052557, -0.46262902, -0.21314916, 0.63874835, -0.8034802, -0.12524417, -0.2280509, -0.45375586, 0.11442453, 0.17320183, -0.16676669, 1.2585441, -0.26324847, -1.0815029, 0.48728508, 0.40939358, -0.2852892, -0.01987523, -1.0332665, 1.4922973, 1.2905895, -0.3012445, 1.1206418, 0.58634394, -0.5885947, 1.027236, 0.5461434, -0.56589985, -2.160386, 0.9977782, 1.4122514, 0.35012767, -0.8348484, -0.91156083, -0.44733608, 0.06918893, 0.073672324, -0.49986246, -0.36920917, 1.2300003, -0.028686464, -1.9602597, 0.3586868, -0.5751905, -1.2226559, -0.160415, -0.45962837, 0.7730631, 0.15213728, -0.40129295, -0.3763386, 0.25027445, -0.017731309, -0.35444453, 1.0308242, -0.68111396, 0.027753418, 1.1759561, 0.1284143, -0.1538926, -0.06069766, -0.5967487, -0.46134785, 0.65801346, 0.38983122, -0.13866639, -0.1946084, 0.39163414, -0.05783741, 1.3692302, -1.1921241, 0.12407765, 0.62342554, -0.22950053, -0.15749526, 0.42076403, -0.15916803, -0.6903404, 0.38964617, -0.96953917, 0.1617446, 0.15616782, 0.94165206, -0.7990292, 1.0704751, -0.3479437, 0.014394938, -0.27818298, -0.2686414, -0.8608855, 1.1030215, 0.30865127, 0.56293905, -0.5808595, -0.09553954, -0.5470532, -0.24101052, 1.7932336, 0.5933583, 0.22850809, 0.6440879, -0.13777807, -0.40607083, -0.14935976, -1.0655402, -0.08556904, 1.5463837, -0.2037431, -0.049918488, -1.948359, 1.3937284, 0.8913616, 0.6618716, 0.29112825, -0.9333397, -0.64939773, -0.1519076, 0.43093035, -0.90897346, 0.23105648, -1.6697718, 0.80526376, -0.10556382, -0.29879344, -1.1856492, -0.08865876, -0.3910298, 0.99155366, 0.05003587, -0.25817716, -0.203244, 1.0919954, 0.43314368, -0.36503968, -1.4359604, -0.27645838, -0.82746905, 0.27085295, 0.6530822, -1.179947, -0.5469275, -0.8221712, 0.4316565, 0.8877416, -0.22656713, -0.9242201, -0.30603468, -0.2247964, -0.8370084, -0.35373253, 0.91914237, -0.030093975, 0.6547502, -1.4251751, -0.17141008, -0.10287389, -0.16700989, -0.17503524, 0.30245206, -0.10866988, 0.11191217, 0.87262994, -0.3063119, -0.8902056, 0.56295437, -1.9272543, -0.0981302, -0.67028433, 0.23364708, -0.6498273, -0.37664372, 0.23457718, 1.4059585, -0.1313058, -0.30622694, -0.021324791, 0.7439346, -1.2513928, -0.34206432, 1.3767378, -0.2954388, -0.5523714, 0.60395724, -0.29732507, -0.2831665, 0.24392214, 0.5988505, 0.0795792, -0.29516765, -0.25286347, 0.10891355, -0.043641455, -0.21956724, -0.1222059, -0.90728974, 0.46377242, 0.49633765, -0.20564441, -0.520319, -1.6375936, -0.0139881335, -0.4310044, 0.5800617, 0.28061712, 0.47284612, -0.07800144, -0.51974624, -0.5967198, -0.2567559, -0.40850466, -0.36360377, -0.61648047, -0.5654142, 0.48337257, 0.21692866, -1.1690227, -0.53939724, 0.2567819, 0.52827764, -0.27963173, -0.038007528, 0.5720037, -0.8600977, 0.13065897, 0.19105779, 0.9926014, -0.50321037, -0.4309987, 0.19077024, 0.7039192, -0.09141481, 0.84667844, -0.77341396, 0.5661096, 0.15038273, -1.0883207, -0.30914208, 0.39496368, -0.06485534, 1.641904, 0.6762734, -0.3347199, -0.8617406, -0.6995804, -0.19845611, -0.5784028, -0.47562283, -1.4047565, -1.0122284, 1.0451913, 0.3910407, 0.21691439, -0.5442791, 0.3343481, -0.33234861, 0.66286534, -0.6073909, -0.23710439, -0.8782153, 0.6301357, -0.78039706, 1.0811063, -0.94600165, 0.50099385, -0.20203432, 0.8153803, 0.4326697, 0.9829363, -1.1359497, -0.5724925, 0.46652472, 0.020673493, 0.17816944, 0.64396065, -0.95867497, 0.8279188, -0.80351615, -0.085244454, -1.0182021, -0.48280728, -0.68415624, 0.26940063, 0.17725682, 0.6659137, 0.343051, -0.036139507, 1.9253529, 0.330179, -0.18667798, -0.7256044, -0.5135883, -0.6487113, -0.8936575, 0.7452832, -0.12287533, -0.11825, -0.70136374, 0.14688696, 1.4273101, -0.15633577, 0.6255618, 2.1027944, 0.8671121, -0.36143222, -1.1867063, 1.1065185, 0.8098748, -0.45667458, -0.24226767, 0.0025809854, -0.25722653, 0.19070284, -0.5484266, -0.6555022, -1.0337746, -0.42591894, 1.7423811, 0.654865, 0.64011616, 0.16377617, -1.2083119, -1.4860584, 0.70743257, 1.1795193, 0.07058562, 0.8440395, 1.0345922, 0.28286603, 1.0439405, -0.31949413, 0.6272188, -0.19404978, 1.5465806, 0.8578423, -0.27853975, 0.66072625, 1.2355281, -2.0446782, -1.7492697, 0.0030216204, -0.56266546, -0.6697648, -0.68279344, -0.35443568, -0.54446316, -0.6759806, 0.1435076, 0.28134957, -0.15788919, 0.24428463, 0.014099263, 0.46920812, -0.85195917, 0.0012707915, 1.3709744, -1.0901219, 0.64788854, -0.14823869, -0.085778356, 0.13496846, -0.24483931, 0.4524359, -0.034560725, 0.63981885, 0.35658672, -0.30224392, 1.0347067, -0.85791016, -0.14240645, 0.79247826, -1.1686097, -1.586391, -0.8209819, -0.119535595, -0.2052218, 0.34335265, -0.6570797, -0.2210782, 0.6748208, -0.09502657, 0.24686556, -1.2017366, -0.63983685, -1.5916613, -1.184105, -0.123895474, -0.03346053, 0.2209342, 0.61311907, 0.3206372, -0.118494704, -0.3988993, 0.3909913, -0.36862627, 0.5302286, -0.6324911, 0.94080716, -0.6024734, -0.38162777, -0.4316226, -0.3143518, -0.36463666, -0.20017555, -0.8736055, -0.9380112, 0.45671174, 1.5155923, -0.09486201, 0.9695505, -0.13833332, -0.6298378, 0.8931586, -0.6301222, -0.26646182, 0.46902105, 0.13617973, -1.3055613, 0.30406374, -0.09564643, 0.10455055, -1.0269212, 0.12177908, 1.1355569, -0.6378392, -0.6559861, -0.78072715, -0.68091595, -1.3237638, -0.4806199, -0.16236575, 0.22558266, 0.4245454, 0.6258281, 0.2573674, 0.92344415, 0.108896874, 0.4044994, 0.06719699, 0.66419035, 0.34098536, 0.58486176, -0.41998512, 0.5359888, 0.61129946, 0.5190456, 0.983025, 0.310331, -0.32300448, 0.35044804, -0.97328913, -0.06142584, -0.34457424, 0.42320502, -0.2103809, 0.94158864, 0.751986, -0.41664547, 0.5273929, -0.023898497, -0.58526397, 0.91506046, -1.587615, -0.62792873, 0.20285669, -1.3050082, 0.62498814, -0.4249226, -1.0144218, 0.409593, 0.27104688, -0.9462727, -0.24467865, 0.86334205, 0.45995265, -0.12513909, -0.70971626, -0.19246241, 0.042387776, 0.07669194, 0.115074575, -1.269335, -0.09286548, 0.54315686, 0.34751275, 0.06670852, 0.14310578, 0.02031393, -1.4052739, 0.34125116, 0.34491134, 0.47022027, -0.80838424, 0.43571746, -0.5313221, 0.8576949, -0.2583056, -0.1817374, 0.4537858, -0.14710322, -0.4226152, 1.6146483, 0.88158476, -0.3151336, 1.2690797, 0.11899912, 0.3866578, 0.76637596, 1.5090572, -0.67779464, 0.9428768, 0.6889142, 0.6410521, 0.28004602, 0.7718466, 0.7421934, -0.28616107, -0.914406, 0.18280843, 0.77757883, -0.37666446, 0.607708, -0.28850508, -0.14639486, 1.0358485, -0.57612544, -0.03077536, -0.09469912, -0.5002359, -1.5291424, -0.5715195, 1.1232437, 0.032881796, 0.24273214, 0.114872776, 0.21159294, 0.86429787, 1.2115531, -0.53747576, 0.5324311, 1.046557, 0.3009321, 0.33693448, 0.033356756, 0.44364536, -0.02425829, -1.4809191, -0.15717486, 0.19116181, -0.09143227, -0.27159914, -0.10439899, -0.74533814, 0.82421553, -0.20139456, -0.0032766405, 0.9916576, -1.0329632, 0.19601333, -1.2602824, 0.2017543, -0.64100575, -0.35785395, 1.0780927, -0.14836146, 0.018262547, 0.9442348, 0.83696884, 0.6329565, -0.093982756, 0.7140547, 0.21587613, 1.2869248, 0.60281265, -0.47821552, 0.43734503, 0.25959963, -0.16328156, -0.12055825, 0.4622288, -0.9157813, 0.5098907, -0.31852883, -1.0538068, 0.63930315, 1.0165753, -0.8952555, -1.1551671, -0.07045259, 0.33253628, -1.4805075, 0.5346395, 0.40822038, 0.78947777, 0.056913875, -0.23994705, -0.47662988, 0.12904635, -0.3096597, -1.2386975, 0.027118616, -0.297474, -0.34640983, -0.7081305, -0.987574, -0.4112696, -0.16663915, -0.14638874, -1.0458425, 0.054047197, 0.99362266, 0.47721052, 0.39771488, -0.4090625, 0.1835733, 0.006618239, 1.8029044, -0.5752119, 1.7840273, 0.14250731, -0.8179414, 1.0404874, -0.7235668, 0.43460107, -0.17297104, -0.66153497, -0.53459716, 1.4169344, -0.25907004, -1.0876834, -0.121780336, 0.9376321, 0.087307006, 0.1502156, -1.3873982, -0.47126013, -0.72027636, -1.0648152, -1.0333831, 0.28081003, 0.0047804266, -0.41970125, 0.12368576, -1.0056207, 1.314159, 0.8322662, 0.50192, 0.6606601, 0.19176152, 0.22359805, 0.6299454, -0.8784206, 0.8435247, -0.62076545, 0.46503085, 0.4955411, 0.47523603, 0.59475726, -0.15033536, 1.5292126, -1.6526178, 0.77440363, 0.21343376, -0.1102623, -0.8003335, 0.12464988, 0.1694136, -0.092712775, 1.1573013, 0.26682746, 0.8170211, -1.0412548, 0.09060685, -0.18826349, 1.1423111, 0.03361123, 0.54229814, -0.31807727, -0.034259863, 1.3871967, -0.05026304, 0.28581905, 0.11886263, 0.7556672, 0.09417425, -1.0077528, 0.9749789, 0.031945437, 0.1542672, 0.44604713, -1.1202078, 0.24686609, 0.5521793, -0.26565984, 1.3768492, -0.41607288, 0.89860183, -0.9901299, -0.55397356, 0.3160442, -0.2748052, -0.028745566, -0.60326695, 0.1855664, 0.014004639, 0.043385062, -0.3658645, 0.21059687, -0.45689726, 0.2032052, 0.73326206, 0.35434416, 0.019100547, -1.4163734, -0.44338754, 0.26873967, -0.5155286, -1.3091766, 0.083646804, 1.3032191, -1.2324255, 0.9689458, -0.50306034, -0.13216153, -0.31209743, 0.42126146, 0.24715918, -0.36722437, 0.8198192, 0.7839475, -0.4742727, -0.23958692, -0.53167427, 0.36589828, 1.4970611, 1.1297909, -0.09345523, -0.7373089, -0.6823638] +2025-10-16 19:28:19 [main] INFO experimental.OnnxTest - ------------------------ +2025-10-16 19:28:19 [main] INFO experimental.OnnxTest - tokenizer加载耗时: 4070 +2025-10-16 19:28:19 [main] INFO experimental.OnnxTest - tokenizer计算耗时: 1 +2025-10-16 19:28:19 [main] INFO experimental.OnnxTest - 模型加载耗时: 587 +2025-10-16 19:28:19 [main] INFO experimental.OnnxTest - 模型数据准备耗时: 2 +2025-10-16 19:28:19 [main] INFO experimental.OnnxTest - 模型计算耗时: 14 2025-10-16 19:28:50 [main] INFO ai.djl.util.Platform - Found matching platform from: jar:file:/home/slhaf/.m2/repository/ai/djl/huggingface/tokenizers/0.34.0/tokenizers-0.34.0.jar!/native/lib/tokenizers.properties 2025-10-16 19:28:50 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Using cache dir: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 2025-10-16 19:28:50 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading huggingface library from: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 2025-10-16 19:28:50 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading native library: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64/libtokenizers.so 2025-10-16 19:28:50 [main] WARN a.d.h.t.HuggingFaceTokenizer - maxLength is not explicitly specified, use modelMaxLength: 512 -2025-10-16 19:28:50 [main] INFO OnnxTest - [0.51123345, 0.43754324, 0.22250144, -0.49621642, -0.59625536, -0.24450612, 0.5863322, 0.46978277, 0.5778739, 0.6761688, -0.0854191, 0.36117497, -0.24092007, -0.19524571, -0.7976704, -0.044580948, -0.53635055, -0.11370213, -1.1403378, 0.2129236, -0.34120926, 0.001864681, -1.3665671, -0.22030343, -0.830733, 0.099989876, 0.4966247, -0.066141784, 0.41148925, 0.729914, -0.29459542, 0.29208705, -0.3367949, -1.0972055, -0.024628287, -0.6583721, 1.253141, -0.61462474, -0.518246, -0.53295904, 0.12913027, 0.04108283, 0.55130756, -0.8039789, -1.2061563, -0.34272343, 0.27257943, -0.13096467, 0.18428354, 0.2605311, 0.057498857, 0.7461083, 0.1835212, 0.021440782, -0.20071763, 0.04362084, -1.3614484, -0.1095237, -1.0870106, 0.40957803, 0.7201999, 0.98604536, 0.39732328, -1.3224756, 0.40671548, 0.406975, 0.50348455, 0.22034347, 0.5530567, 0.25672144, -0.6594347, 0.96159023, 0.07775575, -0.7792945, -1.0163779, 0.36998796, 0.5171132, 0.79771215, -0.5552498, 0.80050594, 0.14805704, 0.2997373, 0.26703542, 0.08637628, -1.4002664, -0.813782, 0.25788978, 0.5414073, -0.46593362, -0.027594358, 0.29689378, 0.65353656, -0.31033817, 0.08076967, 0.76214606, 0.8415609, -0.3084258, -0.32594687, -0.72558767, -0.3289697, 1.0932022, 0.87115157, -0.89196694, -0.18925445, -0.9785898, -0.2336246, -0.9026102, 0.088704094, -0.7258216, -0.6594782, 0.09606822, 1.0850618, 0.0013394654, 0.38363743, -0.3874976, 0.20100841, -0.4128504, 0.74124134, -0.6654147, -0.5718573, 0.27072686, -0.046442233, -0.2115764, -0.7070531, -0.9749727, -0.4404279, -1.3043284, 0.93771523, 0.30211914, -0.59651214, 0.12527934, 0.089207426, 0.51316845, 0.8074455, -0.5485792, 0.07305289, 0.10457601, 0.24046482, 0.5214334, -1.1262523, 0.16574118, 0.01661903, -0.72924286, 1.7897038, 0.7391656, 0.26545036, -0.24889244, 0.019522466, -0.38037547, 0.9288784, -0.90373176, -0.2429637, 0.13991763, 0.4122005, -0.6420515, -0.045609288, -0.055985063, 0.121364415, 0.28139967, -0.0052891895, -0.106420964, 0.56713265, -0.46813145, 0.19711205, -0.58464926, 0.3698026, -0.2838148, 0.12638272, 0.01481974, -0.2993888, 0.14940853, -0.4162319, -0.045515813, -0.07729791, 0.47421545, 0.46603337, 0.62959045, 0.1828863, 0.2002228, 0.07522717, -0.50393486, 0.37032261, -0.35638678, 0.8902856, -0.033868957, 0.100021124, 0.43048963, 0.3153236, -0.6283139, -0.24138638, 0.81751156, 0.2257601, -1.2130985, 0.44707552, 0.0037308559, 0.5666142, -0.8444263, 1.204924, -0.65543765, -1.9701289, -0.8207577, 0.08641613, -0.4112931, -0.20802015, 0.87505317, -0.13793634, 0.07145847, 0.31840786, -0.092020944, -0.80500084, 0.58076894, 0.117715076, -0.67379886, 0.45848575, 0.4390001, -0.7055742, -0.712911, 0.33785975, 0.42191327, 0.121282555, 0.13419384, 0.17775199, 0.5506595, 0.67962146, 0.4780363, -0.03222577, -0.8667363, 0.8303137, -0.541459, 0.062450707, 0.03477095, 0.49735057, -0.3892, 0.8767689, -0.06756614, 0.35541242, 0.94193155, 0.8131012, 0.58299375, 0.1854296, -0.60147816, 0.4282838, 0.5299751, 0.7330451, -0.3257398, -0.58661395, 0.5521986, -0.606695, 0.44539154, 0.41345364, -0.023682468, 1.0244411, 0.8901564, -0.025144015, -0.6341725, -0.4240578, 0.31344998, 1.0556707, -0.7415066, -0.32343262, 0.1841922, 0.36124998, 0.5530684, 0.29907, -0.02951768, 0.19808297, 0.08838599, 0.05037989, -0.049141884, -1.1747736, 0.03532947, 0.07290274, -0.7062243, -0.027512219, -0.5645471, -0.034089435, 0.4769841, -0.5791185, -0.062474817, -0.5574461, -0.07675014, -0.58530134, 0.5648111, 0.7009718, 0.19080682, -0.37462634, -0.38008162, -0.8266342, -0.56594104, 0.6085925, -0.8169755, 0.2305794, 0.022104293, -0.32453218, 0.029340252, 0.12966694, -0.35197243, 1.0937076, -0.08106287, -0.630723, -0.07665277, 0.09807674, -0.15652439, -0.032777905, -0.59978753, 0.7365465, 0.8591844, -0.16815796, 0.8361499, 0.27674484, -0.3099411, 0.60480386, 0.23437774, -0.7338224, -0.9829839, 0.67439365, 0.742201, 0.42505273, -0.68957865, -0.47552192, -0.5682225, -0.5110189, -0.28437212, -0.565194, -0.19356139, 0.63973606, -0.014390081, -1.646161, 0.2918704, -0.4594489, -0.8228203, -0.16133638, 0.07148346, 0.9419251, -0.019150853, -0.4403408, -0.56392926, 0.12463045, 0.24700657, -0.19791731, 0.6058087, -0.5370069, -0.051276788, 0.9354616, -0.055462413, 0.050041005, -0.6077635, -0.68125796, -0.13532986, 0.36517376, -0.019653555, -0.03586552, -0.1600579, 0.67996794, -0.25741813, 0.9547673, -0.910809, -0.009982694, 0.7332152, -0.20394151, -0.09925252, 0.5988749, 0.10125684, -0.2892084, 0.09639569, -0.9270706, -0.14898436, 0.23913115, 0.7453801, -1.0168681, 0.80838275, -0.27111107, -0.14699328, -0.68104225, 0.19166322, -0.79916215, 0.43923154, 0.16553934, 0.33551145, -0.5704513, -0.070023894, -0.3918103, -0.17701462, 1.6619401, 0.674843, 0.23895527, 0.80687135, -0.01851894, -0.34060583, -0.58362544, -0.96381485, -0.19843449, 1.6370385, -0.44541967, -0.13564552, -1.7383175, 0.94101083, 0.4386875, 0.8844557, 0.7002662, -0.72894764, -0.6103935, -0.32648364, 0.054746274, -0.6872155, 0.18739484, -1.0520368, 0.6648933, -0.2648567, -0.06654116, -1.3043286, 0.22864798, -0.10361338, 0.594177, 0.5787685, 0.1750473, -0.0105097145, 0.91527426, 0.25346497, -0.27341178, -1.1472199, -0.31140554, -0.49403697, -0.13216135, 0.7429359, -0.57663065, -0.5814875, -0.46789917, 0.62059444, 1.0459176, 0.105841815, -0.8354111, -0.09153462, -0.4892223, -0.9736461, 0.03827665, 0.6993418, -0.5639835, 0.3098794, -0.8142145, 0.047523424, -0.21321937, -0.034833632, -0.010952409, -0.041929975, -0.28044957, 0.060209088, 0.50224316, -0.046635136, -0.85428065, 0.73049414, -1.4654225, 0.11870827, -0.66137636, 0.27924734, -0.7339802, -0.42894232, 0.17209588, 1.1703713, -0.1511008, -0.27938917, -0.13280374, 0.86497086, -0.4407706, -0.3784376, 1.2453586, -0.21126446, -0.15996158, 0.48933926, -0.27048388, -0.2984165, 0.7081715, 0.58110875, -0.06946933, -0.27087092, -0.23854852, 0.36320952, 0.3962092, 0.11321919, 0.10443739, -0.56340504, 0.49124345, 0.6088691, -0.70054543, -0.09448326, -1.4692224, 0.24175254, -0.18142638, 0.3656459, 0.3561722, 0.39745298, 0.35550624, -0.25403917, -0.8084114, -0.3391734, -0.14518976, -0.31460696, -0.8502122, -0.20892489, 0.040290922, 0.36273193, -0.76562995, -0.80031925, 0.060696647, -0.15262939, -0.061190173, -0.09423466, 0.6150074, -0.5358167, 0.3251421, 0.28123394, 0.7587028, -0.4789124, -0.10876167, -0.18576714, 0.49481302, -0.09939133, 0.20352225, -0.5852573, 0.6395335, -0.3011577, -0.8522485, -0.31254715, 0.5950347, -0.26513442, 0.70972127, 0.43091288, -0.041825093, -0.2292053, -0.6451991, -0.34200215, -0.41545817, -0.2689111, -0.9946734, -0.25178003, 0.6669945, 0.17163065, -0.15006264, -0.9421287, -0.019158833, -0.6975499, 0.438868, -0.6849216, 0.03262051, -0.44509438, 0.64882565, -0.5953382, 1.1495787, -0.8011461, 0.20847918, 0.1251037, 0.32168102, -0.21917565, 1.0629005, -0.92278206, -0.37890035, 0.4195118, -0.21815889, 0.2514746, 0.6282729, -0.14128427, 0.050928507, -0.35163182, -0.06737878, -0.9663225, -0.4687798, -0.59459, 0.21002933, 0.048163563, 0.48905462, 0.14316124, 0.028260775, 1.2529061, 0.14390653, -0.21695222, -0.7194682, -0.66993797, -0.70739895, -0.5410352, 0.8340246, -0.2935943, -0.23657572, -0.4150082, 0.20044121, 0.6332451, -0.4892323, -0.016682208, 1.8937812, 0.7091852, 0.14414868, -0.9804469, 1.2162073, 0.17216161, -0.50498605, -0.34003568, 0.16963801, -0.33994526, 0.0731189, -0.41613013, -0.94484633, -0.815923, -0.5739614, 0.94484705, 0.31987455, 0.14467219, -0.14761059, -0.7047535, -1.0639687, 0.40880874, 1.3001518, -0.23591296, 1.0019474, 0.69951487, 0.33188945, 1.2750803, -0.47983044, 0.033220377, 0.12004468, 0.9492074, 0.9103111, -0.052080557, 0.58394325, 0.8401497, -1.830512, -1.4265813, -0.17748688, -0.061487965, -0.1359964, -0.88339686, -0.37029758, -0.13061845, -0.2954845, 0.2814227, 0.25465572, -0.19771555, 0.09913704, -0.15107808, 0.011260349, -0.14225599, -0.11415321, 1.0593241, -0.7078028, 0.5747197, -0.4055798, -0.18129641, -0.47820956, 0.1952592, 0.22990699, 0.5002197, 0.10373032, 0.628042, 0.06865163, 1.0157357, -0.6903584, -0.15411828, 0.6126792, -1.4284332, -1.3705213, -0.07465902, -0.11910443, -0.13134138, 0.41676903, -0.21215296, -0.028965306, 0.3505228, 0.047843248, 0.30888152, -1.1421498, -0.08647778, -1.1076055, -0.78975534, -0.05059923, 0.058172554, 0.27877957, 0.3418617, 0.27528864, -0.0043393373, -0.425253, 0.21216352, 0.02201505, 0.46995455, -0.35277224, 1.1497868, -0.7000632, -0.49699458, -0.36768207, -0.08427355, -0.106513396, -0.15144402, -0.6940467, -0.6297557, 0.4525672, 1.2141936, -0.12161607, 0.24308786, -0.1425119, -0.38016897, 0.91598785, -0.41090524, 0.14860485, 0.28929144, 0.21543092, -0.84538454, 0.0807224, -0.2773164, 0.5301908, -0.7331233, 0.49941978, 0.5512182, -0.5476493, -0.18183059, -0.77233905, -0.15702356, -1.1651708, -0.21300837, 0.018835044, 0.32697025, 0.34967226, 0.51722765, 0.09109617, 0.61710453, 0.062239163, 0.056631085, 0.06611446, 0.46277747, 0.13079983, 0.08349137, -0.17646214, 0.26698142, 0.046738572, 0.6847735, 0.38814327, 0.014033079, -0.04680039, 0.292931, -0.8164349, 0.3852389, 0.19666976, 0.37969127, -0.23450008, 0.45247716, 0.4581556, -0.9366612, 0.5417323, -0.055298187, -0.6215795, 1.218463, -1.3511043, -0.7937524, 0.008464169, -0.9959098, 0.7161945, -0.25348237, -0.68490624, 0.39310396, 0.3586596, -0.7416965, -0.18592128, 0.30235815, 0.63015443, -0.33157557, -0.89634436, -0.5073603, 0.27419057, 0.112835586, 0.471214, -0.9042775, -0.41822886, 0.71185523, 0.6571464, 0.33782732, 0.15355957, -0.1364721, -1.0384371, 0.64586115, 0.5162391, 0.52103496, -1.1132919, 0.1564614, -0.35837764, 0.7777977, -0.5688318, -0.19020915, 0.12580645, 0.23848471, 0.050079808, 1.4870666, 0.74930036, 0.11167382, 0.51369834, 0.0912603, 0.03457948, 0.97924113, -0.2526727, -0.6790167, 1.0118998, 0.17009932, 0.59963554, 0.38631436, 0.5874571, 0.35385707, -0.49165446, -0.43353337, 0.29959297, 0.90330774, 0.008084901, 0.19826728, 0.035730332, -0.26280853, 0.49997848, -0.3445545, 0.25782338, -0.29269776, -0.7271916, -1.1451478, -0.3687011, 1.2749437, 0.28989944, -0.010594554, 0.20570764, -0.039815754, 0.7760036, 0.83210295, -0.37314057, 0.34827492, 0.33832714, 0.2549089, 0.3180246, 0.15750375, 0.37374565, 0.29076517, -1.084236, -0.2536879, 0.09893724, 0.167326, -0.42620236, -0.06183477, -0.85039747, 0.7655713, 0.5407811, 0.135566, 0.61822957, -0.658225, 0.060597345, -1.0510322, 0.29207668, -0.40406957, -0.06383139, 0.8471315, -0.3460373, 0.0568925, 0.42080507, 0.50762975, 0.29434744, -0.07577321, 0.5478096, 0.31866163, 0.77027106, 0.5869493, -0.4031725, 0.34900978, 0.03501825, -0.60266703, -0.12610222, 0.48031133, -0.843012, 0.4924527, -0.8623877, -0.6477808, 0.22316428, 0.52191186, -0.42713517, -0.4163384, 0.02406159, 0.19311489, -0.8280169, 0.7257932, 0.5891742, 0.6126962, -0.107232764, -0.07629745, -0.50356364, 0.6316943, 0.1606891, -0.70639515, -0.12811224, -0.4105088, -0.08755256, -0.40668, -0.5366433, -0.30879006, 0.10060625, 0.28111058, -0.71532774, -0.3630196, 0.59962934, 0.15385062, 0.36727977, -0.45993006, 0.22452451, -0.23574719, 1.6684455, -0.043385856, 1.6276766, -0.16736466, -0.12352954, 1.0252162, -0.27102458, 0.59440255, 0.26338896, -0.2930035, -0.61721444, 0.6569015, -0.34776017, -0.38311705, -0.4351132, 0.751855, -0.44927332, 0.28445652, -1.4778186, -0.5496483, -0.834149, -1.1146356, -0.8802563, 1.0398924, -0.14450291, -0.022082053, -0.009103067, -0.8312893, 3.564548, 0.31639445, 0.43401474, 0.63638914, 0.048858773, -0.24585214, 0.42760444, -0.627559, 0.36051834, -0.75384, 0.3967399, 0.078143656, 0.12599553, 0.86665404, 0.050567865, 0.92432106, -1.5632179, 0.19709128, 0.12208514, -0.078961484, -0.91890043, 0.23671533, 0.47289363, 0.19900943, 0.7240069, 0.16399404, 1.1182141, -1.0169126, -0.1350502, -0.46091932, 1.2807544, 0.35965964, 0.21481083, -0.3007364, -0.39301196, 0.9101389, 0.1932972, 0.15104347, 0.14832743, 0.27131686, -0.067170985, -0.6418764, 0.50354594, 0.25878644, -0.0033070669, 0.70426977, -0.6287618, 0.31597823, 0.45087764, -0.04529953, 0.8379618, -0.3591785, 0.56057227, -0.5669976, -0.84720474, -0.052068297, -0.16401154, 0.30864736, -0.8251212, 0.22997884, -0.28843462, 0.20421404, -0.10270865, 0.12777951, -0.34080166, 0.28729475, 0.63097245, 0.62922233, -0.23039082, -0.9737556, -0.37730604, 0.021021312, -0.18025522, -1.0727465, 0.0019658804, 1.0562756, -1.0607209, 0.55097324, -0.095470026, -0.16923568, 0.29799882, 0.13360816, -0.015510071, -0.3002998, 0.29892552, 0.5038376, 0.07581481, -0.25795814, -0.26878086, -0.018943973, 1.1134932, 0.84816736, 0.07172927, -0.119864315, 0.16197601, 0.55967194, -0.1490119, 0.35443506, -0.12817872, -0.7264169, 0.35164982, 0.5088061, 0.36944637, 0.75947386, 0.22153465, -0.0902444, 0.35916293, -0.22257099, -0.6245021, -0.66597265, -0.2242328, -0.47101194, -0.09299229, -1.0377257, -0.21733049, -0.32486138, -0.23556301, -0.9277732, 0.023987524, -0.5385696, -0.002912309, 0.6834146, 0.06879748, 0.26568368, 1.1300062, -0.17972237, 0.1250636, -0.06957579, -0.9457501, -0.10762876, -0.7763465, 1.5165349, -0.51138073, -0.53803205, -0.7513938, -0.16054633, -0.057135716, 0.56398803, -0.7251428, -0.9011231, -1.1330264, -0.009565931, -0.46391025, -0.3945485, -0.019825712, -0.214825, 0.662374, 0.4089401, -0.25013703, -0.11175172, -0.3359659, -0.73787993, -0.44064045, -0.95422965, 0.24658713, 0.5482323, 0.44154587, 0.15066868, -0.90368706, 0.16147381, 0.23279902, 0.41150323, -0.14870353, 0.4448821, 0.3361582, -0.5416869, 0.66956925, 9.3244016E-4, -0.58035725, -0.9133776, -0.21026349, 0.47709528, 0.559402, -0.096517116, 0.34964085, 0.021026324, -0.052352354, 0.2260392, 0.083108045, -0.82103014, -0.49560097, 0.13991357, 0.72335935, -0.22744378, -0.17416112, -0.06924981, 0.1720519, -0.056980915, -0.0040308535, 0.4777559, 0.34662804, -0.6132766, -0.1805803, -0.58219105, -0.5035861, 0.743928, 0.62252325, -0.43229088, 0.42164406, -0.7834892, 0.19773507, -0.68034565, 0.15410969, -0.46971694, -0.5955516, 0.23321742, 0.61164176, -0.10516539, 0.581982, -0.7406695, 0.31757313, -0.69854766, 0.9880034, -0.84722793, -0.7633326, 0.4578721, 0.10518447, 0.16203061, -0.6790652, -0.47155732, -0.38882074, -0.9170391, 1.0266749, -0.17550212, -0.4792506, -0.0668991, 0.39064267, 0.0947658, 0.8043089, -0.22434905, -0.313821, 0.052670494, -0.048851267, 0.32592362, -0.860603, 0.2698992, 0.3433336, -0.21785763, 1.5819844, 0.88469046, 0.07691138, 0.09752565, -0.42556408, -0.04519853, 0.87291956, -0.6176682, -0.2865502, 0.20136131, 0.36512914, -0.3311012, -0.30614272, -0.26107365, 0.1894452, 0.32637066, 0.35523584, -0.06667226, 0.10347664, -0.11940256, -0.10296476, -0.38421103, 0.6074242, 0.18352178, 0.015820663, -0.14712866, -0.20719282, 0.6038181, -0.15472703, -0.039784297, 0.059039198, 0.4398168, 0.68517715, 0.592921, -0.48001018, 0.29964036, 0.059656337, -0.36691985, -0.11802984, -0.16027823, 0.8514473, 0.061800294, -0.24240336, -0.00616711, -0.2318474, -0.27456677, -0.20014185, 0.39548382, 0.08403352, -0.6075959, 0.7013164, -0.24715367, 0.7730584, -0.5263237, 0.6818461, -0.4345966, -1.9885256, -0.57651246, 0.3897464, -0.22896479, 0.029132985, 0.62822366, -0.3221436, -0.24454945, -0.13972506, 0.07538301, -0.43282226, 0.29167226, 0.26169014, -0.22840403, 0.12716646, 0.5241455, -0.67354554, -0.23412356, 0.1583346, 0.09397203, -0.6005605, -0.062070902, 0.519738, 0.56230676, 0.19490737, 0.09140409, 0.2827071, -0.7554103, 0.9776802, -0.28762445, -0.16992666, -0.27326876, 0.5205804, -0.39026648, 0.8100204, 0.2251311, 0.3743077, 0.41226578, 0.28279757, 0.10248689, 0.78833973, -0.39051318, -0.035605595, 0.6300383, 0.67743725, -0.18472652, -0.3580135, 0.14300483, -0.36656314, 0.09548992, 0.6840508, 0.53377825, 1.0797411, 1.0701865, -0.14112248, -0.1359908, -0.52505445, 0.2282274, 0.8130599, 0.10876868, -0.5497892, -0.06409781, -0.12850465, -0.08437914, -0.348632, -0.55334604, -0.057698317, -0.020369263, 0.0053720847, 0.16307293, -0.8254809, -0.10885659, -0.54735035, -0.9688062, -0.2985726, -0.051860273, -0.13334262, 0.35509858, -0.8054574, -0.28351018, -0.68802255, 0.17037089, -0.7018103, 0.8101351, 0.96281683, -0.053284153, -0.42187208, -0.41856027, -0.7051473, -0.43084157, 0.46245623, -0.6828755, 0.13075721, -0.12911314, -0.28247756, 0.683695, 0.07331526, 0.008655533, 1.0331321, 0.41872248, -0.43458146, 0.11952154, 0.4864054, -0.4770374, -0.672267, -0.7951411, 0.90124786, 0.38761422, -0.06815794, 0.4979946, 0.3519773, -0.51443356, 0.47134402, 0.32008561, -0.52492595, -0.5968779, 0.91214985, 0.62872326, 0.25207788, -0.78720355, -0.65435094, -0.3022893, -0.026059672, 0.03250689, -0.4841232, -0.21127056, 0.94293606, -0.31384826, -1.024962, 0.4258807, -0.5591192, -0.85103065, 0.07572705, -0.029542465, 0.9386782, -0.01834616, -0.41138232, -0.41427138, 0.080845095, -0.021675527, -0.25335732, 0.85154873, -0.83299226, 0.010143421, 0.7232927, 0.60553235, 0.1309088, -0.3839781, -0.5941144, -0.45264992, 0.38672507, 0.21139218, 0.34125578, -0.30670395, 0.5510206, 0.19656421, 0.7967939, -0.61074483, 0.032774314, 0.4495337, -0.4416033, 0.04436638, 0.19213377, 0.25077653, -0.1421333, -0.07981576, -0.80517834, -0.44514215, 0.12253037, 0.5937313, -0.7326427, 0.7710463, -0.47982028, -0.026294831, -0.27366686, 0.59971505, -0.88799405, 0.34242895, 0.011235021, 0.68797493, -0.31184798, -0.2491819, -0.39411223, -0.37572742, 1.597634, 0.5555229, 0.53293955, 0.85264903, -0.014117359, -0.04914263, -0.32758757, -0.42537898, 0.016268618, 1.7822325, 0.014657244, -0.33223224, -1.4506384, 0.8279289, 0.63178736, 0.70278394, 0.16083482, -0.11632228, -0.42550898, 0.2825111, 0.050327733, -0.62059164, 0.24553949, -0.84764546, 0.5793387, -0.19014005, 0.18559122, -0.60808384, -0.22480549, -0.10949272, 0.4119357, 0.48874575, 0.10797066, 0.14826402, 0.95159596, 0.1007035, -0.28172037, -0.78677756, -0.2911378, -0.39184836, 0.18129729, 0.14663315, -0.6903422, -0.6197286, -0.22756599, 0.4553, 0.7559648, -0.19024116, -0.7333675, -0.22558317, -0.10755519, -0.8364387, -0.24587573, 0.61560297, -0.116256624, 0.09515799, -0.61133057, -0.60270244, 0.11373564, -0.478234, 0.054566797, 0.21379222, -0.20055366, 0.4200289, 0.38137415, 0.57250637, -0.8365286, 0.46541566, -1.5011121, 0.007360235, -0.7604555, 0.0025998056, -0.5833547, -0.07466688, 0.39678958, 0.96836436, -0.2345093, -0.18433093, 0.3012629, 0.2799663, -0.70134974, -0.48911846, 0.7690916, -0.06511322, -0.49618146, 0.3662134, -0.6264914, -0.22856562, 0.24773872, 0.3183567, 0.13739681, 0.07009312, 0.23409715, 0.34881467, -0.33139125, 0.28852808, -0.095444344, -0.51926076, 0.51465845, 0.2062692, -0.5242261, -0.46329415, -0.9741153, 0.06456158, 0.030457906, 0.14805505, 0.17728561, 0.27969873, 0.4174524, -0.53553534, -0.050896656, -0.7748257, 0.07999295, -0.064726844, -0.6482009, -0.16539901, 0.52794135, 0.2680578, -0.54837555, -0.846483, -0.1018344, 0.2759287, 0.01647371, -0.30559725, 0.77830505, -0.42698085, 0.22914001, 0.29629123, 0.9014104, -0.6857988, -0.02880317, -0.27855328, 0.5116826, -0.09280562, -0.026375346, -0.82933587, 0.29830056, 0.10016385, -0.9599105, 0.06670639, 0.32166743, -0.12561196, 1.15202, 0.17707397, -0.08005495, -0.039337177, -0.2968356, -0.12169429, -0.36883074, 0.2049313, -0.6679535, 0.031608433, 0.52695143, 0.007821337, -0.1485552, -0.62809414, 0.13040474, -0.15451281, 0.54773754, -0.4706813, 0.24263154, -0.1301415, 0.67641205, -0.62720996, 0.8313544, -0.7381075, -0.14358105, 0.3762475, 0.62239164, -0.045437563, 0.9459873, -0.8233303, -0.7147683, 0.46758357, -0.52135533, 0.06063361, 0.56855184, -0.507306, -0.036665827, -0.6302179, 0.07766994, -0.942735, -0.5909925, -0.2635432, 0.5478883, -0.07890162, 0.32488316, 0.26487243, 0.46853012, 1.1034807, -0.06512659, 0.33847657, -0.61609834, 0.06321365, -0.22743702, -0.87944865, 0.37845594, -0.020726902, -0.59833187, -0.42895967, -0.11077006, 1.0032699, -0.1725022, 0.32639518, 1.6419518, 0.21870343, 0.1484011, -0.7495263, 0.5773338, 0.1948407, -0.26478645, 0.31931522, -0.02530934, -0.18381046, 0.039240766, -0.3821348, -0.880036, -0.40542898, -0.5050127, 1.0508015, 0.6978597, 0.27783167, 0.43318307, -0.686163, -0.95909375, 0.39126918, 0.736118, 0.010625005, 0.4478026, 0.5347271, -0.28854454, 0.7788674, -0.65132344, 0.028316252, -0.24979532, 0.3684371, 0.8357179, -0.35869396, 0.24370271, 0.33024335, -1.4370449, -1.2778331, 0.19882585, -0.017336432, -0.4316948, -1.2735684, -0.26503587, -0.015060261, -0.6085152, 0.22704697, 0.26457584, -0.42646304, 0.03879311, -0.19615118, 0.44677356, -0.32433823, -0.084605284, 1.198679, -0.51367915, 0.36138633, -0.26781407, -0.25285503, 0.10098021, -0.24817827, -0.18135414, -0.17848538, 0.35427713, 0.521286, -0.02674108, 0.4217017, -0.08987662, 0.25608358, 0.50207585, -0.98633564, -1.0628304, -0.3846806, 0.022207262, -0.1283618, 0.37523708, -0.24025467, 0.5153696, 0.46323073, 0.13989824, 0.1561494, -0.77944976, -0.44046345, -0.63301426, -0.34989792, 0.13549271, 0.006190121, 0.24559984, 0.31742877, 0.1545193, -0.44265345, -0.08644013, 0.28001422, 0.15021466, 0.85503155, -0.76575583, 0.86318636, -0.55829847, -0.25753778, -0.7185067, -0.085994214, -0.18091784, 0.446105, -0.77112305, -0.4430915, 0.2551184, 1.1472955, -0.40047967, 0.35478163, -0.4045759, -0.48856065, 0.7408055, -0.13986495, 0.09953445, 0.2774477, 0.2467106, -0.42283788, 0.21039721, 0.10461013, 0.31418386, -0.6786972, 0.964533, 0.6333979, -0.42829648, -0.2897507, -0.9437793, 0.067182526, -0.99148446, -0.31607157, -0.5791597, 0.04460093, 0.2817655, 0.21890405, -0.0091788955, 0.614969, 0.21509607, 0.26194388, -0.028229192, 0.6323737, 0.3229837, -5.941242E-4, 0.1451681, 0.3452308, 0.26828063, 0.82891965, 0.6615142, 0.15845887, -0.1930975, 0.32330292, -0.49461275, 0.33965734, 0.5015075, 0.22370936, -0.038758203, 0.33031383, 0.64308834, -0.22973657, 0.40101275, 0.1735294, -0.62445706, 0.63983095, -1.0835669, -0.59931755, -0.25685513, -1.0129862, 0.148363, -0.3387562, -0.7876695, 0.36497584, 0.4875883, -0.46318775, -0.30246222, 0.24639976, 0.3614344, -0.4353444, -0.7491151, 0.03876262, 0.014877375, 0.5000705, 0.48863775, -0.5708522, -0.29530814, 0.39000627, 0.18866692, 0.13831648, -0.38619447, -0.5484635, -1.1455809, 0.14575654, 0.41666955, 0.17747879, -0.8406549, 0.13223548, -0.45904288, 1.1353003, -0.26693252, -0.12810816, 0.37510347, -0.29213232, -0.43941584, 0.9184803, 0.6855956, 0.2599459, 0.6948795, -0.0708392, -0.12901774, 0.55323, -0.5387498, -0.716477, 0.42386472, 0.12503567, 0.6216118, 0.10394464, 0.8343109, 0.65234077, -0.41163832, -0.39263293, -0.108594045, 0.4115751, 0.16237709, 0.28965876, -0.07473482, -0.23911166, 0.2871039, -0.6131977, 0.513528, -0.11655871, -0.6466727, -1.1273916, -0.19115873, 1.4469596, -0.020101145, -0.11192806, 0.01993516, 0.26601622, 1.1657052, 1.008147, -0.6360585, 0.12956598, 0.9011077, 0.26741764, 0.13538633, -0.082566485, 0.21531783, 0.26441088, -1.1124214, -0.27627683, 0.34551474, 0.15321879, -0.21587288, -0.29057226, -0.5665258, 1.2804754, 0.5072227, 0.2061311, 0.39224344, -0.48967192, 0.2075164, -1.2929554, 0.22832677, -1.1763334, 0.05883432, 0.5320689, -0.19186282, -0.067902, 0.5984157, 0.33769348, 0.24878782, 0.11002658, 0.33792466, 0.547646, 0.7538705, 0.59686947, -0.19582872, 0.39902282, -0.3311249, -0.74637324, -0.14266883, 0.43165115, -0.6139184, 0.29811418, -0.7535113, -0.30266273, 0.53370935, 0.36760342, -0.5749821, -0.68662786, -0.2779321, 0.37260574, -1.1336465, 0.6302474, 0.47815326, 0.9866135, -0.14947067, -0.033082485, -0.2046695, 0.20482336, -0.21032988, -0.52653766, 0.0245497, -0.47625363, -0.12423223, -0.12356821, -0.32638925, -0.0979994, 0.0010491088, 0.29562947, -0.6457077, -0.10971795, 0.06126561, 0.8076332, 0.2573005, -0.21695858, 0.46280462, -0.5214897, 1.3339914, 0.23493724, 1.6153331, 0.18739215, -0.35449666, 0.6756968, -0.35441598, 0.49293745, -0.08351409, -0.24639843, -0.57777464, 0.98248875, 0.0011553783, -0.68022805, -0.1735664, 0.5991789, -0.5056995, 0.28030026, -1.3956647, -0.29886672, -1.040315, -0.6200091, -0.55999726, 0.4394985, 0.25020325, -0.030757431, 0.41339186, -0.99428976, 4.134183, 0.21829394, 0.2768517, 0.24642767, 0.027245255, 0.22640549, 0.47818106, -0.79617405, 0.4751648, -0.4929724, 0.5096883, 0.14533526, 0.087542474, 0.42481625, -0.26212215, 0.94900197, -0.995192, 0.37323165, 0.48663512, 0.16938138, -0.9202455, 0.32618392, 0.3355089, -0.12735334, 0.39952835, -0.4738593, 0.17960149, -0.8438873, -0.15847224, -0.28993642, 1.529727, -0.06471403, 0.040852357, 0.038847372, -0.25056893, 1.0816733, -0.30027992, 0.33796108, 0.057108454, 0.27828, -0.07463636, -0.7907264, 0.89314646, 0.11971448, -0.2797623, 0.56961, -0.5983841, 0.07197225, 0.6231197, -0.16240701, 0.8118333, -0.10884293, 0.36955264, -0.30067077, -0.54466736, 0.23035151, -0.11903405, 0.15843613, -0.9551723, -0.008313894, -0.09104793, -0.34124452, 0.019560076, 0.22333694, -0.46288738, -0.06519584, 0.8732297, 0.4417033, -0.3591715, -0.79684395, -0.18898311, -0.00398656, -0.32608062, -0.624982, -0.43221474, 0.7961611, -1.0244153, 0.6864666, -0.38873324, -0.66227776, 0.18808874, -0.2118657, 0.12453443, -0.20756744, 0.2250452, 0.5361353, -0.38134813, -0.12358688, -0.50916564, 0.06882605, 0.5491102, 0.6088567, 0.043271434, 0.034038477, -0.14568043, 0.34731272, 0.27437162, 0.4291449, -0.5072562, -0.6460547, -0.17843097, 0.4998613, 0.4862506, 0.48174888, 0.43009067, -0.07885784, 0.25953156, -0.44193333, -0.2746965, -0.72802746, -0.24735373, -0.46056688, -0.08113882, -1.2671432, 0.05059053, -0.43514493, 0.09988372, -1.3890023, -0.5439976, -0.5726784, 0.042483523, 0.45590004, -0.12616622, 0.629282, 0.96405625, -0.42434147, 0.29803038, -0.16519342, -0.9395849, -0.230326, -0.83917814, 1.4581625, -0.57237923, -0.5016961, -0.5101177, 0.03989938, -0.16089517, 0.91115934, -0.69840354, -1.4957484, -0.25355923, 0.24498278, -0.03987664, 0.28695616, 0.33610544, 0.42031482, 0.26267177, 0.26665464, -0.036663882, -0.3205201, 0.08044999, -1.3707422, -0.10242602, -1.2773657, 0.44744903, 0.4707493, 1.1146326, 0.52519447, -1.0453299, 0.22108254, 0.3916083, 0.51568663, 0.2354028, 0.50902164, 0.15007426, -0.6983879, 1.0460291, 0.11031413, -0.68165857, -0.867732, 0.08759557, 0.32828143, 0.90392447, -0.74337864, 0.6990192, 0.12273654, 0.1353184, 0.41217592, 0.24795906, -1.3185968, -0.7651147, 0.103916384, 0.6086596, -0.29084563, 0.022982366, 0.28086853, 0.55208766, -0.31949097, -0.01541844, 0.81749123, 0.83401155, -0.14799729, -0.33081663, -0.8713344, -0.20599653, 1.2038018, 0.81881714, -0.62137777, -0.08521465, -0.9437865, -0.19047725, -0.9235109, 0.07554969, -0.54554856, -0.72309697, 0.10257645, 1.2262453, 0.11698446, 0.5399791, -0.6098297, 0.077516764, -0.1635267, 0.7329004, -0.6491352, -0.43532693, 0.13268438, -0.062738866, -0.037672497, -0.6150539, -0.792422, -0.32316244, -1.1831503, 0.8048623, 0.43596715, -0.80266297, 0.20404984, 0.040005, 0.51196873, 0.61864376, -0.3671871, 0.039022297, 0.08777553, 0.34561458, 0.48366174, -1.1842922, 0.108419, 0.09672105, -0.4544338, 1.6715314, 0.8024864, 0.38295293, 0.11245011, -0.13004047, -0.25588313, 0.9442645, -1.106852, -0.3146361, 0.17383303, 0.26125604, -0.836142, -0.2676666, 0.09179972, -0.11250311, 0.35692418, -0.074471295, -0.117300734, 0.47520566, -0.5543069, 0.32387045, -0.66126156, 0.395984, -0.23777974, 0.31760883, -6.269303E-5, -0.42587698, 0.3092674, -0.26971295, 0.12728855, -0.09048116, 0.3214799, 0.6557833, 0.40655518, -0.043354645, 0.23725055, 0.05158411, -0.5487681, 0.47276476, -0.42214486, 0.96318287, 0.101917736, 0.04613815, 0.37172058, 0.35901445, -0.55353534, -0.28215954, 0.646838, 0.055748854, -0.94629276, 0.52053577, -0.096165426, 0.68151516, -0.86083305, 1.2210809, -0.61603034, -1.8547043, -0.70553493, 0.08560893, -0.32475078, -0.07537295, 0.9242262, -0.3031748, -0.039215017, 0.48975095, 0.07386944, -0.635114, 0.5792452, 0.11396569, -0.79614615, 0.47500247, 0.22382374, -0.7640738, -0.7832393, 0.32251167, 0.2957459, 0.19379763, 0.1966333, 0.19957598, 0.47575438, 0.72345144, 0.2891014, -0.07611428, -0.7970295, 0.68839777, -0.65931904, 0.18129885, -0.1070019, 0.4440913, -0.3229485, 0.87062204, 0.0016378155, 0.34254807, 1.0556462, 0.9242675, 0.3841158, 0.19424327, -0.5399717, 0.45922905, 0.4348209, 0.7463028, -0.23992652, -0.60218215, 0.26373464, -0.48176405, 0.3577192, 0.30109936, 0.18007952, 0.97340673, 0.8311445, -0.091018654, -0.43556908, -0.47817314, 0.24427673, 0.86847204, -0.63367134, -0.1392084, 0.20880738, 0.29605484, 0.5102095, 0.0539689, 0.025343515, 0.24565774, 0.20760463, -0.14849266, 0.07748646, -1.0975155, -0.2468316, 0.049564585, -0.81448174, 0.07844066, -0.5533479, -0.12086342, 0.34281364, -0.47970983, 0.012860723, -0.20691025, -0.09066814, -0.6537314, 0.488608, 0.72847027, 0.43217465, -0.3573188, -0.2835165, -0.7994006, -0.60978246, 0.6759259, -0.74162185, 0.021587722, 0.2148367, -0.31782195, 0.15477072, 0.073249355, -0.2504549, 0.9304441, -0.109614864, -0.39431396, -0.13444294, 0.113385625, -0.17943051, -0.13110475, -0.6351985, 0.8168083, 0.7287063, 0.046382003, 0.78491753, 0.12041721, -0.44125587, 0.65859365, 0.1417125, -0.62944174, -0.8578431, 0.5297364, 0.5970799, 0.32134923, -0.6988253, -0.3988505, -0.53683966, -0.5645854, -0.26411146, -0.54879487, -0.08550332, 0.5523895, 0.09527285, -1.4829303, 0.42620313, -0.32207206, -0.80331665, -0.14081834, 0.14321318, 1.0547477, -0.014484324, -0.3733287, -0.6547246, -0.22136927, 0.23872378, -0.114890546, 0.52663624, -0.36137518, -0.10336557, 0.84902483, 0.24802007, 0.2428974, -0.55062777, -0.898774, -0.086360104, 0.42273575, 0.01069665, 0.03268071, -0.22184242, 0.68654114, -0.31356922, 0.99203634, -0.8053663, 0.024493441, 0.52120054, -0.14788416, 0.16501157, 0.71239144, 0.10519813, -0.23112617, -0.30074418, -0.7945606, -0.32828715, 0.1546241, 0.71328896, -0.8631298, 0.6879144, -0.25349656, -0.15505737, -0.52401733, 0.026135508, -0.91197675, 0.4897887, 0.2553321, 0.38357615, -0.5817329, 0.10147074, -0.14365219, -0.07878406, 1.460639, 0.76415765, 0.44990405, 0.9951974, -0.10996676, -0.43003532, -0.6043866, -0.97104216, -0.10857196, 1.7999303, -0.2487742, -0.23330228, -1.9624965, 0.8282924, 0.3562973, 0.99590814, 0.710325, -0.74927074, -0.47313, -0.23652235, 0.17110118, -0.64118886, 0.18618682, -1.0815334, 0.4417191, -0.27619588, 0.13438608, -1.2182668, 0.09222232, -0.046028994, 0.5128414, 0.6309838, 0.17811278, 0.08257908, 0.82218415, 0.24052832, -0.3043413, -1.1845739, -0.31409425, -0.5495012, -0.102475435, 0.6949858, -0.60669345, -0.5356563, -0.12042385, 0.51972234, 0.9788067, 0.27975333, -0.6509743, 0.08709107, -0.3396774, -1.0324789, 0.21493271, 0.64101464, -0.4424937, 0.35320687, -0.8626394, 0.018576376, -0.14504273, 0.0675314, -0.09590454, 0.14231923, -0.32527098, 0.15347226, 0.50280917, -0.12097482, -0.93272054, 0.6082158, -1.5437937, -0.07995024, -0.6858374, 0.39547303, -0.5739462, -0.52489924, 0.041147597, 1.3033543, -0.17370999, -0.22331943, -0.12098679, 0.7863538, -0.6103873, -0.3908378, 1.0210451, -0.33337703, -0.335317, 0.679813, -0.03252794, -0.46655637, 0.58323187, 0.526237, -0.17061844, -0.47416002, -0.35893548, 0.4063307, 0.32042253, -0.0637602, 0.13230446, -0.44979116, 0.5168601, 0.33988982, -0.7665607, 0.0853706, -1.2825401, 0.35769534, -0.21235913, 0.25373393, 0.2737563, 0.4383112, 0.26156312, -0.18157701, -0.82445776, -0.54746836, -0.19033858, -0.14472756, -0.8237075, -0.20849845, 0.09290561, 0.45805925, -0.60196894, -0.9694583, 0.22632071, -0.15821098, -0.07559876, -0.13461533, 0.6933839, -0.32768452, 0.3443336, 0.31391212, 0.9203925, -0.36575687, -0.20933554, -0.31347826, 0.5546571, -0.016795274, -0.092404574, -0.5469727, 0.6365913, -0.43841305, -0.8389967, -0.036488578, 0.61133695, -0.3538103, 0.76916534, 0.2602567, 0.04585594, -0.20960002, -0.69782466, -0.073778585, -0.4628681, -0.31100827, -1.194452, -0.15880762, 0.61074346, 0.01697435, 0.08602919, -1.0204202, -0.1064734, -0.5719034, 0.3842537, -0.61645734, 0.005817363, -0.5069963, 0.73048353, -0.58076227, 1.1014149, -1.002687, 0.26485753, 0.001325082, 0.23775855, -0.1090179, 0.8222375, -0.8824368, -0.60530984, 0.38780227, -0.18472426, 0.18662238, 0.6539168, -0.08568022, 0.0025433525, -0.35558033, 0.019322174, -0.88901633, -0.6802375, -0.69873244, 0.29876226, 0.03279008, 0.41753015, 0.15544944, 0.136213, 1.1869895, 0.13588208, -0.24654882, -0.68050987, -0.6760854, -0.6779837, -0.68511623, 0.96097136, -0.5064433, 0.005498264, -0.47417802, 0.14546248, 0.7594362, -0.367512, -0.098296344, 1.961263, 0.35767633, 0.03230954, -0.69004714, 1.1331533, 0.27895185, -0.49140096, -0.07016089, 0.16740261, -0.34845498, 0.25857598, -0.37114236, -0.92653924, -0.78350365, -0.41225216, 0.69445866, 0.34486955, 0.093205795, -0.066756755, -0.64549917, -1.1127244, 0.37053987, 1.1387469, -0.23592287, 0.80528295, 0.63944227, 0.54414797, 1.0815576, -0.5668222, 0.089382716, 0.13776606, 0.9200868, 0.8992326, -0.27931058, 0.48805022, 0.82883877, -1.7794003, -1.3662231, -0.16744435, 0.084341876, -0.107593, -1.017171, -0.3791846, -0.14377698, -0.27979684, 0.51328593, 0.26247755, -0.27690327, 0.076862276, 0.0780327, -0.07342488, -0.061520025, 0.0024008472, 0.8332128, -0.6966219, 0.4901986, -0.24039306, -0.14298935, -0.24950793, 0.12527625, 0.29839414, 0.7389395, 0.15047178, 0.58706343, 0.12560952, 1.0310695, -0.5962883, -0.18943071, 0.6150714, -1.2840291, -1.3595079, -0.15191634, -0.25942472, -0.17627351, 0.3720213, -0.10289232, 0.056950808, 0.3213657, 0.3321522, 0.053539947, -1.0371126, -0.052774735, -0.87331986, -0.7267541, 0.051209338, 0.1441378, 0.31906247, 0.46871975, 0.18395185, -0.0692848, -0.42856544, 0.01773473, -0.1260064, 0.71401536, -0.27404174, 1.3056145, -0.61608034, -0.3932829, -0.24632904, 0.010613654, -0.21523128, -0.08095754, -0.4983497, -0.626685, 0.64032483, 1.0719864, -0.35518745, 0.31677714, -0.09860298, -0.29361737, 0.98726356, -0.28703505, 0.37888417, 0.2140752, 0.36996755, -0.71319747, 0.2214708, -0.3875488, 0.37793255, -0.7721462, 0.6461019, 0.6115026, -0.5304169, -0.17443098, -0.70448905, -0.021181267, -1.0428503, -0.34047216, -0.06293756, 0.17875059, 0.28179625, 0.44505474, 0.16711755, 0.6964868, 0.2429418, -0.048931554, 0.101600535, 0.29270682, 0.14754868, 0.040776677, -0.2830106, 0.24993977, 0.18217126, 0.5031197, 0.6458861, 0.08088947, -0.06821887, 0.2294434, -0.6025328, 0.4214955, 0.02959657, 0.31607035, 0.048564933, 0.36561626, 0.4328048, -1.0279614, 0.5526877, -0.3101868, -0.7041938, 1.2670145, -1.0038794, -0.7538339, -0.051289015, -0.99725854, 0.54648906, -0.11038782, -0.8033994, 0.31729695, 0.11359299, -0.5800839, -0.29594612, 0.130738, 0.6961497, -0.31145877, -0.6745281, -0.3327659, 0.3130085, 0.12843235, 0.3653333, -0.8100079, -0.22264737, 0.5917342, 0.86295915, 0.3166489, 0.16683327, -0.26316214, -0.8232067, 0.5095601, 0.20595878, 0.45409048, -0.8229478, 0.10812789, -0.47012043, 0.8713862, -0.64504915, -0.24139825, 0.0829124, 0.30529198, -0.04502464, 1.3450638, 0.87469786, 0.1282358, 0.21878737, 0.5608324, -0.023736248, 0.8814906, -0.2450681, -0.64366734, 0.987674, 0.47663254, 0.72472185, 0.20790745, 0.4268311, 0.3406033, -0.40542594, -0.44307786, 0.21143325, 1.1998398, -0.04269371, 0.032475434, -0.028270632, -0.28937843, 0.63828766, -0.4257946, 0.30673802, -0.20225716, -0.8918963, -1.081641, -0.446235, 1.3505905, 0.28334346, -0.113350704, 0.10584864, 0.13026781, 0.9782037, 1.2069069, -0.59382397, 0.13534994, 0.20910484, 0.3964433, -0.08584341, -0.18862218, 0.29279798, 0.10304643, -1.0189443, -0.48712122, 0.089892246, 0.40033635, -0.43739498, -0.09577835, -0.8914217, 0.5634942, 0.46147624, 0.18333669, 0.5018127, -0.57141834, 0.22123447, -0.984082, 0.73240864, -0.42637298, 0.14858729, 0.58898765, -0.41788393, 0.15860158, 0.5590106, 0.5476727, 0.38015527, -0.06930857, 0.63783866, 0.19000062, 0.5320519, 0.85254997, -0.25869924, 0.36578634, 0.059271112, -0.82330275, -0.10596946, 0.32942462, -1.0458459, 0.47975013, -0.9814856, -0.54931, 0.12817167, 0.4720524, -0.60098046, -0.5558935, -0.07903196, 0.08017051, -1.0334187, 0.72646886, 0.28693724, 0.6514715, 0.017122403, 0.059414208, -0.43003318, 0.61294556, 0.15250102, -0.6344637, -0.124711365, -0.40405872, -0.21501787, -0.5084465, -0.6109873, -0.29131338, 0.21077976, 0.4723583, -0.6350576, -0.42727095, 0.3745004, 0.2436617, 0.16013308, -0.266916, 0.41006523, -0.13443582, 1.4617592, -0.09403017, 1.6679444, -0.113599226, -0.1766919, 1.1128019, -0.4637022, 0.6026775, 0.3295456, -0.26246035, -0.58322674, 0.63749, -0.29790995, -0.4552287, -0.34962073, 0.4757661, -0.38596824, 0.40881908, -1.6522696, -0.56499016, -0.9354418, -1.0565773, -0.9105244, 1.0067492, 0.12771598, -0.004504431, 0.23984769, -0.66904426, 3.6624045, 0.2592154, 0.27187067, 0.5508017, -0.10568046, -0.2670927, 0.5288961, -0.6268612, 0.20718782, -0.9910453, 0.4760573, 0.0844937, 0.11704531, 0.7277677, 0.06835682, 0.9558804, -1.4853053, -2.8017908E-4, 0.11895311, -0.11955248, -1.2167906, 0.5527989, 0.5219648, 0.25548583, 0.5149375, 0.123984054, 1.0438063, -1.0745394, -0.09779909, -0.5746613, 1.2606201, 0.4869489, 0.02342626, -0.30612367, -0.4081654, 0.54757965, 0.18535367, 0.089302, 0.14784724, 0.33126256, -0.024330921, -0.46541923, 0.44284585, 0.052763782, 0.093688585, 0.49122953, -0.9165186, 0.34113777, 0.31382066, -0.054380115, 0.8466793, -0.28731346, 0.28629318, -0.57786727, -0.5250714, -0.15221663, 0.029823096, 0.40237293, -0.7914292, 0.24210334, -0.42463204, 0.25620586, -0.21277969, -0.050531507, -0.18733416, 0.16404244, 0.696484, 0.25563902, -0.18624108, -0.8773365, -0.56324744, 0.31544864, -0.31330204, -0.8109294, -0.13510668, 0.9721738, -1.0318075, 0.26569387, 0.038234264, -0.31428084, 0.22263722, 0.06329511, -0.15759473, -0.36926627, 0.17948699, 0.5136905, 0.01984401, -0.19416128, -0.38064262, -0.37309346, 1.102059, 0.7792553, 0.060157903, -0.108390525, 0.11017364, 0.3994228, 0.09555158, 0.5825012, -0.60580367, -1.0827808, -0.1576766, 0.7572717, 0.51690817, 0.76832026, 0.5623794, -0.5242806, 0.10713714, -0.28198227, -0.3057894, -0.4436093, 0.0508234, -0.67036074, -0.50983393, -1.126107, 0.10048007, -0.28169256, 0.06555464, -1.1903594, -0.55183387, -0.4405081, -0.17009944, 0.5612562, 0.047636222, 0.37082034, 0.65144277, -0.21440561, 0.19920659, -0.08983047, -1.3184719, -0.21471508, -0.77892214, 1.0248505, -0.60647166, -0.48059314, -0.38415653, 0.33976716, 0.0074042156, 0.3431964, -0.7637138, -1.562081, 0.21412212, 0.41796106, -0.21860333, -0.036963142, -0.15398574, -0.067759186, 0.6621827, 0.14345872, -0.10131864, -0.15699252, 0.3062003, -0.93177044, 0.110051446, -1.2522842, 0.80647933, 0.19306532, 0.93869627, 0.41989905, -1.2128512, 0.048087396, 0.43417054, 0.51452124, 0.22957322, 0.6538078, 0.045719445, -0.49581295, 0.6129913, 0.2330572, -0.76418656, -0.59514874, 0.10234557, 0.34008834, 0.93430877, -0.7938407, 0.3488256, -0.095158495, 0.39193368, 0.32834923, -0.1460364, -1.1935029, -0.7402658, -0.06672922, 0.34790787, -0.24937785, -0.09675882, 0.54674053, 0.29830703, -0.25361973, 0.26495603, 0.8386657, 0.93270355, -0.30766344, 0.10872549, -0.54271966, -0.2646044, 0.80850345, 0.80533385, -0.3436443, -0.15843843, -1.1156524, -0.37078837, -0.9744277, 0.38333637, -0.7051673, -0.4906921, 0.054198608, 1.0482272, -0.16283801, 0.28291935, -0.2076324, 0.24571949, -0.42660946, 0.6194447, -0.5943218, -0.2044191, 0.80598855, 0.033541154, -0.16847873, -0.4267447, -0.5693771, -0.32211003, -0.80143666, 0.52846223, 0.42857355, -0.2879928, 0.25050047, 0.05486901, -0.059970193, 1.0365646, -0.21031526, -0.2751096, 0.4085902, 0.5967447, 0.46310297, -1.244204, 0.2939693, -0.06727497, -0.65307546, 1.6378098, 0.6602727, 0.3331953, -0.5972358, -0.16830699, -0.4092154, 0.9061645, -0.70522636, -0.30478314, 0.21947536, 0.30807325, -0.5290096, -0.021191731, -0.048273534, 0.052654807, 0.4325883, -0.002106417, 0.22604083, 0.6506453, -0.4128863, 0.06486968, -0.5109035, 0.6262629, -0.59054273, 0.54796576, -0.078081556, -0.22457956, 0.10496932, -0.7126875, -0.07178986, -0.014613241, 0.25202245, 0.6094514, 0.7096744, 0.17859364, -0.07159945, -0.10782984, -1.0702442, 0.2905703, -0.06708715, 0.73710424, 0.025326883, -0.04851279, 0.2838625, 0.100776896, -0.47360796, -0.23008478, 0.7629225, 0.4038585, -1.1927986, 0.7186655, 0.17397834, 0.66196936, -0.3637218, 1.0107775, -0.55020744, -1.4909959, -0.56990623, 0.30201685, -0.20511222, 0.2730165, 0.73218584, 0.048040986, -0.044010743, -0.15303451, -0.17348513, -0.39569393, 0.6480931, 0.10182218, -0.5377528, -0.012679113, -0.007665368, -0.65783006, -0.6718512, 0.36023977, 0.50482917, 0.112826176, -0.16764028, 0.09783888, 0.54286546, 0.82194656, 0.32949015, -0.10446587, -0.66156757, 0.44045573, -0.6881772, -0.12748857, 0.011206888, 0.5880827, -0.3310844, 0.60313576, 0.24298477, 0.18763687, 0.6665168, 0.8176408, 0.63851047, 0.7703525, -0.38874447, 0.29319334, 0.21659724, 0.67248577, -0.04747004, -0.75138336, -0.032682426, -0.58525085, 0.6164005, 0.5252805, 0.067715034, 0.77593464, 0.5756692, 0.01080169, -0.5409408, -0.18088111, 0.28055167, 0.7370628, -0.061915897, -0.14930114, 0.42736712, 0.07878585, 0.6338375, 0.028980128, -0.018971909, 0.24936385, -0.10556009, -0.007052973, -0.08535256, -1.1767282, -0.25823215, -0.16164792, -0.59529424, -0.04154039, -0.43678924, 0.16663226, 0.3614608, -0.4110936, -0.12785242, -0.561177, -0.49575725, -0.53649414, 0.55716574, 0.9938018, 0.3834205, -0.4088232, -0.16438262, -0.8488413, -0.68160176, 0.48920587, -0.35171676, 0.17286812, 0.14482836, -0.4438081, 0.34934083, -0.11522612, -0.18400648, 0.9550849, 0.19140965, -0.25227302, 0.060297303, -0.0070842654, -0.15262157, -0.484868, -0.6926102, 0.84828264, 0.91567695, 0.0016165003, 0.6874639, 0.023342803, -0.5647343, 0.4872593, 0.36987463, -0.53967863, -0.7367035, 0.6690624, 0.36760825, 0.41536736, -0.70216143, -0.78941077, -0.46292698, -0.32272416, 0.00408322, -0.569716, -0.0982589, 0.7778945, -0.22264656, -1.2859204, 0.14981261, -0.4571321, -0.84205663, -0.3931107, -0.13485941, 0.7186496, -0.11406441, -0.19351138, -0.3396683, -0.12722772, 0.0022645625, -0.023715228, 0.7800383, -0.23587298, 0.32181016, 0.6075423, 0.20606756, 0.08583229, -0.3835686, -0.76363343, 0.11516355, 0.26286107, 0.15805645, 0.010979824, -0.28352818, 0.42406383, -0.06747039, 0.7641131, -0.8182565, -0.031834044, 0.59817415, -0.556535, -0.13097134, 0.45006514, 0.45921433, 0.18680452, -0.2353987, -0.39224648, -0.20950153, 0.44744873, 0.7575571, -0.99211806, 1.0048358, -0.21880436, -0.29180026, -0.4883183, 0.11914819, -0.45420957, 0.5537008, 0.038552634, 0.28215736, -0.6505611, -0.05639731, -0.22432365, -0.0753257, 1.534879, 0.6527801, 0.33230194, 0.5043558, -0.17230092, -0.5368485, -0.60196584, -0.972783, -0.35474154, 1.5653621, 0.13357976, -0.23607488, -1.9256357, 0.99502707, 0.56387746, 0.95426637, 0.44848073, -0.6578555, -0.5840174, -0.21664485, -0.06438644, -0.6586791, 0.713435, -0.7542643, 0.4121706, -0.47967133, -0.5214753, -0.86162406, -0.41749653, 0.16635127, 0.67231923, 0.63377875, 0.060160317, -0.16357699, 0.70590246, 0.24508043, -0.31862876, -1.0028367, -0.1415234, -0.4981313, -0.07634404, 0.5626511, -0.5439674, -0.41470236, -0.32987338, 0.38528684, 0.8707138, 0.61265385, -0.7561777, -0.058350243, -0.29060918, -0.8828205, -0.32191333, 0.7171919, -0.6715127, 0.25353637, -0.85777193, -0.22826701, -0.10268143, -0.3677761, -0.21263666, 0.39470083, -0.50553197, 0.104695916, 0.38097295, 0.37870398, -0.7951013, 0.5898909, -1.4096434, 0.18723375, -0.67144465, 0.08446455, -0.32043055, -0.21069425, 0.060452625, 0.89954424, -0.33245453, 0.060212478, -0.16919714, 0.51581824, -0.46913767, -0.43260145, 0.8914732, -0.17595634, -0.39337397, 0.5862695, -0.165371, -0.41703492, 0.2300126, 0.8531972, 6.863475E-4, 0.018732369, -0.19274993, 0.11807219, 0.16294602, -0.13752386, 0.17776681, -0.7283606, 0.5255629, 0.21245965, -0.61398387, -0.019701332, -1.1922736, 0.072056726, -0.15926456, 0.06668207, 0.6565079, 0.3800544, 0.2927567, -0.18829279, -0.47632927, -0.5828585, -0.2932791, -0.32696068, -0.44982386, -0.1601027, 0.23962039, 0.35986, -0.6936998, -0.4130165, -0.028386503, 0.1189172, -0.23614475, -0.13688965, 0.8730439, -0.3260798, 0.6230809, -0.009794818, 0.64238536, -0.30446264, -0.1213474, -0.21677762, 0.64032716, -0.09058951, 0.32761735, -0.8952577, 0.7286184, -0.28435072, -1.0795968, 0.07461093, 0.5260262, 0.081124514, 1.1400597, 0.20557263, -0.22531477, -0.013032559, -0.63784456, -0.25429648, -0.43621144, -0.25980812, -0.68846905, 0.018888742, 0.40777546, 0.31415194, -0.06978384, -0.83367103, -0.47623697, -0.50554305, 0.050676435, -0.54136133, 0.09123197, -0.46119207, 0.8309509, -0.9467837, 1.3522601, -0.56323236, 0.04193849, -0.083614424, 0.65520114, -0.07264876, 1.2610217, -0.6354654, -0.54056776, 0.70698595, 0.00911441, 0.20147234, 0.8186352, -0.38808322, -0.081993535, -0.18767877, 0.27850354, -0.8085504, -0.6826043, -0.70434916, 0.28125268, -0.00417158, 0.1764245, 0.1252622, 0.13679127, 1.1405021, -0.16482627, -0.04663332, -0.58190393, -0.45656186, -0.49414352, -0.6545142, 0.7316151, -0.75474155, -0.13049766, -0.78929186, -0.1713476, 0.68869865, -0.1354918, -0.12297894, 1.374426, 0.53188884, -0.19543867, -0.7560643, 0.7825549, -0.20464867, -0.6691693, -0.024741076, 0.15538393, -0.20939259, 0.09335803, -0.32170793, -0.9581545, -0.3086296, -0.45974192, 0.9343871, 0.28155223, 0.026325535, 0.3607343, -0.51085424, -0.68860966, 0.51546973, 0.9578018, -0.32939222, 0.88570464, 0.8727469, 0.282832, 1.3196431, -0.46789652, 0.18751012, -0.009741772, 0.7062707, 0.7235945, -0.44040543, 0.32659394, 0.82885027, -1.513391, -1.0347612, -0.31969503, -0.17150323, -0.31322023, -1.0168256, -0.39043573, -0.32385135, -0.62966126, 0.4967361, 0.14318325, -0.02364469, -0.18822855, 0.36839056, 0.31844568, -0.25449395, 0.2378134, 1.1323748, -0.57734036, 0.57482517, -0.25512508, -0.3082748, -0.19442557, -0.1397948, -0.37038362, 0.7746373, 0.19150639, 0.057238307, -0.5009022, 0.7646541, -0.3515749, -0.1592197, 0.671271, -1.4349705, -0.87009597, -0.58153695, -0.0132568665, -0.26201454, 0.46259606, -0.24323648, 0.4780776, 0.24452041, 0.022693053, 0.21807481, -1.0536666, -0.3690221, -0.9724109, -0.5958498, 0.2780582, 0.17680575, 0.30712324, 0.33505383, 0.24084339, 0.3497074, -0.066905096, -0.046884567, -0.19839972, 0.49531293, -0.1463247, 0.68853134, -0.57161236, -0.5265372, -0.46173963, -0.29136887, -0.09823992, -0.25131285, -0.49662158, -0.29860687, 0.4173069, 0.61001307, -0.23230451, 0.33880717, -0.38124043, -0.62723, 0.7280858, -0.41596067, 0.12235218, -0.046359077, 0.1374916, -1.0030403, 0.076998085, 0.010334268, 0.16277502, -0.75184274, -0.045661084, 0.6897451, -0.5234157, -0.20258962, -0.35811937, -0.16314638, -1.2877578, -0.29840237, 0.11212779, 0.1864383, 0.30804637, 0.47436863, 0.07938605, 0.23727947, 0.15619943, 0.15607107, 0.3661412, 0.19492516, 0.52977335, 0.14330177, -0.39681092, 0.1595948, -0.17317334, 0.92330325, 0.95668155, 0.16457509, -0.082535796, 0.33720917, -0.6979915, -0.18996246, -0.18736917, 0.0076782946, 0.04778067, 0.4375449, 0.4449576, -0.5646165, 0.4824912, -0.73924667, -0.41778222, 1.228386, -1.4113506, -0.5091015, 0.018879347, -1.0306215, 0.3441526, -0.29703033, -0.76199734, 0.48998946, 0.0538232, -0.6444448, -0.55421084, 0.46473855, 0.41143027, 0.023548841, -0.5623564, -0.15067895, 0.5425395, 0.02348781, 0.33763394, -0.99986434, -0.40732938, 0.64412487, 0.61347324, 0.1844104, 0.060828157, 0.19362581, -0.89388067, 0.44956368, 0.61369896, 0.52955574, -0.93781817, 0.3274699, -0.2934738, 0.886754, -0.7060228, -0.09946883, 0.28589666, 0.38918224, 0.019775577, 0.8416462, 0.60078466, 0.22841358, 0.7777619, 0.048576668, 0.12920377, 0.708591, -0.17719474, -0.62505966, 1.0092452, 0.61805975, 0.53742653, 0.11385523, 0.30024686, 0.50781274, -0.65055555, -0.3315245, 0.089441545, 0.6801583, -0.055591352, 0.5085515, 0.080202654, -0.6231575, 0.7095781, -0.09222566, -0.0023482144, -0.2301088, -0.78504163, -0.89850014, -0.61895406, 1.4755174, 0.44006103, 0.3736515, 0.2789185, 0.3126807, 1.0981504, 0.5982582, -0.5319362, 0.2933641, 0.59055275, 0.449096, 0.09719907, 0.23644274, 0.4262668, 0.19561322, -0.99225354, -0.27452955, 0.0054776296, 0.42809853, -0.3454189, 0.024061855, -0.7582559, 0.4612135, 0.5061168, 0.16127184, 0.2933835, -0.74961704, -0.08755819, -1.038512, 0.52964205, -0.6356245, -0.039177597, 0.8408139, -0.43552092, -0.22568429, 0.6004227, 0.5666311, 0.34723854, 0.17451535, 0.46295786, 0.57787806, 0.5428326, 0.93625444, 0.25844303, 0.71137315, -0.17457405, -0.9393191, -0.0062135123, 0.7324282, -0.8502125, 0.21925573, -0.6307975, -0.40189654, 0.27061498, 0.65880245, -0.59898424, -0.7496212, 0.03331019, 0.19341184, -0.50549847, 0.76212996, 0.35790926, 0.7870286, -0.0400087, 0.055058934, -0.5947467, 0.26547173, 0.13392746, -1.1119648, -0.17382655, -0.5744398, 0.111572, -0.59631276, -0.62594944, -0.097791016, -0.35199642, 0.2313174, -0.58278424, -0.08641501, 0.34744838, 0.34512728, 0.500954, -0.7685111, 0.46870387, -0.10193086, 1.6084917, -0.03636925, 1.4086537, -0.063865475, -0.0015128739, 0.92001283, -0.38939625, 0.45528454, 0.31051323, 0.1577892, -0.5681765, 0.7005183, -0.5051335, -0.34040785, -0.28615594, 0.8032139, -0.46363586, 0.21622391, -1.2667955, -0.29988098, -0.81864244, -0.8201505, -1.1678752, 0.75056106, 0.098227546, -0.010810759, -0.014191384, -0.42939845, 3.9035187, 0.15681595, 0.2582419, 0.4887771, 0.1525703, -0.02428957, 0.66500604, -0.5359085, 0.22960104, -0.7852579, 0.15039048, 0.06367845, 0.3528753, 0.9337709, -0.20073745, 1.0146337, -1.0692636, -0.24778748, 0.23142752, -0.14437445, -1.2041767, 0.28693214, 0.37165838, -0.035585634, 0.52149665, -0.11201562, 0.60554165, -1.043031, 0.06837402, -0.4101506, 0.8253852, 0.12620798, 0.22745697, -0.13505921, -0.45202237, 1.1835434, 0.25073954, 0.1395775, 0.10847205, 0.25401965, -0.37892976, -0.6354462, 0.36379182, 0.1980045, 0.09259137, 0.7982754, -1.1515712, -0.24035174, 0.6636571, -0.15318638, 0.58441776, -0.48915377, 0.5170015, -0.2060879, -0.7129818, -0.1414245, -0.43068886, 0.18446523, -0.9598793, -0.2197116, -0.19919111, 0.12266955, -0.10918245, 0.35740358, -0.3485523, -0.22071102, 0.5921739, 0.5802294, -0.22553721, -0.7331374, -0.5409138, 0.4591624, -0.25060326, -0.6027513, 0.1528463, 1.0014454, -0.9771162, 0.30428672, -0.31012374, -0.36872467, -0.45164657, 0.3022587, -0.3332075, -0.05958897, 0.5864512, 0.29134268, -0.2936555, 0.14974032, -0.21069044, -0.21046856, 1.0327365, 0.87497103, -0.29114136, -0.12409274, 0.30638078, -0.008108355, -0.074863106, 0.1823267, -0.92456347, -1.2252402, 0.023988292, 0.29588172, 0.28956586, 0.92870545, 0.6245167, -0.17748761, 0.49881747, -0.0013700202, -0.6062493, -0.5211433, -0.044155214, -0.58735853, -0.3184926, -1.1066936, 0.31925192, 0.055742487, -0.11290029, -1.2357664, -0.013144705, -0.5662862, 0.06639056, 0.35374135, 0.38557136, 0.20628467, 0.5110246, -0.42163143, 0.12925106, -0.24695382, -1.1608903, -0.15010446, -0.3606254, 1.2112582, -0.5199689, -0.24509984, -0.57505196, 0.06266602, -0.05476774, 0.5543311, -0.6631306, -0.90839344, 0.056663997, 0.39264026, 0.006514296, -0.03379453, -0.06360012, 0.2962194, 0.43456346, 0.29512823, 0.15175281, 0.034137387, -0.15923557, -0.86211294, 0.07326408, -0.80600816, 0.67977273, 0.49671376, 0.6821382, 0.27394387, -1.536363, 0.57825166, 0.7842151, 0.2394658, 0.09236379, 0.6696022, 0.22107342, -0.5844541, 0.68800783, 0.35063517, -0.7489135, -0.84657335, 0.13539974, 0.011126772, 0.83486915, -0.3726464, 0.38500214, 0.15931323, 0.24204169, 0.31334576, -0.38999516, -1.0564649, -0.8066621, 0.32243422, 0.08050046, -0.100161314, 0.1417718, 0.26810834, 0.27799317, -0.24338469, -0.1273042, 0.47630495, 0.761901, -0.31447634, 0.0041330475, -0.6132874, -0.35413107, 0.50921535, 0.92908055, -0.7377505, 0.17884433, -0.97206813, -0.31223825, -1.1257086, 0.054560035, -0.5985438, -0.5419079, 0.34310243, 1.1592656, 0.12414108, 0.6306039, -0.29405472, 0.36001867, -0.26069996, 0.6843612, -0.69717747, -0.25637287, 0.7413816, -0.09426433, 0.007948817, -0.05839423, -0.37699413, -0.54838955, -0.5196219, 0.7450251, 0.5604553, -0.19528422, 0.153679, -0.037510846, 0.21829069, 0.63829726, -0.11303048, 0.0413495, 0.42149734, 0.5452131, 0.12912615, -0.9724758, 0.47631884, -0.11178413, -0.78062665, 1.6786276, 0.88644165, 0.25348303, -0.57685983, -0.10731165, -0.6602384, 0.66389215, -0.7689, 0.1496639, 0.6415253, 0.500464, -0.24878055, -0.07939838, 0.13462633, 0.013040431, 0.73763734, 0.06980479, -0.18928413, 0.6980672, -0.33711007, 0.115530476, -0.61564434, 0.2487322, -0.04897301, 0.13430814, -0.2164018, -0.3666767, -0.095899746, -0.44386792, -0.17055167, -0.036105186, 0.43075958, 0.534845, 0.17878997, 0.06367618, -0.05834858, -0.2430348, -0.6089918, -0.047322188, 0.080885276, 0.5262991, -0.21075973, 0.10692868, 0.13799505, 0.08237328, -0.60258526, -0.51029414, 0.716713, 0.27913976, -1.1312143, 0.69941586, 0.08650997, 0.6624551, -0.70263344, 1.0370399, -0.4800526, -1.3264769, -0.5724056, 0.48490354, -0.36758322, 0.14180458, 1.0191479, -0.16142865, -0.15934804, -0.06126994, -0.12419982, -0.2052495, 0.46710333, 0.25446153, -0.09749228, 0.2416552, 0.13107337, -0.62425584, -0.4665196, 0.41823313, 0.017742202, -0.11604845, -0.014583001, -0.04743681, 0.48962507, 0.5726147, -0.15344103, -0.043124318, -0.4611046, 0.5476682, -0.6814534, -0.13700399, -0.25768772, 0.47459337, -0.5468129, 0.964742, 0.26113805, 0.29224998, 0.69866586, 0.5390306, 0.23548684, 0.5616739, -0.4996161, -0.0531639, 0.15483534, 0.3004987, -0.15385841, -0.6523655, 0.52095807, -0.61126125, 0.29399925, 0.022592522, 0.0036164224, 0.9010767, 0.66380125, 0.22740883, -0.8602492, 0.067954, 0.3547017, 0.4408105, -0.13458662, -0.23914078, 0.20854351, 0.24268481, 0.46751034, 0.36705163, 0.043406673, 0.036361203, 0.05552602, -0.071449906, 0.041502196, -1.2105745, -0.028304726, -0.039797705, -0.66858214, -0.088372126, -0.5237669, 0.16090764, -0.04407379, -0.6910071, 0.054006502, -0.28989974, -0.24306267, -0.61034966, 0.5553436, 0.6809772, 0.096716136, -0.51710796, -0.098939195, -0.3180539, -0.32514825, 0.38779578, -0.7734561, 0.15372227, 0.087640285, -0.4327031, 0.096745, -0.06493625, 0.029305357, 1.0426801, 0.116323724, -0.46691078, 0.011199217, 0.1469512, -0.108034305, -0.24094029, -1.0067587, 0.86667746, 0.681321, -0.34006357, 0.6885098, 0.21300186, -0.55701715, 0.582534, 0.26671684, -0.28656054, -0.7581177, 0.83850646, 0.6659291, 0.63540286, -0.82415324, -0.76791, -0.42685413, -0.1978186, 0.1188646, -0.35998422, -0.4153101, 0.63527155, 0.012389898, -1.5216818, 0.10454872, -0.15033387, -1.1138442, -0.363461, -0.31349632, 0.73108214, -0.13952224, -0.29330423, -0.40340406, 0.19570658, -0.13253699, -0.15259932, 0.8772184, -0.6289534, 0.24124396, 0.8863129, 0.013752261, 0.11636713, -0.2878188, -0.6748302, 0.26673093, 0.074429825, 0.18423261, 0.33583167, -0.31168482, 0.18303514, -0.110326886, 1.0521882, -0.8914687, -0.041218713, 0.7925176, -0.38259062, 0.0699002, 0.39020306, 0.3406126, -0.025504138, 0.030163972, -0.8205811, 0.27958557, 0.42331424, 0.7152617, -0.5693195, 0.79709387, -0.052060973, -0.2502512, -0.5891158, 0.43469584, -0.41373527, 0.6146908, 0.076879665, 0.31544682, -0.5227765, 0.08362824, -0.23998299, -0.06326865, 0.977748, 0.699623, 0.34662923, 0.4053547, -0.57229793, -0.360397, -0.68081236, -0.89546853, -0.38550287, 1.4982802, 0.1295377, 0.03139779, -1.4845395, 0.6942864, 0.52807, 0.8333225, 0.49081743, -0.3854397, -0.5561076, -0.2873355, 0.35955435, -0.40604037, 0.3067069, -0.9793556, 0.54424125, 0.05487563, -0.17266905, -1.1705602, 0.23105747, -0.096690014, 0.66326594, 0.50486475, -0.104512066, -0.17203951, 0.84721786, 0.010612169, -0.2766949, -0.7051157, -0.4017008, -0.63575864, 0.06809341, 0.36169913, -0.83321065, -0.3977779, -0.75799507, 0.45688114, 0.8228988, 0.3614043, -0.3872057, -0.23848563, -0.2693749, -0.90534234, 0.062407956, 0.79575527, -0.28577504, 0.11576642, -0.85940045, -0.2364341, 0.09936187, -0.6178453, -0.2623395, 0.4881133, -0.96528625, -0.002703242, 0.32168373, 0.23600036, -0.5019947, 0.62138635, -1.4865868, -0.15790486, -0.6669983, 0.06801675, -0.5628619, -0.31371945, 0.6114257, 0.96458405, -0.064005196, -0.219717, -0.09132044, 0.547687, -0.633611, -0.21194346, 0.5262808, -0.2213456, -0.47458994, 0.39729577, -0.15099177, -0.43005282, 0.53780806, 0.54377115, -0.124503836, -0.3869376, -0.4276981, -0.017099984, 0.10659635, 0.023432303, -0.023488503, -0.5943924, 0.44783092, 0.21988973, -0.2587016, 0.054121852, -0.98205125, 0.66049236, -0.1100941, 0.40253222, 0.4989391, 0.18264665, 0.024417441, -0.1577205, -0.33052993, -0.40380287, -0.3190465, -0.432463, -0.36828405, -0.5821203, -0.027871974, 0.3407156, -1.0126361, -0.44199046, -0.089746, 0.19934487, 0.24793631, 0.07480049, 0.3483074, -0.468999, 0.49423718, -0.024303712, 0.7697083, -0.5001096, 0.02921876, -0.2797136, 0.5004291, -0.19378904, 0.33850992, -0.5845366, 0.54080933, -0.4231968, -0.8276037, -0.21587685, 0.4471876, 0.17945103, 0.8905926, 0.45168063, 0.120928615, -0.19128208, -0.9465436, -0.4261623, -0.56029624, -0.15703607, -0.70728654, -0.37483913, 0.49776262, 0.25170207, 0.12126787, -1.2433228, 0.06759076, -0.42357254, 0.37723503, -0.37966526, 0.16530818, -0.6875407, 0.6304193, -1.0195813, 1.1075277, -0.78990626, 0.39701256, 0.0069374703, 0.7567582, -0.09521173, 0.67897403, -0.46449107, -0.7232551, 0.6319999, 0.13682938, 0.38638604, 0.4707066, -0.36580908, 0.2677807, 0.34033567, -0.1596111, -0.9749413, -0.37226206, -0.6223806, 0.2617854, 0.103502214, -0.008744709, 0.051227644, 0.351737, 1.1481045, 0.14042997, -0.5311719, -0.49255943, -0.8199234, -0.64042944, -0.21486312, 0.6096419, -0.52185607, -0.2824444, -0.79940456, 0.1712943, 0.4599559, -0.08197235, 0.35854346, 1.6623292, 0.45101458, -0.066510625, -1.0427458, 0.62489176, -0.22252423, -0.5163516, 0.07532082, 0.13290837, 0.13375865, -0.16612516, -0.15780056, -0.94008225, -0.29751578, -0.57456505, 1.1763555, -0.05414252, 0.37103045, 0.19796538, -0.43615937, -0.68003327, 0.3122042, 1.2015585, -0.24554463, 0.8153871, 0.7607808, 0.059229776, 1.3229659, -0.24295142, 0.17053288, 0.048269182, 0.9410707, 0.9070906, 0.06965003, 0.27366185, 0.8945579, -1.2575924, -1.2471954, -0.5133816, -0.03719949, -0.040453598, -0.6262046, -0.22496824, -0.5460526, -0.6761229, 0.38598374, 0.30903018, 0.3048585, 0.05681765, 1.035404, 0.3265798, -0.65159935, 0.012538631, 1.1262999, -0.5801894, 0.6140626, 0.030489383, -0.20633727, -0.091095164, 0.07008093, 0.20600188, 0.42286634, 0.24940234, 0.336841, -0.28344682, 0.15419483, -0.45846593, -0.2657172, 0.30148643, -0.9636932, -0.83163893, -0.15322179, -0.083657995, -0.24991873, 0.2650725, -0.21684909, 0.45393792, 0.2698332, 0.0074559078, 0.4958383, -0.61557376, -0.25072846, -1.2557454, -0.6115327, -0.24550119, -0.04877276, 0.06557663, 0.3164962, 0.2010736, 0.20483038, 0.098864615, 0.4129772, 0.24178419, 0.45724168, -0.4674123, 0.8200659, -0.50947297, -0.449177, -0.30873096, -0.00341261, -0.05515168, -0.5907586, -0.33790907, -0.651591, 0.40981805, 0.7774349, -0.11609654, 0.120979905, -0.17329918, -0.36349046, 0.5757807, -0.30231762, 0.16941534, 0.18787259, 0.016418763, -0.9578842, -0.080765896, -0.023937378, 0.13233513, -0.6668092, -0.18915473, 0.6900721, -0.81779176, -0.3249238, -0.19014584, -0.26334095, -0.9522248, -0.020303745, -0.1590526, 0.45100468, 0.30653527, 0.19623548, 0.3372883, 0.4808515, 0.053027716, 0.039079703, 0.063242614, 0.1595489, 0.36108032, -0.06620808, -0.37538713, 0.023618475, 0.01085633, 0.69008404, 0.27196503, -0.04092282, -0.2127317, 0.2757614, -0.30057618, 0.18570052, -0.19186738, 0.3087836, -0.25180426, 0.26582882, 0.4608781, -0.21650104, 0.2283323, -0.31646472, -0.692105, 1.3698722, -1.257715, -0.45968327, 0.08766882, -0.62902015, 0.52597046, -0.24926928, -0.85368836, 0.53539294, 0.18897045, -0.8144592, -0.24593538, 0.45442003, 0.43394864, -0.021025106, -0.56448966, -0.48068237, 0.57226974, -0.1455751, 0.3920177, -0.805578, -0.3599915, 0.36887014, 0.40636414, -0.38607797, 0.25946122, -0.5041137, -0.7237108, 0.20406774, 0.26659763, 0.50632215, -1.1882919, 0.31482235, -0.16788547, 1.0427362, -0.30384532, 0.25440946, 0.36111465, -0.04078348, -0.08545423, 0.92903745, 0.4287195, 0.38892937, 0.6466388, 0.011067346, 0.10231955, 0.72308904, -0.13572344, -0.31354204, 0.68488604, 0.4170978, 0.42884508, 0.10300704, 0.7566359, 0.17373186, -0.41658837, -0.43844083, -0.086458325, 0.52654135, -0.043467827, 0.6249003, -0.25258037, -0.729916, 0.6514588, -0.21865344, 0.05354707, -0.038330674, -1.0014257, -0.64724433, -0.36293414, 1.4632056, 0.2517041, 0.034037836, 0.24289103, 0.09087169, 0.8479298, 0.55847895, -0.71819776, 0.22156405, 0.59628755, 0.092399985, -0.04420072, -0.3075664, 0.30672166, -0.07358368, -0.9896834, -0.030702464, 0.45216998, 0.23109157, -0.3755612, 0.16779788, -0.6244628, 0.7411318, 0.24217345, 0.17737857, 0.48295784, -0.8859237, -0.24001184, -0.75387233, 0.67960876, -0.83024853, -0.14399245, 0.8452935, -0.3518325, -0.047979936, -0.02630499, 0.5509351, 0.4625635, -0.16918442, 0.30742225, 0.16386184, 0.67220664, 0.6280037, 0.28628358, 0.5660928, -0.1181638, -0.7434205, 0.20981479, 0.30287597, -0.69003713, 0.2184324, -0.76819944, -0.6346251, -0.08185301, 0.4818785, -0.51540446, -0.41744098, -0.09777721, -0.13589545, -0.60600513, 0.5247147, 0.3843186, 0.7094564, -0.16184524, -0.10725272, -0.4548275, 0.19113028, -0.047529392, -1.2795435, 0.17554286, -0.11416066, 0.13803561, -0.15642008, -0.6183412, -0.09616114, -0.37894952, 0.41909993, -0.662439, -0.114946306, 0.24334419, 0.22668067, 0.12224765, -0.63632286, 0.09084573, -0.23651299, 1.572324, 0.2178188, 1.1743072, 0.07571864, -0.1768858, 0.46413594, -0.48011255, 0.60569423, 0.15971124, 0.15805168, -0.9414262, 0.52399147, -0.007178193, -0.5215467, -0.59056896, 0.8559839, -0.2467039, -0.12033293, -0.9019515, -0.59779, -0.7349234, -0.8292922, -0.8635217, 0.5185263, -0.14540526, -0.26934415, 0.09875953, -1.1647751, 4.1182427, 0.46481997, 0.20087855, 0.9354643, 0.105424814, -0.004540026, 0.31147802, -0.6534193, 0.49501762, -0.45092684, 0.26379517, 0.448524, 0.34865677, 0.33569512, -0.016880259, 0.931842, -1.0148392, 0.20927775, 0.27847856, 0.15899846, -1.0693281, 0.1423664, 0.25981626, -0.025161192, 0.37412122, -0.29079884, 0.65601414, -1.0225062, -0.09605144, -0.14980899, 1.4953828, -0.1718415, 0.4066242, -0.08655246, -0.24063088, 1.2393714, 0.30284256, 0.36995012, 0.13408722, 0.30496278, -0.46151608, -0.6467823, 0.6863592, 0.3977234, 0.24254265, 0.30088937, -0.91632855, 0.22041345, 0.21627867, 0.036953487, 0.8198882, -0.38644162, 0.5111023, -0.6528836, -0.05132746, -0.048061155, -0.6670724, 0.32652795, -0.93728834, 0.17837188, -0.07624923, 0.18451518, -0.23230648, 0.34793568, -0.30258647, 0.12964638, 0.51428103, 0.8286943, -0.33250588, -0.6536644, -0.5854663, 0.42078778, 0.0033747032, -1.1266797, 0.10867215, 0.7423345, -0.83774376, 0.77926403, -0.058730222, -0.47217268, -0.092801005, 0.33792138, -0.05150798, -0.31443495, 0.27053922, 0.27824974, -0.11275067, -0.09057309, -0.2926527, 0.06173639, 1.3071758, 0.4730829, -0.14173776, -0.5784081, 0.2668654, 0.23815082, 0.28242433, 0.4774975, -0.54650855, -1.0264833, -0.47225332, 0.8703695, 0.63991624, 0.74452734, 0.42014164, -0.03533741, 0.06514102, -0.09643583, -0.8522862, -1.026076, 0.2499778, -0.42779097, -0.22190364, -0.076258555, 0.44808066, -0.71214545, -0.33959672, -1.3720645, 0.32767367, -0.713407, 0.7200092, 0.54970694, 0.038314663, 0.31601653, 0.82536983, -0.3402146, -0.15020594, -0.38107064, -1.594133, -0.20284157, -0.5158298, 1.4197085, -0.8124861, -0.42961958, -0.9616828, -0.31844, 0.09133983, 0.83976585, -0.69099605, -0.7764937, -0.5044535, -0.021224841, -1.0946624, 0.061164968, -0.008315772, -0.09962118, 0.7529673, 0.13280208, 0.32369834, -0.018207334, 0.30298617, -1.3468391, -0.010767452, -1.2652732, 0.3044045, 0.6346315, 0.41673356, 0.3533945, -1.4007373, 0.73925, 0.4769547, 0.45146942, -0.17096666, 0.53908443, 0.1459171, -0.5496129, 0.8112877, 0.22813308, -0.86315006, -1.0600767, 0.49666116, 0.6343291, 0.9384711, -0.67448175, 0.65366536, 0.12925006, 0.32494718, 0.7210598, -0.119817495, -1.8780767, -1.1060218, 0.26940116, 0.8603358, -0.37159148, 0.22237892, -0.026965573, 1.4551806, -0.04102008, 0.18953791, 1.2205132, 1.3830074, -0.6203029, 0.105550446, -0.9172137, -0.2631466, 1.2078451, 1.1561841, -0.88699704, 0.33485472, -1.1039261, -0.15662864, -0.8889108, -0.021704465, -0.7190207, -0.4444397, -0.09743556, 1.0252041, 0.27867004, 0.47697592, -0.25137198, 0.8654594, -0.5946547, 1.1985759, -0.7184543, -0.37799215, 0.8081364, 0.13715135, 0.03568732, -0.6331051, -0.65091616, -0.63724107, -1.1073422, 0.83576024, 0.01433241, -0.25773996, 0.19880387, 0.26008373, 0.12768374, 1.1019219, -0.48458183, 0.046535883, -0.06099293, 0.5994473, 0.82844126, -1.4832599, 0.76427746, 0.2744197, -0.63113993, 3.4523046, 1.0266101, 0.27708215, -0.41686982, -0.5191848, -0.06873581, 1.3051794, -1.1570866, -0.13528334, 0.36869058, 1.023516, -0.06851939, -0.42901027, -0.061269097, 0.34303978, 0.78846973, -0.10224266, -0.26698807, 0.36766642, -0.052483615, 0.30429786, -0.5263308, 0.8598371, -0.22671875, 0.18051147, -0.08662229, -0.3279599, 0.2018461, -0.6478263, -0.17370462, 0.13946049, 0.68857074, 0.7604215, 0.66072303, -0.2236945, 0.0344449, 0.39498496, -0.86348784, 0.2021577, -0.554239, 1.241565, -0.19903407, 0.096936144, 0.6406258, -0.34654585, -0.73143643, -0.13212292, 0.64585644, 0.20416865, -1.3674644, 0.81159735, -0.53180194, 0.44403616, -0.4629941, 0.8237217, -0.6575767, -1.9094594, -1.0068313, 0.1886729, -0.54099613, -0.31080106, 0.52114534, -0.4064729, -0.3517636, 0.52113307, -0.37713295, -0.54287195, 0.90217155, 0.75736386, -0.057880785, 0.65335006, 0.5185984, -0.6316754, -1.008395, 0.5784696, 0.15871945, -0.096895896, 0.030775126, 0.019246973, 0.635904, 0.7580727, 0.603296, -0.39326644, -0.775648, 0.6632834, -0.76522464, -0.15057506, 0.13213232, 0.8701612, -0.051690824, 0.886158, 0.059451666, 0.39455524, 1.1942627, 0.80077326, 0.30792174, 0.72980845, -0.58946186, 0.11602919, 0.6559696, 0.8268997, -0.20558739, -0.9376819, 0.4666886, -0.6281039, 0.45548218, 0.08520936, 0.19750595, 1.5127107, 0.83545053, 0.3510535, -0.8958543, -0.75617564, 0.894642, 1.4720694, -0.1355076, -0.6986217, 0.29143137, 0.34363377, 0.18577126, 0.26836568, -0.13981187, 0.19420178, -0.1310125, 0.106808856, -0.11584908, -1.3767927, -0.048521705, -0.12314682, -0.70627797, 0.10515572, -0.5317391, 0.5002598, 0.422907, -1.0648339, -0.11869705, -0.93817717, -0.47067133, -1.0766637, 0.7890926, 1.0871282, 0.077466965, -0.022941213, -0.34052557, -0.46262902, -0.21314916, 0.63874835, -0.8034802, -0.12524417, -0.2280509, -0.45375586, 0.11442453, 0.17320183, -0.16676669, 1.2585441, -0.26324847, -1.0815029, 0.48728508, 0.40939358, -0.2852892, -0.01987523, -1.0332665, 1.4922973, 1.2905895, -0.3012445, 1.1206418, 0.58634394, -0.5885947, 1.027236, 0.5461434, -0.56589985, -2.160386, 0.9977782, 1.4122514, 0.35012767, -0.8348484, -0.91156083, -0.44733608, 0.06918893, 0.073672324, -0.49986246, -0.36920917, 1.2300003, -0.028686464, -1.9602597, 0.3586868, -0.5751905, -1.2226559, -0.160415, -0.45962837, 0.7730631, 0.15213728, -0.40129295, -0.3763386, 0.25027445, -0.017731309, -0.35444453, 1.0308242, -0.68111396, 0.027753418, 1.1759561, 0.1284143, -0.1538926, -0.06069766, -0.5967487, -0.46134785, 0.65801346, 0.38983122, -0.13866639, -0.1946084, 0.39163414, -0.05783741, 1.3692302, -1.1921241, 0.12407765, 0.62342554, -0.22950053, -0.15749526, 0.42076403, -0.15916803, -0.6903404, 0.38964617, -0.96953917, 0.1617446, 0.15616782, 0.94165206, -0.7990292, 1.0704751, -0.3479437, 0.014394938, -0.27818298, -0.2686414, -0.8608855, 1.1030215, 0.30865127, 0.56293905, -0.5808595, -0.09553954, -0.5470532, -0.24101052, 1.7932336, 0.5933583, 0.22850809, 0.6440879, -0.13777807, -0.40607083, -0.14935976, -1.0655402, -0.08556904, 1.5463837, -0.2037431, -0.049918488, -1.948359, 1.3937284, 0.8913616, 0.6618716, 0.29112825, -0.9333397, -0.64939773, -0.1519076, 0.43093035, -0.90897346, 0.23105648, -1.6697718, 0.80526376, -0.10556382, -0.29879344, -1.1856492, -0.08865876, -0.3910298, 0.99155366, 0.05003587, -0.25817716, -0.203244, 1.0919954, 0.43314368, -0.36503968, -1.4359604, -0.27645838, -0.82746905, 0.27085295, 0.6530822, -1.179947, -0.5469275, -0.8221712, 0.4316565, 0.8877416, -0.22656713, -0.9242201, -0.30603468, -0.2247964, -0.8370084, -0.35373253, 0.91914237, -0.030093975, 0.6547502, -1.4251751, -0.17141008, -0.10287389, -0.16700989, -0.17503524, 0.30245206, -0.10866988, 0.11191217, 0.87262994, -0.3063119, -0.8902056, 0.56295437, -1.9272543, -0.0981302, -0.67028433, 0.23364708, -0.6498273, -0.37664372, 0.23457718, 1.4059585, -0.1313058, -0.30622694, -0.021324791, 0.7439346, -1.2513928, -0.34206432, 1.3767378, -0.2954388, -0.5523714, 0.60395724, -0.29732507, -0.2831665, 0.24392214, 0.5988505, 0.0795792, -0.29516765, -0.25286347, 0.10891355, -0.043641455, -0.21956724, -0.1222059, -0.90728974, 0.46377242, 0.49633765, -0.20564441, -0.520319, -1.6375936, -0.0139881335, -0.4310044, 0.5800617, 0.28061712, 0.47284612, -0.07800144, -0.51974624, -0.5967198, -0.2567559, -0.40850466, -0.36360377, -0.61648047, -0.5654142, 0.48337257, 0.21692866, -1.1690227, -0.53939724, 0.2567819, 0.52827764, -0.27963173, -0.038007528, 0.5720037, -0.8600977, 0.13065897, 0.19105779, 0.9926014, -0.50321037, -0.4309987, 0.19077024, 0.7039192, -0.09141481, 0.84667844, -0.77341396, 0.5661096, 0.15038273, -1.0883207, -0.30914208, 0.39496368, -0.06485534, 1.641904, 0.6762734, -0.3347199, -0.8617406, -0.6995804, -0.19845611, -0.5784028, -0.47562283, -1.4047565, -1.0122284, 1.0451913, 0.3910407, 0.21691439, -0.5442791, 0.3343481, -0.33234861, 0.66286534, -0.6073909, -0.23710439, -0.8782153, 0.6301357, -0.78039706, 1.0811063, -0.94600165, 0.50099385, -0.20203432, 0.8153803, 0.4326697, 0.9829363, -1.1359497, -0.5724925, 0.46652472, 0.020673493, 0.17816944, 0.64396065, -0.95867497, 0.8279188, -0.80351615, -0.085244454, -1.0182021, -0.48280728, -0.68415624, 0.26940063, 0.17725682, 0.6659137, 0.343051, -0.036139507, 1.9253529, 0.330179, -0.18667798, -0.7256044, -0.5135883, -0.6487113, -0.8936575, 0.7452832, -0.12287533, -0.11825, -0.70136374, 0.14688696, 1.4273101, -0.15633577, 0.6255618, 2.1027944, 0.8671121, -0.36143222, -1.1867063, 1.1065185, 0.8098748, -0.45667458, -0.24226767, 0.0025809854, -0.25722653, 0.19070284, -0.5484266, -0.6555022, -1.0337746, -0.42591894, 1.7423811, 0.654865, 0.64011616, 0.16377617, -1.2083119, -1.4860584, 0.70743257, 1.1795193, 0.07058562, 0.8440395, 1.0345922, 0.28286603, 1.0439405, -0.31949413, 0.6272188, -0.19404978, 1.5465806, 0.8578423, -0.27853975, 0.66072625, 1.2355281, -2.0446782, -1.7492697, 0.0030216204, -0.56266546, -0.6697648, -0.68279344, -0.35443568, -0.54446316, -0.6759806, 0.1435076, 0.28134957, -0.15788919, 0.24428463, 0.014099263, 0.46920812, -0.85195917, 0.0012707915, 1.3709744, -1.0901219, 0.64788854, -0.14823869, -0.085778356, 0.13496846, -0.24483931, 0.4524359, -0.034560725, 0.63981885, 0.35658672, -0.30224392, 1.0347067, -0.85791016, -0.14240645, 0.79247826, -1.1686097, -1.586391, -0.8209819, -0.119535595, -0.2052218, 0.34335265, -0.6570797, -0.2210782, 0.6748208, -0.09502657, 0.24686556, -1.2017366, -0.63983685, -1.5916613, -1.184105, -0.123895474, -0.03346053, 0.2209342, 0.61311907, 0.3206372, -0.118494704, -0.3988993, 0.3909913, -0.36862627, 0.5302286, -0.6324911, 0.94080716, -0.6024734, -0.38162777, -0.4316226, -0.3143518, -0.36463666, -0.20017555, -0.8736055, -0.9380112, 0.45671174, 1.5155923, -0.09486201, 0.9695505, -0.13833332, -0.6298378, 0.8931586, -0.6301222, -0.26646182, 0.46902105, 0.13617973, -1.3055613, 0.30406374, -0.09564643, 0.10455055, -1.0269212, 0.12177908, 1.1355569, -0.6378392, -0.6559861, -0.78072715, -0.68091595, -1.3237638, -0.4806199, -0.16236575, 0.22558266, 0.4245454, 0.6258281, 0.2573674, 0.92344415, 0.108896874, 0.4044994, 0.06719699, 0.66419035, 0.34098536, 0.58486176, -0.41998512, 0.5359888, 0.61129946, 0.5190456, 0.983025, 0.310331, -0.32300448, 0.35044804, -0.97328913, -0.06142584, -0.34457424, 0.42320502, -0.2103809, 0.94158864, 0.751986, -0.41664547, 0.5273929, -0.023898497, -0.58526397, 0.91506046, -1.587615, -0.62792873, 0.20285669, -1.3050082, 0.62498814, -0.4249226, -1.0144218, 0.409593, 0.27104688, -0.9462727, -0.24467865, 0.86334205, 0.45995265, -0.12513909, -0.70971626, -0.19246241, 0.042387776, 0.07669194, 0.115074575, -1.269335, -0.09286548, 0.54315686, 0.34751275, 0.06670852, 0.14310578, 0.02031393, -1.4052739, 0.34125116, 0.34491134, 0.47022027, -0.80838424, 0.43571746, -0.5313221, 0.8576949, -0.2583056, -0.1817374, 0.4537858, -0.14710322, -0.4226152, 1.6146483, 0.88158476, -0.3151336, 1.2690797, 0.11899912, 0.3866578, 0.76637596, 1.5090572, -0.67779464, 0.9428768, 0.6889142, 0.6410521, 0.28004602, 0.7718466, 0.7421934, -0.28616107, -0.914406, 0.18280843, 0.77757883, -0.37666446, 0.607708, -0.28850508, -0.14639486, 1.0358485, -0.57612544, -0.03077536, -0.09469912, -0.5002359, -1.5291424, -0.5715195, 1.1232437, 0.032881796, 0.24273214, 0.114872776, 0.21159294, 0.86429787, 1.2115531, -0.53747576, 0.5324311, 1.046557, 0.3009321, 0.33693448, 0.033356756, 0.44364536, -0.02425829, -1.4809191, -0.15717486, 0.19116181, -0.09143227, -0.27159914, -0.10439899, -0.74533814, 0.82421553, -0.20139456, -0.0032766405, 0.9916576, -1.0329632, 0.19601333, -1.2602824, 0.2017543, -0.64100575, -0.35785395, 1.0780927, -0.14836146, 0.018262547, 0.9442348, 0.83696884, 0.6329565, -0.093982756, 0.7140547, 0.21587613, 1.2869248, 0.60281265, -0.47821552, 0.43734503, 0.25959963, -0.16328156, -0.12055825, 0.4622288, -0.9157813, 0.5098907, -0.31852883, -1.0538068, 0.63930315, 1.0165753, -0.8952555, -1.1551671, -0.07045259, 0.33253628, -1.4805075, 0.5346395, 0.40822038, 0.78947777, 0.056913875, -0.23994705, -0.47662988, 0.12904635, -0.3096597, -1.2386975, 0.027118616, -0.297474, -0.34640983, -0.7081305, -0.987574, -0.4112696, -0.16663915, -0.14638874, -1.0458425, 0.054047197, 0.99362266, 0.47721052, 0.39771488, -0.4090625, 0.1835733, 0.006618239, 1.8029044, -0.5752119, 1.7840273, 0.14250731, -0.8179414, 1.0404874, -0.7235668, 0.43460107, -0.17297104, -0.66153497, -0.53459716, 1.4169344, -0.25907004, -1.0876834, -0.121780336, 0.9376321, 0.087307006, 0.1502156, -1.3873982, -0.47126013, -0.72027636, -1.0648152, -1.0333831, 0.28081003, 0.0047804266, -0.41970125, 0.12368576, -1.0056207, 1.314159, 0.8322662, 0.50192, 0.6606601, 0.19176152, 0.22359805, 0.6299454, -0.8784206, 0.8435247, -0.62076545, 0.46503085, 0.4955411, 0.47523603, 0.59475726, -0.15033536, 1.5292126, -1.6526178, 0.77440363, 0.21343376, -0.1102623, -0.8003335, 0.12464988, 0.1694136, -0.092712775, 1.1573013, 0.26682746, 0.8170211, -1.0412548, 0.09060685, -0.18826349, 1.1423111, 0.03361123, 0.54229814, -0.31807727, -0.034259863, 1.3871967, -0.05026304, 0.28581905, 0.11886263, 0.7556672, 0.09417425, -1.0077528, 0.9749789, 0.031945437, 0.1542672, 0.44604713, -1.1202078, 0.24686609, 0.5521793, -0.26565984, 1.3768492, -0.41607288, 0.89860183, -0.9901299, -0.55397356, 0.3160442, -0.2748052, -0.028745566, -0.60326695, 0.1855664, 0.014004639, 0.043385062, -0.3658645, 0.21059687, -0.45689726, 0.2032052, 0.73326206, 0.35434416, 0.019100547, -1.4163734, -0.44338754, 0.26873967, -0.5155286, -1.3091766, 0.083646804, 1.3032191, -1.2324255, 0.9689458, -0.50306034, -0.13216153, -0.31209743, 0.42126146, 0.24715918, -0.36722437, 0.8198192, 0.7839475, -0.4742727, -0.23958692, -0.53167427, 0.36589828, 1.4970611, 1.1297909, -0.09345523, -0.7373089, -0.6823638] -2025-10-16 19:28:50 [main] INFO OnnxTest - ------------------------ -2025-10-16 19:28:50 [main] INFO OnnxTest - tokenizer加载耗时: 4073ms -2025-10-16 19:28:50 [main] INFO OnnxTest - tokenizer计算耗时: 1ms -2025-10-16 19:28:50 [main] INFO OnnxTest - 模型加载耗时: 558ms -2025-10-16 19:28:50 [main] INFO OnnxTest - 模型数据准备耗时: 2ms -2025-10-16 19:28:50 [main] INFO OnnxTest - 模型计算耗时: 11ms +2025-10-16 19:28:50 [main] INFO experimental.OnnxTest - [0.51123345, 0.43754324, 0.22250144, -0.49621642, -0.59625536, -0.24450612, 0.5863322, 0.46978277, 0.5778739, 0.6761688, -0.0854191, 0.36117497, -0.24092007, -0.19524571, -0.7976704, -0.044580948, -0.53635055, -0.11370213, -1.1403378, 0.2129236, -0.34120926, 0.001864681, -1.3665671, -0.22030343, -0.830733, 0.099989876, 0.4966247, -0.066141784, 0.41148925, 0.729914, -0.29459542, 0.29208705, -0.3367949, -1.0972055, -0.024628287, -0.6583721, 1.253141, -0.61462474, -0.518246, -0.53295904, 0.12913027, 0.04108283, 0.55130756, -0.8039789, -1.2061563, -0.34272343, 0.27257943, -0.13096467, 0.18428354, 0.2605311, 0.057498857, 0.7461083, 0.1835212, 0.021440782, -0.20071763, 0.04362084, -1.3614484, -0.1095237, -1.0870106, 0.40957803, 0.7201999, 0.98604536, 0.39732328, -1.3224756, 0.40671548, 0.406975, 0.50348455, 0.22034347, 0.5530567, 0.25672144, -0.6594347, 0.96159023, 0.07775575, -0.7792945, -1.0163779, 0.36998796, 0.5171132, 0.79771215, -0.5552498, 0.80050594, 0.14805704, 0.2997373, 0.26703542, 0.08637628, -1.4002664, -0.813782, 0.25788978, 0.5414073, -0.46593362, -0.027594358, 0.29689378, 0.65353656, -0.31033817, 0.08076967, 0.76214606, 0.8415609, -0.3084258, -0.32594687, -0.72558767, -0.3289697, 1.0932022, 0.87115157, -0.89196694, -0.18925445, -0.9785898, -0.2336246, -0.9026102, 0.088704094, -0.7258216, -0.6594782, 0.09606822, 1.0850618, 0.0013394654, 0.38363743, -0.3874976, 0.20100841, -0.4128504, 0.74124134, -0.6654147, -0.5718573, 0.27072686, -0.046442233, -0.2115764, -0.7070531, -0.9749727, -0.4404279, -1.3043284, 0.93771523, 0.30211914, -0.59651214, 0.12527934, 0.089207426, 0.51316845, 0.8074455, -0.5485792, 0.07305289, 0.10457601, 0.24046482, 0.5214334, -1.1262523, 0.16574118, 0.01661903, -0.72924286, 1.7897038, 0.7391656, 0.26545036, -0.24889244, 0.019522466, -0.38037547, 0.9288784, -0.90373176, -0.2429637, 0.13991763, 0.4122005, -0.6420515, -0.045609288, -0.055985063, 0.121364415, 0.28139967, -0.0052891895, -0.106420964, 0.56713265, -0.46813145, 0.19711205, -0.58464926, 0.3698026, -0.2838148, 0.12638272, 0.01481974, -0.2993888, 0.14940853, -0.4162319, -0.045515813, -0.07729791, 0.47421545, 0.46603337, 0.62959045, 0.1828863, 0.2002228, 0.07522717, -0.50393486, 0.37032261, -0.35638678, 0.8902856, -0.033868957, 0.100021124, 0.43048963, 0.3153236, -0.6283139, -0.24138638, 0.81751156, 0.2257601, -1.2130985, 0.44707552, 0.0037308559, 0.5666142, -0.8444263, 1.204924, -0.65543765, -1.9701289, -0.8207577, 0.08641613, -0.4112931, -0.20802015, 0.87505317, -0.13793634, 0.07145847, 0.31840786, -0.092020944, -0.80500084, 0.58076894, 0.117715076, -0.67379886, 0.45848575, 0.4390001, -0.7055742, -0.712911, 0.33785975, 0.42191327, 0.121282555, 0.13419384, 0.17775199, 0.5506595, 0.67962146, 0.4780363, -0.03222577, -0.8667363, 0.8303137, -0.541459, 0.062450707, 0.03477095, 0.49735057, -0.3892, 0.8767689, -0.06756614, 0.35541242, 0.94193155, 0.8131012, 0.58299375, 0.1854296, -0.60147816, 0.4282838, 0.5299751, 0.7330451, -0.3257398, -0.58661395, 0.5521986, -0.606695, 0.44539154, 0.41345364, -0.023682468, 1.0244411, 0.8901564, -0.025144015, -0.6341725, -0.4240578, 0.31344998, 1.0556707, -0.7415066, -0.32343262, 0.1841922, 0.36124998, 0.5530684, 0.29907, -0.02951768, 0.19808297, 0.08838599, 0.05037989, -0.049141884, -1.1747736, 0.03532947, 0.07290274, -0.7062243, -0.027512219, -0.5645471, -0.034089435, 0.4769841, -0.5791185, -0.062474817, -0.5574461, -0.07675014, -0.58530134, 0.5648111, 0.7009718, 0.19080682, -0.37462634, -0.38008162, -0.8266342, -0.56594104, 0.6085925, -0.8169755, 0.2305794, 0.022104293, -0.32453218, 0.029340252, 0.12966694, -0.35197243, 1.0937076, -0.08106287, -0.630723, -0.07665277, 0.09807674, -0.15652439, -0.032777905, -0.59978753, 0.7365465, 0.8591844, -0.16815796, 0.8361499, 0.27674484, -0.3099411, 0.60480386, 0.23437774, -0.7338224, -0.9829839, 0.67439365, 0.742201, 0.42505273, -0.68957865, -0.47552192, -0.5682225, -0.5110189, -0.28437212, -0.565194, -0.19356139, 0.63973606, -0.014390081, -1.646161, 0.2918704, -0.4594489, -0.8228203, -0.16133638, 0.07148346, 0.9419251, -0.019150853, -0.4403408, -0.56392926, 0.12463045, 0.24700657, -0.19791731, 0.6058087, -0.5370069, -0.051276788, 0.9354616, -0.055462413, 0.050041005, -0.6077635, -0.68125796, -0.13532986, 0.36517376, -0.019653555, -0.03586552, -0.1600579, 0.67996794, -0.25741813, 0.9547673, -0.910809, -0.009982694, 0.7332152, -0.20394151, -0.09925252, 0.5988749, 0.10125684, -0.2892084, 0.09639569, -0.9270706, -0.14898436, 0.23913115, 0.7453801, -1.0168681, 0.80838275, -0.27111107, -0.14699328, -0.68104225, 0.19166322, -0.79916215, 0.43923154, 0.16553934, 0.33551145, -0.5704513, -0.070023894, -0.3918103, -0.17701462, 1.6619401, 0.674843, 0.23895527, 0.80687135, -0.01851894, -0.34060583, -0.58362544, -0.96381485, -0.19843449, 1.6370385, -0.44541967, -0.13564552, -1.7383175, 0.94101083, 0.4386875, 0.8844557, 0.7002662, -0.72894764, -0.6103935, -0.32648364, 0.054746274, -0.6872155, 0.18739484, -1.0520368, 0.6648933, -0.2648567, -0.06654116, -1.3043286, 0.22864798, -0.10361338, 0.594177, 0.5787685, 0.1750473, -0.0105097145, 0.91527426, 0.25346497, -0.27341178, -1.1472199, -0.31140554, -0.49403697, -0.13216135, 0.7429359, -0.57663065, -0.5814875, -0.46789917, 0.62059444, 1.0459176, 0.105841815, -0.8354111, -0.09153462, -0.4892223, -0.9736461, 0.03827665, 0.6993418, -0.5639835, 0.3098794, -0.8142145, 0.047523424, -0.21321937, -0.034833632, -0.010952409, -0.041929975, -0.28044957, 0.060209088, 0.50224316, -0.046635136, -0.85428065, 0.73049414, -1.4654225, 0.11870827, -0.66137636, 0.27924734, -0.7339802, -0.42894232, 0.17209588, 1.1703713, -0.1511008, -0.27938917, -0.13280374, 0.86497086, -0.4407706, -0.3784376, 1.2453586, -0.21126446, -0.15996158, 0.48933926, -0.27048388, -0.2984165, 0.7081715, 0.58110875, -0.06946933, -0.27087092, -0.23854852, 0.36320952, 0.3962092, 0.11321919, 0.10443739, -0.56340504, 0.49124345, 0.6088691, -0.70054543, -0.09448326, -1.4692224, 0.24175254, -0.18142638, 0.3656459, 0.3561722, 0.39745298, 0.35550624, -0.25403917, -0.8084114, -0.3391734, -0.14518976, -0.31460696, -0.8502122, -0.20892489, 0.040290922, 0.36273193, -0.76562995, -0.80031925, 0.060696647, -0.15262939, -0.061190173, -0.09423466, 0.6150074, -0.5358167, 0.3251421, 0.28123394, 0.7587028, -0.4789124, -0.10876167, -0.18576714, 0.49481302, -0.09939133, 0.20352225, -0.5852573, 0.6395335, -0.3011577, -0.8522485, -0.31254715, 0.5950347, -0.26513442, 0.70972127, 0.43091288, -0.041825093, -0.2292053, -0.6451991, -0.34200215, -0.41545817, -0.2689111, -0.9946734, -0.25178003, 0.6669945, 0.17163065, -0.15006264, -0.9421287, -0.019158833, -0.6975499, 0.438868, -0.6849216, 0.03262051, -0.44509438, 0.64882565, -0.5953382, 1.1495787, -0.8011461, 0.20847918, 0.1251037, 0.32168102, -0.21917565, 1.0629005, -0.92278206, -0.37890035, 0.4195118, -0.21815889, 0.2514746, 0.6282729, -0.14128427, 0.050928507, -0.35163182, -0.06737878, -0.9663225, -0.4687798, -0.59459, 0.21002933, 0.048163563, 0.48905462, 0.14316124, 0.028260775, 1.2529061, 0.14390653, -0.21695222, -0.7194682, -0.66993797, -0.70739895, -0.5410352, 0.8340246, -0.2935943, -0.23657572, -0.4150082, 0.20044121, 0.6332451, -0.4892323, -0.016682208, 1.8937812, 0.7091852, 0.14414868, -0.9804469, 1.2162073, 0.17216161, -0.50498605, -0.34003568, 0.16963801, -0.33994526, 0.0731189, -0.41613013, -0.94484633, -0.815923, -0.5739614, 0.94484705, 0.31987455, 0.14467219, -0.14761059, -0.7047535, -1.0639687, 0.40880874, 1.3001518, -0.23591296, 1.0019474, 0.69951487, 0.33188945, 1.2750803, -0.47983044, 0.033220377, 0.12004468, 0.9492074, 0.9103111, -0.052080557, 0.58394325, 0.8401497, -1.830512, -1.4265813, -0.17748688, -0.061487965, -0.1359964, -0.88339686, -0.37029758, -0.13061845, -0.2954845, 0.2814227, 0.25465572, -0.19771555, 0.09913704, -0.15107808, 0.011260349, -0.14225599, -0.11415321, 1.0593241, -0.7078028, 0.5747197, -0.4055798, -0.18129641, -0.47820956, 0.1952592, 0.22990699, 0.5002197, 0.10373032, 0.628042, 0.06865163, 1.0157357, -0.6903584, -0.15411828, 0.6126792, -1.4284332, -1.3705213, -0.07465902, -0.11910443, -0.13134138, 0.41676903, -0.21215296, -0.028965306, 0.3505228, 0.047843248, 0.30888152, -1.1421498, -0.08647778, -1.1076055, -0.78975534, -0.05059923, 0.058172554, 0.27877957, 0.3418617, 0.27528864, -0.0043393373, -0.425253, 0.21216352, 0.02201505, 0.46995455, -0.35277224, 1.1497868, -0.7000632, -0.49699458, -0.36768207, -0.08427355, -0.106513396, -0.15144402, -0.6940467, -0.6297557, 0.4525672, 1.2141936, -0.12161607, 0.24308786, -0.1425119, -0.38016897, 0.91598785, -0.41090524, 0.14860485, 0.28929144, 0.21543092, -0.84538454, 0.0807224, -0.2773164, 0.5301908, -0.7331233, 0.49941978, 0.5512182, -0.5476493, -0.18183059, -0.77233905, -0.15702356, -1.1651708, -0.21300837, 0.018835044, 0.32697025, 0.34967226, 0.51722765, 0.09109617, 0.61710453, 0.062239163, 0.056631085, 0.06611446, 0.46277747, 0.13079983, 0.08349137, -0.17646214, 0.26698142, 0.046738572, 0.6847735, 0.38814327, 0.014033079, -0.04680039, 0.292931, -0.8164349, 0.3852389, 0.19666976, 0.37969127, -0.23450008, 0.45247716, 0.4581556, -0.9366612, 0.5417323, -0.055298187, -0.6215795, 1.218463, -1.3511043, -0.7937524, 0.008464169, -0.9959098, 0.7161945, -0.25348237, -0.68490624, 0.39310396, 0.3586596, -0.7416965, -0.18592128, 0.30235815, 0.63015443, -0.33157557, -0.89634436, -0.5073603, 0.27419057, 0.112835586, 0.471214, -0.9042775, -0.41822886, 0.71185523, 0.6571464, 0.33782732, 0.15355957, -0.1364721, -1.0384371, 0.64586115, 0.5162391, 0.52103496, -1.1132919, 0.1564614, -0.35837764, 0.7777977, -0.5688318, -0.19020915, 0.12580645, 0.23848471, 0.050079808, 1.4870666, 0.74930036, 0.11167382, 0.51369834, 0.0912603, 0.03457948, 0.97924113, -0.2526727, -0.6790167, 1.0118998, 0.17009932, 0.59963554, 0.38631436, 0.5874571, 0.35385707, -0.49165446, -0.43353337, 0.29959297, 0.90330774, 0.008084901, 0.19826728, 0.035730332, -0.26280853, 0.49997848, -0.3445545, 0.25782338, -0.29269776, -0.7271916, -1.1451478, -0.3687011, 1.2749437, 0.28989944, -0.010594554, 0.20570764, -0.039815754, 0.7760036, 0.83210295, -0.37314057, 0.34827492, 0.33832714, 0.2549089, 0.3180246, 0.15750375, 0.37374565, 0.29076517, -1.084236, -0.2536879, 0.09893724, 0.167326, -0.42620236, -0.06183477, -0.85039747, 0.7655713, 0.5407811, 0.135566, 0.61822957, -0.658225, 0.060597345, -1.0510322, 0.29207668, -0.40406957, -0.06383139, 0.8471315, -0.3460373, 0.0568925, 0.42080507, 0.50762975, 0.29434744, -0.07577321, 0.5478096, 0.31866163, 0.77027106, 0.5869493, -0.4031725, 0.34900978, 0.03501825, -0.60266703, -0.12610222, 0.48031133, -0.843012, 0.4924527, -0.8623877, -0.6477808, 0.22316428, 0.52191186, -0.42713517, -0.4163384, 0.02406159, 0.19311489, -0.8280169, 0.7257932, 0.5891742, 0.6126962, -0.107232764, -0.07629745, -0.50356364, 0.6316943, 0.1606891, -0.70639515, -0.12811224, -0.4105088, -0.08755256, -0.40668, -0.5366433, -0.30879006, 0.10060625, 0.28111058, -0.71532774, -0.3630196, 0.59962934, 0.15385062, 0.36727977, -0.45993006, 0.22452451, -0.23574719, 1.6684455, -0.043385856, 1.6276766, -0.16736466, -0.12352954, 1.0252162, -0.27102458, 0.59440255, 0.26338896, -0.2930035, -0.61721444, 0.6569015, -0.34776017, -0.38311705, -0.4351132, 0.751855, -0.44927332, 0.28445652, -1.4778186, -0.5496483, -0.834149, -1.1146356, -0.8802563, 1.0398924, -0.14450291, -0.022082053, -0.009103067, -0.8312893, 3.564548, 0.31639445, 0.43401474, 0.63638914, 0.048858773, -0.24585214, 0.42760444, -0.627559, 0.36051834, -0.75384, 0.3967399, 0.078143656, 0.12599553, 0.86665404, 0.050567865, 0.92432106, -1.5632179, 0.19709128, 0.12208514, -0.078961484, -0.91890043, 0.23671533, 0.47289363, 0.19900943, 0.7240069, 0.16399404, 1.1182141, -1.0169126, -0.1350502, -0.46091932, 1.2807544, 0.35965964, 0.21481083, -0.3007364, -0.39301196, 0.9101389, 0.1932972, 0.15104347, 0.14832743, 0.27131686, -0.067170985, -0.6418764, 0.50354594, 0.25878644, -0.0033070669, 0.70426977, -0.6287618, 0.31597823, 0.45087764, -0.04529953, 0.8379618, -0.3591785, 0.56057227, -0.5669976, -0.84720474, -0.052068297, -0.16401154, 0.30864736, -0.8251212, 0.22997884, -0.28843462, 0.20421404, -0.10270865, 0.12777951, -0.34080166, 0.28729475, 0.63097245, 0.62922233, -0.23039082, -0.9737556, -0.37730604, 0.021021312, -0.18025522, -1.0727465, 0.0019658804, 1.0562756, -1.0607209, 0.55097324, -0.095470026, -0.16923568, 0.29799882, 0.13360816, -0.015510071, -0.3002998, 0.29892552, 0.5038376, 0.07581481, -0.25795814, -0.26878086, -0.018943973, 1.1134932, 0.84816736, 0.07172927, -0.119864315, 0.16197601, 0.55967194, -0.1490119, 0.35443506, -0.12817872, -0.7264169, 0.35164982, 0.5088061, 0.36944637, 0.75947386, 0.22153465, -0.0902444, 0.35916293, -0.22257099, -0.6245021, -0.66597265, -0.2242328, -0.47101194, -0.09299229, -1.0377257, -0.21733049, -0.32486138, -0.23556301, -0.9277732, 0.023987524, -0.5385696, -0.002912309, 0.6834146, 0.06879748, 0.26568368, 1.1300062, -0.17972237, 0.1250636, -0.06957579, -0.9457501, -0.10762876, -0.7763465, 1.5165349, -0.51138073, -0.53803205, -0.7513938, -0.16054633, -0.057135716, 0.56398803, -0.7251428, -0.9011231, -1.1330264, -0.009565931, -0.46391025, -0.3945485, -0.019825712, -0.214825, 0.662374, 0.4089401, -0.25013703, -0.11175172, -0.3359659, -0.73787993, -0.44064045, -0.95422965, 0.24658713, 0.5482323, 0.44154587, 0.15066868, -0.90368706, 0.16147381, 0.23279902, 0.41150323, -0.14870353, 0.4448821, 0.3361582, -0.5416869, 0.66956925, 9.3244016E-4, -0.58035725, -0.9133776, -0.21026349, 0.47709528, 0.559402, -0.096517116, 0.34964085, 0.021026324, -0.052352354, 0.2260392, 0.083108045, -0.82103014, -0.49560097, 0.13991357, 0.72335935, -0.22744378, -0.17416112, -0.06924981, 0.1720519, -0.056980915, -0.0040308535, 0.4777559, 0.34662804, -0.6132766, -0.1805803, -0.58219105, -0.5035861, 0.743928, 0.62252325, -0.43229088, 0.42164406, -0.7834892, 0.19773507, -0.68034565, 0.15410969, -0.46971694, -0.5955516, 0.23321742, 0.61164176, -0.10516539, 0.581982, -0.7406695, 0.31757313, -0.69854766, 0.9880034, -0.84722793, -0.7633326, 0.4578721, 0.10518447, 0.16203061, -0.6790652, -0.47155732, -0.38882074, -0.9170391, 1.0266749, -0.17550212, -0.4792506, -0.0668991, 0.39064267, 0.0947658, 0.8043089, -0.22434905, -0.313821, 0.052670494, -0.048851267, 0.32592362, -0.860603, 0.2698992, 0.3433336, -0.21785763, 1.5819844, 0.88469046, 0.07691138, 0.09752565, -0.42556408, -0.04519853, 0.87291956, -0.6176682, -0.2865502, 0.20136131, 0.36512914, -0.3311012, -0.30614272, -0.26107365, 0.1894452, 0.32637066, 0.35523584, -0.06667226, 0.10347664, -0.11940256, -0.10296476, -0.38421103, 0.6074242, 0.18352178, 0.015820663, -0.14712866, -0.20719282, 0.6038181, -0.15472703, -0.039784297, 0.059039198, 0.4398168, 0.68517715, 0.592921, -0.48001018, 0.29964036, 0.059656337, -0.36691985, -0.11802984, -0.16027823, 0.8514473, 0.061800294, -0.24240336, -0.00616711, -0.2318474, -0.27456677, -0.20014185, 0.39548382, 0.08403352, -0.6075959, 0.7013164, -0.24715367, 0.7730584, -0.5263237, 0.6818461, -0.4345966, -1.9885256, -0.57651246, 0.3897464, -0.22896479, 0.029132985, 0.62822366, -0.3221436, -0.24454945, -0.13972506, 0.07538301, -0.43282226, 0.29167226, 0.26169014, -0.22840403, 0.12716646, 0.5241455, -0.67354554, -0.23412356, 0.1583346, 0.09397203, -0.6005605, -0.062070902, 0.519738, 0.56230676, 0.19490737, 0.09140409, 0.2827071, -0.7554103, 0.9776802, -0.28762445, -0.16992666, -0.27326876, 0.5205804, -0.39026648, 0.8100204, 0.2251311, 0.3743077, 0.41226578, 0.28279757, 0.10248689, 0.78833973, -0.39051318, -0.035605595, 0.6300383, 0.67743725, -0.18472652, -0.3580135, 0.14300483, -0.36656314, 0.09548992, 0.6840508, 0.53377825, 1.0797411, 1.0701865, -0.14112248, -0.1359908, -0.52505445, 0.2282274, 0.8130599, 0.10876868, -0.5497892, -0.06409781, -0.12850465, -0.08437914, -0.348632, -0.55334604, -0.057698317, -0.020369263, 0.0053720847, 0.16307293, -0.8254809, -0.10885659, -0.54735035, -0.9688062, -0.2985726, -0.051860273, -0.13334262, 0.35509858, -0.8054574, -0.28351018, -0.68802255, 0.17037089, -0.7018103, 0.8101351, 0.96281683, -0.053284153, -0.42187208, -0.41856027, -0.7051473, -0.43084157, 0.46245623, -0.6828755, 0.13075721, -0.12911314, -0.28247756, 0.683695, 0.07331526, 0.008655533, 1.0331321, 0.41872248, -0.43458146, 0.11952154, 0.4864054, -0.4770374, -0.672267, -0.7951411, 0.90124786, 0.38761422, -0.06815794, 0.4979946, 0.3519773, -0.51443356, 0.47134402, 0.32008561, -0.52492595, -0.5968779, 0.91214985, 0.62872326, 0.25207788, -0.78720355, -0.65435094, -0.3022893, -0.026059672, 0.03250689, -0.4841232, -0.21127056, 0.94293606, -0.31384826, -1.024962, 0.4258807, -0.5591192, -0.85103065, 0.07572705, -0.029542465, 0.9386782, -0.01834616, -0.41138232, -0.41427138, 0.080845095, -0.021675527, -0.25335732, 0.85154873, -0.83299226, 0.010143421, 0.7232927, 0.60553235, 0.1309088, -0.3839781, -0.5941144, -0.45264992, 0.38672507, 0.21139218, 0.34125578, -0.30670395, 0.5510206, 0.19656421, 0.7967939, -0.61074483, 0.032774314, 0.4495337, -0.4416033, 0.04436638, 0.19213377, 0.25077653, -0.1421333, -0.07981576, -0.80517834, -0.44514215, 0.12253037, 0.5937313, -0.7326427, 0.7710463, -0.47982028, -0.026294831, -0.27366686, 0.59971505, -0.88799405, 0.34242895, 0.011235021, 0.68797493, -0.31184798, -0.2491819, -0.39411223, -0.37572742, 1.597634, 0.5555229, 0.53293955, 0.85264903, -0.014117359, -0.04914263, -0.32758757, -0.42537898, 0.016268618, 1.7822325, 0.014657244, -0.33223224, -1.4506384, 0.8279289, 0.63178736, 0.70278394, 0.16083482, -0.11632228, -0.42550898, 0.2825111, 0.050327733, -0.62059164, 0.24553949, -0.84764546, 0.5793387, -0.19014005, 0.18559122, -0.60808384, -0.22480549, -0.10949272, 0.4119357, 0.48874575, 0.10797066, 0.14826402, 0.95159596, 0.1007035, -0.28172037, -0.78677756, -0.2911378, -0.39184836, 0.18129729, 0.14663315, -0.6903422, -0.6197286, -0.22756599, 0.4553, 0.7559648, -0.19024116, -0.7333675, -0.22558317, -0.10755519, -0.8364387, -0.24587573, 0.61560297, -0.116256624, 0.09515799, -0.61133057, -0.60270244, 0.11373564, -0.478234, 0.054566797, 0.21379222, -0.20055366, 0.4200289, 0.38137415, 0.57250637, -0.8365286, 0.46541566, -1.5011121, 0.007360235, -0.7604555, 0.0025998056, -0.5833547, -0.07466688, 0.39678958, 0.96836436, -0.2345093, -0.18433093, 0.3012629, 0.2799663, -0.70134974, -0.48911846, 0.7690916, -0.06511322, -0.49618146, 0.3662134, -0.6264914, -0.22856562, 0.24773872, 0.3183567, 0.13739681, 0.07009312, 0.23409715, 0.34881467, -0.33139125, 0.28852808, -0.095444344, -0.51926076, 0.51465845, 0.2062692, -0.5242261, -0.46329415, -0.9741153, 0.06456158, 0.030457906, 0.14805505, 0.17728561, 0.27969873, 0.4174524, -0.53553534, -0.050896656, -0.7748257, 0.07999295, -0.064726844, -0.6482009, -0.16539901, 0.52794135, 0.2680578, -0.54837555, -0.846483, -0.1018344, 0.2759287, 0.01647371, -0.30559725, 0.77830505, -0.42698085, 0.22914001, 0.29629123, 0.9014104, -0.6857988, -0.02880317, -0.27855328, 0.5116826, -0.09280562, -0.026375346, -0.82933587, 0.29830056, 0.10016385, -0.9599105, 0.06670639, 0.32166743, -0.12561196, 1.15202, 0.17707397, -0.08005495, -0.039337177, -0.2968356, -0.12169429, -0.36883074, 0.2049313, -0.6679535, 0.031608433, 0.52695143, 0.007821337, -0.1485552, -0.62809414, 0.13040474, -0.15451281, 0.54773754, -0.4706813, 0.24263154, -0.1301415, 0.67641205, -0.62720996, 0.8313544, -0.7381075, -0.14358105, 0.3762475, 0.62239164, -0.045437563, 0.9459873, -0.8233303, -0.7147683, 0.46758357, -0.52135533, 0.06063361, 0.56855184, -0.507306, -0.036665827, -0.6302179, 0.07766994, -0.942735, -0.5909925, -0.2635432, 0.5478883, -0.07890162, 0.32488316, 0.26487243, 0.46853012, 1.1034807, -0.06512659, 0.33847657, -0.61609834, 0.06321365, -0.22743702, -0.87944865, 0.37845594, -0.020726902, -0.59833187, -0.42895967, -0.11077006, 1.0032699, -0.1725022, 0.32639518, 1.6419518, 0.21870343, 0.1484011, -0.7495263, 0.5773338, 0.1948407, -0.26478645, 0.31931522, -0.02530934, -0.18381046, 0.039240766, -0.3821348, -0.880036, -0.40542898, -0.5050127, 1.0508015, 0.6978597, 0.27783167, 0.43318307, -0.686163, -0.95909375, 0.39126918, 0.736118, 0.010625005, 0.4478026, 0.5347271, -0.28854454, 0.7788674, -0.65132344, 0.028316252, -0.24979532, 0.3684371, 0.8357179, -0.35869396, 0.24370271, 0.33024335, -1.4370449, -1.2778331, 0.19882585, -0.017336432, -0.4316948, -1.2735684, -0.26503587, -0.015060261, -0.6085152, 0.22704697, 0.26457584, -0.42646304, 0.03879311, -0.19615118, 0.44677356, -0.32433823, -0.084605284, 1.198679, -0.51367915, 0.36138633, -0.26781407, -0.25285503, 0.10098021, -0.24817827, -0.18135414, -0.17848538, 0.35427713, 0.521286, -0.02674108, 0.4217017, -0.08987662, 0.25608358, 0.50207585, -0.98633564, -1.0628304, -0.3846806, 0.022207262, -0.1283618, 0.37523708, -0.24025467, 0.5153696, 0.46323073, 0.13989824, 0.1561494, -0.77944976, -0.44046345, -0.63301426, -0.34989792, 0.13549271, 0.006190121, 0.24559984, 0.31742877, 0.1545193, -0.44265345, -0.08644013, 0.28001422, 0.15021466, 0.85503155, -0.76575583, 0.86318636, -0.55829847, -0.25753778, -0.7185067, -0.085994214, -0.18091784, 0.446105, -0.77112305, -0.4430915, 0.2551184, 1.1472955, -0.40047967, 0.35478163, -0.4045759, -0.48856065, 0.7408055, -0.13986495, 0.09953445, 0.2774477, 0.2467106, -0.42283788, 0.21039721, 0.10461013, 0.31418386, -0.6786972, 0.964533, 0.6333979, -0.42829648, -0.2897507, -0.9437793, 0.067182526, -0.99148446, -0.31607157, -0.5791597, 0.04460093, 0.2817655, 0.21890405, -0.0091788955, 0.614969, 0.21509607, 0.26194388, -0.028229192, 0.6323737, 0.3229837, -5.941242E-4, 0.1451681, 0.3452308, 0.26828063, 0.82891965, 0.6615142, 0.15845887, -0.1930975, 0.32330292, -0.49461275, 0.33965734, 0.5015075, 0.22370936, -0.038758203, 0.33031383, 0.64308834, -0.22973657, 0.40101275, 0.1735294, -0.62445706, 0.63983095, -1.0835669, -0.59931755, -0.25685513, -1.0129862, 0.148363, -0.3387562, -0.7876695, 0.36497584, 0.4875883, -0.46318775, -0.30246222, 0.24639976, 0.3614344, -0.4353444, -0.7491151, 0.03876262, 0.014877375, 0.5000705, 0.48863775, -0.5708522, -0.29530814, 0.39000627, 0.18866692, 0.13831648, -0.38619447, -0.5484635, -1.1455809, 0.14575654, 0.41666955, 0.17747879, -0.8406549, 0.13223548, -0.45904288, 1.1353003, -0.26693252, -0.12810816, 0.37510347, -0.29213232, -0.43941584, 0.9184803, 0.6855956, 0.2599459, 0.6948795, -0.0708392, -0.12901774, 0.55323, -0.5387498, -0.716477, 0.42386472, 0.12503567, 0.6216118, 0.10394464, 0.8343109, 0.65234077, -0.41163832, -0.39263293, -0.108594045, 0.4115751, 0.16237709, 0.28965876, -0.07473482, -0.23911166, 0.2871039, -0.6131977, 0.513528, -0.11655871, -0.6466727, -1.1273916, -0.19115873, 1.4469596, -0.020101145, -0.11192806, 0.01993516, 0.26601622, 1.1657052, 1.008147, -0.6360585, 0.12956598, 0.9011077, 0.26741764, 0.13538633, -0.082566485, 0.21531783, 0.26441088, -1.1124214, -0.27627683, 0.34551474, 0.15321879, -0.21587288, -0.29057226, -0.5665258, 1.2804754, 0.5072227, 0.2061311, 0.39224344, -0.48967192, 0.2075164, -1.2929554, 0.22832677, -1.1763334, 0.05883432, 0.5320689, -0.19186282, -0.067902, 0.5984157, 0.33769348, 0.24878782, 0.11002658, 0.33792466, 0.547646, 0.7538705, 0.59686947, -0.19582872, 0.39902282, -0.3311249, -0.74637324, -0.14266883, 0.43165115, -0.6139184, 0.29811418, -0.7535113, -0.30266273, 0.53370935, 0.36760342, -0.5749821, -0.68662786, -0.2779321, 0.37260574, -1.1336465, 0.6302474, 0.47815326, 0.9866135, -0.14947067, -0.033082485, -0.2046695, 0.20482336, -0.21032988, -0.52653766, 0.0245497, -0.47625363, -0.12423223, -0.12356821, -0.32638925, -0.0979994, 0.0010491088, 0.29562947, -0.6457077, -0.10971795, 0.06126561, 0.8076332, 0.2573005, -0.21695858, 0.46280462, -0.5214897, 1.3339914, 0.23493724, 1.6153331, 0.18739215, -0.35449666, 0.6756968, -0.35441598, 0.49293745, -0.08351409, -0.24639843, -0.57777464, 0.98248875, 0.0011553783, -0.68022805, -0.1735664, 0.5991789, -0.5056995, 0.28030026, -1.3956647, -0.29886672, -1.040315, -0.6200091, -0.55999726, 0.4394985, 0.25020325, -0.030757431, 0.41339186, -0.99428976, 4.134183, 0.21829394, 0.2768517, 0.24642767, 0.027245255, 0.22640549, 0.47818106, -0.79617405, 0.4751648, -0.4929724, 0.5096883, 0.14533526, 0.087542474, 0.42481625, -0.26212215, 0.94900197, -0.995192, 0.37323165, 0.48663512, 0.16938138, -0.9202455, 0.32618392, 0.3355089, -0.12735334, 0.39952835, -0.4738593, 0.17960149, -0.8438873, -0.15847224, -0.28993642, 1.529727, -0.06471403, 0.040852357, 0.038847372, -0.25056893, 1.0816733, -0.30027992, 0.33796108, 0.057108454, 0.27828, -0.07463636, -0.7907264, 0.89314646, 0.11971448, -0.2797623, 0.56961, -0.5983841, 0.07197225, 0.6231197, -0.16240701, 0.8118333, -0.10884293, 0.36955264, -0.30067077, -0.54466736, 0.23035151, -0.11903405, 0.15843613, -0.9551723, -0.008313894, -0.09104793, -0.34124452, 0.019560076, 0.22333694, -0.46288738, -0.06519584, 0.8732297, 0.4417033, -0.3591715, -0.79684395, -0.18898311, -0.00398656, -0.32608062, -0.624982, -0.43221474, 0.7961611, -1.0244153, 0.6864666, -0.38873324, -0.66227776, 0.18808874, -0.2118657, 0.12453443, -0.20756744, 0.2250452, 0.5361353, -0.38134813, -0.12358688, -0.50916564, 0.06882605, 0.5491102, 0.6088567, 0.043271434, 0.034038477, -0.14568043, 0.34731272, 0.27437162, 0.4291449, -0.5072562, -0.6460547, -0.17843097, 0.4998613, 0.4862506, 0.48174888, 0.43009067, -0.07885784, 0.25953156, -0.44193333, -0.2746965, -0.72802746, -0.24735373, -0.46056688, -0.08113882, -1.2671432, 0.05059053, -0.43514493, 0.09988372, -1.3890023, -0.5439976, -0.5726784, 0.042483523, 0.45590004, -0.12616622, 0.629282, 0.96405625, -0.42434147, 0.29803038, -0.16519342, -0.9395849, -0.230326, -0.83917814, 1.4581625, -0.57237923, -0.5016961, -0.5101177, 0.03989938, -0.16089517, 0.91115934, -0.69840354, -1.4957484, -0.25355923, 0.24498278, -0.03987664, 0.28695616, 0.33610544, 0.42031482, 0.26267177, 0.26665464, -0.036663882, -0.3205201, 0.08044999, -1.3707422, -0.10242602, -1.2773657, 0.44744903, 0.4707493, 1.1146326, 0.52519447, -1.0453299, 0.22108254, 0.3916083, 0.51568663, 0.2354028, 0.50902164, 0.15007426, -0.6983879, 1.0460291, 0.11031413, -0.68165857, -0.867732, 0.08759557, 0.32828143, 0.90392447, -0.74337864, 0.6990192, 0.12273654, 0.1353184, 0.41217592, 0.24795906, -1.3185968, -0.7651147, 0.103916384, 0.6086596, -0.29084563, 0.022982366, 0.28086853, 0.55208766, -0.31949097, -0.01541844, 0.81749123, 0.83401155, -0.14799729, -0.33081663, -0.8713344, -0.20599653, 1.2038018, 0.81881714, -0.62137777, -0.08521465, -0.9437865, -0.19047725, -0.9235109, 0.07554969, -0.54554856, -0.72309697, 0.10257645, 1.2262453, 0.11698446, 0.5399791, -0.6098297, 0.077516764, -0.1635267, 0.7329004, -0.6491352, -0.43532693, 0.13268438, -0.062738866, -0.037672497, -0.6150539, -0.792422, -0.32316244, -1.1831503, 0.8048623, 0.43596715, -0.80266297, 0.20404984, 0.040005, 0.51196873, 0.61864376, -0.3671871, 0.039022297, 0.08777553, 0.34561458, 0.48366174, -1.1842922, 0.108419, 0.09672105, -0.4544338, 1.6715314, 0.8024864, 0.38295293, 0.11245011, -0.13004047, -0.25588313, 0.9442645, -1.106852, -0.3146361, 0.17383303, 0.26125604, -0.836142, -0.2676666, 0.09179972, -0.11250311, 0.35692418, -0.074471295, -0.117300734, 0.47520566, -0.5543069, 0.32387045, -0.66126156, 0.395984, -0.23777974, 0.31760883, -6.269303E-5, -0.42587698, 0.3092674, -0.26971295, 0.12728855, -0.09048116, 0.3214799, 0.6557833, 0.40655518, -0.043354645, 0.23725055, 0.05158411, -0.5487681, 0.47276476, -0.42214486, 0.96318287, 0.101917736, 0.04613815, 0.37172058, 0.35901445, -0.55353534, -0.28215954, 0.646838, 0.055748854, -0.94629276, 0.52053577, -0.096165426, 0.68151516, -0.86083305, 1.2210809, -0.61603034, -1.8547043, -0.70553493, 0.08560893, -0.32475078, -0.07537295, 0.9242262, -0.3031748, -0.039215017, 0.48975095, 0.07386944, -0.635114, 0.5792452, 0.11396569, -0.79614615, 0.47500247, 0.22382374, -0.7640738, -0.7832393, 0.32251167, 0.2957459, 0.19379763, 0.1966333, 0.19957598, 0.47575438, 0.72345144, 0.2891014, -0.07611428, -0.7970295, 0.68839777, -0.65931904, 0.18129885, -0.1070019, 0.4440913, -0.3229485, 0.87062204, 0.0016378155, 0.34254807, 1.0556462, 0.9242675, 0.3841158, 0.19424327, -0.5399717, 0.45922905, 0.4348209, 0.7463028, -0.23992652, -0.60218215, 0.26373464, -0.48176405, 0.3577192, 0.30109936, 0.18007952, 0.97340673, 0.8311445, -0.091018654, -0.43556908, -0.47817314, 0.24427673, 0.86847204, -0.63367134, -0.1392084, 0.20880738, 0.29605484, 0.5102095, 0.0539689, 0.025343515, 0.24565774, 0.20760463, -0.14849266, 0.07748646, -1.0975155, -0.2468316, 0.049564585, -0.81448174, 0.07844066, -0.5533479, -0.12086342, 0.34281364, -0.47970983, 0.012860723, -0.20691025, -0.09066814, -0.6537314, 0.488608, 0.72847027, 0.43217465, -0.3573188, -0.2835165, -0.7994006, -0.60978246, 0.6759259, -0.74162185, 0.021587722, 0.2148367, -0.31782195, 0.15477072, 0.073249355, -0.2504549, 0.9304441, -0.109614864, -0.39431396, -0.13444294, 0.113385625, -0.17943051, -0.13110475, -0.6351985, 0.8168083, 0.7287063, 0.046382003, 0.78491753, 0.12041721, -0.44125587, 0.65859365, 0.1417125, -0.62944174, -0.8578431, 0.5297364, 0.5970799, 0.32134923, -0.6988253, -0.3988505, -0.53683966, -0.5645854, -0.26411146, -0.54879487, -0.08550332, 0.5523895, 0.09527285, -1.4829303, 0.42620313, -0.32207206, -0.80331665, -0.14081834, 0.14321318, 1.0547477, -0.014484324, -0.3733287, -0.6547246, -0.22136927, 0.23872378, -0.114890546, 0.52663624, -0.36137518, -0.10336557, 0.84902483, 0.24802007, 0.2428974, -0.55062777, -0.898774, -0.086360104, 0.42273575, 0.01069665, 0.03268071, -0.22184242, 0.68654114, -0.31356922, 0.99203634, -0.8053663, 0.024493441, 0.52120054, -0.14788416, 0.16501157, 0.71239144, 0.10519813, -0.23112617, -0.30074418, -0.7945606, -0.32828715, 0.1546241, 0.71328896, -0.8631298, 0.6879144, -0.25349656, -0.15505737, -0.52401733, 0.026135508, -0.91197675, 0.4897887, 0.2553321, 0.38357615, -0.5817329, 0.10147074, -0.14365219, -0.07878406, 1.460639, 0.76415765, 0.44990405, 0.9951974, -0.10996676, -0.43003532, -0.6043866, -0.97104216, -0.10857196, 1.7999303, -0.2487742, -0.23330228, -1.9624965, 0.8282924, 0.3562973, 0.99590814, 0.710325, -0.74927074, -0.47313, -0.23652235, 0.17110118, -0.64118886, 0.18618682, -1.0815334, 0.4417191, -0.27619588, 0.13438608, -1.2182668, 0.09222232, -0.046028994, 0.5128414, 0.6309838, 0.17811278, 0.08257908, 0.82218415, 0.24052832, -0.3043413, -1.1845739, -0.31409425, -0.5495012, -0.102475435, 0.6949858, -0.60669345, -0.5356563, -0.12042385, 0.51972234, 0.9788067, 0.27975333, -0.6509743, 0.08709107, -0.3396774, -1.0324789, 0.21493271, 0.64101464, -0.4424937, 0.35320687, -0.8626394, 0.018576376, -0.14504273, 0.0675314, -0.09590454, 0.14231923, -0.32527098, 0.15347226, 0.50280917, -0.12097482, -0.93272054, 0.6082158, -1.5437937, -0.07995024, -0.6858374, 0.39547303, -0.5739462, -0.52489924, 0.041147597, 1.3033543, -0.17370999, -0.22331943, -0.12098679, 0.7863538, -0.6103873, -0.3908378, 1.0210451, -0.33337703, -0.335317, 0.679813, -0.03252794, -0.46655637, 0.58323187, 0.526237, -0.17061844, -0.47416002, -0.35893548, 0.4063307, 0.32042253, -0.0637602, 0.13230446, -0.44979116, 0.5168601, 0.33988982, -0.7665607, 0.0853706, -1.2825401, 0.35769534, -0.21235913, 0.25373393, 0.2737563, 0.4383112, 0.26156312, -0.18157701, -0.82445776, -0.54746836, -0.19033858, -0.14472756, -0.8237075, -0.20849845, 0.09290561, 0.45805925, -0.60196894, -0.9694583, 0.22632071, -0.15821098, -0.07559876, -0.13461533, 0.6933839, -0.32768452, 0.3443336, 0.31391212, 0.9203925, -0.36575687, -0.20933554, -0.31347826, 0.5546571, -0.016795274, -0.092404574, -0.5469727, 0.6365913, -0.43841305, -0.8389967, -0.036488578, 0.61133695, -0.3538103, 0.76916534, 0.2602567, 0.04585594, -0.20960002, -0.69782466, -0.073778585, -0.4628681, -0.31100827, -1.194452, -0.15880762, 0.61074346, 0.01697435, 0.08602919, -1.0204202, -0.1064734, -0.5719034, 0.3842537, -0.61645734, 0.005817363, -0.5069963, 0.73048353, -0.58076227, 1.1014149, -1.002687, 0.26485753, 0.001325082, 0.23775855, -0.1090179, 0.8222375, -0.8824368, -0.60530984, 0.38780227, -0.18472426, 0.18662238, 0.6539168, -0.08568022, 0.0025433525, -0.35558033, 0.019322174, -0.88901633, -0.6802375, -0.69873244, 0.29876226, 0.03279008, 0.41753015, 0.15544944, 0.136213, 1.1869895, 0.13588208, -0.24654882, -0.68050987, -0.6760854, -0.6779837, -0.68511623, 0.96097136, -0.5064433, 0.005498264, -0.47417802, 0.14546248, 0.7594362, -0.367512, -0.098296344, 1.961263, 0.35767633, 0.03230954, -0.69004714, 1.1331533, 0.27895185, -0.49140096, -0.07016089, 0.16740261, -0.34845498, 0.25857598, -0.37114236, -0.92653924, -0.78350365, -0.41225216, 0.69445866, 0.34486955, 0.093205795, -0.066756755, -0.64549917, -1.1127244, 0.37053987, 1.1387469, -0.23592287, 0.80528295, 0.63944227, 0.54414797, 1.0815576, -0.5668222, 0.089382716, 0.13776606, 0.9200868, 0.8992326, -0.27931058, 0.48805022, 0.82883877, -1.7794003, -1.3662231, -0.16744435, 0.084341876, -0.107593, -1.017171, -0.3791846, -0.14377698, -0.27979684, 0.51328593, 0.26247755, -0.27690327, 0.076862276, 0.0780327, -0.07342488, -0.061520025, 0.0024008472, 0.8332128, -0.6966219, 0.4901986, -0.24039306, -0.14298935, -0.24950793, 0.12527625, 0.29839414, 0.7389395, 0.15047178, 0.58706343, 0.12560952, 1.0310695, -0.5962883, -0.18943071, 0.6150714, -1.2840291, -1.3595079, -0.15191634, -0.25942472, -0.17627351, 0.3720213, -0.10289232, 0.056950808, 0.3213657, 0.3321522, 0.053539947, -1.0371126, -0.052774735, -0.87331986, -0.7267541, 0.051209338, 0.1441378, 0.31906247, 0.46871975, 0.18395185, -0.0692848, -0.42856544, 0.01773473, -0.1260064, 0.71401536, -0.27404174, 1.3056145, -0.61608034, -0.3932829, -0.24632904, 0.010613654, -0.21523128, -0.08095754, -0.4983497, -0.626685, 0.64032483, 1.0719864, -0.35518745, 0.31677714, -0.09860298, -0.29361737, 0.98726356, -0.28703505, 0.37888417, 0.2140752, 0.36996755, -0.71319747, 0.2214708, -0.3875488, 0.37793255, -0.7721462, 0.6461019, 0.6115026, -0.5304169, -0.17443098, -0.70448905, -0.021181267, -1.0428503, -0.34047216, -0.06293756, 0.17875059, 0.28179625, 0.44505474, 0.16711755, 0.6964868, 0.2429418, -0.048931554, 0.101600535, 0.29270682, 0.14754868, 0.040776677, -0.2830106, 0.24993977, 0.18217126, 0.5031197, 0.6458861, 0.08088947, -0.06821887, 0.2294434, -0.6025328, 0.4214955, 0.02959657, 0.31607035, 0.048564933, 0.36561626, 0.4328048, -1.0279614, 0.5526877, -0.3101868, -0.7041938, 1.2670145, -1.0038794, -0.7538339, -0.051289015, -0.99725854, 0.54648906, -0.11038782, -0.8033994, 0.31729695, 0.11359299, -0.5800839, -0.29594612, 0.130738, 0.6961497, -0.31145877, -0.6745281, -0.3327659, 0.3130085, 0.12843235, 0.3653333, -0.8100079, -0.22264737, 0.5917342, 0.86295915, 0.3166489, 0.16683327, -0.26316214, -0.8232067, 0.5095601, 0.20595878, 0.45409048, -0.8229478, 0.10812789, -0.47012043, 0.8713862, -0.64504915, -0.24139825, 0.0829124, 0.30529198, -0.04502464, 1.3450638, 0.87469786, 0.1282358, 0.21878737, 0.5608324, -0.023736248, 0.8814906, -0.2450681, -0.64366734, 0.987674, 0.47663254, 0.72472185, 0.20790745, 0.4268311, 0.3406033, -0.40542594, -0.44307786, 0.21143325, 1.1998398, -0.04269371, 0.032475434, -0.028270632, -0.28937843, 0.63828766, -0.4257946, 0.30673802, -0.20225716, -0.8918963, -1.081641, -0.446235, 1.3505905, 0.28334346, -0.113350704, 0.10584864, 0.13026781, 0.9782037, 1.2069069, -0.59382397, 0.13534994, 0.20910484, 0.3964433, -0.08584341, -0.18862218, 0.29279798, 0.10304643, -1.0189443, -0.48712122, 0.089892246, 0.40033635, -0.43739498, -0.09577835, -0.8914217, 0.5634942, 0.46147624, 0.18333669, 0.5018127, -0.57141834, 0.22123447, -0.984082, 0.73240864, -0.42637298, 0.14858729, 0.58898765, -0.41788393, 0.15860158, 0.5590106, 0.5476727, 0.38015527, -0.06930857, 0.63783866, 0.19000062, 0.5320519, 0.85254997, -0.25869924, 0.36578634, 0.059271112, -0.82330275, -0.10596946, 0.32942462, -1.0458459, 0.47975013, -0.9814856, -0.54931, 0.12817167, 0.4720524, -0.60098046, -0.5558935, -0.07903196, 0.08017051, -1.0334187, 0.72646886, 0.28693724, 0.6514715, 0.017122403, 0.059414208, -0.43003318, 0.61294556, 0.15250102, -0.6344637, -0.124711365, -0.40405872, -0.21501787, -0.5084465, -0.6109873, -0.29131338, 0.21077976, 0.4723583, -0.6350576, -0.42727095, 0.3745004, 0.2436617, 0.16013308, -0.266916, 0.41006523, -0.13443582, 1.4617592, -0.09403017, 1.6679444, -0.113599226, -0.1766919, 1.1128019, -0.4637022, 0.6026775, 0.3295456, -0.26246035, -0.58322674, 0.63749, -0.29790995, -0.4552287, -0.34962073, 0.4757661, -0.38596824, 0.40881908, -1.6522696, -0.56499016, -0.9354418, -1.0565773, -0.9105244, 1.0067492, 0.12771598, -0.004504431, 0.23984769, -0.66904426, 3.6624045, 0.2592154, 0.27187067, 0.5508017, -0.10568046, -0.2670927, 0.5288961, -0.6268612, 0.20718782, -0.9910453, 0.4760573, 0.0844937, 0.11704531, 0.7277677, 0.06835682, 0.9558804, -1.4853053, -2.8017908E-4, 0.11895311, -0.11955248, -1.2167906, 0.5527989, 0.5219648, 0.25548583, 0.5149375, 0.123984054, 1.0438063, -1.0745394, -0.09779909, -0.5746613, 1.2606201, 0.4869489, 0.02342626, -0.30612367, -0.4081654, 0.54757965, 0.18535367, 0.089302, 0.14784724, 0.33126256, -0.024330921, -0.46541923, 0.44284585, 0.052763782, 0.093688585, 0.49122953, -0.9165186, 0.34113777, 0.31382066, -0.054380115, 0.8466793, -0.28731346, 0.28629318, -0.57786727, -0.5250714, -0.15221663, 0.029823096, 0.40237293, -0.7914292, 0.24210334, -0.42463204, 0.25620586, -0.21277969, -0.050531507, -0.18733416, 0.16404244, 0.696484, 0.25563902, -0.18624108, -0.8773365, -0.56324744, 0.31544864, -0.31330204, -0.8109294, -0.13510668, 0.9721738, -1.0318075, 0.26569387, 0.038234264, -0.31428084, 0.22263722, 0.06329511, -0.15759473, -0.36926627, 0.17948699, 0.5136905, 0.01984401, -0.19416128, -0.38064262, -0.37309346, 1.102059, 0.7792553, 0.060157903, -0.108390525, 0.11017364, 0.3994228, 0.09555158, 0.5825012, -0.60580367, -1.0827808, -0.1576766, 0.7572717, 0.51690817, 0.76832026, 0.5623794, -0.5242806, 0.10713714, -0.28198227, -0.3057894, -0.4436093, 0.0508234, -0.67036074, -0.50983393, -1.126107, 0.10048007, -0.28169256, 0.06555464, -1.1903594, -0.55183387, -0.4405081, -0.17009944, 0.5612562, 0.047636222, 0.37082034, 0.65144277, -0.21440561, 0.19920659, -0.08983047, -1.3184719, -0.21471508, -0.77892214, 1.0248505, -0.60647166, -0.48059314, -0.38415653, 0.33976716, 0.0074042156, 0.3431964, -0.7637138, -1.562081, 0.21412212, 0.41796106, -0.21860333, -0.036963142, -0.15398574, -0.067759186, 0.6621827, 0.14345872, -0.10131864, -0.15699252, 0.3062003, -0.93177044, 0.110051446, -1.2522842, 0.80647933, 0.19306532, 0.93869627, 0.41989905, -1.2128512, 0.048087396, 0.43417054, 0.51452124, 0.22957322, 0.6538078, 0.045719445, -0.49581295, 0.6129913, 0.2330572, -0.76418656, -0.59514874, 0.10234557, 0.34008834, 0.93430877, -0.7938407, 0.3488256, -0.095158495, 0.39193368, 0.32834923, -0.1460364, -1.1935029, -0.7402658, -0.06672922, 0.34790787, -0.24937785, -0.09675882, 0.54674053, 0.29830703, -0.25361973, 0.26495603, 0.8386657, 0.93270355, -0.30766344, 0.10872549, -0.54271966, -0.2646044, 0.80850345, 0.80533385, -0.3436443, -0.15843843, -1.1156524, -0.37078837, -0.9744277, 0.38333637, -0.7051673, -0.4906921, 0.054198608, 1.0482272, -0.16283801, 0.28291935, -0.2076324, 0.24571949, -0.42660946, 0.6194447, -0.5943218, -0.2044191, 0.80598855, 0.033541154, -0.16847873, -0.4267447, -0.5693771, -0.32211003, -0.80143666, 0.52846223, 0.42857355, -0.2879928, 0.25050047, 0.05486901, -0.059970193, 1.0365646, -0.21031526, -0.2751096, 0.4085902, 0.5967447, 0.46310297, -1.244204, 0.2939693, -0.06727497, -0.65307546, 1.6378098, 0.6602727, 0.3331953, -0.5972358, -0.16830699, -0.4092154, 0.9061645, -0.70522636, -0.30478314, 0.21947536, 0.30807325, -0.5290096, -0.021191731, -0.048273534, 0.052654807, 0.4325883, -0.002106417, 0.22604083, 0.6506453, -0.4128863, 0.06486968, -0.5109035, 0.6262629, -0.59054273, 0.54796576, -0.078081556, -0.22457956, 0.10496932, -0.7126875, -0.07178986, -0.014613241, 0.25202245, 0.6094514, 0.7096744, 0.17859364, -0.07159945, -0.10782984, -1.0702442, 0.2905703, -0.06708715, 0.73710424, 0.025326883, -0.04851279, 0.2838625, 0.100776896, -0.47360796, -0.23008478, 0.7629225, 0.4038585, -1.1927986, 0.7186655, 0.17397834, 0.66196936, -0.3637218, 1.0107775, -0.55020744, -1.4909959, -0.56990623, 0.30201685, -0.20511222, 0.2730165, 0.73218584, 0.048040986, -0.044010743, -0.15303451, -0.17348513, -0.39569393, 0.6480931, 0.10182218, -0.5377528, -0.012679113, -0.007665368, -0.65783006, -0.6718512, 0.36023977, 0.50482917, 0.112826176, -0.16764028, 0.09783888, 0.54286546, 0.82194656, 0.32949015, -0.10446587, -0.66156757, 0.44045573, -0.6881772, -0.12748857, 0.011206888, 0.5880827, -0.3310844, 0.60313576, 0.24298477, 0.18763687, 0.6665168, 0.8176408, 0.63851047, 0.7703525, -0.38874447, 0.29319334, 0.21659724, 0.67248577, -0.04747004, -0.75138336, -0.032682426, -0.58525085, 0.6164005, 0.5252805, 0.067715034, 0.77593464, 0.5756692, 0.01080169, -0.5409408, -0.18088111, 0.28055167, 0.7370628, -0.061915897, -0.14930114, 0.42736712, 0.07878585, 0.6338375, 0.028980128, -0.018971909, 0.24936385, -0.10556009, -0.007052973, -0.08535256, -1.1767282, -0.25823215, -0.16164792, -0.59529424, -0.04154039, -0.43678924, 0.16663226, 0.3614608, -0.4110936, -0.12785242, -0.561177, -0.49575725, -0.53649414, 0.55716574, 0.9938018, 0.3834205, -0.4088232, -0.16438262, -0.8488413, -0.68160176, 0.48920587, -0.35171676, 0.17286812, 0.14482836, -0.4438081, 0.34934083, -0.11522612, -0.18400648, 0.9550849, 0.19140965, -0.25227302, 0.060297303, -0.0070842654, -0.15262157, -0.484868, -0.6926102, 0.84828264, 0.91567695, 0.0016165003, 0.6874639, 0.023342803, -0.5647343, 0.4872593, 0.36987463, -0.53967863, -0.7367035, 0.6690624, 0.36760825, 0.41536736, -0.70216143, -0.78941077, -0.46292698, -0.32272416, 0.00408322, -0.569716, -0.0982589, 0.7778945, -0.22264656, -1.2859204, 0.14981261, -0.4571321, -0.84205663, -0.3931107, -0.13485941, 0.7186496, -0.11406441, -0.19351138, -0.3396683, -0.12722772, 0.0022645625, -0.023715228, 0.7800383, -0.23587298, 0.32181016, 0.6075423, 0.20606756, 0.08583229, -0.3835686, -0.76363343, 0.11516355, 0.26286107, 0.15805645, 0.010979824, -0.28352818, 0.42406383, -0.06747039, 0.7641131, -0.8182565, -0.031834044, 0.59817415, -0.556535, -0.13097134, 0.45006514, 0.45921433, 0.18680452, -0.2353987, -0.39224648, -0.20950153, 0.44744873, 0.7575571, -0.99211806, 1.0048358, -0.21880436, -0.29180026, -0.4883183, 0.11914819, -0.45420957, 0.5537008, 0.038552634, 0.28215736, -0.6505611, -0.05639731, -0.22432365, -0.0753257, 1.534879, 0.6527801, 0.33230194, 0.5043558, -0.17230092, -0.5368485, -0.60196584, -0.972783, -0.35474154, 1.5653621, 0.13357976, -0.23607488, -1.9256357, 0.99502707, 0.56387746, 0.95426637, 0.44848073, -0.6578555, -0.5840174, -0.21664485, -0.06438644, -0.6586791, 0.713435, -0.7542643, 0.4121706, -0.47967133, -0.5214753, -0.86162406, -0.41749653, 0.16635127, 0.67231923, 0.63377875, 0.060160317, -0.16357699, 0.70590246, 0.24508043, -0.31862876, -1.0028367, -0.1415234, -0.4981313, -0.07634404, 0.5626511, -0.5439674, -0.41470236, -0.32987338, 0.38528684, 0.8707138, 0.61265385, -0.7561777, -0.058350243, -0.29060918, -0.8828205, -0.32191333, 0.7171919, -0.6715127, 0.25353637, -0.85777193, -0.22826701, -0.10268143, -0.3677761, -0.21263666, 0.39470083, -0.50553197, 0.104695916, 0.38097295, 0.37870398, -0.7951013, 0.5898909, -1.4096434, 0.18723375, -0.67144465, 0.08446455, -0.32043055, -0.21069425, 0.060452625, 0.89954424, -0.33245453, 0.060212478, -0.16919714, 0.51581824, -0.46913767, -0.43260145, 0.8914732, -0.17595634, -0.39337397, 0.5862695, -0.165371, -0.41703492, 0.2300126, 0.8531972, 6.863475E-4, 0.018732369, -0.19274993, 0.11807219, 0.16294602, -0.13752386, 0.17776681, -0.7283606, 0.5255629, 0.21245965, -0.61398387, -0.019701332, -1.1922736, 0.072056726, -0.15926456, 0.06668207, 0.6565079, 0.3800544, 0.2927567, -0.18829279, -0.47632927, -0.5828585, -0.2932791, -0.32696068, -0.44982386, -0.1601027, 0.23962039, 0.35986, -0.6936998, -0.4130165, -0.028386503, 0.1189172, -0.23614475, -0.13688965, 0.8730439, -0.3260798, 0.6230809, -0.009794818, 0.64238536, -0.30446264, -0.1213474, -0.21677762, 0.64032716, -0.09058951, 0.32761735, -0.8952577, 0.7286184, -0.28435072, -1.0795968, 0.07461093, 0.5260262, 0.081124514, 1.1400597, 0.20557263, -0.22531477, -0.013032559, -0.63784456, -0.25429648, -0.43621144, -0.25980812, -0.68846905, 0.018888742, 0.40777546, 0.31415194, -0.06978384, -0.83367103, -0.47623697, -0.50554305, 0.050676435, -0.54136133, 0.09123197, -0.46119207, 0.8309509, -0.9467837, 1.3522601, -0.56323236, 0.04193849, -0.083614424, 0.65520114, -0.07264876, 1.2610217, -0.6354654, -0.54056776, 0.70698595, 0.00911441, 0.20147234, 0.8186352, -0.38808322, -0.081993535, -0.18767877, 0.27850354, -0.8085504, -0.6826043, -0.70434916, 0.28125268, -0.00417158, 0.1764245, 0.1252622, 0.13679127, 1.1405021, -0.16482627, -0.04663332, -0.58190393, -0.45656186, -0.49414352, -0.6545142, 0.7316151, -0.75474155, -0.13049766, -0.78929186, -0.1713476, 0.68869865, -0.1354918, -0.12297894, 1.374426, 0.53188884, -0.19543867, -0.7560643, 0.7825549, -0.20464867, -0.6691693, -0.024741076, 0.15538393, -0.20939259, 0.09335803, -0.32170793, -0.9581545, -0.3086296, -0.45974192, 0.9343871, 0.28155223, 0.026325535, 0.3607343, -0.51085424, -0.68860966, 0.51546973, 0.9578018, -0.32939222, 0.88570464, 0.8727469, 0.282832, 1.3196431, -0.46789652, 0.18751012, -0.009741772, 0.7062707, 0.7235945, -0.44040543, 0.32659394, 0.82885027, -1.513391, -1.0347612, -0.31969503, -0.17150323, -0.31322023, -1.0168256, -0.39043573, -0.32385135, -0.62966126, 0.4967361, 0.14318325, -0.02364469, -0.18822855, 0.36839056, 0.31844568, -0.25449395, 0.2378134, 1.1323748, -0.57734036, 0.57482517, -0.25512508, -0.3082748, -0.19442557, -0.1397948, -0.37038362, 0.7746373, 0.19150639, 0.057238307, -0.5009022, 0.7646541, -0.3515749, -0.1592197, 0.671271, -1.4349705, -0.87009597, -0.58153695, -0.0132568665, -0.26201454, 0.46259606, -0.24323648, 0.4780776, 0.24452041, 0.022693053, 0.21807481, -1.0536666, -0.3690221, -0.9724109, -0.5958498, 0.2780582, 0.17680575, 0.30712324, 0.33505383, 0.24084339, 0.3497074, -0.066905096, -0.046884567, -0.19839972, 0.49531293, -0.1463247, 0.68853134, -0.57161236, -0.5265372, -0.46173963, -0.29136887, -0.09823992, -0.25131285, -0.49662158, -0.29860687, 0.4173069, 0.61001307, -0.23230451, 0.33880717, -0.38124043, -0.62723, 0.7280858, -0.41596067, 0.12235218, -0.046359077, 0.1374916, -1.0030403, 0.076998085, 0.010334268, 0.16277502, -0.75184274, -0.045661084, 0.6897451, -0.5234157, -0.20258962, -0.35811937, -0.16314638, -1.2877578, -0.29840237, 0.11212779, 0.1864383, 0.30804637, 0.47436863, 0.07938605, 0.23727947, 0.15619943, 0.15607107, 0.3661412, 0.19492516, 0.52977335, 0.14330177, -0.39681092, 0.1595948, -0.17317334, 0.92330325, 0.95668155, 0.16457509, -0.082535796, 0.33720917, -0.6979915, -0.18996246, -0.18736917, 0.0076782946, 0.04778067, 0.4375449, 0.4449576, -0.5646165, 0.4824912, -0.73924667, -0.41778222, 1.228386, -1.4113506, -0.5091015, 0.018879347, -1.0306215, 0.3441526, -0.29703033, -0.76199734, 0.48998946, 0.0538232, -0.6444448, -0.55421084, 0.46473855, 0.41143027, 0.023548841, -0.5623564, -0.15067895, 0.5425395, 0.02348781, 0.33763394, -0.99986434, -0.40732938, 0.64412487, 0.61347324, 0.1844104, 0.060828157, 0.19362581, -0.89388067, 0.44956368, 0.61369896, 0.52955574, -0.93781817, 0.3274699, -0.2934738, 0.886754, -0.7060228, -0.09946883, 0.28589666, 0.38918224, 0.019775577, 0.8416462, 0.60078466, 0.22841358, 0.7777619, 0.048576668, 0.12920377, 0.708591, -0.17719474, -0.62505966, 1.0092452, 0.61805975, 0.53742653, 0.11385523, 0.30024686, 0.50781274, -0.65055555, -0.3315245, 0.089441545, 0.6801583, -0.055591352, 0.5085515, 0.080202654, -0.6231575, 0.7095781, -0.09222566, -0.0023482144, -0.2301088, -0.78504163, -0.89850014, -0.61895406, 1.4755174, 0.44006103, 0.3736515, 0.2789185, 0.3126807, 1.0981504, 0.5982582, -0.5319362, 0.2933641, 0.59055275, 0.449096, 0.09719907, 0.23644274, 0.4262668, 0.19561322, -0.99225354, -0.27452955, 0.0054776296, 0.42809853, -0.3454189, 0.024061855, -0.7582559, 0.4612135, 0.5061168, 0.16127184, 0.2933835, -0.74961704, -0.08755819, -1.038512, 0.52964205, -0.6356245, -0.039177597, 0.8408139, -0.43552092, -0.22568429, 0.6004227, 0.5666311, 0.34723854, 0.17451535, 0.46295786, 0.57787806, 0.5428326, 0.93625444, 0.25844303, 0.71137315, -0.17457405, -0.9393191, -0.0062135123, 0.7324282, -0.8502125, 0.21925573, -0.6307975, -0.40189654, 0.27061498, 0.65880245, -0.59898424, -0.7496212, 0.03331019, 0.19341184, -0.50549847, 0.76212996, 0.35790926, 0.7870286, -0.0400087, 0.055058934, -0.5947467, 0.26547173, 0.13392746, -1.1119648, -0.17382655, -0.5744398, 0.111572, -0.59631276, -0.62594944, -0.097791016, -0.35199642, 0.2313174, -0.58278424, -0.08641501, 0.34744838, 0.34512728, 0.500954, -0.7685111, 0.46870387, -0.10193086, 1.6084917, -0.03636925, 1.4086537, -0.063865475, -0.0015128739, 0.92001283, -0.38939625, 0.45528454, 0.31051323, 0.1577892, -0.5681765, 0.7005183, -0.5051335, -0.34040785, -0.28615594, 0.8032139, -0.46363586, 0.21622391, -1.2667955, -0.29988098, -0.81864244, -0.8201505, -1.1678752, 0.75056106, 0.098227546, -0.010810759, -0.014191384, -0.42939845, 3.9035187, 0.15681595, 0.2582419, 0.4887771, 0.1525703, -0.02428957, 0.66500604, -0.5359085, 0.22960104, -0.7852579, 0.15039048, 0.06367845, 0.3528753, 0.9337709, -0.20073745, 1.0146337, -1.0692636, -0.24778748, 0.23142752, -0.14437445, -1.2041767, 0.28693214, 0.37165838, -0.035585634, 0.52149665, -0.11201562, 0.60554165, -1.043031, 0.06837402, -0.4101506, 0.8253852, 0.12620798, 0.22745697, -0.13505921, -0.45202237, 1.1835434, 0.25073954, 0.1395775, 0.10847205, 0.25401965, -0.37892976, -0.6354462, 0.36379182, 0.1980045, 0.09259137, 0.7982754, -1.1515712, -0.24035174, 0.6636571, -0.15318638, 0.58441776, -0.48915377, 0.5170015, -0.2060879, -0.7129818, -0.1414245, -0.43068886, 0.18446523, -0.9598793, -0.2197116, -0.19919111, 0.12266955, -0.10918245, 0.35740358, -0.3485523, -0.22071102, 0.5921739, 0.5802294, -0.22553721, -0.7331374, -0.5409138, 0.4591624, -0.25060326, -0.6027513, 0.1528463, 1.0014454, -0.9771162, 0.30428672, -0.31012374, -0.36872467, -0.45164657, 0.3022587, -0.3332075, -0.05958897, 0.5864512, 0.29134268, -0.2936555, 0.14974032, -0.21069044, -0.21046856, 1.0327365, 0.87497103, -0.29114136, -0.12409274, 0.30638078, -0.008108355, -0.074863106, 0.1823267, -0.92456347, -1.2252402, 0.023988292, 0.29588172, 0.28956586, 0.92870545, 0.6245167, -0.17748761, 0.49881747, -0.0013700202, -0.6062493, -0.5211433, -0.044155214, -0.58735853, -0.3184926, -1.1066936, 0.31925192, 0.055742487, -0.11290029, -1.2357664, -0.013144705, -0.5662862, 0.06639056, 0.35374135, 0.38557136, 0.20628467, 0.5110246, -0.42163143, 0.12925106, -0.24695382, -1.1608903, -0.15010446, -0.3606254, 1.2112582, -0.5199689, -0.24509984, -0.57505196, 0.06266602, -0.05476774, 0.5543311, -0.6631306, -0.90839344, 0.056663997, 0.39264026, 0.006514296, -0.03379453, -0.06360012, 0.2962194, 0.43456346, 0.29512823, 0.15175281, 0.034137387, -0.15923557, -0.86211294, 0.07326408, -0.80600816, 0.67977273, 0.49671376, 0.6821382, 0.27394387, -1.536363, 0.57825166, 0.7842151, 0.2394658, 0.09236379, 0.6696022, 0.22107342, -0.5844541, 0.68800783, 0.35063517, -0.7489135, -0.84657335, 0.13539974, 0.011126772, 0.83486915, -0.3726464, 0.38500214, 0.15931323, 0.24204169, 0.31334576, -0.38999516, -1.0564649, -0.8066621, 0.32243422, 0.08050046, -0.100161314, 0.1417718, 0.26810834, 0.27799317, -0.24338469, -0.1273042, 0.47630495, 0.761901, -0.31447634, 0.0041330475, -0.6132874, -0.35413107, 0.50921535, 0.92908055, -0.7377505, 0.17884433, -0.97206813, -0.31223825, -1.1257086, 0.054560035, -0.5985438, -0.5419079, 0.34310243, 1.1592656, 0.12414108, 0.6306039, -0.29405472, 0.36001867, -0.26069996, 0.6843612, -0.69717747, -0.25637287, 0.7413816, -0.09426433, 0.007948817, -0.05839423, -0.37699413, -0.54838955, -0.5196219, 0.7450251, 0.5604553, -0.19528422, 0.153679, -0.037510846, 0.21829069, 0.63829726, -0.11303048, 0.0413495, 0.42149734, 0.5452131, 0.12912615, -0.9724758, 0.47631884, -0.11178413, -0.78062665, 1.6786276, 0.88644165, 0.25348303, -0.57685983, -0.10731165, -0.6602384, 0.66389215, -0.7689, 0.1496639, 0.6415253, 0.500464, -0.24878055, -0.07939838, 0.13462633, 0.013040431, 0.73763734, 0.06980479, -0.18928413, 0.6980672, -0.33711007, 0.115530476, -0.61564434, 0.2487322, -0.04897301, 0.13430814, -0.2164018, -0.3666767, -0.095899746, -0.44386792, -0.17055167, -0.036105186, 0.43075958, 0.534845, 0.17878997, 0.06367618, -0.05834858, -0.2430348, -0.6089918, -0.047322188, 0.080885276, 0.5262991, -0.21075973, 0.10692868, 0.13799505, 0.08237328, -0.60258526, -0.51029414, 0.716713, 0.27913976, -1.1312143, 0.69941586, 0.08650997, 0.6624551, -0.70263344, 1.0370399, -0.4800526, -1.3264769, -0.5724056, 0.48490354, -0.36758322, 0.14180458, 1.0191479, -0.16142865, -0.15934804, -0.06126994, -0.12419982, -0.2052495, 0.46710333, 0.25446153, -0.09749228, 0.2416552, 0.13107337, -0.62425584, -0.4665196, 0.41823313, 0.017742202, -0.11604845, -0.014583001, -0.04743681, 0.48962507, 0.5726147, -0.15344103, -0.043124318, -0.4611046, 0.5476682, -0.6814534, -0.13700399, -0.25768772, 0.47459337, -0.5468129, 0.964742, 0.26113805, 0.29224998, 0.69866586, 0.5390306, 0.23548684, 0.5616739, -0.4996161, -0.0531639, 0.15483534, 0.3004987, -0.15385841, -0.6523655, 0.52095807, -0.61126125, 0.29399925, 0.022592522, 0.0036164224, 0.9010767, 0.66380125, 0.22740883, -0.8602492, 0.067954, 0.3547017, 0.4408105, -0.13458662, -0.23914078, 0.20854351, 0.24268481, 0.46751034, 0.36705163, 0.043406673, 0.036361203, 0.05552602, -0.071449906, 0.041502196, -1.2105745, -0.028304726, -0.039797705, -0.66858214, -0.088372126, -0.5237669, 0.16090764, -0.04407379, -0.6910071, 0.054006502, -0.28989974, -0.24306267, -0.61034966, 0.5553436, 0.6809772, 0.096716136, -0.51710796, -0.098939195, -0.3180539, -0.32514825, 0.38779578, -0.7734561, 0.15372227, 0.087640285, -0.4327031, 0.096745, -0.06493625, 0.029305357, 1.0426801, 0.116323724, -0.46691078, 0.011199217, 0.1469512, -0.108034305, -0.24094029, -1.0067587, 0.86667746, 0.681321, -0.34006357, 0.6885098, 0.21300186, -0.55701715, 0.582534, 0.26671684, -0.28656054, -0.7581177, 0.83850646, 0.6659291, 0.63540286, -0.82415324, -0.76791, -0.42685413, -0.1978186, 0.1188646, -0.35998422, -0.4153101, 0.63527155, 0.012389898, -1.5216818, 0.10454872, -0.15033387, -1.1138442, -0.363461, -0.31349632, 0.73108214, -0.13952224, -0.29330423, -0.40340406, 0.19570658, -0.13253699, -0.15259932, 0.8772184, -0.6289534, 0.24124396, 0.8863129, 0.013752261, 0.11636713, -0.2878188, -0.6748302, 0.26673093, 0.074429825, 0.18423261, 0.33583167, -0.31168482, 0.18303514, -0.110326886, 1.0521882, -0.8914687, -0.041218713, 0.7925176, -0.38259062, 0.0699002, 0.39020306, 0.3406126, -0.025504138, 0.030163972, -0.8205811, 0.27958557, 0.42331424, 0.7152617, -0.5693195, 0.79709387, -0.052060973, -0.2502512, -0.5891158, 0.43469584, -0.41373527, 0.6146908, 0.076879665, 0.31544682, -0.5227765, 0.08362824, -0.23998299, -0.06326865, 0.977748, 0.699623, 0.34662923, 0.4053547, -0.57229793, -0.360397, -0.68081236, -0.89546853, -0.38550287, 1.4982802, 0.1295377, 0.03139779, -1.4845395, 0.6942864, 0.52807, 0.8333225, 0.49081743, -0.3854397, -0.5561076, -0.2873355, 0.35955435, -0.40604037, 0.3067069, -0.9793556, 0.54424125, 0.05487563, -0.17266905, -1.1705602, 0.23105747, -0.096690014, 0.66326594, 0.50486475, -0.104512066, -0.17203951, 0.84721786, 0.010612169, -0.2766949, -0.7051157, -0.4017008, -0.63575864, 0.06809341, 0.36169913, -0.83321065, -0.3977779, -0.75799507, 0.45688114, 0.8228988, 0.3614043, -0.3872057, -0.23848563, -0.2693749, -0.90534234, 0.062407956, 0.79575527, -0.28577504, 0.11576642, -0.85940045, -0.2364341, 0.09936187, -0.6178453, -0.2623395, 0.4881133, -0.96528625, -0.002703242, 0.32168373, 0.23600036, -0.5019947, 0.62138635, -1.4865868, -0.15790486, -0.6669983, 0.06801675, -0.5628619, -0.31371945, 0.6114257, 0.96458405, -0.064005196, -0.219717, -0.09132044, 0.547687, -0.633611, -0.21194346, 0.5262808, -0.2213456, -0.47458994, 0.39729577, -0.15099177, -0.43005282, 0.53780806, 0.54377115, -0.124503836, -0.3869376, -0.4276981, -0.017099984, 0.10659635, 0.023432303, -0.023488503, -0.5943924, 0.44783092, 0.21988973, -0.2587016, 0.054121852, -0.98205125, 0.66049236, -0.1100941, 0.40253222, 0.4989391, 0.18264665, 0.024417441, -0.1577205, -0.33052993, -0.40380287, -0.3190465, -0.432463, -0.36828405, -0.5821203, -0.027871974, 0.3407156, -1.0126361, -0.44199046, -0.089746, 0.19934487, 0.24793631, 0.07480049, 0.3483074, -0.468999, 0.49423718, -0.024303712, 0.7697083, -0.5001096, 0.02921876, -0.2797136, 0.5004291, -0.19378904, 0.33850992, -0.5845366, 0.54080933, -0.4231968, -0.8276037, -0.21587685, 0.4471876, 0.17945103, 0.8905926, 0.45168063, 0.120928615, -0.19128208, -0.9465436, -0.4261623, -0.56029624, -0.15703607, -0.70728654, -0.37483913, 0.49776262, 0.25170207, 0.12126787, -1.2433228, 0.06759076, -0.42357254, 0.37723503, -0.37966526, 0.16530818, -0.6875407, 0.6304193, -1.0195813, 1.1075277, -0.78990626, 0.39701256, 0.0069374703, 0.7567582, -0.09521173, 0.67897403, -0.46449107, -0.7232551, 0.6319999, 0.13682938, 0.38638604, 0.4707066, -0.36580908, 0.2677807, 0.34033567, -0.1596111, -0.9749413, -0.37226206, -0.6223806, 0.2617854, 0.103502214, -0.008744709, 0.051227644, 0.351737, 1.1481045, 0.14042997, -0.5311719, -0.49255943, -0.8199234, -0.64042944, -0.21486312, 0.6096419, -0.52185607, -0.2824444, -0.79940456, 0.1712943, 0.4599559, -0.08197235, 0.35854346, 1.6623292, 0.45101458, -0.066510625, -1.0427458, 0.62489176, -0.22252423, -0.5163516, 0.07532082, 0.13290837, 0.13375865, -0.16612516, -0.15780056, -0.94008225, -0.29751578, -0.57456505, 1.1763555, -0.05414252, 0.37103045, 0.19796538, -0.43615937, -0.68003327, 0.3122042, 1.2015585, -0.24554463, 0.8153871, 0.7607808, 0.059229776, 1.3229659, -0.24295142, 0.17053288, 0.048269182, 0.9410707, 0.9070906, 0.06965003, 0.27366185, 0.8945579, -1.2575924, -1.2471954, -0.5133816, -0.03719949, -0.040453598, -0.6262046, -0.22496824, -0.5460526, -0.6761229, 0.38598374, 0.30903018, 0.3048585, 0.05681765, 1.035404, 0.3265798, -0.65159935, 0.012538631, 1.1262999, -0.5801894, 0.6140626, 0.030489383, -0.20633727, -0.091095164, 0.07008093, 0.20600188, 0.42286634, 0.24940234, 0.336841, -0.28344682, 0.15419483, -0.45846593, -0.2657172, 0.30148643, -0.9636932, -0.83163893, -0.15322179, -0.083657995, -0.24991873, 0.2650725, -0.21684909, 0.45393792, 0.2698332, 0.0074559078, 0.4958383, -0.61557376, -0.25072846, -1.2557454, -0.6115327, -0.24550119, -0.04877276, 0.06557663, 0.3164962, 0.2010736, 0.20483038, 0.098864615, 0.4129772, 0.24178419, 0.45724168, -0.4674123, 0.8200659, -0.50947297, -0.449177, -0.30873096, -0.00341261, -0.05515168, -0.5907586, -0.33790907, -0.651591, 0.40981805, 0.7774349, -0.11609654, 0.120979905, -0.17329918, -0.36349046, 0.5757807, -0.30231762, 0.16941534, 0.18787259, 0.016418763, -0.9578842, -0.080765896, -0.023937378, 0.13233513, -0.6668092, -0.18915473, 0.6900721, -0.81779176, -0.3249238, -0.19014584, -0.26334095, -0.9522248, -0.020303745, -0.1590526, 0.45100468, 0.30653527, 0.19623548, 0.3372883, 0.4808515, 0.053027716, 0.039079703, 0.063242614, 0.1595489, 0.36108032, -0.06620808, -0.37538713, 0.023618475, 0.01085633, 0.69008404, 0.27196503, -0.04092282, -0.2127317, 0.2757614, -0.30057618, 0.18570052, -0.19186738, 0.3087836, -0.25180426, 0.26582882, 0.4608781, -0.21650104, 0.2283323, -0.31646472, -0.692105, 1.3698722, -1.257715, -0.45968327, 0.08766882, -0.62902015, 0.52597046, -0.24926928, -0.85368836, 0.53539294, 0.18897045, -0.8144592, -0.24593538, 0.45442003, 0.43394864, -0.021025106, -0.56448966, -0.48068237, 0.57226974, -0.1455751, 0.3920177, -0.805578, -0.3599915, 0.36887014, 0.40636414, -0.38607797, 0.25946122, -0.5041137, -0.7237108, 0.20406774, 0.26659763, 0.50632215, -1.1882919, 0.31482235, -0.16788547, 1.0427362, -0.30384532, 0.25440946, 0.36111465, -0.04078348, -0.08545423, 0.92903745, 0.4287195, 0.38892937, 0.6466388, 0.011067346, 0.10231955, 0.72308904, -0.13572344, -0.31354204, 0.68488604, 0.4170978, 0.42884508, 0.10300704, 0.7566359, 0.17373186, -0.41658837, -0.43844083, -0.086458325, 0.52654135, -0.043467827, 0.6249003, -0.25258037, -0.729916, 0.6514588, -0.21865344, 0.05354707, -0.038330674, -1.0014257, -0.64724433, -0.36293414, 1.4632056, 0.2517041, 0.034037836, 0.24289103, 0.09087169, 0.8479298, 0.55847895, -0.71819776, 0.22156405, 0.59628755, 0.092399985, -0.04420072, -0.3075664, 0.30672166, -0.07358368, -0.9896834, -0.030702464, 0.45216998, 0.23109157, -0.3755612, 0.16779788, -0.6244628, 0.7411318, 0.24217345, 0.17737857, 0.48295784, -0.8859237, -0.24001184, -0.75387233, 0.67960876, -0.83024853, -0.14399245, 0.8452935, -0.3518325, -0.047979936, -0.02630499, 0.5509351, 0.4625635, -0.16918442, 0.30742225, 0.16386184, 0.67220664, 0.6280037, 0.28628358, 0.5660928, -0.1181638, -0.7434205, 0.20981479, 0.30287597, -0.69003713, 0.2184324, -0.76819944, -0.6346251, -0.08185301, 0.4818785, -0.51540446, -0.41744098, -0.09777721, -0.13589545, -0.60600513, 0.5247147, 0.3843186, 0.7094564, -0.16184524, -0.10725272, -0.4548275, 0.19113028, -0.047529392, -1.2795435, 0.17554286, -0.11416066, 0.13803561, -0.15642008, -0.6183412, -0.09616114, -0.37894952, 0.41909993, -0.662439, -0.114946306, 0.24334419, 0.22668067, 0.12224765, -0.63632286, 0.09084573, -0.23651299, 1.572324, 0.2178188, 1.1743072, 0.07571864, -0.1768858, 0.46413594, -0.48011255, 0.60569423, 0.15971124, 0.15805168, -0.9414262, 0.52399147, -0.007178193, -0.5215467, -0.59056896, 0.8559839, -0.2467039, -0.12033293, -0.9019515, -0.59779, -0.7349234, -0.8292922, -0.8635217, 0.5185263, -0.14540526, -0.26934415, 0.09875953, -1.1647751, 4.1182427, 0.46481997, 0.20087855, 0.9354643, 0.105424814, -0.004540026, 0.31147802, -0.6534193, 0.49501762, -0.45092684, 0.26379517, 0.448524, 0.34865677, 0.33569512, -0.016880259, 0.931842, -1.0148392, 0.20927775, 0.27847856, 0.15899846, -1.0693281, 0.1423664, 0.25981626, -0.025161192, 0.37412122, -0.29079884, 0.65601414, -1.0225062, -0.09605144, -0.14980899, 1.4953828, -0.1718415, 0.4066242, -0.08655246, -0.24063088, 1.2393714, 0.30284256, 0.36995012, 0.13408722, 0.30496278, -0.46151608, -0.6467823, 0.6863592, 0.3977234, 0.24254265, 0.30088937, -0.91632855, 0.22041345, 0.21627867, 0.036953487, 0.8198882, -0.38644162, 0.5111023, -0.6528836, -0.05132746, -0.048061155, -0.6670724, 0.32652795, -0.93728834, 0.17837188, -0.07624923, 0.18451518, -0.23230648, 0.34793568, -0.30258647, 0.12964638, 0.51428103, 0.8286943, -0.33250588, -0.6536644, -0.5854663, 0.42078778, 0.0033747032, -1.1266797, 0.10867215, 0.7423345, -0.83774376, 0.77926403, -0.058730222, -0.47217268, -0.092801005, 0.33792138, -0.05150798, -0.31443495, 0.27053922, 0.27824974, -0.11275067, -0.09057309, -0.2926527, 0.06173639, 1.3071758, 0.4730829, -0.14173776, -0.5784081, 0.2668654, 0.23815082, 0.28242433, 0.4774975, -0.54650855, -1.0264833, -0.47225332, 0.8703695, 0.63991624, 0.74452734, 0.42014164, -0.03533741, 0.06514102, -0.09643583, -0.8522862, -1.026076, 0.2499778, -0.42779097, -0.22190364, -0.076258555, 0.44808066, -0.71214545, -0.33959672, -1.3720645, 0.32767367, -0.713407, 0.7200092, 0.54970694, 0.038314663, 0.31601653, 0.82536983, -0.3402146, -0.15020594, -0.38107064, -1.594133, -0.20284157, -0.5158298, 1.4197085, -0.8124861, -0.42961958, -0.9616828, -0.31844, 0.09133983, 0.83976585, -0.69099605, -0.7764937, -0.5044535, -0.021224841, -1.0946624, 0.061164968, -0.008315772, -0.09962118, 0.7529673, 0.13280208, 0.32369834, -0.018207334, 0.30298617, -1.3468391, -0.010767452, -1.2652732, 0.3044045, 0.6346315, 0.41673356, 0.3533945, -1.4007373, 0.73925, 0.4769547, 0.45146942, -0.17096666, 0.53908443, 0.1459171, -0.5496129, 0.8112877, 0.22813308, -0.86315006, -1.0600767, 0.49666116, 0.6343291, 0.9384711, -0.67448175, 0.65366536, 0.12925006, 0.32494718, 0.7210598, -0.119817495, -1.8780767, -1.1060218, 0.26940116, 0.8603358, -0.37159148, 0.22237892, -0.026965573, 1.4551806, -0.04102008, 0.18953791, 1.2205132, 1.3830074, -0.6203029, 0.105550446, -0.9172137, -0.2631466, 1.2078451, 1.1561841, -0.88699704, 0.33485472, -1.1039261, -0.15662864, -0.8889108, -0.021704465, -0.7190207, -0.4444397, -0.09743556, 1.0252041, 0.27867004, 0.47697592, -0.25137198, 0.8654594, -0.5946547, 1.1985759, -0.7184543, -0.37799215, 0.8081364, 0.13715135, 0.03568732, -0.6331051, -0.65091616, -0.63724107, -1.1073422, 0.83576024, 0.01433241, -0.25773996, 0.19880387, 0.26008373, 0.12768374, 1.1019219, -0.48458183, 0.046535883, -0.06099293, 0.5994473, 0.82844126, -1.4832599, 0.76427746, 0.2744197, -0.63113993, 3.4523046, 1.0266101, 0.27708215, -0.41686982, -0.5191848, -0.06873581, 1.3051794, -1.1570866, -0.13528334, 0.36869058, 1.023516, -0.06851939, -0.42901027, -0.061269097, 0.34303978, 0.78846973, -0.10224266, -0.26698807, 0.36766642, -0.052483615, 0.30429786, -0.5263308, 0.8598371, -0.22671875, 0.18051147, -0.08662229, -0.3279599, 0.2018461, -0.6478263, -0.17370462, 0.13946049, 0.68857074, 0.7604215, 0.66072303, -0.2236945, 0.0344449, 0.39498496, -0.86348784, 0.2021577, -0.554239, 1.241565, -0.19903407, 0.096936144, 0.6406258, -0.34654585, -0.73143643, -0.13212292, 0.64585644, 0.20416865, -1.3674644, 0.81159735, -0.53180194, 0.44403616, -0.4629941, 0.8237217, -0.6575767, -1.9094594, -1.0068313, 0.1886729, -0.54099613, -0.31080106, 0.52114534, -0.4064729, -0.3517636, 0.52113307, -0.37713295, -0.54287195, 0.90217155, 0.75736386, -0.057880785, 0.65335006, 0.5185984, -0.6316754, -1.008395, 0.5784696, 0.15871945, -0.096895896, 0.030775126, 0.019246973, 0.635904, 0.7580727, 0.603296, -0.39326644, -0.775648, 0.6632834, -0.76522464, -0.15057506, 0.13213232, 0.8701612, -0.051690824, 0.886158, 0.059451666, 0.39455524, 1.1942627, 0.80077326, 0.30792174, 0.72980845, -0.58946186, 0.11602919, 0.6559696, 0.8268997, -0.20558739, -0.9376819, 0.4666886, -0.6281039, 0.45548218, 0.08520936, 0.19750595, 1.5127107, 0.83545053, 0.3510535, -0.8958543, -0.75617564, 0.894642, 1.4720694, -0.1355076, -0.6986217, 0.29143137, 0.34363377, 0.18577126, 0.26836568, -0.13981187, 0.19420178, -0.1310125, 0.106808856, -0.11584908, -1.3767927, -0.048521705, -0.12314682, -0.70627797, 0.10515572, -0.5317391, 0.5002598, 0.422907, -1.0648339, -0.11869705, -0.93817717, -0.47067133, -1.0766637, 0.7890926, 1.0871282, 0.077466965, -0.022941213, -0.34052557, -0.46262902, -0.21314916, 0.63874835, -0.8034802, -0.12524417, -0.2280509, -0.45375586, 0.11442453, 0.17320183, -0.16676669, 1.2585441, -0.26324847, -1.0815029, 0.48728508, 0.40939358, -0.2852892, -0.01987523, -1.0332665, 1.4922973, 1.2905895, -0.3012445, 1.1206418, 0.58634394, -0.5885947, 1.027236, 0.5461434, -0.56589985, -2.160386, 0.9977782, 1.4122514, 0.35012767, -0.8348484, -0.91156083, -0.44733608, 0.06918893, 0.073672324, -0.49986246, -0.36920917, 1.2300003, -0.028686464, -1.9602597, 0.3586868, -0.5751905, -1.2226559, -0.160415, -0.45962837, 0.7730631, 0.15213728, -0.40129295, -0.3763386, 0.25027445, -0.017731309, -0.35444453, 1.0308242, -0.68111396, 0.027753418, 1.1759561, 0.1284143, -0.1538926, -0.06069766, -0.5967487, -0.46134785, 0.65801346, 0.38983122, -0.13866639, -0.1946084, 0.39163414, -0.05783741, 1.3692302, -1.1921241, 0.12407765, 0.62342554, -0.22950053, -0.15749526, 0.42076403, -0.15916803, -0.6903404, 0.38964617, -0.96953917, 0.1617446, 0.15616782, 0.94165206, -0.7990292, 1.0704751, -0.3479437, 0.014394938, -0.27818298, -0.2686414, -0.8608855, 1.1030215, 0.30865127, 0.56293905, -0.5808595, -0.09553954, -0.5470532, -0.24101052, 1.7932336, 0.5933583, 0.22850809, 0.6440879, -0.13777807, -0.40607083, -0.14935976, -1.0655402, -0.08556904, 1.5463837, -0.2037431, -0.049918488, -1.948359, 1.3937284, 0.8913616, 0.6618716, 0.29112825, -0.9333397, -0.64939773, -0.1519076, 0.43093035, -0.90897346, 0.23105648, -1.6697718, 0.80526376, -0.10556382, -0.29879344, -1.1856492, -0.08865876, -0.3910298, 0.99155366, 0.05003587, -0.25817716, -0.203244, 1.0919954, 0.43314368, -0.36503968, -1.4359604, -0.27645838, -0.82746905, 0.27085295, 0.6530822, -1.179947, -0.5469275, -0.8221712, 0.4316565, 0.8877416, -0.22656713, -0.9242201, -0.30603468, -0.2247964, -0.8370084, -0.35373253, 0.91914237, -0.030093975, 0.6547502, -1.4251751, -0.17141008, -0.10287389, -0.16700989, -0.17503524, 0.30245206, -0.10866988, 0.11191217, 0.87262994, -0.3063119, -0.8902056, 0.56295437, -1.9272543, -0.0981302, -0.67028433, 0.23364708, -0.6498273, -0.37664372, 0.23457718, 1.4059585, -0.1313058, -0.30622694, -0.021324791, 0.7439346, -1.2513928, -0.34206432, 1.3767378, -0.2954388, -0.5523714, 0.60395724, -0.29732507, -0.2831665, 0.24392214, 0.5988505, 0.0795792, -0.29516765, -0.25286347, 0.10891355, -0.043641455, -0.21956724, -0.1222059, -0.90728974, 0.46377242, 0.49633765, -0.20564441, -0.520319, -1.6375936, -0.0139881335, -0.4310044, 0.5800617, 0.28061712, 0.47284612, -0.07800144, -0.51974624, -0.5967198, -0.2567559, -0.40850466, -0.36360377, -0.61648047, -0.5654142, 0.48337257, 0.21692866, -1.1690227, -0.53939724, 0.2567819, 0.52827764, -0.27963173, -0.038007528, 0.5720037, -0.8600977, 0.13065897, 0.19105779, 0.9926014, -0.50321037, -0.4309987, 0.19077024, 0.7039192, -0.09141481, 0.84667844, -0.77341396, 0.5661096, 0.15038273, -1.0883207, -0.30914208, 0.39496368, -0.06485534, 1.641904, 0.6762734, -0.3347199, -0.8617406, -0.6995804, -0.19845611, -0.5784028, -0.47562283, -1.4047565, -1.0122284, 1.0451913, 0.3910407, 0.21691439, -0.5442791, 0.3343481, -0.33234861, 0.66286534, -0.6073909, -0.23710439, -0.8782153, 0.6301357, -0.78039706, 1.0811063, -0.94600165, 0.50099385, -0.20203432, 0.8153803, 0.4326697, 0.9829363, -1.1359497, -0.5724925, 0.46652472, 0.020673493, 0.17816944, 0.64396065, -0.95867497, 0.8279188, -0.80351615, -0.085244454, -1.0182021, -0.48280728, -0.68415624, 0.26940063, 0.17725682, 0.6659137, 0.343051, -0.036139507, 1.9253529, 0.330179, -0.18667798, -0.7256044, -0.5135883, -0.6487113, -0.8936575, 0.7452832, -0.12287533, -0.11825, -0.70136374, 0.14688696, 1.4273101, -0.15633577, 0.6255618, 2.1027944, 0.8671121, -0.36143222, -1.1867063, 1.1065185, 0.8098748, -0.45667458, -0.24226767, 0.0025809854, -0.25722653, 0.19070284, -0.5484266, -0.6555022, -1.0337746, -0.42591894, 1.7423811, 0.654865, 0.64011616, 0.16377617, -1.2083119, -1.4860584, 0.70743257, 1.1795193, 0.07058562, 0.8440395, 1.0345922, 0.28286603, 1.0439405, -0.31949413, 0.6272188, -0.19404978, 1.5465806, 0.8578423, -0.27853975, 0.66072625, 1.2355281, -2.0446782, -1.7492697, 0.0030216204, -0.56266546, -0.6697648, -0.68279344, -0.35443568, -0.54446316, -0.6759806, 0.1435076, 0.28134957, -0.15788919, 0.24428463, 0.014099263, 0.46920812, -0.85195917, 0.0012707915, 1.3709744, -1.0901219, 0.64788854, -0.14823869, -0.085778356, 0.13496846, -0.24483931, 0.4524359, -0.034560725, 0.63981885, 0.35658672, -0.30224392, 1.0347067, -0.85791016, -0.14240645, 0.79247826, -1.1686097, -1.586391, -0.8209819, -0.119535595, -0.2052218, 0.34335265, -0.6570797, -0.2210782, 0.6748208, -0.09502657, 0.24686556, -1.2017366, -0.63983685, -1.5916613, -1.184105, -0.123895474, -0.03346053, 0.2209342, 0.61311907, 0.3206372, -0.118494704, -0.3988993, 0.3909913, -0.36862627, 0.5302286, -0.6324911, 0.94080716, -0.6024734, -0.38162777, -0.4316226, -0.3143518, -0.36463666, -0.20017555, -0.8736055, -0.9380112, 0.45671174, 1.5155923, -0.09486201, 0.9695505, -0.13833332, -0.6298378, 0.8931586, -0.6301222, -0.26646182, 0.46902105, 0.13617973, -1.3055613, 0.30406374, -0.09564643, 0.10455055, -1.0269212, 0.12177908, 1.1355569, -0.6378392, -0.6559861, -0.78072715, -0.68091595, -1.3237638, -0.4806199, -0.16236575, 0.22558266, 0.4245454, 0.6258281, 0.2573674, 0.92344415, 0.108896874, 0.4044994, 0.06719699, 0.66419035, 0.34098536, 0.58486176, -0.41998512, 0.5359888, 0.61129946, 0.5190456, 0.983025, 0.310331, -0.32300448, 0.35044804, -0.97328913, -0.06142584, -0.34457424, 0.42320502, -0.2103809, 0.94158864, 0.751986, -0.41664547, 0.5273929, -0.023898497, -0.58526397, 0.91506046, -1.587615, -0.62792873, 0.20285669, -1.3050082, 0.62498814, -0.4249226, -1.0144218, 0.409593, 0.27104688, -0.9462727, -0.24467865, 0.86334205, 0.45995265, -0.12513909, -0.70971626, -0.19246241, 0.042387776, 0.07669194, 0.115074575, -1.269335, -0.09286548, 0.54315686, 0.34751275, 0.06670852, 0.14310578, 0.02031393, -1.4052739, 0.34125116, 0.34491134, 0.47022027, -0.80838424, 0.43571746, -0.5313221, 0.8576949, -0.2583056, -0.1817374, 0.4537858, -0.14710322, -0.4226152, 1.6146483, 0.88158476, -0.3151336, 1.2690797, 0.11899912, 0.3866578, 0.76637596, 1.5090572, -0.67779464, 0.9428768, 0.6889142, 0.6410521, 0.28004602, 0.7718466, 0.7421934, -0.28616107, -0.914406, 0.18280843, 0.77757883, -0.37666446, 0.607708, -0.28850508, -0.14639486, 1.0358485, -0.57612544, -0.03077536, -0.09469912, -0.5002359, -1.5291424, -0.5715195, 1.1232437, 0.032881796, 0.24273214, 0.114872776, 0.21159294, 0.86429787, 1.2115531, -0.53747576, 0.5324311, 1.046557, 0.3009321, 0.33693448, 0.033356756, 0.44364536, -0.02425829, -1.4809191, -0.15717486, 0.19116181, -0.09143227, -0.27159914, -0.10439899, -0.74533814, 0.82421553, -0.20139456, -0.0032766405, 0.9916576, -1.0329632, 0.19601333, -1.2602824, 0.2017543, -0.64100575, -0.35785395, 1.0780927, -0.14836146, 0.018262547, 0.9442348, 0.83696884, 0.6329565, -0.093982756, 0.7140547, 0.21587613, 1.2869248, 0.60281265, -0.47821552, 0.43734503, 0.25959963, -0.16328156, -0.12055825, 0.4622288, -0.9157813, 0.5098907, -0.31852883, -1.0538068, 0.63930315, 1.0165753, -0.8952555, -1.1551671, -0.07045259, 0.33253628, -1.4805075, 0.5346395, 0.40822038, 0.78947777, 0.056913875, -0.23994705, -0.47662988, 0.12904635, -0.3096597, -1.2386975, 0.027118616, -0.297474, -0.34640983, -0.7081305, -0.987574, -0.4112696, -0.16663915, -0.14638874, -1.0458425, 0.054047197, 0.99362266, 0.47721052, 0.39771488, -0.4090625, 0.1835733, 0.006618239, 1.8029044, -0.5752119, 1.7840273, 0.14250731, -0.8179414, 1.0404874, -0.7235668, 0.43460107, -0.17297104, -0.66153497, -0.53459716, 1.4169344, -0.25907004, -1.0876834, -0.121780336, 0.9376321, 0.087307006, 0.1502156, -1.3873982, -0.47126013, -0.72027636, -1.0648152, -1.0333831, 0.28081003, 0.0047804266, -0.41970125, 0.12368576, -1.0056207, 1.314159, 0.8322662, 0.50192, 0.6606601, 0.19176152, 0.22359805, 0.6299454, -0.8784206, 0.8435247, -0.62076545, 0.46503085, 0.4955411, 0.47523603, 0.59475726, -0.15033536, 1.5292126, -1.6526178, 0.77440363, 0.21343376, -0.1102623, -0.8003335, 0.12464988, 0.1694136, -0.092712775, 1.1573013, 0.26682746, 0.8170211, -1.0412548, 0.09060685, -0.18826349, 1.1423111, 0.03361123, 0.54229814, -0.31807727, -0.034259863, 1.3871967, -0.05026304, 0.28581905, 0.11886263, 0.7556672, 0.09417425, -1.0077528, 0.9749789, 0.031945437, 0.1542672, 0.44604713, -1.1202078, 0.24686609, 0.5521793, -0.26565984, 1.3768492, -0.41607288, 0.89860183, -0.9901299, -0.55397356, 0.3160442, -0.2748052, -0.028745566, -0.60326695, 0.1855664, 0.014004639, 0.043385062, -0.3658645, 0.21059687, -0.45689726, 0.2032052, 0.73326206, 0.35434416, 0.019100547, -1.4163734, -0.44338754, 0.26873967, -0.5155286, -1.3091766, 0.083646804, 1.3032191, -1.2324255, 0.9689458, -0.50306034, -0.13216153, -0.31209743, 0.42126146, 0.24715918, -0.36722437, 0.8198192, 0.7839475, -0.4742727, -0.23958692, -0.53167427, 0.36589828, 1.4970611, 1.1297909, -0.09345523, -0.7373089, -0.6823638] +2025-10-16 19:28:50 [main] INFO experimental.OnnxTest - ------------------------ +2025-10-16 19:28:50 [main] INFO experimental.OnnxTest - tokenizer加载耗时: 4073ms +2025-10-16 19:28:50 [main] INFO experimental.OnnxTest - tokenizer计算耗时: 1ms +2025-10-16 19:28:50 [main] INFO experimental.OnnxTest - 模型加载耗时: 558ms +2025-10-16 19:28:50 [main] INFO experimental.OnnxTest - 模型数据准备耗时: 2ms +2025-10-16 19:28:50 [main] INFO experimental.OnnxTest - 模型计算耗时: 11ms 2025-10-16 21:35:57 [main] INFO ai.djl.util.Platform - Found matching platform from: jar:file:/home/slhaf/.m2/repository/ai/djl/huggingface/tokenizers/0.34.0/tokenizers-0.34.0.jar!/native/lib/tokenizers.properties 2025-10-16 21:35:57 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Using cache dir: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 2025-10-16 21:35:57 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading huggingface library from: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 2025-10-16 21:35:57 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading native library: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64/libtokenizers.so 2025-10-16 21:35:57 [main] WARN a.d.h.t.HuggingFaceTokenizer - maxLength is not explicitly specified, use modelMaxLength: 512 -2025-10-16 21:35:57 [main] INFO OnnxTest - [101, 3231, 1024, 7592, 2088, 102] -2025-10-16 21:35:57 [main] INFO OnnxTest - ----------------------------- -2025-10-16 21:35:57 [main] INFO OnnxTest - [1, 1, 1, 1, 1, 1] -2025-10-16 21:35:57 [main] INFO OnnxTest - ----------------------------- -2025-10-16 21:35:57 [main] INFO OnnxTest - 加载耗时: 4105ms -2025-10-16 21:35:57 [main] INFO OnnxTest - 计算耗时: 1ms +2025-10-16 21:35:57 [main] INFO experimental.OnnxTest - [101, 3231, 1024, 7592, 2088, 102] +2025-10-16 21:35:57 [main] INFO experimental.OnnxTest - ----------------------------- +2025-10-16 21:35:57 [main] INFO experimental.OnnxTest - [1, 1, 1, 1, 1, 1] +2025-10-16 21:35:57 [main] INFO experimental.OnnxTest - ----------------------------- +2025-10-16 21:35:57 [main] INFO experimental.OnnxTest - 加载耗时: 4105ms +2025-10-16 21:35:57 [main] INFO experimental.OnnxTest - 计算耗时: 1ms 2025-10-16 21:36:08 [main] INFO ai.djl.util.Platform - Found matching platform from: jar:file:/home/slhaf/.m2/repository/ai/djl/huggingface/tokenizers/0.34.0/tokenizers-0.34.0.jar!/native/lib/tokenizers.properties 2025-10-16 21:36:08 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Using cache dir: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 2025-10-16 21:36:08 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading huggingface library from: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 2025-10-16 21:36:08 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading native library: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64/libtokenizers.so 2025-10-16 21:36:08 [main] WARN a.d.h.t.HuggingFaceTokenizer - maxLength is not explicitly specified, use modelMaxLength: 512 -2025-10-16 21:36:09 [main] INFO OnnxTest - [0.008940695, 0.50210774, -5.0510945, -0.8937678, 0.8091147, 1.2654096, 1.2879646, -0.72453403, 0.46069813, -1.1958805, -0.038145, 1.8672976, 0.6281317, 1.7732, -0.52271223, -1.4445113, 1.5514337, -2.508686, -0.6864384, -0.6301254, -0.29560322, -1.0180707, -0.83187616, 0.46920234, 1.9916652, -0.35749114, -0.11190428, 2.2374659, -0.6664558, 0.1793392, 0.64779544, -0.111028045, 0.67277247, -0.9106091, 0.2552021, -0.21566938, 0.5772215, 1.3539819, 0.45714578, 0.17660096, 0.49979687, 1.1208547, 0.19748983, -0.71146816, 1.9074292, -0.11441079, -0.24318233, 0.61392385, 1.8441632, -1.3443937, -1.0027645, -0.9185232, 0.19459805, 0.22545397, 1.7715352, 1.353761, 0.21172398, -0.5133596, 0.8219211, 0.9679444, 0.5380537, 1.2222915, 0.1917364, 1.8536644, 0.85374683, -1.6372596, 0.1961565, 0.69616926, -0.24206743, 0.8010477, 1.3424035, -0.050939456, 0.8211133, -0.020956516, 0.26211494, -0.4410275, -1.1032287, 0.115168236, -0.37371528, 0.12982085, 1.0343108, -0.51043314, 0.9773637, 0.52081937, 1.8070213, -1.2970276, -0.36602047, -0.34678212, -1.5465903, 1.0458957, 1.1246372, -0.22684537, -0.33523685, 0.6524532, -0.4258627, 0.8639704, 0.6747687, 1.1801372, -0.18055356, -0.325558, 0.58573216, -0.6885681, -0.008652464, -0.35967788, 1.4759315, 0.79462963, -1.0071485, -0.13985354, -1.7917951, -1.302046, -0.9551339, 0.72700655, -0.82785696, -0.016509667, 0.2450114, -0.14989577, 0.66587335, -1.6692137, -0.10025135, 0.5849763, -0.0066149235, 0.15871382, -1.0094404, 0.57655615, 0.31472182, 0.98309034, -1.8285725, 0.3632993, 0.13209791, 0.5869235, 0.21235198, -0.17361814, -0.32928634, -0.4548379, -0.6051484, 0.4909709, 0.51352304, -0.25750488, 0.21058336, 0.23544005, -1.0283852, 0.61832947, 0.012845237, -0.0017602667, -0.11332193, -0.64147717, 1.3873081, -0.82721007, -0.48795754, 0.04623498, -0.32260513, -0.40278208, 1.4807189, 0.6844304, 0.5813694, -0.7781652, 0.504094, 0.51536506, 0.47406924, 0.9439167, 1.0232425, -0.6551769, -1.3913715, 0.56962323, -0.25564027, -2.001826, 1.0167072, 1.6333333, 0.9226843, 0.23638949, -1.0627227, -1.5849673, 0.53583235, -0.32994375, -1.4948924, -0.54732955, -0.6555769, -0.56513834, 0.56638885, 0.71271247, 1.1922938, -1.5763108, 0.5924969, 1.7915413, -0.6964754, -1.0084081, -0.08877027, -0.28982282, -0.020199053, -0.7514959, -0.24143167, -0.20266221, -2.3080733, -0.34911162, 0.002499245, -0.9315997, 0.14224178, 0.26388752, 0.55929285, -1.9308436, -0.7808089, 0.20109546, -0.50900704, -0.06720903, -0.57660383, -0.12015574, 0.8564407, -0.19855615, 0.5351314, 0.7831901, 2.2334285, -0.07724279, -0.8556066, -1.1182219, -0.10898359, -0.43939131, 0.18218377, -1.0329244, -0.28819674, 0.6573483, 0.94202, -0.5684383, 0.39345515, -0.2149513, 1.1943405, 0.2175886, -1.4272945, -0.15624487, -2.1790175, -0.31830606, -0.074882746, -2.1189816, 1.3915615, 0.53846455, -0.6594929, 1.1428193, 0.14244053, 1.4449791, -0.33742362, 0.1302906, -1.0304217, 1.0046071, -0.14830303, -0.2878356, -0.833144, 0.7353544, -0.047339574, -0.50411963, -0.14792854, 1.2162826, -0.87097895, 0.5479907, -0.61530846, 0.91772366, 0.39351106, -1.1159807, -0.6962802, 0.6177609, 0.28574178, -0.933717, 0.6656517, -2.550455, 0.28417572, -0.81885386, -0.57173115, -0.47732124, -0.83434474, 0.6218224, -0.23378877, -0.16290052, -0.33495492, 0.9589823, -0.13438444, 0.87317586, -0.7977557, -0.8751001, 0.121376105, 0.0016995966, 0.119280726, 0.8511828, -0.80091643, 0.21969834, -0.52506125, 0.21649529, 0.20917195, 0.53206205, -0.060215697, -0.92501277, -0.43172908, 0.1354983, 0.77811605, 0.6264411, 0.11004971, 1.4162332, 0.3008895, 0.6369807, 0.8966343, -0.46057636, -0.4627554, -0.99630976, 0.8575164, 0.45908165, 1.4463993, 0.24505532, -1.313617, -0.26200497, 1.4678717, -0.78108716, 1.5716724, 0.04318331, -1.4950266, 0.87165, -1.2442464, 0.40303344, -0.8583747, 1.123798, -0.27928567, 1.4853265, 0.8615038, -0.22005291, -0.19541085, -0.8011397, 0.6476904, -0.092515044, -0.34317318, -0.16905296, 1.1762776, 0.5573735, -0.59209, -0.3909012, 0.19253278, 1.5935065, -0.7802029, -0.72745705, -0.15390143, 0.9641196, -0.7650623, -0.5825169, -0.42223948, 1.2938359, 0.32511997, -0.48691022, 1.3244666, -0.9317738, 0.0053078495, -0.2814655, -0.010061342, 0.5678287, 0.53736544, 0.84125555, -1.6721346, 0.6866992, -1.039913, -0.55957854, 0.9752761, -0.10916731, 0.81267405, 0.3757345, 0.31622255, -0.070370235, -0.28069317, 0.7060322, -0.30573946, -1.1120561, 0.087441884, 2.1169686, 0.3793122, 0.7199018, 0.7972706, 0.6312716, -0.28640646, -0.24372002, -0.39927763, 1.3067431, 1.3677809, 0.17182645, -1.5993283, -1.0617065, -0.9970951, 0.3591527, -0.2642659, -0.92191654, 0.09367664, -0.8568419, 0.24673605, -0.01075469, 0.53148615, -0.8131387, 0.16646563, 0.4456662, 0.42658246, -0.2286683, -1.240861, 1.2182664, 0.31972283, -0.52042526, 1.0313315, -0.74151134, -1.9206606, 0.67172974, -0.76771915, -0.11668143, -0.16317451, -1.1896999, -0.14067993, -0.5754039, -1.178021, -0.19320671, 1.0556533, -0.13083985, 0.8500223, 0.7322127, 0.47325015, -1.1170738, -0.46539554, 0.60346323, 1.1163684, -0.6468576, -0.6749016, 0.32706273, 0.5102571, 1.538664, 0.2564993, 0.12480027, -0.5115198, -0.22911404, 1.2661121, 2.2754738, 0.054497525, -1.8307894, -0.70205, 0.2732521, 0.3695401, 0.8007306, -0.28857967, 0.38666317, -0.7592721, -0.5713192, 1.1246057, 0.593709, 0.35631394, -0.3205832, -1.4436417, -0.6496872, 0.37343976, 3.2232847, 1.9115183, -1.0618794, -0.96111053, -0.10857664, -1.103422, 0.9816166, 0.60177815, 0.8528089, 1.4430338, -1.370729, 1.3978995, -0.69921416, 0.23256098, 0.4660253, -0.06287591, 0.6654809, -0.69219005, 0.24058081, 0.93626904, -0.7160164, 0.42666763, -0.38045081, -0.17772737, 0.95297396, -0.7321556, -0.82016414, 1.6348257, 0.098678365, -1.8395785, 1.0368643, -0.04200262, 0.7008558, -0.6598028, 1.1169665, 0.59610337, 0.42644075, -0.70989525, -1.1907579, 0.4301988, 0.24375978, 0.12559327, -0.086863026, 0.6391059, 0.3239115, 0.18681988, -0.9638547, 0.6950969, -1.0718625, -0.35861596, 0.007594481, -0.50218886, -0.07959162, 0.3074152, -1.0058187, -0.5779988, -0.21252635, 0.16711673, 0.2945148, -0.9580504, -0.44329655, -0.080028936, -1.9545618, -0.7434137, 0.42564327, -1.1064954, -0.02137646, 0.33320808, 0.87851465, 1.3674957, -0.18974975, 0.30143118, 0.09378138, -2.184264, 1.4090663, 0.42376116, -0.6386673, 0.23209023, 0.93278, -0.9901231, 1.2871186, -0.55473083, -1.0378529, 1.2385598, 0.6200016, -0.19011533, 1.2526734, -0.29594705, -1.159091, 0.12753622, -1.3564175, 0.39733884, 0.35340226, 0.47517172, 0.5938189, -0.97271687, 0.72243273, -0.3874474, -0.8634288, 1.4369297, 0.76829016, -1.5096359, 0.67411625, -0.5942944, -0.68440664, -0.6967539, -1.3790333, -1.0722706, -0.26939258, -0.51274854, -1.6252055, -0.042074203, -0.2941991, -0.9963352, -1.6290406, 0.5964556, 0.61665666, 0.107714295, 0.638748, 0.4289012, -0.8213354, -0.18691581, 0.260664, 0.1988615, -0.67643714, -0.4602536, -1.04408, 0.47709525, -1.5441273, -1.09128, -0.2589167, 0.5129835, 0.35384816, -0.69535726, -0.5024993, 0.17009991, -0.9128699, 0.35023412, 1.5284145, 0.38180998, -0.36242324, 0.7157388, -0.5221178, -0.07077499, -0.80303806, -1.0217718, 0.014210036, 1.1169853, -0.84779525, 0.07265417, 1.5137844, -0.43872315, -3.6163976, -0.71127445, 0.030030718, -0.54634804, 0.6007818, 1.0862793, -1.4570272, 0.29859456, 1.6187196, -0.5408837, 0.7542678, -0.043661788, -0.627822, 0.9626751, -0.18183072, -0.40761006, 0.92285067, 0.4483496, -0.20151655, 2.1187465, -0.5030096, 0.042685598, -1.0087817, -0.27128118, -0.6693532, 0.90893507, -0.5863207, 1.1904533, -0.6463561, -0.9224859, -0.5095885, -0.6562933, 1.7482289, -1.0871308, 0.6194082, -2.2877498, -0.0012813509, -1.1376673, 0.87655807, 0.663956, 0.24306166, 0.22504678, 1.0432729, 0.7316973, -0.20957288, 0.21609576, -0.054103754, 1.2539151, -0.3260904, 1.4898258, 0.71351856, 1.469297, -0.25216702, 2.0916111, 1.6792994, 0.834613, -0.19511522, 0.97750825, -0.1270805, 0.66032535, -0.15046631, -0.99626607, -0.5324382, -0.228696, 0.26502895, -0.7099257, -0.24755025, 0.5434749, -0.4053922, -0.8309872, -0.2989617, -0.86280966, -0.9859461, 0.97572213, 1.3376713, -0.3430115, -0.43402225, -0.1924202, 0.6710346, 0.74688536, 0.68394524, -0.29258135, -0.63783354, -0.25838947, -0.7412832, -0.13756852, 0.29825956, 0.38041145, -1.1111758, 0.5355625, -1.0727328, -0.37962234, -0.90463316, -0.2698317, -0.1467724, 0.13004409, -1.0194534, 0.11609152, 0.4127395, 0.28521538, -0.6652327, -0.7038725, 0.7316348, -0.48964947, 0.87470716, 0.8198417, 0.8121711, -0.55107266, -1.7259613, -0.27550706, -0.29355648, -1.0490227, -0.021362338, 0.19700499, 2.365385, 0.531291, 1.4412646, 0.8194168, 1.334413, -0.21749905, -0.3275181, 0.5781112, 1.150555, 1.4283984, 0.10826522, -1.1658969, -0.45134637, 0.04636837, -0.83447146, 0.81878465, -0.20615144, 0.5333617, -0.60880643, -0.042713113, 0.42055398, -0.5879446, 1.5446286, -0.3906217, -0.014214683, -0.9320095, -1.0041155, -0.77032924, -0.8490772, -0.3068128, -0.3138222, 0.8429545, 0.7392214, 0.059413563, -0.84115446, -0.1827325, 1.2329874, 0.20420718, -0.7757152, -0.4077565, -1.1934249, -0.8312496, 0.06622116, 0.36520314, 1.3569491, 0.27295056, 0.3010164, 1.8382473, -0.42277017, 0.23495656, -0.21165037, 0.37068194, 0.53597724, -0.15588544, -1.2607875, -0.40104312, -0.50267667, -0.13610771, 0.08203963, -4.3039837, -0.082001, 0.4916641, 0.7460458, 1.3272368, -0.5917864, 0.93342024, -1.0633006, -0.22604129, 2.1822553, 0.77348, 1.2415451, -0.92593575, -1.6016923, 1.9382031, -2.2590072, -0.72137606, 0.14148775, 0.13457671, -0.7451491, -0.41633192, 0.572699, 0.20894296, -0.665532, 0.1557113, 1.8900913, -0.17060457, 0.14676529, 0.9459177, 0.1988962, 0.6571039, -1.2214427, 0.48302603, 0.07323967, 0.6089274, 1.5770257, 0.06876827, -0.2896797, 0.6952437, 1.5110533, 0.32220465, -0.6618951, 2.1899383, 0.23477301, -0.41625032, 0.94061273, 1.5684785, -1.8303659, -1.2356102, -0.8779911, 0.89357895, 0.91234356, 1.0632848, 0.9623276, 0.73280936, -0.81256485, 0.62779176, 1.1951995, 0.18735348, 0.48628578, 0.20784137, 1.6061101, 0.6428331, -1.8172319, 0.07742017, 0.76475334, -0.28695786, 0.69205785, 1.3851129, -0.3151007, 0.5124455, -0.4670857, 0.42660737, -0.27413413, -0.79418296, 0.38474238, 0.44336423, -0.70331454, 1.6133739, -0.79705983, 0.58497494, 0.7683212, 0.95143867, -1.2097393, -0.5542208, -1.401292, -1.7129737, 0.32851774, 1.7300217, -0.13283907, 0.7207998, 0.79250276, -0.5060547, 0.838996, 0.33558664, 1.3048035, -0.6595723, 0.01165621, 0.40351102, -0.29559255, -0.3484041, -0.40840417, 0.95276344, 1.3805048, -0.28706077, -0.14665662, -1.5373006, -1.6770992, -0.9637392, 1.0667742, -0.8824096, -0.10521127, -0.33972454, -0.15037933, 0.29304558, -0.7167169, -0.026037984, 0.45332485, -0.30548358, 0.67668605, -0.70388466, 0.9721674, 0.022312656, 0.67783666, -2.221327, 1.0432537, 0.10468251, 0.50377524, 0.5216907, -0.26383665, -0.5668552, -1.0790802, -0.66269624, 0.53420395, -0.056507684, -0.030799769, -0.38935354, -0.26135808, -0.51806945, 0.6764826, 0.21997608, -0.2842363, 0.4153023, -0.7909994, 1.2961726, -0.32138214, -0.21153454, -0.23352191, -0.78287107, -0.47774607, 1.6039003, 0.5824032, 0.2871944, -0.77046245, -0.3201174, 0.4231739, 0.8662363, 0.8589964, 0.5837137, -0.5550777, -0.73803765, 0.7114582, -0.15480545, -2.4421003, 1.2693365, 1.5083162, 0.57656115, 0.5589083, -1.294058, -0.7516413, 0.68240094, -0.6442521, -1.8912579, -0.76375854, -0.18127736, -0.8704367, 0.78815466, 0.58496165, 1.2333207, -0.67811775, 0.7778747, 1.180586, -0.52837384, -1.6866188, 0.43942052, -0.5797858, -0.12091714, -1.5169264, 0.05719204, -0.26951146, -2.684711, -1.0172228, -0.30936632, -1.1998694, 0.13886273, 0.036559507, 0.3245873, -1.6026664, -1.3267136, 0.5069053, -0.36913142, -0.5306911, -0.070908874, -0.18541811, 0.69640446, -0.30087128, 1.0078833, 0.610926, 1.7221036, -0.5379479, -1.326377, -0.52609026, -0.46600527, 0.06604308, 0.2197823, -0.9372009, -0.3256157, 0.14768064, 0.699552, -0.72368884, 0.4794218, 0.026545957, 1.3436007, 0.23628801, -1.5402796, 0.19139451, -1.8511007, -0.44703215, -0.08679469, -1.6827856, 0.8235698, 0.16579445, -0.074705936, 1.0817068, -0.01459034, 0.8199119, -0.80417913, 0.53254235, -1.08217, 0.9492825, 0.24019396, -0.44084668, -0.73341775, 0.9208635, 0.37783542, 0.29370502, 0.27790993, 0.90694183, -0.68210644, 0.35099593, -0.50210375, 0.40147668, 0.56336397, -0.8843219, 0.1813156, 0.60259986, 0.4996659, -1.2195214, -0.06456041, -2.0830536, 0.79561657, -0.33496487, -0.41333812, -0.60755616, -1.3942319, -0.023980334, -0.31574172, -0.47269264, -0.45879, 0.37798846, 0.464371, 1.1505239, -0.35299638, -0.66388196, -0.46442628, -0.0014668554, 0.4657766, 0.3824118, -1.0646446, 0.47359174, -0.5501442, 0.54858595, 0.3592662, 0.41308272, 0.45073894, -0.7594449, -0.33872837, 0.31371093, 0.55662763, -0.20230436, 0.4447407, 1.6444561, 0.22029482, 0.0872115, 0.6798017, -0.32205412, -0.2614859, -0.6706727, 0.35378987, 0.38164073, 1.367708, 0.43917412, -1.6509491, -0.29672295, 1.7558253, -1.3782254, 1.0295317, 0.6083522, -1.7402619, 0.5930131, -1.4394379, -0.3491493, -1.1771997, 0.78438175, 0.0027834475, 1.0757275, 1.8362582, -0.6623099, -0.061427217, -1.429398, 1.0720371, -0.023497377, -0.41509795, 0.07872723, 1.5710311, 0.3394337, -0.86737263, -0.8013209, 1.0093807, 1.9009106, -0.78051865, -0.23401639, 0.073471576, 1.342778, -0.8758744, -0.05092702, -1.0604082, 0.88840294, 0.4845464, -0.31408712, 0.7285716, -0.6598388, 0.26622984, -0.15347672, 0.34162325, 0.5272665, 0.15939362, 1.0359404, -1.3569661, 0.8223073, -0.82353425, -0.851304, 1.2659918, -0.31349543, 0.9090855, 0.25253433, 0.61904687, -0.13841742, -0.67474073, 1.0259502, -0.051506877, -1.1969513, 0.16987415, 0.073220626, 0.37979242, 0.7651893, 0.58660114, 0.7042103, -0.5287451, 0.29557738, 0.17244934, 1.4235036, 1.7157453, 0.37425035, -1.8584217, -1.2582158, -0.6299258, 0.17255291, -0.12686756, -0.49752375, -0.22709069, -0.6200077, 0.42430815, 0.463663, 0.68685627, -0.71040833, -0.17139806, 0.38501126, 0.5601121, 0.50367576, -1.6438738, 0.077835165, -0.36538386, -0.23477188, 1.2270359, -0.61405075, -1.7066628, 0.81988287, -0.7482188, 0.035242945, -0.14084256, -0.65183985, -0.019776158, 0.12996586, -0.9195582, -0.41340956, 0.90673864, -0.6422904, 1.2120672, 0.06385599, 0.63100183, -1.30815, -0.9428998, -0.41631383, 1.965007, -0.86749756, -0.5259007, 0.13663939, 0.3468347, 1.7422681, 0.7007072, -0.020115245, -0.31306064, -0.031459868, 1.0573552, 1.8225657, 0.11774525, -1.5830071, -0.79576176, 0.05965937, 0.6052492, 0.62318075, -0.096916795, 0.31733304, -0.96026015, -0.27850336, 1.4682877, 0.6666615, 0.24167539, -0.5812353, -0.90307945, -0.55028933, 0.5831116, 2.5405624, 2.0145776, -0.960979, -0.4206924, -0.7996599, -1.7888918, 0.5773138, 0.44929433, 0.79602045, 1.2793171, -1.1028179, 1.5785166, -0.6605679, 0.123961315, 1.0325454, -0.030368492, 0.14277515, -0.24839605, 0.22407623, 1.2428747, -0.8223916, 0.7238152, 0.5589315, -1.2599404, 0.36306778, -1.1173778, -0.8732166, 1.4703016, -0.23819679, -1.6242712, 0.7218292, 0.118932486, 0.7071069, 0.53992164, 0.44476104, 0.6507463, 0.5524653, -0.6212482, -0.8308021, 1.7792088, -0.4863599, 0.24588388, 0.48519036, 0.45862278, -0.23362559, 0.6741241, 0.8668838, 0.12244135, -0.6257747, -0.67283255, 0.028253525, -0.6896872, 1.181849, -0.4711876, -0.5782417, 1.0118928, -0.05969412, 0.14305171, -0.4259127, -0.61529285, 0.077514656, 0.85673195, -1.3015722, -0.7207134, -0.27778414, -1.125479, -0.49426728, 0.3936475, 0.8884816, 1.7654979, -0.45583653, -0.11059831, 0.2442121, -2.1273844, 1.4961429, 0.641687, -0.45369974, -0.54703337, 0.6895549, -0.6619705, 1.1465002, -1.1790969, -0.45576596, 1.6416053, 0.6164581, -0.15951222, 0.7921248, -0.032377556, -0.80429655, 0.08237736, -1.4837114, 0.1985715, 0.15340376, 0.801544, 0.078613624, -1.9629599, 0.88010734, -0.46030182, -0.64362615, 1.1952101, 0.32887614, -1.7267823, 0.93907595, 0.094770044, -0.9705627, -0.27643013, -2.292801, -1.2397184, -0.41275358, -0.80883455, -1.7987494, 0.2907484, -0.20178545, -0.87403935, -1.7124034, 0.85280275, 0.042721435, -0.78331816, 0.25862864, -0.045897268, -1.3428419, -0.41759884, 0.6986912, 0.29880998, -0.74742967, -0.5181912, -1.019665, 0.3793689, -1.7902851, -1.4508095, -0.32118288, 0.5071308, 0.7328687, -0.60655284, -0.15128464, 0.6374675, -1.0154953, 0.03218935, 1.279699, 0.28615817, -0.07616529, 0.6687399, -0.7565428, -0.27557972, -0.23855832, -0.93483484, -0.087293684, 1.1687524, -1.3584801, 0.21150073, 1.2037069, -0.6048212, 0.30108434, -0.5661793, -0.27420956, -0.022391453, 0.33260012, 0.85373664, -1.4766654, 0.5845996, 1.4180158, -0.22024389, 0.667976, 0.6244385, -0.3168699, 1.1868767, 0.34774554, -0.64997494, 1.2400774, 0.19068903, -0.13514502, 2.0202057, -0.9182257, 0.199046, -2.1286008, -0.16045126, -0.15270948, 1.3005338, -0.5548139, 1.2173984, -0.29274017, -0.30937454, -0.7711906, -1.2893053, 2.3575566, -0.72209096, 0.7947462, -2.0041177, -0.39761025, -1.015814, 0.6978156, 0.868944, 0.13364673, 0.18352914, 0.8586364, 0.66782385, 0.610228, -0.34375954, 0.13003342, 1.2151164, -0.2166828, 1.1116873, 0.71258795, 1.1434194, -0.47186866, 2.1353364, 1.447041, 0.085622765, -0.5998132, 0.89812726, -0.08066484, 0.8420984, -0.32581723, -0.71437097, -0.17589144, -0.41022748, 0.60955167, -0.6410985, -0.7388026, 0.36736083, 0.039181054, -0.6307165, -0.5466139, -0.7783671, -1.5159419, 0.7252672, 1.2741427, -0.13147596, -0.40053046, -0.028620407, 0.7103258, 0.57227916, 0.87115306, 0.13265681, -0.7893819, -0.73650587, -0.9073851, 0.5145203, 0.11678757, 0.34510773, -0.93830043, 0.11222476, -0.8524616, -0.061620682, -0.55093145, -0.47949544, -0.09997742, 0.09835012, -1.0597764, 0.14261375, 0.1746223, 0.28936136, -1.0353326, -0.19909178, 0.47905058, -1.252357, 0.7624163, 1.2160978, 0.7688873, -0.6454922, -1.0831699, 0.02088613, -0.38204393, -0.907776, -0.9166499, 0.18642414, 2.432432, 0.10058874, 0.8733756, 0.27784142, 1.0831978, -0.60613316, -1.3419845, 0.7750269, 0.8635206, 1.8219028, 0.54030687, -0.87049514, -0.8088964, -0.6807017, -0.89217746, 0.53863055, 0.103357926, 0.29255334, -1.2158495, 0.18755785, -0.41067183, -0.61871785, 2.0842297, -0.6564288, 0.1175787, -0.25890535, -0.7177374, -0.6349298, -0.65529674, -0.26780748, -0.8083765, 0.51767904, 0.6745196, 0.36527988, -0.585937, -0.20295776, 1.7653798, -0.33259234, -0.96098894, -0.07512732, -1.5987782, -0.5730393, 0.25935447, -0.11502524, 0.7548667, 0.6395263, 0.45042387, 2.8521442, -0.95156074, 0.47897643, 0.17717683, 0.36947063, 0.72072726, 0.05572194, -0.8413897, -0.46243054, -1.2105479, 0.13334659, -0.032581076, -4.2375526, -0.59686345, 0.4538272, 1.0885404, 0.6702778, -0.48081216, 0.44729152, -1.140004, -0.010168858, 1.9525921, 0.832294, 1.7936808, -0.048765276, -1.6751267, 1.5497643, -2.353122, -0.4451682, 0.17112952, -0.1890958, -1.3813912, -0.39053974, 0.62938404, 2.082432, -0.7175064, -0.24595845, 2.3162117, -0.3158726, -0.12359636, 0.40302536, 0.18462911, 0.7844205, -0.0015291646, 0.6743531, 0.075157195, 0.11210073, 1.2258631, -0.05680778, -0.24221358, 0.27545154, 0.8361591, 0.5928248, -0.2545021, 1.8165491, -0.04416865, -0.26884404, 0.64862126, 2.21904, -1.7403183, -0.75271726, -0.7202007, 0.16653919, 1.0871801, 1.3364254, 1.4694904, 0.9652211, -0.80510324, 0.5183391, 1.7491461, 0.511918, 1.3462274, 0.7024353, 1.4506098, -0.04295113, -1.2183081, 9.816363E-4, 0.8816808, 0.1508924, 1.1356016, 1.6477102, -0.11800997, 0.30756932, 0.26012784, 0.7386577, 0.29488558, -0.47505602, 0.19272491, 0.51341426, -0.6810482, 0.8993299, -0.60003865, 0.86971986, -0.15220067, 1.1147594, -1.1383475, -0.33894932, -0.26593307, -1.6458954, 0.18725836, 0.94011426, 0.11729905, 0.105840944, 0.3609804, -0.9327989, 0.3713091, 0.060831085, 0.9854874, -0.34511298, -0.2879524, 0.5795063, -0.5236333, 0.065186724, 0.18788286, 1.3223159, 1.1334118, -1.0533829, -0.39967948, -1.9732791, -1.1970584, -1.0549864, 0.43055233, -0.34520608, 0.42950767, -0.003649138, -0.07939597, 0.6475297, -1.3730345, 0.062667415, 1.6147989, -0.1476839, 0.04871749, -0.91856533, 0.56362367, 0.55767614, 1.1749725, -2.0295792, 0.43310302, 0.09634046, 0.20091093, 0.26272556, 0.046745386, -0.21969129, -0.6707004, -0.7647821, -0.063160166, 0.51600844, -0.3087896, 0.41689703, 0.4392679, -0.8582071, 0.79339665, 0.28519478, -0.26558462, -0.6659972, -0.7188982, 1.3808789, -0.89023215, 0.41144633, 0.16805208, -0.75122094, -0.11867887, 1.543643, 0.61344016, -0.19704866, -1.0062346, 0.44627762, 0.4860831, 0.3939407, 0.36183584, 0.7851459, -0.8682549, -1.1847831, 0.5358516, 0.26103783, -2.2152636, 1.103417, 1.4953772, 0.1992315, 0.07908572, -0.8492448, -1.2705877, 0.29931432, -0.9461487, -1.4458283, -1.0470415, -0.41218147, -1.0918698, 0.6166757, 0.18749386, 1.2787181, -0.92622375, 0.6054672, 0.870527, -1.0691093, -1.7123365, 0.0495075, -0.738194, 0.34881157, -0.44842792, -0.4201811, -0.05393745, -2.1925974, 0.09545113, 0.06688569, -0.8977198, -0.085284755, 0.102158695, 0.20149165, -1.7651014, -1.0870925, 0.24054264, -0.74779993, -0.44569153, -0.42099476, 0.8351224, 0.97377527, 0.7060151, 1.0186949, 1.0475934, 2.3733313, -1.1107163, -1.101293, -0.85240287, 0.021774217, -0.03084986, 0.31226873, -0.8944292, -0.6745035, 0.8306402, 0.63163084, -0.88356215, 0.6354829, 0.5462163, 1.6622038, 0.22387153, -1.3001823, -0.0757204, -2.4847255, -0.22084947, -0.7999485, -1.89805, 1.0499556, 0.44911587, -0.5646096, 0.8053865, 1.3021152, 1.8230816, -0.56671524, 0.11187309, -1.3048412, 0.9349616, 0.2546708, -0.36234832, -0.6659309, 0.90868163, 0.04853189, 0.09261486, 0.015527621, 0.7454172, -0.9419852, -0.047329552, 0.08699082, 0.42673504, 0.780743, -0.94500506, -0.73876095, 0.16158783, -0.070774965, -0.5767895, 1.137128, -3.186622, 1.1911851, -1.0656859, -0.392686, -0.03938763, -0.9039558, 0.75739443, 0.5312309, -0.7341834, -0.38595462, 0.2647596, -0.07928561, 0.75340587, -1.3045008, -0.8802977, 0.30121127, 0.2543338, -0.34264043, 0.45520693, -0.9154624, -0.10101467, -0.02641562, -0.12726673, 0.010956101, 0.9258601, 0.1098481, -0.16978537, -0.3670274, -0.07359931, 0.5837086, 0.69936067, -0.28604972, 1.59343, -0.1453458, 0.32370114, 0.6298896, 0.46533775, 0.14416869, -0.39564282, 0.88691527, 0.6066644, 1.3613597, -0.37090945, -1.7808118, -0.1720133, 1.0270717, -0.54187065, 1.6680968, 0.11771559, -1.8401663, 1.1491469, -1.9306219, 0.5856592, -1.1250175, 0.9635127, -0.86805916, 0.9950776, 1.5667278, -0.108083725, -0.8249335, -0.9405231, 1.1947067, -0.35845593, -0.48510844, -0.25952032, 1.5655563, 0.8452434, -0.55366373, -0.842601, 0.14117181, 1.1900853, -0.88801455, -0.8419519, 0.009560674, 0.7411447, -0.11118782, -0.46682933, 0.17498611, 1.4330704, 0.49638534, 0.19230416, 1.2091411, -0.34786895, 0.2274889, -0.37641925, 0.10583784, 0.29251122, 0.26727018, 1.0795634, -1.1727878, 0.7986189, -0.75620455, -0.14081307, 0.70355874, -0.17094393, 0.8434166, 0.0870233, 0.005512327, -0.67821467, -0.5855471, 0.16779336, -0.15551087, -0.58186996, 0.0809322, 0.25340253, 0.4838119, 0.6051569, 0.72161484, 0.24405366, -0.3099302, -0.19053733, -0.33977276, 0.6870599, 1.2345992, 0.3064082, -2.0492685, -0.80029774, -0.73350406, 0.047823828, -0.2212841, -0.53130865, -0.39911112, -0.81050694, 0.19141236, 0.39204028, -0.041854225, -0.41634703, 0.5479881, 0.9199982, 0.37612298, 0.46730843, -0.844545, 0.7269514, -0.54978836, -0.22469144, 0.5518924, -0.21882303, -1.7599337, 0.19333343, -0.6137202, 0.35599604, 0.4681678, -0.93530613, 0.3675471, -0.5560331, -0.93811864, -0.05328221, 0.30546796, -0.06468683, 1.1055162, 0.31039363, 0.79712665, -0.8880656, -0.41150033, 0.62709105, 1.0567634, -1.3500221, -0.58200276, 0.3762134, 0.47680095, 1.6633757, 0.3248726, 0.3021961, -0.65517944, -0.109807625, 1.2432631, 1.7977482, -0.18578239, -2.0532904, -0.619208, 0.14947218, 0.9085295, 1.0551935, 0.011069931, -0.37766242, -0.689911, -0.43453133, 1.6019069, 0.3811674, 0.7572155, -0.40539703, -1.2555295, -0.69455326, 0.49768996, 2.6146052, 2.6659274, -0.9112146, -1.1077894, -0.23498018, -1.2007558, 0.8432704, 1.4062907, 0.53809303, 1.529563, -1.5362505, 1.6111442, -0.5297894, -0.11808497, 0.20472874, 0.31043276, 0.1835281, -0.5836088, -0.02861229, 1.4592621, -0.9100425, 0.61336476, -0.19170228, -0.83800125, 0.8228804, -1.1628532, -0.7328894, 0.84273213, -0.11957289, -1.5090224, 1.0768483, -0.104951106, 0.24791405, -0.366059, 0.96841574, 0.42228532, 0.50324833, -0.5371943, -0.5149842, 1.1027789, 0.19120961, 0.15430793, 0.2757321, -0.36539328, 0.28428805, -0.08055519, -0.3374042, 0.7996474, -0.3285212, -0.14873916, -0.41024688, -0.88183016, 0.2243497, -0.20743272, -0.39711243, -0.20242156, 0.066387035, 0.123112775, 0.469679, -0.39338633, 0.16844624, -0.053532504, -1.3422933, -0.66371524, -0.10573699, -0.2580982, 0.008790031, -0.29559684, 0.8452203, 1.7971001, -0.36888883, 0.58605707, -0.17919783, -1.3992865, 1.8432058, 0.6336147, -0.53755534, 0.05347249, 0.70169985, -1.0162297, 1.4821874, -0.40619004, -1.5554171, 1.3304783, 0.7642607, 0.06273963, 1.190404, 0.050506398, -1.0424638, 0.46894956, -1.1349477, -0.0035732836, 0.47234288, 0.52248424, -0.31404004, -1.919094, 0.51133317, -0.2986818, -0.36438683, 1.6392047, 1.1344445, -1.5788847, 0.9403384, -0.12823837, -0.4158857, -1.3239692, -1.9897468, -0.89076465, -0.47164863, -0.5873591, -1.5080955, -0.4241918, -0.34073642, -0.8595737, -2.1563668, 0.5392478, 1.1566588, -0.48543102, 0.26236895, 0.47868973, -1.1099099, -0.02641529, 0.24095038, 0.05020159, -0.749434, -0.5565289, -1.1763871, 0.7146039, -1.4472867, -0.594348, -0.46612006, 0.7443287, 0.17006834, -1.274579, -0.35685042, -0.07105823, -1.6138446, 0.06209471, 1.7139359, 0.22178563, -0.35350642, 0.543285, -1.3267688, -0.0037474781, -0.6415884, -0.6476863, -0.0051679052, 0.8534037, -1.1693122, 0.010954498, 1.6279119, -0.6788517, -2.533438, -0.8678859, -0.5320176, -0.4124887, 0.9793085, 1.4319218, -1.6222152, 0.5541427, 1.929475, -0.44764268, 0.57726157, 0.30474505, -0.08566475, 1.6472805, 0.15703492, -0.24655053, 0.7776795, 0.49221545, -0.042755544, 1.8118613, -0.33484954, 0.9483563, -1.1041298, -0.34732231, -0.5435285, 0.63029665, -0.29857004, 1.038833, -0.41452676, -0.762923, -0.19454634, -1.763375, 1.6416986, -0.14207828, 0.43010616, -2.5701048, -0.4156133, -0.3095801, 0.7914582, 0.83072764, -0.33544338, 0.03689442, 0.91521347, 0.7419453, 0.4195006, 0.29579616, 0.1270438, 1.1525235, -0.34384894, 1.3438214, 0.7089049, 1.4401239, 0.8427912, 1.9773139, 1.280215, 0.8321328, -0.11056949, 0.541568, -0.37214747, 0.7184359, -0.4635601, -1.0396259, -0.1376052, 0.08048542, 0.2302494, -0.8580882, -0.54565936, 0.0654906, -0.75482774, -0.9244739, 0.06187714, -1.1852716, -0.6424487, 0.25576863, 0.78124565, -0.06435682, -0.70427924, -0.55639213, 0.93429047, 0.69335544, 0.5599617, 0.17459932, -0.41115555, -0.16953023, -0.5571107, -0.6561706, 0.3354718, 0.9480737, -0.94258595, 0.90569663, -1.1170458, -1.9504805, -1.196713, -0.3679911, 0.015131488, 0.18721208, -1.1809741, -0.26950598, 0.6782336, -0.34831914, -0.42956293, -0.62750363, 0.41887188, -0.8657223, 0.2825969, 0.8393127, 0.56417716, -0.05883214, -1.5311673, 0.01864133, -0.1042253, -1.3455918, -0.55855167, -0.24753773, 2.4837918, 0.57509506, 1.0181949, -0.12295708, 0.8753308, -0.5293411, -0.36454523, 0.5012073, 1.1117135, 1.3556263, 0.42402056, -0.93515843, -0.5668046, -0.7429016, -0.49684244, 0.18577796, -0.1632435, 0.12502918, -0.8384259, -0.38961706, -0.20223175, -0.75471324, 2.1295795, -0.3969314, 0.22128996, -0.74520034, -0.675958, -0.56324315, -0.42674473, -0.63405246, -1.2011486, 0.52042735, 0.9495089, 0.020391192, -0.90801936, 0.4682513, 1.7587634, -0.3028639, -1.1834548, -0.31927472, -0.6695488, -0.52235776, -0.7186115, 0.7899222, 1.0014939, 0.27173263, 0.42071947, 1.7468405, -0.78924674, 0.36825815, 0.31606954, 0.11986427, 0.63423735, 0.51299596, -1.373041, -1.069034, -0.57540166, -0.045445397, -0.34945235, -3.3275523, 0.22731975, 0.36902305, 1.2367005, 0.39194432, -0.4746917, -0.24819094, -1.2438312, 0.08193148, 1.8569534, 0.098598346, 1.8004669, 0.097691424, -1.7224234, 0.88370246, -1.9531832, -0.9167318, 0.5780656, 0.05229275, -1.3191699, -0.34447095, 0.68812364, 0.5720577, -0.8811223, -0.11898157, 2.3788629, -0.02985695, -0.5108037, -0.054584697, 0.73180276, 0.4270401, 0.33755153, 1.1565756, 0.23356235, 0.1625686, 0.88033533, -0.2092922, 0.06942951, 0.23726052, -0.23033059, 0.68557966, 0.08532261, 0.99904776, 0.57505476, -0.39024824, -0.13172224, 1.9205338, -1.5390093, -0.08105607, -0.5932407, -0.16045141, 1.7443988, 1.2447889, 1.1255945, 1.2813084, -0.330172, 0.76995254, 1.8966867, 0.1743443, 1.3014711, 1.7853279, 1.1622835, -0.31911337, -0.6598214, 0.7157046, 0.89193434, 0.5118476, 0.65639853, 1.424856, 0.5915188, 0.13096291, 0.022042617, 0.8315848, 0.6827663, 0.07303734, 0.054391682, 0.1589834, -0.9787285, 1.0332872, -0.008612797, 0.8126753, -0.97286534, -0.5721441, -1.9303764, -0.29299396, -0.21202728, -1.1703851, -0.22406223, 1.4962769, 0.11641924, 0.23256451, -0.0811607, -0.8660191, 0.24334851, -0.008027129, 0.9900221, -1.0267837, 0.16684823, 0.57861924, -0.09820887, -0.06444654, 0.79702586, 1.5110456, 1.18736, -1.2774931, -0.78421193, -1.9064893, -1.2888294, -1.0921284, 0.08533788, -0.26716572, 1.0318695, 0.16370623, -0.07553395, 0.5450891, -1.4996822, 0.5724112, 1.5733267, -0.8450707, -0.043714702, -0.6893503, 0.51687837, 1.2746414, 0.7146934, -2.1531124, 0.20818664, -0.10973995, 0.18675843, 0.16448702, -0.7166813, -0.12982129, -0.63502383, 0.031319126, -0.18294649, 0.49100095, -0.36713195, 0.66632205, 0.6834382, -0.35128006, 1.0835311, 0.2283787, -0.66630197, -1.1066312, -0.89536554, 1.5596511, -1.0005987, 0.765801, -0.5909458, -0.85717076, 0.30332184, 1.67724, 1.0395846, -0.028179117, -0.26196128, -0.20154642, -0.15438686, 0.7855068, -0.19717416, 0.5493648, -0.75587803, -0.455737, 0.3237022, 0.42722195, -2.0473754, 0.56801397, 1.3903089, 0.12004324, 0.7005229, -0.3407321, -0.5261313, -0.1538756, -0.7910628, -0.9309482, -0.16353002, -0.58801615, -1.1426258, 0.76081985, -0.53621614, 0.84474635, -0.72333145, 0.24581629, 0.66596776, -0.70429707, -1.6138331, -0.7180623, 0.043840438, 0.84993523, -0.5890736, -0.24500962, -0.20937885, -2.2674901, -0.03398995, -0.078055896, -0.49442667, 0.075571254, 0.09625011, 0.35759744, -0.99303055, -1.5036392, -0.05741927, -0.5990357, -0.56783354, 0.03719426, 2.5208445, 1.2792852, 0.8199502, 0.93128866, 0.9208104, 1.6470743, -1.5426618, -1.3811654, -0.7987242, -0.8944512, 0.4178534, 0.38932425, -0.75248533, -0.06557035, 0.7185067, 0.9333569, -1.0048586, 1.0705352, 0.9695664, 1.353385, 0.09010321, -1.1382583, 0.55308497, -2.6025121, 0.15243526, -1.4278551, -1.6607153, 0.860541, 0.5684724, -0.7798525, 0.9574742, 1.8088274, 1.4807726, -0.1732581, -0.49971592, -1.2938926, 0.6186871, 0.37323606, -0.5336785, -0.98147213, 1.0458283, 0.25446412, 0.36312097, 0.07027008, 0.11262571, -0.42707434, -0.220013, -0.5875742, 0.4669395, 0.6798075, -0.63334805, -0.5783406, 0.1251126, -0.38114056, -0.68132406, 1.0469259, -3.5155873, 1.9671042, -0.9190454, -0.55197716, 0.83801544, -0.5714603, 0.44932735, 0.5354219, -0.5702951, 0.16947825, 0.24018587, 0.48090443, 1.0678362, -1.1853591, 0.079099774, 0.16553098, 0.7293623, -0.71074075, 0.5235574, -0.90503824, -0.88592046, -0.13836983, -1.052803, 0.2526356, 0.34508625, 0.20159572, -0.5355421, -0.43164968, -0.26517433, 0.8913823, 0.39937818, 0.30155915, 2.2124255, 0.0603099, 0.23342517, 0.49676266, 0.75205475, 0.20550296, -0.62654245, 0.28884768, 0.46931282, 1.577348, -0.5057512, -0.8608184, 0.44936067, 1.383238, -0.03490097, 1.2874973, 0.29172882, -1.3608899, 2.2177153, -2.2990627, 0.15486032, -0.94746184, 0.72527826, -0.74821305, 0.5642979, 1.6237416, 0.35510045, -1.371967, -1.4305518, 0.5656934, -1.2487237, 0.4213405, -0.36367983, 0.76374024, 0.93968344, 0.36534926, -0.7551423, -0.0038674623, 0.63060087, -0.6101065, -0.38811347, -0.4785545, 0.5892981, 0.2723823, -0.80994344, -0.7184911, 1.58496, -0.74103945, 0.14645888, 0.8801471, -0.0349124, -0.17808646, -0.8373291, -0.5489321, 0.6399772, -0.56448287, 0.45920986, -0.32797137, 0.48876214, -0.7722936, 0.7110514, 0.5914641, -0.023131683, 0.46343315, 0.4108361, -0.10862967, -0.80872583, -0.56265444, -0.2195296, 0.07072757, -0.32874253, -0.2331534, 0.221698, 0.73738515, 0.7718544, 0.6031042, -0.27522433, -0.8341945, -0.7196441, -0.17732127, 0.5561446, 0.6526755, 0.36112553, -1.6164314, -0.6448827, -0.2615705, 0.37312427, -0.42878437, -0.50876844, 0.01557447, -0.9423974, 0.14062455, 0.6049541, 0.67849314, -0.34584293, 0.4975931, 0.025627308, 0.8797541, 0.4259451, -0.22281408, 0.24196546, -0.11239098, -0.01917174, 0.25028148, -0.34636748, -2.0611026, -0.06447427, -0.62459165, 0.858958, 0.36105034, -1.1696876, 0.056905136, -0.4261216, -0.94341487, -0.30531296, -0.47526762, -0.42512742, 1.4714365, 0.083199374, 1.0179315, -0.9701613, -1.1648011, 0.42087835, 1.1566582, -1.1164685, -0.39050156, 0.4177849, 0.54503053, 1.0581168, 0.122496866, 0.64877594, -0.3731066, 0.8710224, 1.0467112, 1.4225514, -0.1536279, -1.5523295, -0.52426374, -0.2779017, 0.8133898, 0.85683167, -0.36897337, -0.35123062, 0.120082036, -0.54450643, 1.0384865, 0.27679268, 1.8568588, 0.03938148, -1.1608962, -0.41695762, 0.39431348, 3.1264772, 2.3877347, -0.15257652, -0.7320024, 0.12419622, -1.287175, 0.39385453, 0.974821, 0.049994696, 1.0091165, -1.7531127, 1.6948011, -0.366085, -0.4567839, -0.29971364, 0.16656825, 0.08037225, -1.1328343, -0.36554125, 0.40561542, -0.63396376, 0.57928526, -0.40685052, -0.5381798, 0.8005147, -1.3192124, -0.904293, 0.008866582, -0.44051528, -1.3872772, 0.43811536, -0.014631502, -0.022128046, -0.13452059, 1.015941, 0.53356636, 0.39078796, -0.75855446, -0.047520082, 1.2373616, 1.0721242, 0.12809762, 0.1334298, -0.89095044, 0.004328221, -0.24677542, -0.5256807, 0.41210282, 0.35521665, -0.3742752, -0.5365181, -0.40289578, 1.0373986, -0.62946624, 0.09559971, 0.16945997, 0.16011313, 0.15484661, 0.7171279, 0.2228621, 0.62859035, 0.56555617, -1.0822077, 0.104222655, -0.3825818, -0.7731678, -0.34897146, -0.45309782, 0.80402774, 2.3230875, -0.30913597, 0.6176475, -0.15234187, -0.9130463, 1.9025639, 0.86815125, -0.83166724, -0.21401684, 0.78785205, -1.739686, 2.2668343, -0.345401, -1.0512193, 0.91875213, 0.5199171, 0.58468884, 0.73392284, 0.041696012, -0.6166961, 0.84339494, -0.77854466, -0.24405773, 0.67765325, 0.55435055, -0.8057577, -1.5064452, 0.16376469, 0.14463758, 0.19168483, 1.114181, 0.55640376, -1.3145398, 0.98460054, 0.9113636, 0.8381783, -1.8150179, -1.5715137, -0.4935258, -0.49357474, -1.229667, -1.7216921, 0.4676819, -0.11519488, -1.0244559, -2.2180781, 1.4384127, 0.9492223, -0.69357115, 0.1867604, 1.0693477, 0.27487653, 0.121413276, -0.042237528, 0.12876141, -1.2549193, -0.77649903, -1.20677, 0.9945025, -1.718436, -0.3108896, -0.3544942, 0.9586106, 0.12614103, -1.4019394, 0.06979652, -0.51264375, -0.7824047, -0.14419945, 0.78628355, 0.07944815, -0.37333307, 0.540624, -1.2557046, 0.07462505, -0.41541994, -0.62134737, -0.28327915, 1.3320854, -1.043966, -0.12159033, 1.3173989, -0.81243837, -1.0274365, -0.49187303, -0.7640168, -0.7643263, 0.33342665, 1.655695, -1.7654641, 0.35340893, 1.9987454, -0.78443074, 0.79294956, 0.6738753, 0.023859248, 1.9800975, 0.47687012, -0.7451932, 0.1652671, 0.6715458, 0.29612985, 0.89887625, 0.14210236, 0.73136324, -1.5946822, -1.0582726, -0.038778365, 0.16555099, 0.524512, 1.2363143, -0.49336198, -1.3413302, -0.7077877, -1.6578598, 1.5656521, 0.8138503, -0.36629808, -2.1896977, 0.0034853667, 0.9763886, 0.8405733, 0.8849647, -0.17390905, -0.6129, 0.6286722, 1.2564892, 0.2851164, 0.13694803, 9.93222E-4, 0.4676696, -0.48247516, 1.1001453, 0.5705339, 0.94548523, 1.187321, 1.783094, 0.8113491, 1.2139865, -0.016164929, 0.06480987, -0.4149706, 0.23398118, -0.37877452, -1.9220417, -0.050598614, -0.043078206, 0.16855747, -1.6443363, -1.1252139, 0.29613024, -0.672517, -0.5698791, 0.9530813, -1.0694199, -0.46017033, 0.24601588, -0.092323065, -0.44932622, -1.0141845, -1.1348956, 0.61431545, 1.1054189, 0.6349839, 0.7187088, -0.17796, -0.62297076, -0.031074379, -0.79158825, 0.9304359, 1.0766014, -0.76064134, 1.7666234, -0.80129695, -0.74121195, -1.0616574, -0.47188386, -0.36682612, 0.056807466, -0.8654932, -1.0248501, 0.546155, -0.5306963, 0.13037133, -0.6111008, 0.6068614, -0.91773814, -0.44095993, 0.5009603, 0.23484223, -0.17028934, -0.99245024, -0.65067893, 0.5472163, -0.3604442, -0.090568155, -0.4291102, 2.0521805, 0.1021027, 0.6916592, -0.023792937, 1.0715119, -0.83712643, -0.262352, 0.49454427, 0.8390617, 1.3250201, 0.46689984, -1.3506244, -0.99871457, -0.41264826, -0.49381423, 0.26062092, -0.0091345385, -0.02672518, -0.83447754, -0.5903585, -0.39882338, -1.0657839, 1.609232, -0.8066679, 0.4368572, -0.27918258, -2.0761468, -0.09133339, -0.9619137, -1.0781144, -1.9522108, 0.26916057, 1.4185976, -0.2584761, -0.8973954, 1.2409537, 1.2401322, -0.5636558, -0.85113424, 0.65403336, -0.060163096, -0.25691256, -2.1591415, 0.51948744, 0.88662255, 0.1598527, 0.44388902, 0.83538866, -0.6544175, 0.7489537, 0.3759879, -0.30538988, 0.76651734, 0.8989458, -1.1572857, -1.8967073, -0.8011603, 0.20302266, -0.10743599, -3.762876, -0.24564815, -0.6410657, 1.6019788, 1.327007, -1.260699, 0.17235702, -0.99035263, 0.1482996, 2.056026, -0.44028974, 1.9759376, -0.12924966, -1.6157428, 0.03122072, -1.1889125, -0.908909, 0.54299027, -0.8005189, -2.12892, -0.791977, 0.74162257, -0.1204547, -0.6256237, -0.26259482, 1.8753844, -0.3260839, 0.080399685, -0.026118852, 0.8907727, 0.4319697, 0.08642858, 0.8313999, 0.17721243, 1.0065078, 0.6526892, 0.7172497, -0.8695093, 0.6089649, 0.27802703, 0.71105754, 0.31578606, 0.9712795, 0.16790774, -0.038687415, -0.13922635, 1.5738863, -1.0589528, -0.4771744, -0.22979447, 0.21364734, 1.2524059, 1.6702797, 0.20834085, 1.1059339, -1.6936125, 0.6711643, 1.6396366, 0.57020766, 1.045982, 1.2803408, 1.4934437, -0.41918638, -1.1421211, 0.030070513, 0.7253566, 0.31505457, 0.63685656, 1.8019769, 0.54031014, 0.11650577, 0.2846742, 1.5046045, 0.5767608, 0.36930075, 0.32829267, 0.052114997, 0.578656, 1.4265828, 0.3710441, 1.0938163, -0.5008584, -0.5134587, -1.9278206, 0.30874428, 0.15796334, -1.2401778, 0.17576662, 2.0004287, -0.02314052, -0.055543534, -0.50468975, -0.11305372, 0.54043645, -0.5756428, 0.49722683, -0.5297424, 0.13753265, 0.25518733, -0.23544669, -0.5141269, 0.75673586, 1.3438044, 0.9461643, -0.39285365, -0.5860044, -1.787984, -0.8788467, -0.40555692, 0.3285657, -0.38691264, 1.3708282, 0.36385515, -0.7747672, 1.2061442, -1.6046813, -0.23393211, 1.293443, -0.31235135, 0.28134233, -1.1506547, -0.0991762, 1.4272449, 0.6899714, -1.3709666, -0.30998096, 0.7646165, 0.52666295, 0.6161754, -0.32877484, -0.054364443, -0.44929767, -0.8694531, 0.94425637, 0.3422884, 0.6323704, 0.34922627, 0.9050418, -1.5845101, 0.45886135, -0.29504868, -0.5662195, -1.5704926, -0.54826355, 2.2663965, -0.96759653, 0.07684225, -0.68078613, -0.49419355, 0.5082733, 1.7261288, 1.2518026, -0.02031415, -0.90473115, 0.35896915, 0.49848247, 0.5520185, -0.7405191, 0.3500682, -0.262386, -0.3942172, 0.29561684, 1.021035, -1.4068037, 2.2699223, 1.4257491, -0.10412434, 0.17128283, -1.0413268, -0.86806285, 0.37422425, -1.391298, -0.995613, -0.81997967, -1.0913445, -0.43824428, 0.7557612, 0.7228685, 1.022525, -0.8960229, -0.5878514, 0.29143187, -0.24042165, -1.5417792, -0.8847957, -0.16454956, -0.108894505, -0.8830671, 0.30506596, -0.047977895, -1.5889373, 0.0026431233, 0.1652314, -0.084799856, -0.14659284, 0.7213514, -0.25080308, -2.7894351, 0.05464632, 0.20575038, -1.2875743, -0.5489224, -0.23698223, 0.62773806, 1.4328256, 0.87418485, 0.29029268, 0.72027886, 1.5169219, -0.93750125, -0.6640493, -0.8408683, -0.69088763, 0.071907505, -0.33705214, -0.37655997, -1.1414671, -0.3436033, 0.6703798, -0.34200937, 0.76734024, 0.48768342, 2.0672226, 0.3513915, -2.6420221, 0.79512703, -1.9421546, -0.39919388, -0.3103354, -1.3154385, 0.5201629, -0.039092638, -1.0361304, 1.2638918, 1.6469301, 1.4541465, -0.12338864, -0.20437062, -1.3766631, 0.20336919, 0.3032297, -1.1453805, -0.63037485, 0.86080396, 0.057820674, -0.17105912, -0.66717327, 0.8759303, -1.5944928, -0.34394643, -0.81281877, -0.10437061, 0.51413935, -0.6940095, 0.09568102, 0.4002368, 0.3984665, -0.4812769, 1.0038961, -2.2231097, 1.4474787, -0.57229334, -0.20271471, 0.8423536, -0.3723959, 1.499843, 0.74556774, -0.2668783, -0.17127366, -0.26935872, 0.04133615, 0.5453585, -0.8243729, -0.39952496, 0.4004973, 0.41419125, -0.5219258, 0.78898853, -1.1944782, -0.069127515, -0.50455236, -0.72714645, -0.020746175, 0.5059885, 0.04399816, -0.7894044, -0.4625147, -1.1342267, 1.1750203, 1.0542814, 0.54491824, 1.1081833, 0.9187785, 0.35971174, 1.2452533, 0.34259045, 0.21274799, -0.3588566, 0.4610651, -0.04601556, 1.4945889, -0.5564384, -1.0967007, 0.7066467, 3.3626142, -0.45100608, 0.94582105, 0.5915438, -1.2985345, 1.8414979, -1.8253032, 0.14959589, -0.77038383, 1.4642384, -0.4388054, 1.288484, 1.3210498, -0.80942005, -0.9672099, -0.65774846, 1.1029816, 0.46842724, -0.6264829, 0.4077455, 0.81473553, -0.42250708, 0.32202694, -0.22059433, -0.7988756, 0.708937, -0.9522668, -0.7775771, 0.059927836, 0.74642587, -0.19692329, -1.2440609, -1.098552, 1.0545642, -1.0772063, 0.74647504, 1.470575, -0.5858193, -0.0924616, -0.17740022, -0.66750735, 1.1928539, -0.23574628, 0.81189126, 0.09582798, 0.4183188, -1.1813284, -0.026065111, 0.31969306, 0.43597493, 0.66805744, 0.62070143, -0.0034784377, -0.8889909, -0.80639535, 0.3112222, 3.1803548E-4, -0.6416318, 0.33191863, 1.1382916, 1.3028858, -0.10085269, 0.3195763, -0.31446657, -0.35984194, -0.38577667, 0.53107315, 0.40813607, 0.7133298, 0.25367644, -1.0670294, -0.6008749, 0.2553314, 0.80797035, -0.35269725, -0.6880298, 0.24852966, -1.1319366, -0.8757431, -0.21580404, -0.18601301, -0.6906879, 0.014807865, 1.1912467, 1.04509, -0.10085851, -0.45177278, -0.072870165, 0.329378, -0.49100843, -0.43467385, -1.2889651, -0.70850945, 0.26771125, 0.18572438, -0.2720942, 0.43180743, -0.81432074, -0.16396782, -0.6017848, -1.1050781, -0.1555152, -0.23216394, 0.037618868, 0.7290777, 0.9550213, 0.5936872, -1.586561, -0.6771395, 0.56206936, 1.130935, -1.2366065, -0.1617217, 0.51420254, 0.971334, 1.78033, -0.1060246, 0.21716677, -0.27206194, 0.54947907, 0.94673073, 0.73379856, -0.8343029, -1.4676459, -0.46819842, 0.48852733, 0.37889057, 0.23780534, 0.38874793, -0.5406712, 1.3277413, 0.15832564, 1.6661067, 1.2097427, 1.4635663, -0.12328875, -0.67774004, -0.28292066, 0.320097, 2.5623178, 1.3031111, -0.603192, -0.89567465, 0.30138868, -1.5841885, 0.53296447, 0.6786059, 0.40331912, 2.0684633, -1.8140808, 1.4070704, -0.3449422, 0.042878196, 0.015341766, -0.5814527, 0.40312484, -1.6848412, 0.3573785, 0.58632135, -1.2993916, 0.4050647, 0.09386148, -0.9597645, 0.24521033, -1.296575, -0.8788979, -0.07583651, -0.19651726, -1.3198664, 0.91247207, -0.23491615, -0.69126385, -0.36646947, 0.6679405, 0.6521822, 1.2520598, -1.2030113, -0.05532061, 1.2752007, 0.65868104, 0.13310033, -0.38185915, -0.36582285, 0.6203386, -0.44607306, -1.0542217, 0.69973034, -0.21898067, -0.90345484, 0.3432177, -1.1876707, -0.61998874, -0.17062163, 0.03154456, 0.9546824, -1.1999363, 0.35003653, 0.3774589, -0.69688475, 0.5394852, -0.4178684, -0.5743325, 0.44549868, 0.23013777, 0.48078102, -1.2584909, 0.17692174, 0.77223897, 2.3418598, -0.60895723, 0.47246987, 0.0635868, -1.6709051, 0.9226307, 0.87492394, -0.26498368, -0.62524897, 0.4892697, -1.2254604, 1.4037976, -0.2848704, -1.2092291, 0.07173258, 0.9759337, 0.28825217, 1.1190293, 0.36933511, -0.86020666, 0.46288306, -0.8207261, 0.7977053, 0.3890648, 1.1675832, 0.0275044, -0.39459595, -0.13455182, 0.07498321, -1.271422, 1.2770928, 0.049766738, -1.4789736, 0.9204863, 0.70714617, 0.70985067, -2.331192, -0.61922467, -0.2763989, -0.5571157, -0.67623353, -1.1761963, -0.21970682, 0.27037323, -0.8994191, -2.381745, 0.6371306, 1.2865686, -0.18902478, 0.50391877, 0.059875734, 0.060568426, -0.29835868, 0.04036907, 0.22656354, -0.50994015, -0.37293923, -1.2668151, 0.49166775, -0.8428958, -0.19374083, -0.60098785, 1.1365696, 0.27369553, -0.7550793, -0.1837983, -0.28003544, -1.5021, 0.017706933, 1.007257, 0.5001768, -0.76717174, 0.81601655, -1.4830563, -0.06647308, -0.8637145, -0.8227021, 0.45729873, 0.8057303, -0.9028343, -0.6716624, 1.3764576, -0.049274106, 1.3423727, -0.92215544, -1.1009762, -0.32981873, 0.7333975, 1.4434083, -2.4913514, 1.482163, 1.5521965, -0.81519526, 0.5059769, 0.44045776, 0.5900404, 1.4250352, 0.49720865, 0.41570318, 0.15930353, -0.13293587, -0.64938587, 1.6937196, -0.1525658, -0.090940125, -1.6866062, -1.2692227, -0.82893753, 0.8964745, 0.75051117, 1.5867168, 0.096937, -0.74163896, -1.2800126, -1.4941839, 1.6449912, 0.4826567, 0.5664867, -1.7497717, -0.06550709, -0.08505991, 0.4821029, 0.54030067, -0.082249105, -0.99253076, 0.2034322, 0.25167018, 0.32151845, 0.032924175, 0.16754732, 0.11660733, -0.69654804, 1.8220257, 0.28798974, 1.8381176, 1.1841091, 1.6198701, 1.8414903, 1.23679, 0.043849654, 0.1534152, 0.18300694, -0.21019913, -0.8895652, -1.1764803, 0.6239901, -0.26321217, 0.06479309, -0.55182844, 0.040147334, 0.2995581, -0.5331417, -1.0413771, 0.60910714, -1.2584362, -0.28730014, 0.12595543, 0.12742367, -1.0103757, -0.8232557, -0.49357045, 0.70783716, 0.30833355, 0.48050115, 0.29242313, -0.7269964, 0.22016521, 0.14010502, -0.7454974, 0.6690863, 0.8573559, -0.17470227, 1.4966593, -1.2781067, -0.77586764, -0.7272115, -0.45727804, 0.17809007, -0.449621, -0.93235147, -0.45838866, 0.7588631, -0.5219085, 0.1722843, -0.51468235, 0.4696321, -0.7007964, -0.6519156, 0.652754, -0.419362, 0.13925533, -1.5399723, -0.36031464, 0.07082115, -0.5639774, -0.2888695, -0.56151384, 2.0554755, 0.14657974, 0.87772167, -0.4596722, 1.6220878, -0.30062535, -0.63579226, 0.23556773, 1.7248702, 0.17956474, 0.51734966, -1.474717, -0.72370553, 0.016837284, -0.6655267, -0.108507134, 0.09206803, 0.23756504, -0.75349075, -0.7275167, 0.3287605, -0.20825714, 0.540179, -0.563493, 0.18271421, -0.93017954, -1.3007112, -0.36480477, -0.9600047, -0.803205, -1.6867162, 0.55379134, 0.6960957, -0.47614285, -0.7246411, 0.5093761, 1.6628364, -0.5569885, -0.6545775, -0.80253917, -0.8271408, -0.9183827, -1.5228175, -0.09946534, 0.99671286, 0.6209274, 0.12665525, 1.159173, -0.30778784, 0.2912266, 0.12909448, 0.579844, 0.14042296, 0.57635796, -1.6015556, -1.344032, -0.08781851, -0.10264405, 0.1350973, -4.4351306, -0.18748549, 0.11809458, 1.3453304, 0.9689776, -0.86725503, 0.02527731, -0.9093106, -0.039363153, 1.8000926, 0.37629968, 1.5821699, -0.11818232, -1.6388477, 0.70786685, -1.7642478, -0.34004864, 0.05239167, -0.45685053, -1.4894409, -0.6160852, 0.8691628, 8.518949, -0.44275343, -0.15159568, 1.7194852, -0.32879514, 0.503711, 0.32538795, -0.047598664, 0.4116954, -0.37143373, 0.8617377, -0.0024800003, 0.68594164, 0.8106313, 0.5021601, -0.65510845, 0.2947012, 0.4580874, 0.8429514, -0.029524736, 1.244981, 0.056723148, -0.11515126, 0.2904784, 1.5083828, -0.90244603, -0.89504975, -0.5929145, -0.13560995, 1.2172327, 1.2993513, 0.5471312, 0.9823583, -0.53089905, 0.6470476, 1.3706353, 0.07710672, 0.66170347, 0.8522321, 3.7581966, 0.18205029, -1.5388376, 0.14968619, 0.7957213, 0.5417012, 0.57052195, 1.7262292, 0.3853963, 0.05573173, 0.019531325, 0.889642, 0.14051607, -0.10019319, 0.52222127, -0.045800984, -0.1372413, 1.3182182, 0.06720713, 0.65188503, -0.49704686, 0.15328996, -1.4841757, 0.07393673, -0.10667658, -1.741219, 0.15979664, 1.0401752, 0.20498934, -0.09760857, 0.26027164, -0.4799143, 0.66915995, 0.0971428, 0.50639033, -0.5895407, -0.2591088, -0.12500899, -0.44097197, -0.018114433, 0.07570505, 1.8875248, 0.72134954, -0.6835846, -0.43611696, -1.5730146, -0.47251692, -0.967706, 0.67281497, -0.3970288, 0.23531409, 0.31934413, -0.4834523, 0.85528296, -1.4495584, -0.17761847, 1.0605572, -0.33328635, 0.09331871, -1.6740737, 0.32838723, 1.2812709, 0.7532023, -1.6620958, -0.06949543, 0.22357371, 0.5511003, 0.44403845, -0.088602625, 0.086290106, -0.29867518, -0.59133786, 0.47898614, -0.16206141, -0.3974132, 0.020216722, 0.9978839, -0.88115966, 0.43280727, -0.027793905, -0.67816794, -0.6834847, -0.310411, 1.4877534, -0.9325847, 0.08318488, -0.056899868, -0.3264665, 0.18626533, 1.311764, 0.52422476, 0.27261677, -0.9771914, -0.07349676, 0.23518278, 0.6440802, -0.38859436, 0.7356058, -0.87186205, -0.79511106, 0.6331253, 0.51360786, -1.8998158, 1.2421445, 1.6992611, 0.3416561, 0.08102964, -1.1458695, -1.3352224, 0.4332353, -0.82750726, -0.68687415, -1.0607231, -0.45399368, -0.65770257, 0.5407971, 0.36140308, 0.78880286, -0.87017035, 0.11368229, 0.9742579, -0.836373, -1.4891531, -0.39808506, -0.12711097, 0.2665581, -0.94508183, 0.3168681, 0.18193309, -2.0642102, -0.42695135, -0.01493331, -0.8744083, 0.136745, 0.33562094, 0.35592413, -1.9299185, -0.9336301, 0.21273266, -1.1257002, -0.46698323, -0.44841182, 0.4095448, 0.9316055, 0.42856336, 0.7239482, 0.5807358, 1.7736349, -0.8905484, -0.98154503, -0.8812651, -0.591294, 0.114608765, 0.074452646, -0.7906054, -0.48456904, 0.58756906, 0.72785217, -0.45900884, 0.80664396, 0.20831603, 1.404514, 0.10135339, -1.7207683, 0.121471085, -1.4293977, -0.25176442, -0.88530314, -1.932973, 0.75488913, 0.053633798, -0.5996313, 1.1192294, 0.7987387, 1.0803125, -0.20899309, -0.3250925, -1.0392616, 0.60894144, 0.24588943, -0.64634514, -0.6554399, 0.8959745, 0.44019213, -0.045357216, -0.38841888, 0.79150975, -0.70056456, -0.10906712, -0.35132694, 0.38104087, 0.83124346, -0.9196306, 0.101093374, 0.3173144, 0.35568184, -0.72773474, 1.0110441, -2.1881406, 0.90069056, -1.2138778, -0.49465472, 0.29515645, -0.42973396, 0.86696035, 0.462676, -0.2891507, 0.48092514, 0.14870986, 0.2362285, 0.94265085, -0.95444787, -0.7235914, 0.15523535, 0.8009351, -0.57308763, 0.8169279, -0.66213703, -0.03514193, -0.06134875, -0.7540824, -0.20499344, 0.5033528, 0.6832062, -1.0438838, 0.0013836473, -0.5009912, 0.93052953, 0.57491046, 0.42732602, 1.4600122, 0.7491548, 0.1275791, 0.9447524, 0.14973052, 0.5151727, -0.4853087, 0.71405834, 0.5183598, 1.313502, -0.21636684, -0.77506334, -0.12591712, 1.486607, -0.7264576, 0.99942267, 0.3202754, -1.502707, 1.4193612, -1.40818, 0.27752662, -0.80451846, 1.1607374, -0.20769496, 0.61043406, 1.315206, 0.0568088, -0.40790638, -0.5757813, 1.0029505, -0.25614408, -0.60398436, 0.2829705, 0.90209776, 0.19745542, -0.3516592, -0.55319506, -0.1090347, 0.9403592, -0.28909415, -0.61357373, -0.28233677, 0.8260039, -0.211104, -1.1662388, -0.7386189, 1.4462554, -0.34844738, 0.37773976, 0.7810842, -0.5882355, -0.059488796, -0.19547813, -0.24606134, 0.6835963, 0.2511679, 0.856332, -1.0636065, 0.3394099, -0.96563685, -0.005031675, 0.50627327, -0.5008203, 0.90881467, 0.3842252, 0.11551586, -0.83781016, -0.77075464, -0.2338815, -0.035362475, -1.0022215, 0.20489949, 1.1973978, 0.6405313, 0.22105882, 0.759547, -0.15372802, -0.9853528, -0.055215254, -0.11200724, 0.93392026, 0.92165124, 0.56908315, -1.6037151, -0.63075554, -0.3626079, 0.42245942, -0.37033117, -0.899393, 0.3136378, -0.38658756, -0.045805737, -0.12737003, -0.62156856, -0.77010757, 0.3646657, 0.30881408, 0.81467205, -0.35185418, -1.2174497, -0.124289915, 0.21588212, -0.5912653, 0.5155864, -0.55197835, -0.74786615, 0.32146156, -0.54999655, -0.3350795, -0.074797854, -1.4570993, 0.23734923, -0.6517045, -0.39027223, -0.0027831644, -0.07549344, -0.12575209, 1.3137401, 0.77984715, 0.5054453, -1.1595855, -0.31115592, 0.5981977, 1.5581173, -0.71296954, -0.60147953, 0.23892058, 0.90308523, 1.2783934, 0.4829749, 0.56447566, -0.11322677, 0.4671607, 0.7727588, 0.7172333, -0.1574448, -1.2798158, -0.3061784, 0.6185353, 0.9465671, 0.679906, -0.2793042, -0.46887103, -0.016957872, -0.17706259, 0.90864146, 0.5860386, 0.78973603, -0.2444247, -1.0041484, -0.34054106, 0.3139922, 5.928577, 1.9771936, -0.54047304, -0.6981526, 0.18960235, -0.8373701, 0.44040245, 0.92274296, 0.32851875, 2.1369495, -1.9185268, 1.7090166, -0.22396593, -0.0027257204, 0.2886428, -0.14268377, 0.30027795, -1.1787082, 0.29569986, 0.44846383, -1.0683426, 0.19287628, -0.061031498, -0.45552272, 0.8514906, -1.1983136, -0.7224097, 0.56610334, -0.43930328, -1.6241871, 0.022371702, 0.056378156, -0.28574908, 0.22669566, 0.6215599, 0.56851315, -0.12263401, -1.1360767, -0.6112565, 0.9653295, 0.23831022, 0.46430987, -0.004769601, 0.007459389, 0.447268, -0.1048284, -0.29818714, 0.39249915, -0.34207064, -0.57210505, -0.4499803, -0.7788103, -0.0464814, -0.31602553, -0.30049258, -0.26680958, -0.12828995, -0.037486445, 0.09821058, -0.24948204, -0.25496805, 0.3345239, -1.4232894, -0.15812662, 0.08070272, -0.36936277, -0.69673073, -0.33060092, 0.73889613, 1.8970333, -0.53052443, 0.9062418, -0.33914202, -1.9018056, 0.61787736, 0.46802747, -0.40738654, -0.24149843, 0.52864766, -1.6946682, 1.5362931, -0.2065873, -1.3585843, 0.3950286, 0.48188406, 0.37551737, 0.4769164, 0.48761457, -1.0027927, 0.14477731, -1.1952885, -0.23367448, 1.2076813, 0.58423406, 0.07876493, -1.041011, 0.13759089, -0.14066333, -0.40304744, 0.8249726, 0.5309512, -1.5140133, 0.6465395, 0.00805977, -0.35565233, -1.0447453, -1.6391871, -0.57476056, -0.60116166, -0.6509856, -1.6507915, -0.24304004, -0.32796037, -0.9862035, -2.3792913, 0.72232765, 0.88596475, 0.05681677, 0.69371164, 0.4067158, -0.32266128, 0.35941786, 0.14268196, 0.008820172, -0.44048947, -0.3807906, -1.2657222, 0.011590555, -1.4166234, -0.5570914, -0.09691977, 0.61406046, 0.85134614, -0.9073981, -0.14514786, -0.19705656, -1.3431568, -0.18641903, 1.1970922, 0.43596244, -0.4643676, 0.23464873, -1.4809799, 0.22952351, -0.79023015, -0.9660293, -0.06106868, 0.91435355, -0.9410994, -0.27363744, 1.1213156, -0.5552039, 0.47450387, -0.67726296, -0.84531724, -0.3695472, 0.32097948, 1.236008, -1.9377409, 0.8715727, 1.7278404, -0.7182699, 0.34749338, 0.055821747, -0.25673252, 1.5338271, 0.5981914, 0.26056722, 0.35266542, 0.34506303, -0.2707516, 1.6680403, -0.26225284, 0.28264982, -0.93208283, -0.7195003, -0.49397373, 1.097455, -0.17251527, 1.2040282, -0.13247448, -0.8344006, -1.3730105, -0.9985511, 1.6127682, 0.102908984, -0.050705314, -2.0138884, -0.26599008, -0.67300093, 0.4828793, 0.8306255, 0.06904271, -0.2150876, 0.71669734, 0.71310204, 0.18367703, 0.3811021, 0.3367172, 0.4790209, -0.52320474, 1.4387411, 0.49768502, 1.6168096, 0.48664856, 2.0569668, 1.767732, 1.2483784, -0.1911243, 0.2164427, -0.41037652, 0.44743055, -0.32683307, -1.4615301, -0.2763298, -0.3156423, 0.28007326, -1.0386963, -0.556035, 0.55629194, -1.0255252, -0.54166985, 0.47017503, -1.3562512, -0.6570422, 0.85600406, 0.42322922, -0.3800823, -0.96864665, -0.39303845, 0.6151631, 0.8127344, 0.40640417, 0.29468858, -0.3595955, -0.26588053, -0.48084825, 0.1381006, 0.6274589, 0.50441945, -0.70409054, 0.6415553, -1.4776558, -0.7265096, -0.56839985, -0.37481079, -0.0556299, -0.07709563, -1.0079755, -0.31482062, 0.5529114, -0.2905458, -0.33441335, -0.7538321, 1.0301089, -0.8336837, 0.014018759, 0.6930184, 0.2822684, -0.59929043, -1.2549504, -0.04152093, -0.15594202, -0.8416114, 0.30521527, 0.085296825, 1.998172, 0.17953297, 0.81972474, -0.12049776, 0.636938, -0.32321817, -0.6623517, 0.4681129, 0.86831105, 1.3369138, 0.3237801, -1.4724734, -0.77724206, -0.13026565, -0.4761805, 0.25618175, -0.5109254, 0.33371875, -0.54170126, -0.25134182, 0.2437961, -0.46777722, 0.7951042, -0.92533684, 0.3077589, -0.67483133, -1.337733, -0.46373364, -0.6056862, -1.1445198, -0.5523313, 0.5446045, 0.69936764, -0.100782454, -0.7716193, 0.18777585, 1.7000009, -0.13324845, -0.04496102, -0.38585514, -0.6497307, -0.9735717, -0.3312297, 0.67569, 0.6791347, 0.1443547, -0.28027967, 1.9505106, -0.31825987, 0.09358952, -0.003940981, 0.060346037, 0.75013196, 0.75749826, -1.0889099, -1.6545596, 0.1618316] -2025-10-16 21:36:09 [main] INFO OnnxTest - ------------------------ -2025-10-16 21:36:09 [main] INFO OnnxTest - tokenizer加载耗时: 4082ms -2025-10-16 21:36:09 [main] INFO OnnxTest - tokenizer计算耗时: 1ms -2025-10-16 21:36:09 [main] INFO OnnxTest - 模型加载耗时: 441ms -2025-10-16 21:36:09 [main] INFO OnnxTest - 模型数据准备耗时: 10ms -2025-10-16 21:36:09 [main] INFO OnnxTest - 模型计算耗时: 5ms +2025-10-16 21:36:09 [main] INFO experimental.OnnxTest - [0.008940695, 0.50210774, -5.0510945, -0.8937678, 0.8091147, 1.2654096, 1.2879646, -0.72453403, 0.46069813, -1.1958805, -0.038145, 1.8672976, 0.6281317, 1.7732, -0.52271223, -1.4445113, 1.5514337, -2.508686, -0.6864384, -0.6301254, -0.29560322, -1.0180707, -0.83187616, 0.46920234, 1.9916652, -0.35749114, -0.11190428, 2.2374659, -0.6664558, 0.1793392, 0.64779544, -0.111028045, 0.67277247, -0.9106091, 0.2552021, -0.21566938, 0.5772215, 1.3539819, 0.45714578, 0.17660096, 0.49979687, 1.1208547, 0.19748983, -0.71146816, 1.9074292, -0.11441079, -0.24318233, 0.61392385, 1.8441632, -1.3443937, -1.0027645, -0.9185232, 0.19459805, 0.22545397, 1.7715352, 1.353761, 0.21172398, -0.5133596, 0.8219211, 0.9679444, 0.5380537, 1.2222915, 0.1917364, 1.8536644, 0.85374683, -1.6372596, 0.1961565, 0.69616926, -0.24206743, 0.8010477, 1.3424035, -0.050939456, 0.8211133, -0.020956516, 0.26211494, -0.4410275, -1.1032287, 0.115168236, -0.37371528, 0.12982085, 1.0343108, -0.51043314, 0.9773637, 0.52081937, 1.8070213, -1.2970276, -0.36602047, -0.34678212, -1.5465903, 1.0458957, 1.1246372, -0.22684537, -0.33523685, 0.6524532, -0.4258627, 0.8639704, 0.6747687, 1.1801372, -0.18055356, -0.325558, 0.58573216, -0.6885681, -0.008652464, -0.35967788, 1.4759315, 0.79462963, -1.0071485, -0.13985354, -1.7917951, -1.302046, -0.9551339, 0.72700655, -0.82785696, -0.016509667, 0.2450114, -0.14989577, 0.66587335, -1.6692137, -0.10025135, 0.5849763, -0.0066149235, 0.15871382, -1.0094404, 0.57655615, 0.31472182, 0.98309034, -1.8285725, 0.3632993, 0.13209791, 0.5869235, 0.21235198, -0.17361814, -0.32928634, -0.4548379, -0.6051484, 0.4909709, 0.51352304, -0.25750488, 0.21058336, 0.23544005, -1.0283852, 0.61832947, 0.012845237, -0.0017602667, -0.11332193, -0.64147717, 1.3873081, -0.82721007, -0.48795754, 0.04623498, -0.32260513, -0.40278208, 1.4807189, 0.6844304, 0.5813694, -0.7781652, 0.504094, 0.51536506, 0.47406924, 0.9439167, 1.0232425, -0.6551769, -1.3913715, 0.56962323, -0.25564027, -2.001826, 1.0167072, 1.6333333, 0.9226843, 0.23638949, -1.0627227, -1.5849673, 0.53583235, -0.32994375, -1.4948924, -0.54732955, -0.6555769, -0.56513834, 0.56638885, 0.71271247, 1.1922938, -1.5763108, 0.5924969, 1.7915413, -0.6964754, -1.0084081, -0.08877027, -0.28982282, -0.020199053, -0.7514959, -0.24143167, -0.20266221, -2.3080733, -0.34911162, 0.002499245, -0.9315997, 0.14224178, 0.26388752, 0.55929285, -1.9308436, -0.7808089, 0.20109546, -0.50900704, -0.06720903, -0.57660383, -0.12015574, 0.8564407, -0.19855615, 0.5351314, 0.7831901, 2.2334285, -0.07724279, -0.8556066, -1.1182219, -0.10898359, -0.43939131, 0.18218377, -1.0329244, -0.28819674, 0.6573483, 0.94202, -0.5684383, 0.39345515, -0.2149513, 1.1943405, 0.2175886, -1.4272945, -0.15624487, -2.1790175, -0.31830606, -0.074882746, -2.1189816, 1.3915615, 0.53846455, -0.6594929, 1.1428193, 0.14244053, 1.4449791, -0.33742362, 0.1302906, -1.0304217, 1.0046071, -0.14830303, -0.2878356, -0.833144, 0.7353544, -0.047339574, -0.50411963, -0.14792854, 1.2162826, -0.87097895, 0.5479907, -0.61530846, 0.91772366, 0.39351106, -1.1159807, -0.6962802, 0.6177609, 0.28574178, -0.933717, 0.6656517, -2.550455, 0.28417572, -0.81885386, -0.57173115, -0.47732124, -0.83434474, 0.6218224, -0.23378877, -0.16290052, -0.33495492, 0.9589823, -0.13438444, 0.87317586, -0.7977557, -0.8751001, 0.121376105, 0.0016995966, 0.119280726, 0.8511828, -0.80091643, 0.21969834, -0.52506125, 0.21649529, 0.20917195, 0.53206205, -0.060215697, -0.92501277, -0.43172908, 0.1354983, 0.77811605, 0.6264411, 0.11004971, 1.4162332, 0.3008895, 0.6369807, 0.8966343, -0.46057636, -0.4627554, -0.99630976, 0.8575164, 0.45908165, 1.4463993, 0.24505532, -1.313617, -0.26200497, 1.4678717, -0.78108716, 1.5716724, 0.04318331, -1.4950266, 0.87165, -1.2442464, 0.40303344, -0.8583747, 1.123798, -0.27928567, 1.4853265, 0.8615038, -0.22005291, -0.19541085, -0.8011397, 0.6476904, -0.092515044, -0.34317318, -0.16905296, 1.1762776, 0.5573735, -0.59209, -0.3909012, 0.19253278, 1.5935065, -0.7802029, -0.72745705, -0.15390143, 0.9641196, -0.7650623, -0.5825169, -0.42223948, 1.2938359, 0.32511997, -0.48691022, 1.3244666, -0.9317738, 0.0053078495, -0.2814655, -0.010061342, 0.5678287, 0.53736544, 0.84125555, -1.6721346, 0.6866992, -1.039913, -0.55957854, 0.9752761, -0.10916731, 0.81267405, 0.3757345, 0.31622255, -0.070370235, -0.28069317, 0.7060322, -0.30573946, -1.1120561, 0.087441884, 2.1169686, 0.3793122, 0.7199018, 0.7972706, 0.6312716, -0.28640646, -0.24372002, -0.39927763, 1.3067431, 1.3677809, 0.17182645, -1.5993283, -1.0617065, -0.9970951, 0.3591527, -0.2642659, -0.92191654, 0.09367664, -0.8568419, 0.24673605, -0.01075469, 0.53148615, -0.8131387, 0.16646563, 0.4456662, 0.42658246, -0.2286683, -1.240861, 1.2182664, 0.31972283, -0.52042526, 1.0313315, -0.74151134, -1.9206606, 0.67172974, -0.76771915, -0.11668143, -0.16317451, -1.1896999, -0.14067993, -0.5754039, -1.178021, -0.19320671, 1.0556533, -0.13083985, 0.8500223, 0.7322127, 0.47325015, -1.1170738, -0.46539554, 0.60346323, 1.1163684, -0.6468576, -0.6749016, 0.32706273, 0.5102571, 1.538664, 0.2564993, 0.12480027, -0.5115198, -0.22911404, 1.2661121, 2.2754738, 0.054497525, -1.8307894, -0.70205, 0.2732521, 0.3695401, 0.8007306, -0.28857967, 0.38666317, -0.7592721, -0.5713192, 1.1246057, 0.593709, 0.35631394, -0.3205832, -1.4436417, -0.6496872, 0.37343976, 3.2232847, 1.9115183, -1.0618794, -0.96111053, -0.10857664, -1.103422, 0.9816166, 0.60177815, 0.8528089, 1.4430338, -1.370729, 1.3978995, -0.69921416, 0.23256098, 0.4660253, -0.06287591, 0.6654809, -0.69219005, 0.24058081, 0.93626904, -0.7160164, 0.42666763, -0.38045081, -0.17772737, 0.95297396, -0.7321556, -0.82016414, 1.6348257, 0.098678365, -1.8395785, 1.0368643, -0.04200262, 0.7008558, -0.6598028, 1.1169665, 0.59610337, 0.42644075, -0.70989525, -1.1907579, 0.4301988, 0.24375978, 0.12559327, -0.086863026, 0.6391059, 0.3239115, 0.18681988, -0.9638547, 0.6950969, -1.0718625, -0.35861596, 0.007594481, -0.50218886, -0.07959162, 0.3074152, -1.0058187, -0.5779988, -0.21252635, 0.16711673, 0.2945148, -0.9580504, -0.44329655, -0.080028936, -1.9545618, -0.7434137, 0.42564327, -1.1064954, -0.02137646, 0.33320808, 0.87851465, 1.3674957, -0.18974975, 0.30143118, 0.09378138, -2.184264, 1.4090663, 0.42376116, -0.6386673, 0.23209023, 0.93278, -0.9901231, 1.2871186, -0.55473083, -1.0378529, 1.2385598, 0.6200016, -0.19011533, 1.2526734, -0.29594705, -1.159091, 0.12753622, -1.3564175, 0.39733884, 0.35340226, 0.47517172, 0.5938189, -0.97271687, 0.72243273, -0.3874474, -0.8634288, 1.4369297, 0.76829016, -1.5096359, 0.67411625, -0.5942944, -0.68440664, -0.6967539, -1.3790333, -1.0722706, -0.26939258, -0.51274854, -1.6252055, -0.042074203, -0.2941991, -0.9963352, -1.6290406, 0.5964556, 0.61665666, 0.107714295, 0.638748, 0.4289012, -0.8213354, -0.18691581, 0.260664, 0.1988615, -0.67643714, -0.4602536, -1.04408, 0.47709525, -1.5441273, -1.09128, -0.2589167, 0.5129835, 0.35384816, -0.69535726, -0.5024993, 0.17009991, -0.9128699, 0.35023412, 1.5284145, 0.38180998, -0.36242324, 0.7157388, -0.5221178, -0.07077499, -0.80303806, -1.0217718, 0.014210036, 1.1169853, -0.84779525, 0.07265417, 1.5137844, -0.43872315, -3.6163976, -0.71127445, 0.030030718, -0.54634804, 0.6007818, 1.0862793, -1.4570272, 0.29859456, 1.6187196, -0.5408837, 0.7542678, -0.043661788, -0.627822, 0.9626751, -0.18183072, -0.40761006, 0.92285067, 0.4483496, -0.20151655, 2.1187465, -0.5030096, 0.042685598, -1.0087817, -0.27128118, -0.6693532, 0.90893507, -0.5863207, 1.1904533, -0.6463561, -0.9224859, -0.5095885, -0.6562933, 1.7482289, -1.0871308, 0.6194082, -2.2877498, -0.0012813509, -1.1376673, 0.87655807, 0.663956, 0.24306166, 0.22504678, 1.0432729, 0.7316973, -0.20957288, 0.21609576, -0.054103754, 1.2539151, -0.3260904, 1.4898258, 0.71351856, 1.469297, -0.25216702, 2.0916111, 1.6792994, 0.834613, -0.19511522, 0.97750825, -0.1270805, 0.66032535, -0.15046631, -0.99626607, -0.5324382, -0.228696, 0.26502895, -0.7099257, -0.24755025, 0.5434749, -0.4053922, -0.8309872, -0.2989617, -0.86280966, -0.9859461, 0.97572213, 1.3376713, -0.3430115, -0.43402225, -0.1924202, 0.6710346, 0.74688536, 0.68394524, -0.29258135, -0.63783354, -0.25838947, -0.7412832, -0.13756852, 0.29825956, 0.38041145, -1.1111758, 0.5355625, -1.0727328, -0.37962234, -0.90463316, -0.2698317, -0.1467724, 0.13004409, -1.0194534, 0.11609152, 0.4127395, 0.28521538, -0.6652327, -0.7038725, 0.7316348, -0.48964947, 0.87470716, 0.8198417, 0.8121711, -0.55107266, -1.7259613, -0.27550706, -0.29355648, -1.0490227, -0.021362338, 0.19700499, 2.365385, 0.531291, 1.4412646, 0.8194168, 1.334413, -0.21749905, -0.3275181, 0.5781112, 1.150555, 1.4283984, 0.10826522, -1.1658969, -0.45134637, 0.04636837, -0.83447146, 0.81878465, -0.20615144, 0.5333617, -0.60880643, -0.042713113, 0.42055398, -0.5879446, 1.5446286, -0.3906217, -0.014214683, -0.9320095, -1.0041155, -0.77032924, -0.8490772, -0.3068128, -0.3138222, 0.8429545, 0.7392214, 0.059413563, -0.84115446, -0.1827325, 1.2329874, 0.20420718, -0.7757152, -0.4077565, -1.1934249, -0.8312496, 0.06622116, 0.36520314, 1.3569491, 0.27295056, 0.3010164, 1.8382473, -0.42277017, 0.23495656, -0.21165037, 0.37068194, 0.53597724, -0.15588544, -1.2607875, -0.40104312, -0.50267667, -0.13610771, 0.08203963, -4.3039837, -0.082001, 0.4916641, 0.7460458, 1.3272368, -0.5917864, 0.93342024, -1.0633006, -0.22604129, 2.1822553, 0.77348, 1.2415451, -0.92593575, -1.6016923, 1.9382031, -2.2590072, -0.72137606, 0.14148775, 0.13457671, -0.7451491, -0.41633192, 0.572699, 0.20894296, -0.665532, 0.1557113, 1.8900913, -0.17060457, 0.14676529, 0.9459177, 0.1988962, 0.6571039, -1.2214427, 0.48302603, 0.07323967, 0.6089274, 1.5770257, 0.06876827, -0.2896797, 0.6952437, 1.5110533, 0.32220465, -0.6618951, 2.1899383, 0.23477301, -0.41625032, 0.94061273, 1.5684785, -1.8303659, -1.2356102, -0.8779911, 0.89357895, 0.91234356, 1.0632848, 0.9623276, 0.73280936, -0.81256485, 0.62779176, 1.1951995, 0.18735348, 0.48628578, 0.20784137, 1.6061101, 0.6428331, -1.8172319, 0.07742017, 0.76475334, -0.28695786, 0.69205785, 1.3851129, -0.3151007, 0.5124455, -0.4670857, 0.42660737, -0.27413413, -0.79418296, 0.38474238, 0.44336423, -0.70331454, 1.6133739, -0.79705983, 0.58497494, 0.7683212, 0.95143867, -1.2097393, -0.5542208, -1.401292, -1.7129737, 0.32851774, 1.7300217, -0.13283907, 0.7207998, 0.79250276, -0.5060547, 0.838996, 0.33558664, 1.3048035, -0.6595723, 0.01165621, 0.40351102, -0.29559255, -0.3484041, -0.40840417, 0.95276344, 1.3805048, -0.28706077, -0.14665662, -1.5373006, -1.6770992, -0.9637392, 1.0667742, -0.8824096, -0.10521127, -0.33972454, -0.15037933, 0.29304558, -0.7167169, -0.026037984, 0.45332485, -0.30548358, 0.67668605, -0.70388466, 0.9721674, 0.022312656, 0.67783666, -2.221327, 1.0432537, 0.10468251, 0.50377524, 0.5216907, -0.26383665, -0.5668552, -1.0790802, -0.66269624, 0.53420395, -0.056507684, -0.030799769, -0.38935354, -0.26135808, -0.51806945, 0.6764826, 0.21997608, -0.2842363, 0.4153023, -0.7909994, 1.2961726, -0.32138214, -0.21153454, -0.23352191, -0.78287107, -0.47774607, 1.6039003, 0.5824032, 0.2871944, -0.77046245, -0.3201174, 0.4231739, 0.8662363, 0.8589964, 0.5837137, -0.5550777, -0.73803765, 0.7114582, -0.15480545, -2.4421003, 1.2693365, 1.5083162, 0.57656115, 0.5589083, -1.294058, -0.7516413, 0.68240094, -0.6442521, -1.8912579, -0.76375854, -0.18127736, -0.8704367, 0.78815466, 0.58496165, 1.2333207, -0.67811775, 0.7778747, 1.180586, -0.52837384, -1.6866188, 0.43942052, -0.5797858, -0.12091714, -1.5169264, 0.05719204, -0.26951146, -2.684711, -1.0172228, -0.30936632, -1.1998694, 0.13886273, 0.036559507, 0.3245873, -1.6026664, -1.3267136, 0.5069053, -0.36913142, -0.5306911, -0.070908874, -0.18541811, 0.69640446, -0.30087128, 1.0078833, 0.610926, 1.7221036, -0.5379479, -1.326377, -0.52609026, -0.46600527, 0.06604308, 0.2197823, -0.9372009, -0.3256157, 0.14768064, 0.699552, -0.72368884, 0.4794218, 0.026545957, 1.3436007, 0.23628801, -1.5402796, 0.19139451, -1.8511007, -0.44703215, -0.08679469, -1.6827856, 0.8235698, 0.16579445, -0.074705936, 1.0817068, -0.01459034, 0.8199119, -0.80417913, 0.53254235, -1.08217, 0.9492825, 0.24019396, -0.44084668, -0.73341775, 0.9208635, 0.37783542, 0.29370502, 0.27790993, 0.90694183, -0.68210644, 0.35099593, -0.50210375, 0.40147668, 0.56336397, -0.8843219, 0.1813156, 0.60259986, 0.4996659, -1.2195214, -0.06456041, -2.0830536, 0.79561657, -0.33496487, -0.41333812, -0.60755616, -1.3942319, -0.023980334, -0.31574172, -0.47269264, -0.45879, 0.37798846, 0.464371, 1.1505239, -0.35299638, -0.66388196, -0.46442628, -0.0014668554, 0.4657766, 0.3824118, -1.0646446, 0.47359174, -0.5501442, 0.54858595, 0.3592662, 0.41308272, 0.45073894, -0.7594449, -0.33872837, 0.31371093, 0.55662763, -0.20230436, 0.4447407, 1.6444561, 0.22029482, 0.0872115, 0.6798017, -0.32205412, -0.2614859, -0.6706727, 0.35378987, 0.38164073, 1.367708, 0.43917412, -1.6509491, -0.29672295, 1.7558253, -1.3782254, 1.0295317, 0.6083522, -1.7402619, 0.5930131, -1.4394379, -0.3491493, -1.1771997, 0.78438175, 0.0027834475, 1.0757275, 1.8362582, -0.6623099, -0.061427217, -1.429398, 1.0720371, -0.023497377, -0.41509795, 0.07872723, 1.5710311, 0.3394337, -0.86737263, -0.8013209, 1.0093807, 1.9009106, -0.78051865, -0.23401639, 0.073471576, 1.342778, -0.8758744, -0.05092702, -1.0604082, 0.88840294, 0.4845464, -0.31408712, 0.7285716, -0.6598388, 0.26622984, -0.15347672, 0.34162325, 0.5272665, 0.15939362, 1.0359404, -1.3569661, 0.8223073, -0.82353425, -0.851304, 1.2659918, -0.31349543, 0.9090855, 0.25253433, 0.61904687, -0.13841742, -0.67474073, 1.0259502, -0.051506877, -1.1969513, 0.16987415, 0.073220626, 0.37979242, 0.7651893, 0.58660114, 0.7042103, -0.5287451, 0.29557738, 0.17244934, 1.4235036, 1.7157453, 0.37425035, -1.8584217, -1.2582158, -0.6299258, 0.17255291, -0.12686756, -0.49752375, -0.22709069, -0.6200077, 0.42430815, 0.463663, 0.68685627, -0.71040833, -0.17139806, 0.38501126, 0.5601121, 0.50367576, -1.6438738, 0.077835165, -0.36538386, -0.23477188, 1.2270359, -0.61405075, -1.7066628, 0.81988287, -0.7482188, 0.035242945, -0.14084256, -0.65183985, -0.019776158, 0.12996586, -0.9195582, -0.41340956, 0.90673864, -0.6422904, 1.2120672, 0.06385599, 0.63100183, -1.30815, -0.9428998, -0.41631383, 1.965007, -0.86749756, -0.5259007, 0.13663939, 0.3468347, 1.7422681, 0.7007072, -0.020115245, -0.31306064, -0.031459868, 1.0573552, 1.8225657, 0.11774525, -1.5830071, -0.79576176, 0.05965937, 0.6052492, 0.62318075, -0.096916795, 0.31733304, -0.96026015, -0.27850336, 1.4682877, 0.6666615, 0.24167539, -0.5812353, -0.90307945, -0.55028933, 0.5831116, 2.5405624, 2.0145776, -0.960979, -0.4206924, -0.7996599, -1.7888918, 0.5773138, 0.44929433, 0.79602045, 1.2793171, -1.1028179, 1.5785166, -0.6605679, 0.123961315, 1.0325454, -0.030368492, 0.14277515, -0.24839605, 0.22407623, 1.2428747, -0.8223916, 0.7238152, 0.5589315, -1.2599404, 0.36306778, -1.1173778, -0.8732166, 1.4703016, -0.23819679, -1.6242712, 0.7218292, 0.118932486, 0.7071069, 0.53992164, 0.44476104, 0.6507463, 0.5524653, -0.6212482, -0.8308021, 1.7792088, -0.4863599, 0.24588388, 0.48519036, 0.45862278, -0.23362559, 0.6741241, 0.8668838, 0.12244135, -0.6257747, -0.67283255, 0.028253525, -0.6896872, 1.181849, -0.4711876, -0.5782417, 1.0118928, -0.05969412, 0.14305171, -0.4259127, -0.61529285, 0.077514656, 0.85673195, -1.3015722, -0.7207134, -0.27778414, -1.125479, -0.49426728, 0.3936475, 0.8884816, 1.7654979, -0.45583653, -0.11059831, 0.2442121, -2.1273844, 1.4961429, 0.641687, -0.45369974, -0.54703337, 0.6895549, -0.6619705, 1.1465002, -1.1790969, -0.45576596, 1.6416053, 0.6164581, -0.15951222, 0.7921248, -0.032377556, -0.80429655, 0.08237736, -1.4837114, 0.1985715, 0.15340376, 0.801544, 0.078613624, -1.9629599, 0.88010734, -0.46030182, -0.64362615, 1.1952101, 0.32887614, -1.7267823, 0.93907595, 0.094770044, -0.9705627, -0.27643013, -2.292801, -1.2397184, -0.41275358, -0.80883455, -1.7987494, 0.2907484, -0.20178545, -0.87403935, -1.7124034, 0.85280275, 0.042721435, -0.78331816, 0.25862864, -0.045897268, -1.3428419, -0.41759884, 0.6986912, 0.29880998, -0.74742967, -0.5181912, -1.019665, 0.3793689, -1.7902851, -1.4508095, -0.32118288, 0.5071308, 0.7328687, -0.60655284, -0.15128464, 0.6374675, -1.0154953, 0.03218935, 1.279699, 0.28615817, -0.07616529, 0.6687399, -0.7565428, -0.27557972, -0.23855832, -0.93483484, -0.087293684, 1.1687524, -1.3584801, 0.21150073, 1.2037069, -0.6048212, 0.30108434, -0.5661793, -0.27420956, -0.022391453, 0.33260012, 0.85373664, -1.4766654, 0.5845996, 1.4180158, -0.22024389, 0.667976, 0.6244385, -0.3168699, 1.1868767, 0.34774554, -0.64997494, 1.2400774, 0.19068903, -0.13514502, 2.0202057, -0.9182257, 0.199046, -2.1286008, -0.16045126, -0.15270948, 1.3005338, -0.5548139, 1.2173984, -0.29274017, -0.30937454, -0.7711906, -1.2893053, 2.3575566, -0.72209096, 0.7947462, -2.0041177, -0.39761025, -1.015814, 0.6978156, 0.868944, 0.13364673, 0.18352914, 0.8586364, 0.66782385, 0.610228, -0.34375954, 0.13003342, 1.2151164, -0.2166828, 1.1116873, 0.71258795, 1.1434194, -0.47186866, 2.1353364, 1.447041, 0.085622765, -0.5998132, 0.89812726, -0.08066484, 0.8420984, -0.32581723, -0.71437097, -0.17589144, -0.41022748, 0.60955167, -0.6410985, -0.7388026, 0.36736083, 0.039181054, -0.6307165, -0.5466139, -0.7783671, -1.5159419, 0.7252672, 1.2741427, -0.13147596, -0.40053046, -0.028620407, 0.7103258, 0.57227916, 0.87115306, 0.13265681, -0.7893819, -0.73650587, -0.9073851, 0.5145203, 0.11678757, 0.34510773, -0.93830043, 0.11222476, -0.8524616, -0.061620682, -0.55093145, -0.47949544, -0.09997742, 0.09835012, -1.0597764, 0.14261375, 0.1746223, 0.28936136, -1.0353326, -0.19909178, 0.47905058, -1.252357, 0.7624163, 1.2160978, 0.7688873, -0.6454922, -1.0831699, 0.02088613, -0.38204393, -0.907776, -0.9166499, 0.18642414, 2.432432, 0.10058874, 0.8733756, 0.27784142, 1.0831978, -0.60613316, -1.3419845, 0.7750269, 0.8635206, 1.8219028, 0.54030687, -0.87049514, -0.8088964, -0.6807017, -0.89217746, 0.53863055, 0.103357926, 0.29255334, -1.2158495, 0.18755785, -0.41067183, -0.61871785, 2.0842297, -0.6564288, 0.1175787, -0.25890535, -0.7177374, -0.6349298, -0.65529674, -0.26780748, -0.8083765, 0.51767904, 0.6745196, 0.36527988, -0.585937, -0.20295776, 1.7653798, -0.33259234, -0.96098894, -0.07512732, -1.5987782, -0.5730393, 0.25935447, -0.11502524, 0.7548667, 0.6395263, 0.45042387, 2.8521442, -0.95156074, 0.47897643, 0.17717683, 0.36947063, 0.72072726, 0.05572194, -0.8413897, -0.46243054, -1.2105479, 0.13334659, -0.032581076, -4.2375526, -0.59686345, 0.4538272, 1.0885404, 0.6702778, -0.48081216, 0.44729152, -1.140004, -0.010168858, 1.9525921, 0.832294, 1.7936808, -0.048765276, -1.6751267, 1.5497643, -2.353122, -0.4451682, 0.17112952, -0.1890958, -1.3813912, -0.39053974, 0.62938404, 2.082432, -0.7175064, -0.24595845, 2.3162117, -0.3158726, -0.12359636, 0.40302536, 0.18462911, 0.7844205, -0.0015291646, 0.6743531, 0.075157195, 0.11210073, 1.2258631, -0.05680778, -0.24221358, 0.27545154, 0.8361591, 0.5928248, -0.2545021, 1.8165491, -0.04416865, -0.26884404, 0.64862126, 2.21904, -1.7403183, -0.75271726, -0.7202007, 0.16653919, 1.0871801, 1.3364254, 1.4694904, 0.9652211, -0.80510324, 0.5183391, 1.7491461, 0.511918, 1.3462274, 0.7024353, 1.4506098, -0.04295113, -1.2183081, 9.816363E-4, 0.8816808, 0.1508924, 1.1356016, 1.6477102, -0.11800997, 0.30756932, 0.26012784, 0.7386577, 0.29488558, -0.47505602, 0.19272491, 0.51341426, -0.6810482, 0.8993299, -0.60003865, 0.86971986, -0.15220067, 1.1147594, -1.1383475, -0.33894932, -0.26593307, -1.6458954, 0.18725836, 0.94011426, 0.11729905, 0.105840944, 0.3609804, -0.9327989, 0.3713091, 0.060831085, 0.9854874, -0.34511298, -0.2879524, 0.5795063, -0.5236333, 0.065186724, 0.18788286, 1.3223159, 1.1334118, -1.0533829, -0.39967948, -1.9732791, -1.1970584, -1.0549864, 0.43055233, -0.34520608, 0.42950767, -0.003649138, -0.07939597, 0.6475297, -1.3730345, 0.062667415, 1.6147989, -0.1476839, 0.04871749, -0.91856533, 0.56362367, 0.55767614, 1.1749725, -2.0295792, 0.43310302, 0.09634046, 0.20091093, 0.26272556, 0.046745386, -0.21969129, -0.6707004, -0.7647821, -0.063160166, 0.51600844, -0.3087896, 0.41689703, 0.4392679, -0.8582071, 0.79339665, 0.28519478, -0.26558462, -0.6659972, -0.7188982, 1.3808789, -0.89023215, 0.41144633, 0.16805208, -0.75122094, -0.11867887, 1.543643, 0.61344016, -0.19704866, -1.0062346, 0.44627762, 0.4860831, 0.3939407, 0.36183584, 0.7851459, -0.8682549, -1.1847831, 0.5358516, 0.26103783, -2.2152636, 1.103417, 1.4953772, 0.1992315, 0.07908572, -0.8492448, -1.2705877, 0.29931432, -0.9461487, -1.4458283, -1.0470415, -0.41218147, -1.0918698, 0.6166757, 0.18749386, 1.2787181, -0.92622375, 0.6054672, 0.870527, -1.0691093, -1.7123365, 0.0495075, -0.738194, 0.34881157, -0.44842792, -0.4201811, -0.05393745, -2.1925974, 0.09545113, 0.06688569, -0.8977198, -0.085284755, 0.102158695, 0.20149165, -1.7651014, -1.0870925, 0.24054264, -0.74779993, -0.44569153, -0.42099476, 0.8351224, 0.97377527, 0.7060151, 1.0186949, 1.0475934, 2.3733313, -1.1107163, -1.101293, -0.85240287, 0.021774217, -0.03084986, 0.31226873, -0.8944292, -0.6745035, 0.8306402, 0.63163084, -0.88356215, 0.6354829, 0.5462163, 1.6622038, 0.22387153, -1.3001823, -0.0757204, -2.4847255, -0.22084947, -0.7999485, -1.89805, 1.0499556, 0.44911587, -0.5646096, 0.8053865, 1.3021152, 1.8230816, -0.56671524, 0.11187309, -1.3048412, 0.9349616, 0.2546708, -0.36234832, -0.6659309, 0.90868163, 0.04853189, 0.09261486, 0.015527621, 0.7454172, -0.9419852, -0.047329552, 0.08699082, 0.42673504, 0.780743, -0.94500506, -0.73876095, 0.16158783, -0.070774965, -0.5767895, 1.137128, -3.186622, 1.1911851, -1.0656859, -0.392686, -0.03938763, -0.9039558, 0.75739443, 0.5312309, -0.7341834, -0.38595462, 0.2647596, -0.07928561, 0.75340587, -1.3045008, -0.8802977, 0.30121127, 0.2543338, -0.34264043, 0.45520693, -0.9154624, -0.10101467, -0.02641562, -0.12726673, 0.010956101, 0.9258601, 0.1098481, -0.16978537, -0.3670274, -0.07359931, 0.5837086, 0.69936067, -0.28604972, 1.59343, -0.1453458, 0.32370114, 0.6298896, 0.46533775, 0.14416869, -0.39564282, 0.88691527, 0.6066644, 1.3613597, -0.37090945, -1.7808118, -0.1720133, 1.0270717, -0.54187065, 1.6680968, 0.11771559, -1.8401663, 1.1491469, -1.9306219, 0.5856592, -1.1250175, 0.9635127, -0.86805916, 0.9950776, 1.5667278, -0.108083725, -0.8249335, -0.9405231, 1.1947067, -0.35845593, -0.48510844, -0.25952032, 1.5655563, 0.8452434, -0.55366373, -0.842601, 0.14117181, 1.1900853, -0.88801455, -0.8419519, 0.009560674, 0.7411447, -0.11118782, -0.46682933, 0.17498611, 1.4330704, 0.49638534, 0.19230416, 1.2091411, -0.34786895, 0.2274889, -0.37641925, 0.10583784, 0.29251122, 0.26727018, 1.0795634, -1.1727878, 0.7986189, -0.75620455, -0.14081307, 0.70355874, -0.17094393, 0.8434166, 0.0870233, 0.005512327, -0.67821467, -0.5855471, 0.16779336, -0.15551087, -0.58186996, 0.0809322, 0.25340253, 0.4838119, 0.6051569, 0.72161484, 0.24405366, -0.3099302, -0.19053733, -0.33977276, 0.6870599, 1.2345992, 0.3064082, -2.0492685, -0.80029774, -0.73350406, 0.047823828, -0.2212841, -0.53130865, -0.39911112, -0.81050694, 0.19141236, 0.39204028, -0.041854225, -0.41634703, 0.5479881, 0.9199982, 0.37612298, 0.46730843, -0.844545, 0.7269514, -0.54978836, -0.22469144, 0.5518924, -0.21882303, -1.7599337, 0.19333343, -0.6137202, 0.35599604, 0.4681678, -0.93530613, 0.3675471, -0.5560331, -0.93811864, -0.05328221, 0.30546796, -0.06468683, 1.1055162, 0.31039363, 0.79712665, -0.8880656, -0.41150033, 0.62709105, 1.0567634, -1.3500221, -0.58200276, 0.3762134, 0.47680095, 1.6633757, 0.3248726, 0.3021961, -0.65517944, -0.109807625, 1.2432631, 1.7977482, -0.18578239, -2.0532904, -0.619208, 0.14947218, 0.9085295, 1.0551935, 0.011069931, -0.37766242, -0.689911, -0.43453133, 1.6019069, 0.3811674, 0.7572155, -0.40539703, -1.2555295, -0.69455326, 0.49768996, 2.6146052, 2.6659274, -0.9112146, -1.1077894, -0.23498018, -1.2007558, 0.8432704, 1.4062907, 0.53809303, 1.529563, -1.5362505, 1.6111442, -0.5297894, -0.11808497, 0.20472874, 0.31043276, 0.1835281, -0.5836088, -0.02861229, 1.4592621, -0.9100425, 0.61336476, -0.19170228, -0.83800125, 0.8228804, -1.1628532, -0.7328894, 0.84273213, -0.11957289, -1.5090224, 1.0768483, -0.104951106, 0.24791405, -0.366059, 0.96841574, 0.42228532, 0.50324833, -0.5371943, -0.5149842, 1.1027789, 0.19120961, 0.15430793, 0.2757321, -0.36539328, 0.28428805, -0.08055519, -0.3374042, 0.7996474, -0.3285212, -0.14873916, -0.41024688, -0.88183016, 0.2243497, -0.20743272, -0.39711243, -0.20242156, 0.066387035, 0.123112775, 0.469679, -0.39338633, 0.16844624, -0.053532504, -1.3422933, -0.66371524, -0.10573699, -0.2580982, 0.008790031, -0.29559684, 0.8452203, 1.7971001, -0.36888883, 0.58605707, -0.17919783, -1.3992865, 1.8432058, 0.6336147, -0.53755534, 0.05347249, 0.70169985, -1.0162297, 1.4821874, -0.40619004, -1.5554171, 1.3304783, 0.7642607, 0.06273963, 1.190404, 0.050506398, -1.0424638, 0.46894956, -1.1349477, -0.0035732836, 0.47234288, 0.52248424, -0.31404004, -1.919094, 0.51133317, -0.2986818, -0.36438683, 1.6392047, 1.1344445, -1.5788847, 0.9403384, -0.12823837, -0.4158857, -1.3239692, -1.9897468, -0.89076465, -0.47164863, -0.5873591, -1.5080955, -0.4241918, -0.34073642, -0.8595737, -2.1563668, 0.5392478, 1.1566588, -0.48543102, 0.26236895, 0.47868973, -1.1099099, -0.02641529, 0.24095038, 0.05020159, -0.749434, -0.5565289, -1.1763871, 0.7146039, -1.4472867, -0.594348, -0.46612006, 0.7443287, 0.17006834, -1.274579, -0.35685042, -0.07105823, -1.6138446, 0.06209471, 1.7139359, 0.22178563, -0.35350642, 0.543285, -1.3267688, -0.0037474781, -0.6415884, -0.6476863, -0.0051679052, 0.8534037, -1.1693122, 0.010954498, 1.6279119, -0.6788517, -2.533438, -0.8678859, -0.5320176, -0.4124887, 0.9793085, 1.4319218, -1.6222152, 0.5541427, 1.929475, -0.44764268, 0.57726157, 0.30474505, -0.08566475, 1.6472805, 0.15703492, -0.24655053, 0.7776795, 0.49221545, -0.042755544, 1.8118613, -0.33484954, 0.9483563, -1.1041298, -0.34732231, -0.5435285, 0.63029665, -0.29857004, 1.038833, -0.41452676, -0.762923, -0.19454634, -1.763375, 1.6416986, -0.14207828, 0.43010616, -2.5701048, -0.4156133, -0.3095801, 0.7914582, 0.83072764, -0.33544338, 0.03689442, 0.91521347, 0.7419453, 0.4195006, 0.29579616, 0.1270438, 1.1525235, -0.34384894, 1.3438214, 0.7089049, 1.4401239, 0.8427912, 1.9773139, 1.280215, 0.8321328, -0.11056949, 0.541568, -0.37214747, 0.7184359, -0.4635601, -1.0396259, -0.1376052, 0.08048542, 0.2302494, -0.8580882, -0.54565936, 0.0654906, -0.75482774, -0.9244739, 0.06187714, -1.1852716, -0.6424487, 0.25576863, 0.78124565, -0.06435682, -0.70427924, -0.55639213, 0.93429047, 0.69335544, 0.5599617, 0.17459932, -0.41115555, -0.16953023, -0.5571107, -0.6561706, 0.3354718, 0.9480737, -0.94258595, 0.90569663, -1.1170458, -1.9504805, -1.196713, -0.3679911, 0.015131488, 0.18721208, -1.1809741, -0.26950598, 0.6782336, -0.34831914, -0.42956293, -0.62750363, 0.41887188, -0.8657223, 0.2825969, 0.8393127, 0.56417716, -0.05883214, -1.5311673, 0.01864133, -0.1042253, -1.3455918, -0.55855167, -0.24753773, 2.4837918, 0.57509506, 1.0181949, -0.12295708, 0.8753308, -0.5293411, -0.36454523, 0.5012073, 1.1117135, 1.3556263, 0.42402056, -0.93515843, -0.5668046, -0.7429016, -0.49684244, 0.18577796, -0.1632435, 0.12502918, -0.8384259, -0.38961706, -0.20223175, -0.75471324, 2.1295795, -0.3969314, 0.22128996, -0.74520034, -0.675958, -0.56324315, -0.42674473, -0.63405246, -1.2011486, 0.52042735, 0.9495089, 0.020391192, -0.90801936, 0.4682513, 1.7587634, -0.3028639, -1.1834548, -0.31927472, -0.6695488, -0.52235776, -0.7186115, 0.7899222, 1.0014939, 0.27173263, 0.42071947, 1.7468405, -0.78924674, 0.36825815, 0.31606954, 0.11986427, 0.63423735, 0.51299596, -1.373041, -1.069034, -0.57540166, -0.045445397, -0.34945235, -3.3275523, 0.22731975, 0.36902305, 1.2367005, 0.39194432, -0.4746917, -0.24819094, -1.2438312, 0.08193148, 1.8569534, 0.098598346, 1.8004669, 0.097691424, -1.7224234, 0.88370246, -1.9531832, -0.9167318, 0.5780656, 0.05229275, -1.3191699, -0.34447095, 0.68812364, 0.5720577, -0.8811223, -0.11898157, 2.3788629, -0.02985695, -0.5108037, -0.054584697, 0.73180276, 0.4270401, 0.33755153, 1.1565756, 0.23356235, 0.1625686, 0.88033533, -0.2092922, 0.06942951, 0.23726052, -0.23033059, 0.68557966, 0.08532261, 0.99904776, 0.57505476, -0.39024824, -0.13172224, 1.9205338, -1.5390093, -0.08105607, -0.5932407, -0.16045141, 1.7443988, 1.2447889, 1.1255945, 1.2813084, -0.330172, 0.76995254, 1.8966867, 0.1743443, 1.3014711, 1.7853279, 1.1622835, -0.31911337, -0.6598214, 0.7157046, 0.89193434, 0.5118476, 0.65639853, 1.424856, 0.5915188, 0.13096291, 0.022042617, 0.8315848, 0.6827663, 0.07303734, 0.054391682, 0.1589834, -0.9787285, 1.0332872, -0.008612797, 0.8126753, -0.97286534, -0.5721441, -1.9303764, -0.29299396, -0.21202728, -1.1703851, -0.22406223, 1.4962769, 0.11641924, 0.23256451, -0.0811607, -0.8660191, 0.24334851, -0.008027129, 0.9900221, -1.0267837, 0.16684823, 0.57861924, -0.09820887, -0.06444654, 0.79702586, 1.5110456, 1.18736, -1.2774931, -0.78421193, -1.9064893, -1.2888294, -1.0921284, 0.08533788, -0.26716572, 1.0318695, 0.16370623, -0.07553395, 0.5450891, -1.4996822, 0.5724112, 1.5733267, -0.8450707, -0.043714702, -0.6893503, 0.51687837, 1.2746414, 0.7146934, -2.1531124, 0.20818664, -0.10973995, 0.18675843, 0.16448702, -0.7166813, -0.12982129, -0.63502383, 0.031319126, -0.18294649, 0.49100095, -0.36713195, 0.66632205, 0.6834382, -0.35128006, 1.0835311, 0.2283787, -0.66630197, -1.1066312, -0.89536554, 1.5596511, -1.0005987, 0.765801, -0.5909458, -0.85717076, 0.30332184, 1.67724, 1.0395846, -0.028179117, -0.26196128, -0.20154642, -0.15438686, 0.7855068, -0.19717416, 0.5493648, -0.75587803, -0.455737, 0.3237022, 0.42722195, -2.0473754, 0.56801397, 1.3903089, 0.12004324, 0.7005229, -0.3407321, -0.5261313, -0.1538756, -0.7910628, -0.9309482, -0.16353002, -0.58801615, -1.1426258, 0.76081985, -0.53621614, 0.84474635, -0.72333145, 0.24581629, 0.66596776, -0.70429707, -1.6138331, -0.7180623, 0.043840438, 0.84993523, -0.5890736, -0.24500962, -0.20937885, -2.2674901, -0.03398995, -0.078055896, -0.49442667, 0.075571254, 0.09625011, 0.35759744, -0.99303055, -1.5036392, -0.05741927, -0.5990357, -0.56783354, 0.03719426, 2.5208445, 1.2792852, 0.8199502, 0.93128866, 0.9208104, 1.6470743, -1.5426618, -1.3811654, -0.7987242, -0.8944512, 0.4178534, 0.38932425, -0.75248533, -0.06557035, 0.7185067, 0.9333569, -1.0048586, 1.0705352, 0.9695664, 1.353385, 0.09010321, -1.1382583, 0.55308497, -2.6025121, 0.15243526, -1.4278551, -1.6607153, 0.860541, 0.5684724, -0.7798525, 0.9574742, 1.8088274, 1.4807726, -0.1732581, -0.49971592, -1.2938926, 0.6186871, 0.37323606, -0.5336785, -0.98147213, 1.0458283, 0.25446412, 0.36312097, 0.07027008, 0.11262571, -0.42707434, -0.220013, -0.5875742, 0.4669395, 0.6798075, -0.63334805, -0.5783406, 0.1251126, -0.38114056, -0.68132406, 1.0469259, -3.5155873, 1.9671042, -0.9190454, -0.55197716, 0.83801544, -0.5714603, 0.44932735, 0.5354219, -0.5702951, 0.16947825, 0.24018587, 0.48090443, 1.0678362, -1.1853591, 0.079099774, 0.16553098, 0.7293623, -0.71074075, 0.5235574, -0.90503824, -0.88592046, -0.13836983, -1.052803, 0.2526356, 0.34508625, 0.20159572, -0.5355421, -0.43164968, -0.26517433, 0.8913823, 0.39937818, 0.30155915, 2.2124255, 0.0603099, 0.23342517, 0.49676266, 0.75205475, 0.20550296, -0.62654245, 0.28884768, 0.46931282, 1.577348, -0.5057512, -0.8608184, 0.44936067, 1.383238, -0.03490097, 1.2874973, 0.29172882, -1.3608899, 2.2177153, -2.2990627, 0.15486032, -0.94746184, 0.72527826, -0.74821305, 0.5642979, 1.6237416, 0.35510045, -1.371967, -1.4305518, 0.5656934, -1.2487237, 0.4213405, -0.36367983, 0.76374024, 0.93968344, 0.36534926, -0.7551423, -0.0038674623, 0.63060087, -0.6101065, -0.38811347, -0.4785545, 0.5892981, 0.2723823, -0.80994344, -0.7184911, 1.58496, -0.74103945, 0.14645888, 0.8801471, -0.0349124, -0.17808646, -0.8373291, -0.5489321, 0.6399772, -0.56448287, 0.45920986, -0.32797137, 0.48876214, -0.7722936, 0.7110514, 0.5914641, -0.023131683, 0.46343315, 0.4108361, -0.10862967, -0.80872583, -0.56265444, -0.2195296, 0.07072757, -0.32874253, -0.2331534, 0.221698, 0.73738515, 0.7718544, 0.6031042, -0.27522433, -0.8341945, -0.7196441, -0.17732127, 0.5561446, 0.6526755, 0.36112553, -1.6164314, -0.6448827, -0.2615705, 0.37312427, -0.42878437, -0.50876844, 0.01557447, -0.9423974, 0.14062455, 0.6049541, 0.67849314, -0.34584293, 0.4975931, 0.025627308, 0.8797541, 0.4259451, -0.22281408, 0.24196546, -0.11239098, -0.01917174, 0.25028148, -0.34636748, -2.0611026, -0.06447427, -0.62459165, 0.858958, 0.36105034, -1.1696876, 0.056905136, -0.4261216, -0.94341487, -0.30531296, -0.47526762, -0.42512742, 1.4714365, 0.083199374, 1.0179315, -0.9701613, -1.1648011, 0.42087835, 1.1566582, -1.1164685, -0.39050156, 0.4177849, 0.54503053, 1.0581168, 0.122496866, 0.64877594, -0.3731066, 0.8710224, 1.0467112, 1.4225514, -0.1536279, -1.5523295, -0.52426374, -0.2779017, 0.8133898, 0.85683167, -0.36897337, -0.35123062, 0.120082036, -0.54450643, 1.0384865, 0.27679268, 1.8568588, 0.03938148, -1.1608962, -0.41695762, 0.39431348, 3.1264772, 2.3877347, -0.15257652, -0.7320024, 0.12419622, -1.287175, 0.39385453, 0.974821, 0.049994696, 1.0091165, -1.7531127, 1.6948011, -0.366085, -0.4567839, -0.29971364, 0.16656825, 0.08037225, -1.1328343, -0.36554125, 0.40561542, -0.63396376, 0.57928526, -0.40685052, -0.5381798, 0.8005147, -1.3192124, -0.904293, 0.008866582, -0.44051528, -1.3872772, 0.43811536, -0.014631502, -0.022128046, -0.13452059, 1.015941, 0.53356636, 0.39078796, -0.75855446, -0.047520082, 1.2373616, 1.0721242, 0.12809762, 0.1334298, -0.89095044, 0.004328221, -0.24677542, -0.5256807, 0.41210282, 0.35521665, -0.3742752, -0.5365181, -0.40289578, 1.0373986, -0.62946624, 0.09559971, 0.16945997, 0.16011313, 0.15484661, 0.7171279, 0.2228621, 0.62859035, 0.56555617, -1.0822077, 0.104222655, -0.3825818, -0.7731678, -0.34897146, -0.45309782, 0.80402774, 2.3230875, -0.30913597, 0.6176475, -0.15234187, -0.9130463, 1.9025639, 0.86815125, -0.83166724, -0.21401684, 0.78785205, -1.739686, 2.2668343, -0.345401, -1.0512193, 0.91875213, 0.5199171, 0.58468884, 0.73392284, 0.041696012, -0.6166961, 0.84339494, -0.77854466, -0.24405773, 0.67765325, 0.55435055, -0.8057577, -1.5064452, 0.16376469, 0.14463758, 0.19168483, 1.114181, 0.55640376, -1.3145398, 0.98460054, 0.9113636, 0.8381783, -1.8150179, -1.5715137, -0.4935258, -0.49357474, -1.229667, -1.7216921, 0.4676819, -0.11519488, -1.0244559, -2.2180781, 1.4384127, 0.9492223, -0.69357115, 0.1867604, 1.0693477, 0.27487653, 0.121413276, -0.042237528, 0.12876141, -1.2549193, -0.77649903, -1.20677, 0.9945025, -1.718436, -0.3108896, -0.3544942, 0.9586106, 0.12614103, -1.4019394, 0.06979652, -0.51264375, -0.7824047, -0.14419945, 0.78628355, 0.07944815, -0.37333307, 0.540624, -1.2557046, 0.07462505, -0.41541994, -0.62134737, -0.28327915, 1.3320854, -1.043966, -0.12159033, 1.3173989, -0.81243837, -1.0274365, -0.49187303, -0.7640168, -0.7643263, 0.33342665, 1.655695, -1.7654641, 0.35340893, 1.9987454, -0.78443074, 0.79294956, 0.6738753, 0.023859248, 1.9800975, 0.47687012, -0.7451932, 0.1652671, 0.6715458, 0.29612985, 0.89887625, 0.14210236, 0.73136324, -1.5946822, -1.0582726, -0.038778365, 0.16555099, 0.524512, 1.2363143, -0.49336198, -1.3413302, -0.7077877, -1.6578598, 1.5656521, 0.8138503, -0.36629808, -2.1896977, 0.0034853667, 0.9763886, 0.8405733, 0.8849647, -0.17390905, -0.6129, 0.6286722, 1.2564892, 0.2851164, 0.13694803, 9.93222E-4, 0.4676696, -0.48247516, 1.1001453, 0.5705339, 0.94548523, 1.187321, 1.783094, 0.8113491, 1.2139865, -0.016164929, 0.06480987, -0.4149706, 0.23398118, -0.37877452, -1.9220417, -0.050598614, -0.043078206, 0.16855747, -1.6443363, -1.1252139, 0.29613024, -0.672517, -0.5698791, 0.9530813, -1.0694199, -0.46017033, 0.24601588, -0.092323065, -0.44932622, -1.0141845, -1.1348956, 0.61431545, 1.1054189, 0.6349839, 0.7187088, -0.17796, -0.62297076, -0.031074379, -0.79158825, 0.9304359, 1.0766014, -0.76064134, 1.7666234, -0.80129695, -0.74121195, -1.0616574, -0.47188386, -0.36682612, 0.056807466, -0.8654932, -1.0248501, 0.546155, -0.5306963, 0.13037133, -0.6111008, 0.6068614, -0.91773814, -0.44095993, 0.5009603, 0.23484223, -0.17028934, -0.99245024, -0.65067893, 0.5472163, -0.3604442, -0.090568155, -0.4291102, 2.0521805, 0.1021027, 0.6916592, -0.023792937, 1.0715119, -0.83712643, -0.262352, 0.49454427, 0.8390617, 1.3250201, 0.46689984, -1.3506244, -0.99871457, -0.41264826, -0.49381423, 0.26062092, -0.0091345385, -0.02672518, -0.83447754, -0.5903585, -0.39882338, -1.0657839, 1.609232, -0.8066679, 0.4368572, -0.27918258, -2.0761468, -0.09133339, -0.9619137, -1.0781144, -1.9522108, 0.26916057, 1.4185976, -0.2584761, -0.8973954, 1.2409537, 1.2401322, -0.5636558, -0.85113424, 0.65403336, -0.060163096, -0.25691256, -2.1591415, 0.51948744, 0.88662255, 0.1598527, 0.44388902, 0.83538866, -0.6544175, 0.7489537, 0.3759879, -0.30538988, 0.76651734, 0.8989458, -1.1572857, -1.8967073, -0.8011603, 0.20302266, -0.10743599, -3.762876, -0.24564815, -0.6410657, 1.6019788, 1.327007, -1.260699, 0.17235702, -0.99035263, 0.1482996, 2.056026, -0.44028974, 1.9759376, -0.12924966, -1.6157428, 0.03122072, -1.1889125, -0.908909, 0.54299027, -0.8005189, -2.12892, -0.791977, 0.74162257, -0.1204547, -0.6256237, -0.26259482, 1.8753844, -0.3260839, 0.080399685, -0.026118852, 0.8907727, 0.4319697, 0.08642858, 0.8313999, 0.17721243, 1.0065078, 0.6526892, 0.7172497, -0.8695093, 0.6089649, 0.27802703, 0.71105754, 0.31578606, 0.9712795, 0.16790774, -0.038687415, -0.13922635, 1.5738863, -1.0589528, -0.4771744, -0.22979447, 0.21364734, 1.2524059, 1.6702797, 0.20834085, 1.1059339, -1.6936125, 0.6711643, 1.6396366, 0.57020766, 1.045982, 1.2803408, 1.4934437, -0.41918638, -1.1421211, 0.030070513, 0.7253566, 0.31505457, 0.63685656, 1.8019769, 0.54031014, 0.11650577, 0.2846742, 1.5046045, 0.5767608, 0.36930075, 0.32829267, 0.052114997, 0.578656, 1.4265828, 0.3710441, 1.0938163, -0.5008584, -0.5134587, -1.9278206, 0.30874428, 0.15796334, -1.2401778, 0.17576662, 2.0004287, -0.02314052, -0.055543534, -0.50468975, -0.11305372, 0.54043645, -0.5756428, 0.49722683, -0.5297424, 0.13753265, 0.25518733, -0.23544669, -0.5141269, 0.75673586, 1.3438044, 0.9461643, -0.39285365, -0.5860044, -1.787984, -0.8788467, -0.40555692, 0.3285657, -0.38691264, 1.3708282, 0.36385515, -0.7747672, 1.2061442, -1.6046813, -0.23393211, 1.293443, -0.31235135, 0.28134233, -1.1506547, -0.0991762, 1.4272449, 0.6899714, -1.3709666, -0.30998096, 0.7646165, 0.52666295, 0.6161754, -0.32877484, -0.054364443, -0.44929767, -0.8694531, 0.94425637, 0.3422884, 0.6323704, 0.34922627, 0.9050418, -1.5845101, 0.45886135, -0.29504868, -0.5662195, -1.5704926, -0.54826355, 2.2663965, -0.96759653, 0.07684225, -0.68078613, -0.49419355, 0.5082733, 1.7261288, 1.2518026, -0.02031415, -0.90473115, 0.35896915, 0.49848247, 0.5520185, -0.7405191, 0.3500682, -0.262386, -0.3942172, 0.29561684, 1.021035, -1.4068037, 2.2699223, 1.4257491, -0.10412434, 0.17128283, -1.0413268, -0.86806285, 0.37422425, -1.391298, -0.995613, -0.81997967, -1.0913445, -0.43824428, 0.7557612, 0.7228685, 1.022525, -0.8960229, -0.5878514, 0.29143187, -0.24042165, -1.5417792, -0.8847957, -0.16454956, -0.108894505, -0.8830671, 0.30506596, -0.047977895, -1.5889373, 0.0026431233, 0.1652314, -0.084799856, -0.14659284, 0.7213514, -0.25080308, -2.7894351, 0.05464632, 0.20575038, -1.2875743, -0.5489224, -0.23698223, 0.62773806, 1.4328256, 0.87418485, 0.29029268, 0.72027886, 1.5169219, -0.93750125, -0.6640493, -0.8408683, -0.69088763, 0.071907505, -0.33705214, -0.37655997, -1.1414671, -0.3436033, 0.6703798, -0.34200937, 0.76734024, 0.48768342, 2.0672226, 0.3513915, -2.6420221, 0.79512703, -1.9421546, -0.39919388, -0.3103354, -1.3154385, 0.5201629, -0.039092638, -1.0361304, 1.2638918, 1.6469301, 1.4541465, -0.12338864, -0.20437062, -1.3766631, 0.20336919, 0.3032297, -1.1453805, -0.63037485, 0.86080396, 0.057820674, -0.17105912, -0.66717327, 0.8759303, -1.5944928, -0.34394643, -0.81281877, -0.10437061, 0.51413935, -0.6940095, 0.09568102, 0.4002368, 0.3984665, -0.4812769, 1.0038961, -2.2231097, 1.4474787, -0.57229334, -0.20271471, 0.8423536, -0.3723959, 1.499843, 0.74556774, -0.2668783, -0.17127366, -0.26935872, 0.04133615, 0.5453585, -0.8243729, -0.39952496, 0.4004973, 0.41419125, -0.5219258, 0.78898853, -1.1944782, -0.069127515, -0.50455236, -0.72714645, -0.020746175, 0.5059885, 0.04399816, -0.7894044, -0.4625147, -1.1342267, 1.1750203, 1.0542814, 0.54491824, 1.1081833, 0.9187785, 0.35971174, 1.2452533, 0.34259045, 0.21274799, -0.3588566, 0.4610651, -0.04601556, 1.4945889, -0.5564384, -1.0967007, 0.7066467, 3.3626142, -0.45100608, 0.94582105, 0.5915438, -1.2985345, 1.8414979, -1.8253032, 0.14959589, -0.77038383, 1.4642384, -0.4388054, 1.288484, 1.3210498, -0.80942005, -0.9672099, -0.65774846, 1.1029816, 0.46842724, -0.6264829, 0.4077455, 0.81473553, -0.42250708, 0.32202694, -0.22059433, -0.7988756, 0.708937, -0.9522668, -0.7775771, 0.059927836, 0.74642587, -0.19692329, -1.2440609, -1.098552, 1.0545642, -1.0772063, 0.74647504, 1.470575, -0.5858193, -0.0924616, -0.17740022, -0.66750735, 1.1928539, -0.23574628, 0.81189126, 0.09582798, 0.4183188, -1.1813284, -0.026065111, 0.31969306, 0.43597493, 0.66805744, 0.62070143, -0.0034784377, -0.8889909, -0.80639535, 0.3112222, 3.1803548E-4, -0.6416318, 0.33191863, 1.1382916, 1.3028858, -0.10085269, 0.3195763, -0.31446657, -0.35984194, -0.38577667, 0.53107315, 0.40813607, 0.7133298, 0.25367644, -1.0670294, -0.6008749, 0.2553314, 0.80797035, -0.35269725, -0.6880298, 0.24852966, -1.1319366, -0.8757431, -0.21580404, -0.18601301, -0.6906879, 0.014807865, 1.1912467, 1.04509, -0.10085851, -0.45177278, -0.072870165, 0.329378, -0.49100843, -0.43467385, -1.2889651, -0.70850945, 0.26771125, 0.18572438, -0.2720942, 0.43180743, -0.81432074, -0.16396782, -0.6017848, -1.1050781, -0.1555152, -0.23216394, 0.037618868, 0.7290777, 0.9550213, 0.5936872, -1.586561, -0.6771395, 0.56206936, 1.130935, -1.2366065, -0.1617217, 0.51420254, 0.971334, 1.78033, -0.1060246, 0.21716677, -0.27206194, 0.54947907, 0.94673073, 0.73379856, -0.8343029, -1.4676459, -0.46819842, 0.48852733, 0.37889057, 0.23780534, 0.38874793, -0.5406712, 1.3277413, 0.15832564, 1.6661067, 1.2097427, 1.4635663, -0.12328875, -0.67774004, -0.28292066, 0.320097, 2.5623178, 1.3031111, -0.603192, -0.89567465, 0.30138868, -1.5841885, 0.53296447, 0.6786059, 0.40331912, 2.0684633, -1.8140808, 1.4070704, -0.3449422, 0.042878196, 0.015341766, -0.5814527, 0.40312484, -1.6848412, 0.3573785, 0.58632135, -1.2993916, 0.4050647, 0.09386148, -0.9597645, 0.24521033, -1.296575, -0.8788979, -0.07583651, -0.19651726, -1.3198664, 0.91247207, -0.23491615, -0.69126385, -0.36646947, 0.6679405, 0.6521822, 1.2520598, -1.2030113, -0.05532061, 1.2752007, 0.65868104, 0.13310033, -0.38185915, -0.36582285, 0.6203386, -0.44607306, -1.0542217, 0.69973034, -0.21898067, -0.90345484, 0.3432177, -1.1876707, -0.61998874, -0.17062163, 0.03154456, 0.9546824, -1.1999363, 0.35003653, 0.3774589, -0.69688475, 0.5394852, -0.4178684, -0.5743325, 0.44549868, 0.23013777, 0.48078102, -1.2584909, 0.17692174, 0.77223897, 2.3418598, -0.60895723, 0.47246987, 0.0635868, -1.6709051, 0.9226307, 0.87492394, -0.26498368, -0.62524897, 0.4892697, -1.2254604, 1.4037976, -0.2848704, -1.2092291, 0.07173258, 0.9759337, 0.28825217, 1.1190293, 0.36933511, -0.86020666, 0.46288306, -0.8207261, 0.7977053, 0.3890648, 1.1675832, 0.0275044, -0.39459595, -0.13455182, 0.07498321, -1.271422, 1.2770928, 0.049766738, -1.4789736, 0.9204863, 0.70714617, 0.70985067, -2.331192, -0.61922467, -0.2763989, -0.5571157, -0.67623353, -1.1761963, -0.21970682, 0.27037323, -0.8994191, -2.381745, 0.6371306, 1.2865686, -0.18902478, 0.50391877, 0.059875734, 0.060568426, -0.29835868, 0.04036907, 0.22656354, -0.50994015, -0.37293923, -1.2668151, 0.49166775, -0.8428958, -0.19374083, -0.60098785, 1.1365696, 0.27369553, -0.7550793, -0.1837983, -0.28003544, -1.5021, 0.017706933, 1.007257, 0.5001768, -0.76717174, 0.81601655, -1.4830563, -0.06647308, -0.8637145, -0.8227021, 0.45729873, 0.8057303, -0.9028343, -0.6716624, 1.3764576, -0.049274106, 1.3423727, -0.92215544, -1.1009762, -0.32981873, 0.7333975, 1.4434083, -2.4913514, 1.482163, 1.5521965, -0.81519526, 0.5059769, 0.44045776, 0.5900404, 1.4250352, 0.49720865, 0.41570318, 0.15930353, -0.13293587, -0.64938587, 1.6937196, -0.1525658, -0.090940125, -1.6866062, -1.2692227, -0.82893753, 0.8964745, 0.75051117, 1.5867168, 0.096937, -0.74163896, -1.2800126, -1.4941839, 1.6449912, 0.4826567, 0.5664867, -1.7497717, -0.06550709, -0.08505991, 0.4821029, 0.54030067, -0.082249105, -0.99253076, 0.2034322, 0.25167018, 0.32151845, 0.032924175, 0.16754732, 0.11660733, -0.69654804, 1.8220257, 0.28798974, 1.8381176, 1.1841091, 1.6198701, 1.8414903, 1.23679, 0.043849654, 0.1534152, 0.18300694, -0.21019913, -0.8895652, -1.1764803, 0.6239901, -0.26321217, 0.06479309, -0.55182844, 0.040147334, 0.2995581, -0.5331417, -1.0413771, 0.60910714, -1.2584362, -0.28730014, 0.12595543, 0.12742367, -1.0103757, -0.8232557, -0.49357045, 0.70783716, 0.30833355, 0.48050115, 0.29242313, -0.7269964, 0.22016521, 0.14010502, -0.7454974, 0.6690863, 0.8573559, -0.17470227, 1.4966593, -1.2781067, -0.77586764, -0.7272115, -0.45727804, 0.17809007, -0.449621, -0.93235147, -0.45838866, 0.7588631, -0.5219085, 0.1722843, -0.51468235, 0.4696321, -0.7007964, -0.6519156, 0.652754, -0.419362, 0.13925533, -1.5399723, -0.36031464, 0.07082115, -0.5639774, -0.2888695, -0.56151384, 2.0554755, 0.14657974, 0.87772167, -0.4596722, 1.6220878, -0.30062535, -0.63579226, 0.23556773, 1.7248702, 0.17956474, 0.51734966, -1.474717, -0.72370553, 0.016837284, -0.6655267, -0.108507134, 0.09206803, 0.23756504, -0.75349075, -0.7275167, 0.3287605, -0.20825714, 0.540179, -0.563493, 0.18271421, -0.93017954, -1.3007112, -0.36480477, -0.9600047, -0.803205, -1.6867162, 0.55379134, 0.6960957, -0.47614285, -0.7246411, 0.5093761, 1.6628364, -0.5569885, -0.6545775, -0.80253917, -0.8271408, -0.9183827, -1.5228175, -0.09946534, 0.99671286, 0.6209274, 0.12665525, 1.159173, -0.30778784, 0.2912266, 0.12909448, 0.579844, 0.14042296, 0.57635796, -1.6015556, -1.344032, -0.08781851, -0.10264405, 0.1350973, -4.4351306, -0.18748549, 0.11809458, 1.3453304, 0.9689776, -0.86725503, 0.02527731, -0.9093106, -0.039363153, 1.8000926, 0.37629968, 1.5821699, -0.11818232, -1.6388477, 0.70786685, -1.7642478, -0.34004864, 0.05239167, -0.45685053, -1.4894409, -0.6160852, 0.8691628, 8.518949, -0.44275343, -0.15159568, 1.7194852, -0.32879514, 0.503711, 0.32538795, -0.047598664, 0.4116954, -0.37143373, 0.8617377, -0.0024800003, 0.68594164, 0.8106313, 0.5021601, -0.65510845, 0.2947012, 0.4580874, 0.8429514, -0.029524736, 1.244981, 0.056723148, -0.11515126, 0.2904784, 1.5083828, -0.90244603, -0.89504975, -0.5929145, -0.13560995, 1.2172327, 1.2993513, 0.5471312, 0.9823583, -0.53089905, 0.6470476, 1.3706353, 0.07710672, 0.66170347, 0.8522321, 3.7581966, 0.18205029, -1.5388376, 0.14968619, 0.7957213, 0.5417012, 0.57052195, 1.7262292, 0.3853963, 0.05573173, 0.019531325, 0.889642, 0.14051607, -0.10019319, 0.52222127, -0.045800984, -0.1372413, 1.3182182, 0.06720713, 0.65188503, -0.49704686, 0.15328996, -1.4841757, 0.07393673, -0.10667658, -1.741219, 0.15979664, 1.0401752, 0.20498934, -0.09760857, 0.26027164, -0.4799143, 0.66915995, 0.0971428, 0.50639033, -0.5895407, -0.2591088, -0.12500899, -0.44097197, -0.018114433, 0.07570505, 1.8875248, 0.72134954, -0.6835846, -0.43611696, -1.5730146, -0.47251692, -0.967706, 0.67281497, -0.3970288, 0.23531409, 0.31934413, -0.4834523, 0.85528296, -1.4495584, -0.17761847, 1.0605572, -0.33328635, 0.09331871, -1.6740737, 0.32838723, 1.2812709, 0.7532023, -1.6620958, -0.06949543, 0.22357371, 0.5511003, 0.44403845, -0.088602625, 0.086290106, -0.29867518, -0.59133786, 0.47898614, -0.16206141, -0.3974132, 0.020216722, 0.9978839, -0.88115966, 0.43280727, -0.027793905, -0.67816794, -0.6834847, -0.310411, 1.4877534, -0.9325847, 0.08318488, -0.056899868, -0.3264665, 0.18626533, 1.311764, 0.52422476, 0.27261677, -0.9771914, -0.07349676, 0.23518278, 0.6440802, -0.38859436, 0.7356058, -0.87186205, -0.79511106, 0.6331253, 0.51360786, -1.8998158, 1.2421445, 1.6992611, 0.3416561, 0.08102964, -1.1458695, -1.3352224, 0.4332353, -0.82750726, -0.68687415, -1.0607231, -0.45399368, -0.65770257, 0.5407971, 0.36140308, 0.78880286, -0.87017035, 0.11368229, 0.9742579, -0.836373, -1.4891531, -0.39808506, -0.12711097, 0.2665581, -0.94508183, 0.3168681, 0.18193309, -2.0642102, -0.42695135, -0.01493331, -0.8744083, 0.136745, 0.33562094, 0.35592413, -1.9299185, -0.9336301, 0.21273266, -1.1257002, -0.46698323, -0.44841182, 0.4095448, 0.9316055, 0.42856336, 0.7239482, 0.5807358, 1.7736349, -0.8905484, -0.98154503, -0.8812651, -0.591294, 0.114608765, 0.074452646, -0.7906054, -0.48456904, 0.58756906, 0.72785217, -0.45900884, 0.80664396, 0.20831603, 1.404514, 0.10135339, -1.7207683, 0.121471085, -1.4293977, -0.25176442, -0.88530314, -1.932973, 0.75488913, 0.053633798, -0.5996313, 1.1192294, 0.7987387, 1.0803125, -0.20899309, -0.3250925, -1.0392616, 0.60894144, 0.24588943, -0.64634514, -0.6554399, 0.8959745, 0.44019213, -0.045357216, -0.38841888, 0.79150975, -0.70056456, -0.10906712, -0.35132694, 0.38104087, 0.83124346, -0.9196306, 0.101093374, 0.3173144, 0.35568184, -0.72773474, 1.0110441, -2.1881406, 0.90069056, -1.2138778, -0.49465472, 0.29515645, -0.42973396, 0.86696035, 0.462676, -0.2891507, 0.48092514, 0.14870986, 0.2362285, 0.94265085, -0.95444787, -0.7235914, 0.15523535, 0.8009351, -0.57308763, 0.8169279, -0.66213703, -0.03514193, -0.06134875, -0.7540824, -0.20499344, 0.5033528, 0.6832062, -1.0438838, 0.0013836473, -0.5009912, 0.93052953, 0.57491046, 0.42732602, 1.4600122, 0.7491548, 0.1275791, 0.9447524, 0.14973052, 0.5151727, -0.4853087, 0.71405834, 0.5183598, 1.313502, -0.21636684, -0.77506334, -0.12591712, 1.486607, -0.7264576, 0.99942267, 0.3202754, -1.502707, 1.4193612, -1.40818, 0.27752662, -0.80451846, 1.1607374, -0.20769496, 0.61043406, 1.315206, 0.0568088, -0.40790638, -0.5757813, 1.0029505, -0.25614408, -0.60398436, 0.2829705, 0.90209776, 0.19745542, -0.3516592, -0.55319506, -0.1090347, 0.9403592, -0.28909415, -0.61357373, -0.28233677, 0.8260039, -0.211104, -1.1662388, -0.7386189, 1.4462554, -0.34844738, 0.37773976, 0.7810842, -0.5882355, -0.059488796, -0.19547813, -0.24606134, 0.6835963, 0.2511679, 0.856332, -1.0636065, 0.3394099, -0.96563685, -0.005031675, 0.50627327, -0.5008203, 0.90881467, 0.3842252, 0.11551586, -0.83781016, -0.77075464, -0.2338815, -0.035362475, -1.0022215, 0.20489949, 1.1973978, 0.6405313, 0.22105882, 0.759547, -0.15372802, -0.9853528, -0.055215254, -0.11200724, 0.93392026, 0.92165124, 0.56908315, -1.6037151, -0.63075554, -0.3626079, 0.42245942, -0.37033117, -0.899393, 0.3136378, -0.38658756, -0.045805737, -0.12737003, -0.62156856, -0.77010757, 0.3646657, 0.30881408, 0.81467205, -0.35185418, -1.2174497, -0.124289915, 0.21588212, -0.5912653, 0.5155864, -0.55197835, -0.74786615, 0.32146156, -0.54999655, -0.3350795, -0.074797854, -1.4570993, 0.23734923, -0.6517045, -0.39027223, -0.0027831644, -0.07549344, -0.12575209, 1.3137401, 0.77984715, 0.5054453, -1.1595855, -0.31115592, 0.5981977, 1.5581173, -0.71296954, -0.60147953, 0.23892058, 0.90308523, 1.2783934, 0.4829749, 0.56447566, -0.11322677, 0.4671607, 0.7727588, 0.7172333, -0.1574448, -1.2798158, -0.3061784, 0.6185353, 0.9465671, 0.679906, -0.2793042, -0.46887103, -0.016957872, -0.17706259, 0.90864146, 0.5860386, 0.78973603, -0.2444247, -1.0041484, -0.34054106, 0.3139922, 5.928577, 1.9771936, -0.54047304, -0.6981526, 0.18960235, -0.8373701, 0.44040245, 0.92274296, 0.32851875, 2.1369495, -1.9185268, 1.7090166, -0.22396593, -0.0027257204, 0.2886428, -0.14268377, 0.30027795, -1.1787082, 0.29569986, 0.44846383, -1.0683426, 0.19287628, -0.061031498, -0.45552272, 0.8514906, -1.1983136, -0.7224097, 0.56610334, -0.43930328, -1.6241871, 0.022371702, 0.056378156, -0.28574908, 0.22669566, 0.6215599, 0.56851315, -0.12263401, -1.1360767, -0.6112565, 0.9653295, 0.23831022, 0.46430987, -0.004769601, 0.007459389, 0.447268, -0.1048284, -0.29818714, 0.39249915, -0.34207064, -0.57210505, -0.4499803, -0.7788103, -0.0464814, -0.31602553, -0.30049258, -0.26680958, -0.12828995, -0.037486445, 0.09821058, -0.24948204, -0.25496805, 0.3345239, -1.4232894, -0.15812662, 0.08070272, -0.36936277, -0.69673073, -0.33060092, 0.73889613, 1.8970333, -0.53052443, 0.9062418, -0.33914202, -1.9018056, 0.61787736, 0.46802747, -0.40738654, -0.24149843, 0.52864766, -1.6946682, 1.5362931, -0.2065873, -1.3585843, 0.3950286, 0.48188406, 0.37551737, 0.4769164, 0.48761457, -1.0027927, 0.14477731, -1.1952885, -0.23367448, 1.2076813, 0.58423406, 0.07876493, -1.041011, 0.13759089, -0.14066333, -0.40304744, 0.8249726, 0.5309512, -1.5140133, 0.6465395, 0.00805977, -0.35565233, -1.0447453, -1.6391871, -0.57476056, -0.60116166, -0.6509856, -1.6507915, -0.24304004, -0.32796037, -0.9862035, -2.3792913, 0.72232765, 0.88596475, 0.05681677, 0.69371164, 0.4067158, -0.32266128, 0.35941786, 0.14268196, 0.008820172, -0.44048947, -0.3807906, -1.2657222, 0.011590555, -1.4166234, -0.5570914, -0.09691977, 0.61406046, 0.85134614, -0.9073981, -0.14514786, -0.19705656, -1.3431568, -0.18641903, 1.1970922, 0.43596244, -0.4643676, 0.23464873, -1.4809799, 0.22952351, -0.79023015, -0.9660293, -0.06106868, 0.91435355, -0.9410994, -0.27363744, 1.1213156, -0.5552039, 0.47450387, -0.67726296, -0.84531724, -0.3695472, 0.32097948, 1.236008, -1.9377409, 0.8715727, 1.7278404, -0.7182699, 0.34749338, 0.055821747, -0.25673252, 1.5338271, 0.5981914, 0.26056722, 0.35266542, 0.34506303, -0.2707516, 1.6680403, -0.26225284, 0.28264982, -0.93208283, -0.7195003, -0.49397373, 1.097455, -0.17251527, 1.2040282, -0.13247448, -0.8344006, -1.3730105, -0.9985511, 1.6127682, 0.102908984, -0.050705314, -2.0138884, -0.26599008, -0.67300093, 0.4828793, 0.8306255, 0.06904271, -0.2150876, 0.71669734, 0.71310204, 0.18367703, 0.3811021, 0.3367172, 0.4790209, -0.52320474, 1.4387411, 0.49768502, 1.6168096, 0.48664856, 2.0569668, 1.767732, 1.2483784, -0.1911243, 0.2164427, -0.41037652, 0.44743055, -0.32683307, -1.4615301, -0.2763298, -0.3156423, 0.28007326, -1.0386963, -0.556035, 0.55629194, -1.0255252, -0.54166985, 0.47017503, -1.3562512, -0.6570422, 0.85600406, 0.42322922, -0.3800823, -0.96864665, -0.39303845, 0.6151631, 0.8127344, 0.40640417, 0.29468858, -0.3595955, -0.26588053, -0.48084825, 0.1381006, 0.6274589, 0.50441945, -0.70409054, 0.6415553, -1.4776558, -0.7265096, -0.56839985, -0.37481079, -0.0556299, -0.07709563, -1.0079755, -0.31482062, 0.5529114, -0.2905458, -0.33441335, -0.7538321, 1.0301089, -0.8336837, 0.014018759, 0.6930184, 0.2822684, -0.59929043, -1.2549504, -0.04152093, -0.15594202, -0.8416114, 0.30521527, 0.085296825, 1.998172, 0.17953297, 0.81972474, -0.12049776, 0.636938, -0.32321817, -0.6623517, 0.4681129, 0.86831105, 1.3369138, 0.3237801, -1.4724734, -0.77724206, -0.13026565, -0.4761805, 0.25618175, -0.5109254, 0.33371875, -0.54170126, -0.25134182, 0.2437961, -0.46777722, 0.7951042, -0.92533684, 0.3077589, -0.67483133, -1.337733, -0.46373364, -0.6056862, -1.1445198, -0.5523313, 0.5446045, 0.69936764, -0.100782454, -0.7716193, 0.18777585, 1.7000009, -0.13324845, -0.04496102, -0.38585514, -0.6497307, -0.9735717, -0.3312297, 0.67569, 0.6791347, 0.1443547, -0.28027967, 1.9505106, -0.31825987, 0.09358952, -0.003940981, 0.060346037, 0.75013196, 0.75749826, -1.0889099, -1.6545596, 0.1618316] +2025-10-16 21:36:09 [main] INFO experimental.OnnxTest - ------------------------ +2025-10-16 21:36:09 [main] INFO experimental.OnnxTest - tokenizer加载耗时: 4082ms +2025-10-16 21:36:09 [main] INFO experimental.OnnxTest - tokenizer计算耗时: 1ms +2025-10-16 21:36:09 [main] INFO experimental.OnnxTest - 模型加载耗时: 441ms +2025-10-16 21:36:09 [main] INFO experimental.OnnxTest - 模型数据准备耗时: 10ms +2025-10-16 21:36:09 [main] INFO experimental.OnnxTest - 模型计算耗时: 5ms diff --git a/Partner-Main/src/test/java/NetTest.java b/Partner-Main/src/test/java/experimental/NetTest.java similarity index 94% rename from Partner-Main/src/test/java/NetTest.java rename to Partner-Main/src/test/java/experimental/NetTest.java index 0fbb87ea..ad606c1d 100644 --- a/Partner-Main/src/test/java/NetTest.java +++ b/Partner-Main/src/test/java/experimental/NetTest.java @@ -1,3 +1,5 @@ +package experimental; + import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpResponse; import org.junit.jupiter.api.Test; diff --git a/Partner-Main/src/test/java/OnnxTest.java b/Partner-Main/src/test/java/experimental/OnnxTest.java similarity index 99% rename from Partner-Main/src/test/java/OnnxTest.java rename to Partner-Main/src/test/java/experimental/OnnxTest.java index b8a545d8..fefee815 100644 --- a/Partner-Main/src/test/java/OnnxTest.java +++ b/Partner-Main/src/test/java/experimental/OnnxTest.java @@ -1,3 +1,5 @@ +package experimental; + import ai.djl.huggingface.tokenizers.Encoding; import ai.djl.huggingface.tokenizers.HuggingFaceTokenizer; import ai.onnxruntime.OnnxTensor; diff --git a/Partner-Main/src/test/java/ReflectionTest.java b/Partner-Main/src/test/java/experimental/ReflectionTest.java similarity index 96% rename from Partner-Main/src/test/java/ReflectionTest.java rename to Partner-Main/src/test/java/experimental/ReflectionTest.java index d316e96d..da543cf8 100644 --- a/Partner-Main/src/test/java/ReflectionTest.java +++ b/Partner-Main/src/test/java/experimental/ReflectionTest.java @@ -1,3 +1,5 @@ +package experimental; + import org.junit.jupiter.api.Test; import work.slhaf.partner.core.memory.MemoryCapability; import work.slhaf.partner.core.memory.pojo.MemoryResult; diff --git a/Partner-Main/src/test/java/RegexTest.kt b/Partner-Main/src/test/java/experimental/RegexTest.kt similarity index 98% rename from Partner-Main/src/test/java/RegexTest.kt rename to Partner-Main/src/test/java/experimental/RegexTest.kt index bc97f9c2..73cf7a77 100644 --- a/Partner-Main/src/test/java/RegexTest.kt +++ b/Partner-Main/src/test/java/experimental/RegexTest.kt @@ -1,3 +1,5 @@ +package experimental + import org.junit.jupiter.api.Test import java.lang.String.join import java.util.regex.Pattern diff --git a/Partner-Main/src/test/java/SelfAwarenessTest.java b/Partner-Main/src/test/java/experimental/SelfAwarenessTest.java similarity index 99% rename from Partner-Main/src/test/java/SelfAwarenessTest.java rename to Partner-Main/src/test/java/experimental/SelfAwarenessTest.java index be2cc518..e6a3fbc1 100644 --- a/Partner-Main/src/test/java/SelfAwarenessTest.java +++ b/Partner-Main/src/test/java/experimental/SelfAwarenessTest.java @@ -1,3 +1,5 @@ +package experimental; + import cn.hutool.json.JSONUtil; import org.junit.jupiter.api.Test; import work.slhaf.partner.api.chat.ChatClient; diff --git a/Partner-Main/src/test/java/SystemTest.java b/Partner-Main/src/test/java/experimental/SystemTest.java similarity index 98% rename from Partner-Main/src/test/java/SystemTest.java rename to Partner-Main/src/test/java/experimental/SystemTest.java index b618dae8..fe2200b3 100644 --- a/Partner-Main/src/test/java/SystemTest.java +++ b/Partner-Main/src/test/java/experimental/SystemTest.java @@ -1,3 +1,5 @@ +package experimental; + import com.alibaba.fastjson2.JSONObject; import org.junit.jupiter.api.Test; import work.slhaf.partner.core.action.entity.MetaActionInfo; diff --git a/Partner-Main/src/test/java/ThreadPoolTest.java b/Partner-Main/src/test/java/experimental/ThreadPoolTest.java similarity index 97% rename from Partner-Main/src/test/java/ThreadPoolTest.java rename to Partner-Main/src/test/java/experimental/ThreadPoolTest.java index 7488e2f8..d022253d 100644 --- a/Partner-Main/src/test/java/ThreadPoolTest.java +++ b/Partner-Main/src/test/java/experimental/ThreadPoolTest.java @@ -1,3 +1,5 @@ +package experimental; + import java.util.ArrayList; import java.util.List; import java.util.concurrent.Callable; diff --git a/Partner-Main/src/test/java/timewheel/TimeWheelTest.kt b/Partner-Main/src/test/java/experimental/timewheel/TimeWheelTest.kt similarity index 100% rename from Partner-Main/src/test/java/timewheel/TimeWheelTest.kt rename to Partner-Main/src/test/java/experimental/timewheel/TimeWheelTest.kt diff --git a/Partner-Main/src/test/java/text/relation_input_test.json b/Partner-Main/src/test/java/resources/text/relation_input_test.json similarity index 100% rename from Partner-Main/src/test/java/text/relation_input_test.json rename to Partner-Main/src/test/java/resources/text/relation_input_test.json diff --git a/Partner-Main/src/test/java/text/relation_output_test.json b/Partner-Main/src/test/java/resources/text/relation_output_test.json similarity index 100% rename from Partner-Main/src/test/java/text/relation_output_test.json rename to Partner-Main/src/test/java/resources/text/relation_output_test.json diff --git a/Partner-Main/src/test/java/resources/text/test.json b/Partner-Main/src/test/java/resources/text/test.json new file mode 100644 index 00000000..8fc15c26 --- /dev/null +++ b/Partner-Main/src/test/java/resources/text/test.json @@ -0,0 +1,18 @@ +{ + "keys": [ + { + "d": "H2hNCPdoa3B37PMZBbqlbJ3WZLKRWg3-rHjs5IPVsgERex5X0Etx5VM--lHRrKVjdgjuEbd9AlwUlUmv-UeDsrumaXcZUJN58LbQ7GiMC16pKi7jEIDttZwxJtWMwcwZ6BwO1HCBqruT4aGDL_WP1EX_x4ajsj1B2xs3UryfooR_gMDbDtOj9sxgY5dlCOTuEYxWkVtFZ7u_sGfaLkwMVzVk2bT6O2Hff3D9XXq7ZJvD_ess5z2dbvKb824MENN6ISZ7xNemXQPpM5pjGS8HQR5su5cExImyUhz452Y-Clc6UC_A5buxNwPJzv-3Ooasp3w8YkrXEubUj7lLgYsfSQ", + "dp": "Me4adZbjtq_EhLbiso_OLk-bmlHkoTMs5Nk4oZMDAYZSfh3TtxwbKUM3ycvHJInqNSba33antxQeyY6TXEsghfjZwMWhCz6RzEYWCFFjIv08zm2HGgaEjF2JuDr5i75ym6NC9y5wnvUBHnwm76bbSginrXcpS-2qAuniY7HLzlk", + "dq": "CwcPCdlYRgLmPIezcLLdkDRg2Nh4tBpGn3-nSdUAfwmfKwdPHj6FYnMuP__eFDoCkxZkD8VPYMDuYsALAcGSn8C7I2Vfv_LOvoLds6mcG9cxNHrBGPzpnGsyhNNTOqzmhb51MROs3OCg8H7HEqkBV5HAEzBfi3t9L7d5LI5WivE", + "e": "AQAB", + "kty": "RSA", + "n": "6HaqwtmLP-CkJQlo9aAh-qFFRhh9YTnjXKLtyKejEpkSyJ0_5jBuz_73ynpxB6YlIpNPFAI34dj3pAKjd3ajnoxXopm_MvriETlzqxl4UHQCgsUSAkipYZbP0bQYNZHO8VOCmEJxSJcccNq2gVgpG57MxNgQkB_OSDlQ0lxxIt1R_hpMcLzihPAIBI7lo17Y6oumql8ZHuKRFYgvOV7jx_S6oqpUSLvtyF8hzyLP32LllzzapYlD4UY_ywcHWT2YRS-HfL71F9q-knOiH7cFZf13ydqG3YDuAUnEk6odO2KF_7d3-0LJyFyp6xggWXBeRbVyAOtOt1j_1CHGncAluw", + "p": "_sUrhjSlJNKzJ19rlEKqaqEVpOcvLf970Jrv3xDp2M0inBwZnFbJfqb3kbr53g7N1XKREVS7eGIFNzKQhUWJjJWPdZVc5ewCcs2UVpIgdLnqtN1t7uQlsCf7-B74FONYdSeYkH3NuISqXTmXKA7jPJcxyo97ZcoQb2AEGPU6H4M", + "q": "6ZXuiLgw7eThq28JInIJ2hmSOLQsEMtv2M3CO5juoLE_bumBs1ooIHstG8-FOG_EL70TNZBlHVDZapsJQBbeL5r26LWgysLUQan3mqsWyn3aPje7eCP1hPLWzAafsJRe38_sGox9JlmCqG_UboxUHLf8b-cSr_4Rzmj9MHIbk2k", + "qi": "peNVzNTHxHmWpm-jDh5KnatlJ-4Ian4PKnaUKz6FjB6URXH8rauACX0gJ7-qZe23rq5639WNKeaVVMlADezyVfw4hq0crfURAQnjysyzldQ8kTCcThtw4oN1qyFex6fWNu-6A3VlGMCLgLvD7Pkk3qgnbj8cEtm5teq6srFvdsU", + "use": "sig", + "kid": "b16b20729c3ced11", + "alg": "RS256" + } + ] +} \ No newline at end of file From ad58c0cc7cfa2eb33be967578c543587d1118352 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Tue, 16 Dec 2025 21:02:29 +0800 Subject: [PATCH 025/182] refactor(LocalRunnerClient): allow injecting action watch path Context: The hardcoded action watch path made LocalRunnerClient difficult to test and tightened it to a specific runtime layout. Injecting the watch path improves testability and allows the runner to work in different runtime environments. --- .../java/work/slhaf/partner/common/Constant.java | 2 +- .../core/action/runner/LocalRunnerClient.java | 14 ++++++++++---- .../src/test/java/experimental/SystemTest.java | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/common/Constant.java b/Partner-Main/src/main/java/work/slhaf/partner/common/Constant.java index 4ca7bb11..36d0ab3a 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/common/Constant.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/common/Constant.java @@ -3,7 +3,7 @@ package work.slhaf.partner.common; public final class Constant { public static final class Path { - public static final String DATA = "./data"; + public static final String DATA = "data"; public static final String MEMORY_DATA = DATA + "/memory"; public static final String ACTION_PROGRAM = DATA + "/action"; public static final String TMP_ACTION_DIR_LOCAL = ACTION_PROGRAM + "/tmp"; diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index fd2185ed..212cc7ad 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -5,7 +5,7 @@ import com.alibaba.fastjson2.JSONObject; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.jetbrains.annotations.NotNull; - +import org.jetbrains.annotations.Nullable; import work.slhaf.partner.core.action.entity.McpData; import work.slhaf.partner.core.action.entity.MetaAction; import work.slhaf.partner.core.action.entity.MetaActionInfo; @@ -24,6 +24,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.ExecutorService; +import java.util.concurrent.atomic.AtomicInteger; import static work.slhaf.partner.common.Constant.Path.ACTION_PROGRAM; import static work.slhaf.partner.common.Constant.Path.TMP_ACTION_DIR_LOCAL; @@ -31,9 +32,9 @@ import static work.slhaf.partner.common.Constant.Path.TMP_ACTION_DIR_LOCAL; @Slf4j public class LocalRunnerClient extends RunnerClient { - public LocalRunnerClient(Map existedMetaActions, ExecutorService executor) { + public LocalRunnerClient(Map existedMetaActions, ExecutorService executor, @Nullable String actionWatchPath) { super(existedMetaActions, executor); - ActionWatchService watchService = new ActionWatchService(); + ActionWatchService watchService = new ActionWatchService(actionWatchPath); watchService.launch(); } @@ -149,9 +150,14 @@ public class LocalRunnerClient extends RunnerClient { private class ActionWatchService { private final HashMap registeredPaths = new HashMap<>(); + private final String actionWatchPath; + + private ActionWatchService(String actionWatchPath) { + this.actionWatchPath = actionWatchPath; + } private void launch() { - Path path = Path.of(ACTION_PROGRAM); + Path path = Path.of(actionWatchPath != null ? actionWatchPath : ACTION_PROGRAM); scanActions(path.toFile()); launchActionDirectoryWatcher(path); } diff --git a/Partner-Main/src/test/java/experimental/SystemTest.java b/Partner-Main/src/test/java/experimental/SystemTest.java index fe2200b3..86982bd2 100644 --- a/Partner-Main/src/test/java/experimental/SystemTest.java +++ b/Partner-Main/src/test/java/experimental/SystemTest.java @@ -41,7 +41,7 @@ public class SystemTest { void localRunnerClientTest() { Map existedMetaActions = new HashMap<>(); ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor(); - RunnerClient client = new LocalRunnerClient(existedMetaActions, executor); + RunnerClient client = new LocalRunnerClient(existedMetaActions, executor, null); JSONObject res = client.listSysDependencies(); System.out.println(res.toString()); } From 534dcd5ade2e1aac1a73c42a275880bd9cdb1464 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Tue, 16 Dec 2025 21:30:51 +0800 Subject: [PATCH 026/182] fix(LocalRunnerClient): correctly capture stdout and stderr to avoid missing output in method exec --- .../core/action/runner/LocalRunnerClient.java | 56 +++++++++++++------ 1 file changed, 40 insertions(+), 16 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 212cc7ad..95370f3f 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -114,29 +114,53 @@ public class LocalRunnerClient extends RunnerClient { private SystemExecResult exec(String... command) { SystemExecResult result = new SystemExecResult(); - - List resultList = new ArrayList<>(); - result.setResultList(resultList); - StringBuilder s = new StringBuilder(); + List output = new ArrayList<>(); + List error = new ArrayList<>(); try { - Process process = Runtime.getRuntime().exec(command); - BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); - String line; - while ((line = reader.readLine()) != null) { - s.append(line); - resultList.add(line); - } + Process process = new ProcessBuilder(command) + .redirectErrorStream(false) // 分开读 + .start(); + + Thread stdoutThread = new Thread(() -> { + try (BufferedReader r = new BufferedReader( + new InputStreamReader(process.getInputStream()))) { + String line; + while ((line = r.readLine()) != null) { + output.add(line); + } + } catch (Exception ignored) { + } + }); + + Thread stderrThread = new Thread(() -> { + try (BufferedReader r = new BufferedReader( + new InputStreamReader(process.getErrorStream()))) { + String line; + while ((line = r.readLine()) != null) { + error.add(line); + } + } catch (Exception ignored) { + } + }); + + stdoutThread.start(); + stderrThread.start(); + int exitCode = process.waitFor(); + stdoutThread.join(); + stderrThread.join(); + result.setOk(exitCode == 0); - result.setTotal(s.toString().isEmpty() ? "响应为空" : s.toString()); + result.setResultList(output.isEmpty() ? error : output); + result.setTotal(String.join("\n", + output.isEmpty() ? error : output)); + } catch (Exception e) { result.setOk(false); - result.setTotal(e.getLocalizedMessage()); - } - if (result.getTotal().isEmpty()) { - result.setOk(false); + result.setTotal(e.getMessage()); } + return result; } From 488246525fcdb3cf1ee930b01cf9530c39628713 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Tue, 16 Dec 2025 21:39:11 +0800 Subject: [PATCH 027/182] chore(gitignore): exclude runtime data directory from version control --- .gitignore | 1 + Partner-Main/data/log/partner.log | 111 ------------------------------ 2 files changed, 1 insertion(+), 111 deletions(-) delete mode 100644 Partner-Main/data/log/partner.log diff --git a/.gitignore b/.gitignore index cd40421a..bde338f9 100644 --- a/.gitignore +++ b/.gitignore @@ -55,3 +55,4 @@ build/ /data/ /generated-classes/ /.idea/copilot.data.migration.ask2agent.xml +/Partner-Main/data/ diff --git a/Partner-Main/data/log/partner.log b/Partner-Main/data/log/partner.log deleted file mode 100644 index eb2dca02..00000000 --- a/Partner-Main/data/log/partner.log +++ /dev/null @@ -1,111 +0,0 @@ -2025-10-16 18:48:10 [main] INFO ai.djl.util.Platform - Found matching platform from: jar:file:/home/slhaf/.m2/repository/ai/djl/huggingface/tokenizers/0.34.0/tokenizers-0.34.0.jar!/native/lib/tokenizers.properties -2025-10-16 18:48:10 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Using cache dir: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 -2025-10-16 18:48:10 [main] INFO a.d.h.tokenizers.jni.LibUtils - Extracting native/lib/linux-x86_64/cpu/libtokenizers.so to cache ... -2025-10-16 18:48:10 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading huggingface library from: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 -2025-10-16 18:48:10 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading native library: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64/libtokenizers.so -2025-10-16 18:49:01 [main] INFO ai.djl.util.Platform - Found matching platform from: jar:file:/home/slhaf/.m2/repository/ai/djl/huggingface/tokenizers/0.34.0/tokenizers-0.34.0.jar!/native/lib/tokenizers.properties -2025-10-16 18:49:01 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Using cache dir: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 -2025-10-16 18:49:01 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading huggingface library from: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 -2025-10-16 18:49:01 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading native library: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64/libtokenizers.so -2025-10-16 18:49:57 [main] INFO ai.djl.util.Platform - Found matching platform from: jar:file:/home/slhaf/.m2/repository/ai/djl/huggingface/tokenizers/0.34.0/tokenizers-0.34.0.jar!/native/lib/tokenizers.properties -2025-10-16 18:49:57 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Using cache dir: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 -2025-10-16 18:49:57 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading huggingface library from: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 -2025-10-16 18:49:57 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading native library: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64/libtokenizers.so -2025-10-16 18:49:57 [main] WARN a.d.h.t.HuggingFaceTokenizer - maxLength is not explicitly specified, use modelMaxLength: 512 -2025-10-16 18:50:08 [main] INFO ai.djl.util.Platform - Found matching platform from: jar:file:/home/slhaf/.m2/repository/ai/djl/huggingface/tokenizers/0.34.0/tokenizers-0.34.0.jar!/native/lib/tokenizers.properties -2025-10-16 18:50:08 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Using cache dir: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 -2025-10-16 18:50:08 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading huggingface library from: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 -2025-10-16 18:50:08 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading native library: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64/libtokenizers.so -2025-10-16 18:50:08 [main] WARN a.d.h.t.HuggingFaceTokenizer - maxLength is not explicitly specified, use modelMaxLength: 512 -2025-10-16 18:51:15 [main] INFO ai.djl.util.Platform - Found matching platform from: jar:file:/home/slhaf/.m2/repository/ai/djl/huggingface/tokenizers/0.34.0/tokenizers-0.34.0.jar!/native/lib/tokenizers.properties -2025-10-16 18:51:15 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Using cache dir: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 -2025-10-16 18:51:15 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading huggingface library from: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 -2025-10-16 18:51:15 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading native library: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64/libtokenizers.so -2025-10-16 18:51:15 [main] WARN a.d.h.t.HuggingFaceTokenizer - maxLength is not explicitly specified, use modelMaxLength: 512 -2025-10-16 18:52:08 [main] INFO ai.djl.util.Platform - Found matching platform from: jar:file:/home/slhaf/.m2/repository/ai/djl/huggingface/tokenizers/0.34.0/tokenizers-0.34.0.jar!/native/lib/tokenizers.properties -2025-10-16 18:52:08 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Using cache dir: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 -2025-10-16 18:52:08 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading huggingface library from: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 -2025-10-16 18:52:08 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading native library: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64/libtokenizers.so -2025-10-16 18:52:08 [main] WARN a.d.h.t.HuggingFaceTokenizer - maxLength is not explicitly specified, use modelMaxLength: 512 -2025-10-16 18:53:22 [main] INFO ai.djl.util.Platform - Found matching platform from: jar:file:/home/slhaf/.m2/repository/ai/djl/huggingface/tokenizers/0.34.0/tokenizers-0.34.0.jar!/native/lib/tokenizers.properties -2025-10-16 18:53:22 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Using cache dir: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 -2025-10-16 18:53:22 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading huggingface library from: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 -2025-10-16 18:53:22 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading native library: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64/libtokenizers.so -2025-10-16 18:53:22 [main] WARN a.d.h.t.HuggingFaceTokenizer - maxLength is not explicitly specified, use modelMaxLength: 512 -2025-10-16 19:10:11 [main] INFO ai.djl.util.Platform - Found matching platform from: jar:file:/home/slhaf/.m2/repository/ai/djl/huggingface/tokenizers/0.34.0/tokenizers-0.34.0.jar!/native/lib/tokenizers.properties -2025-10-16 19:10:11 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Using cache dir: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 -2025-10-16 19:10:11 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading huggingface library from: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 -2025-10-16 19:10:11 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading native library: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64/libtokenizers.so -2025-10-16 19:10:11 [main] WARN a.d.h.t.HuggingFaceTokenizer - maxLength is not explicitly specified, use modelMaxLength: 512 -2025-10-16 19:12:10 [main] INFO ai.djl.util.Platform - Found matching platform from: jar:file:/home/slhaf/.m2/repository/ai/djl/huggingface/tokenizers/0.34.0/tokenizers-0.34.0.jar!/native/lib/tokenizers.properties -2025-10-16 19:12:10 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Using cache dir: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 -2025-10-16 19:12:10 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading huggingface library from: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 -2025-10-16 19:12:10 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading native library: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64/libtokenizers.so -2025-10-16 19:12:10 [main] WARN a.d.h.t.HuggingFaceTokenizer - maxLength is not explicitly specified, use modelMaxLength: 512 -2025-10-16 19:15:32 [main] INFO ai.djl.util.Platform - Found matching platform from: jar:file:/home/slhaf/.m2/repository/ai/djl/huggingface/tokenizers/0.34.0/tokenizers-0.34.0.jar!/native/lib/tokenizers.properties -2025-10-16 19:15:32 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Using cache dir: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 -2025-10-16 19:15:32 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading huggingface library from: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 -2025-10-16 19:15:32 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading native library: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64/libtokenizers.so -2025-10-16 19:15:32 [main] WARN a.d.h.t.HuggingFaceTokenizer - maxLength is not explicitly specified, use modelMaxLength: 512 -2025-10-16 19:15:50 [main] INFO ai.djl.util.Platform - Found matching platform from: jar:file:/home/slhaf/.m2/repository/ai/djl/huggingface/tokenizers/0.34.0/tokenizers-0.34.0.jar!/native/lib/tokenizers.properties -2025-10-16 19:15:50 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Using cache dir: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 -2025-10-16 19:15:50 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading huggingface library from: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 -2025-10-16 19:15:50 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading native library: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64/libtokenizers.so -2025-10-16 19:15:50 [main] WARN a.d.h.t.HuggingFaceTokenizer - maxLength is not explicitly specified, use modelMaxLength: 512 -2025-10-16 19:18:36 [main] INFO ai.djl.util.Platform - Found matching platform from: jar:file:/home/slhaf/.m2/repository/ai/djl/huggingface/tokenizers/0.34.0/tokenizers-0.34.0.jar!/native/lib/tokenizers.properties -2025-10-16 19:18:36 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Using cache dir: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 -2025-10-16 19:18:36 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading huggingface library from: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 -2025-10-16 19:18:36 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading native library: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64/libtokenizers.so -2025-10-16 19:18:36 [main] WARN a.d.h.t.HuggingFaceTokenizer - maxLength is not explicitly specified, use modelMaxLength: 512 -2025-10-16 19:19:35 [main] INFO ai.djl.util.Platform - Found matching platform from: jar:file:/home/slhaf/.m2/repository/ai/djl/huggingface/tokenizers/0.34.0/tokenizers-0.34.0.jar!/native/lib/tokenizers.properties -2025-10-16 19:19:35 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Using cache dir: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 -2025-10-16 19:19:35 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading huggingface library from: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 -2025-10-16 19:19:35 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading native library: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64/libtokenizers.so -2025-10-16 19:19:35 [main] WARN a.d.h.t.HuggingFaceTokenizer - maxLength is not explicitly specified, use modelMaxLength: 512 -2025-10-16 19:28:19 [main] INFO ai.djl.util.Platform - Found matching platform from: jar:file:/home/slhaf/.m2/repository/ai/djl/huggingface/tokenizers/0.34.0/tokenizers-0.34.0.jar!/native/lib/tokenizers.properties -2025-10-16 19:28:19 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Using cache dir: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 -2025-10-16 19:28:19 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading huggingface library from: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 -2025-10-16 19:28:19 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading native library: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64/libtokenizers.so -2025-10-16 19:28:19 [main] WARN a.d.h.t.HuggingFaceTokenizer - maxLength is not explicitly specified, use modelMaxLength: 512 -2025-10-16 19:28:19 [main] INFO experimental.OnnxTest - [0.51123345, 0.43754324, 0.22250144, -0.49621642, -0.59625536, -0.24450612, 0.5863322, 0.46978277, 0.5778739, 0.6761688, -0.0854191, 0.36117497, -0.24092007, -0.19524571, -0.7976704, -0.044580948, -0.53635055, -0.11370213, -1.1403378, 0.2129236, -0.34120926, 0.001864681, -1.3665671, -0.22030343, -0.830733, 0.099989876, 0.4966247, -0.066141784, 0.41148925, 0.729914, -0.29459542, 0.29208705, -0.3367949, -1.0972055, -0.024628287, -0.6583721, 1.253141, -0.61462474, -0.518246, -0.53295904, 0.12913027, 0.04108283, 0.55130756, -0.8039789, -1.2061563, -0.34272343, 0.27257943, -0.13096467, 0.18428354, 0.2605311, 0.057498857, 0.7461083, 0.1835212, 0.021440782, -0.20071763, 0.04362084, -1.3614484, -0.1095237, -1.0870106, 0.40957803, 0.7201999, 0.98604536, 0.39732328, -1.3224756, 0.40671548, 0.406975, 0.50348455, 0.22034347, 0.5530567, 0.25672144, -0.6594347, 0.96159023, 0.07775575, -0.7792945, -1.0163779, 0.36998796, 0.5171132, 0.79771215, -0.5552498, 0.80050594, 0.14805704, 0.2997373, 0.26703542, 0.08637628, -1.4002664, -0.813782, 0.25788978, 0.5414073, -0.46593362, -0.027594358, 0.29689378, 0.65353656, -0.31033817, 0.08076967, 0.76214606, 0.8415609, -0.3084258, -0.32594687, -0.72558767, -0.3289697, 1.0932022, 0.87115157, -0.89196694, -0.18925445, -0.9785898, -0.2336246, -0.9026102, 0.088704094, -0.7258216, -0.6594782, 0.09606822, 1.0850618, 0.0013394654, 0.38363743, -0.3874976, 0.20100841, -0.4128504, 0.74124134, -0.6654147, -0.5718573, 0.27072686, -0.046442233, -0.2115764, -0.7070531, -0.9749727, -0.4404279, -1.3043284, 0.93771523, 0.30211914, -0.59651214, 0.12527934, 0.089207426, 0.51316845, 0.8074455, -0.5485792, 0.07305289, 0.10457601, 0.24046482, 0.5214334, -1.1262523, 0.16574118, 0.01661903, -0.72924286, 1.7897038, 0.7391656, 0.26545036, -0.24889244, 0.019522466, -0.38037547, 0.9288784, -0.90373176, -0.2429637, 0.13991763, 0.4122005, -0.6420515, -0.045609288, -0.055985063, 0.121364415, 0.28139967, -0.0052891895, -0.106420964, 0.56713265, -0.46813145, 0.19711205, -0.58464926, 0.3698026, -0.2838148, 0.12638272, 0.01481974, -0.2993888, 0.14940853, -0.4162319, -0.045515813, -0.07729791, 0.47421545, 0.46603337, 0.62959045, 0.1828863, 0.2002228, 0.07522717, -0.50393486, 0.37032261, -0.35638678, 0.8902856, -0.033868957, 0.100021124, 0.43048963, 0.3153236, -0.6283139, -0.24138638, 0.81751156, 0.2257601, -1.2130985, 0.44707552, 0.0037308559, 0.5666142, -0.8444263, 1.204924, -0.65543765, -1.9701289, -0.8207577, 0.08641613, -0.4112931, -0.20802015, 0.87505317, -0.13793634, 0.07145847, 0.31840786, -0.092020944, -0.80500084, 0.58076894, 0.117715076, -0.67379886, 0.45848575, 0.4390001, -0.7055742, -0.712911, 0.33785975, 0.42191327, 0.121282555, 0.13419384, 0.17775199, 0.5506595, 0.67962146, 0.4780363, -0.03222577, -0.8667363, 0.8303137, -0.541459, 0.062450707, 0.03477095, 0.49735057, -0.3892, 0.8767689, -0.06756614, 0.35541242, 0.94193155, 0.8131012, 0.58299375, 0.1854296, -0.60147816, 0.4282838, 0.5299751, 0.7330451, -0.3257398, -0.58661395, 0.5521986, -0.606695, 0.44539154, 0.41345364, -0.023682468, 1.0244411, 0.8901564, -0.025144015, -0.6341725, -0.4240578, 0.31344998, 1.0556707, -0.7415066, -0.32343262, 0.1841922, 0.36124998, 0.5530684, 0.29907, -0.02951768, 0.19808297, 0.08838599, 0.05037989, -0.049141884, -1.1747736, 0.03532947, 0.07290274, -0.7062243, -0.027512219, -0.5645471, -0.034089435, 0.4769841, -0.5791185, -0.062474817, -0.5574461, -0.07675014, -0.58530134, 0.5648111, 0.7009718, 0.19080682, -0.37462634, -0.38008162, -0.8266342, -0.56594104, 0.6085925, -0.8169755, 0.2305794, 0.022104293, -0.32453218, 0.029340252, 0.12966694, -0.35197243, 1.0937076, -0.08106287, -0.630723, -0.07665277, 0.09807674, -0.15652439, -0.032777905, -0.59978753, 0.7365465, 0.8591844, -0.16815796, 0.8361499, 0.27674484, -0.3099411, 0.60480386, 0.23437774, -0.7338224, -0.9829839, 0.67439365, 0.742201, 0.42505273, -0.68957865, -0.47552192, -0.5682225, -0.5110189, -0.28437212, -0.565194, -0.19356139, 0.63973606, -0.014390081, -1.646161, 0.2918704, -0.4594489, -0.8228203, -0.16133638, 0.07148346, 0.9419251, -0.019150853, -0.4403408, -0.56392926, 0.12463045, 0.24700657, -0.19791731, 0.6058087, -0.5370069, -0.051276788, 0.9354616, -0.055462413, 0.050041005, -0.6077635, -0.68125796, -0.13532986, 0.36517376, -0.019653555, -0.03586552, -0.1600579, 0.67996794, -0.25741813, 0.9547673, -0.910809, -0.009982694, 0.7332152, -0.20394151, -0.09925252, 0.5988749, 0.10125684, -0.2892084, 0.09639569, -0.9270706, -0.14898436, 0.23913115, 0.7453801, -1.0168681, 0.80838275, -0.27111107, -0.14699328, -0.68104225, 0.19166322, -0.79916215, 0.43923154, 0.16553934, 0.33551145, -0.5704513, -0.070023894, -0.3918103, -0.17701462, 1.6619401, 0.674843, 0.23895527, 0.80687135, -0.01851894, -0.34060583, -0.58362544, -0.96381485, -0.19843449, 1.6370385, -0.44541967, -0.13564552, -1.7383175, 0.94101083, 0.4386875, 0.8844557, 0.7002662, -0.72894764, -0.6103935, -0.32648364, 0.054746274, -0.6872155, 0.18739484, -1.0520368, 0.6648933, -0.2648567, -0.06654116, -1.3043286, 0.22864798, -0.10361338, 0.594177, 0.5787685, 0.1750473, -0.0105097145, 0.91527426, 0.25346497, -0.27341178, -1.1472199, -0.31140554, -0.49403697, -0.13216135, 0.7429359, -0.57663065, -0.5814875, -0.46789917, 0.62059444, 1.0459176, 0.105841815, -0.8354111, -0.09153462, -0.4892223, -0.9736461, 0.03827665, 0.6993418, -0.5639835, 0.3098794, -0.8142145, 0.047523424, -0.21321937, -0.034833632, -0.010952409, -0.041929975, -0.28044957, 0.060209088, 0.50224316, -0.046635136, -0.85428065, 0.73049414, -1.4654225, 0.11870827, -0.66137636, 0.27924734, -0.7339802, -0.42894232, 0.17209588, 1.1703713, -0.1511008, -0.27938917, -0.13280374, 0.86497086, -0.4407706, -0.3784376, 1.2453586, -0.21126446, -0.15996158, 0.48933926, -0.27048388, -0.2984165, 0.7081715, 0.58110875, -0.06946933, -0.27087092, -0.23854852, 0.36320952, 0.3962092, 0.11321919, 0.10443739, -0.56340504, 0.49124345, 0.6088691, -0.70054543, -0.09448326, -1.4692224, 0.24175254, -0.18142638, 0.3656459, 0.3561722, 0.39745298, 0.35550624, -0.25403917, -0.8084114, -0.3391734, -0.14518976, -0.31460696, -0.8502122, -0.20892489, 0.040290922, 0.36273193, -0.76562995, -0.80031925, 0.060696647, -0.15262939, -0.061190173, -0.09423466, 0.6150074, -0.5358167, 0.3251421, 0.28123394, 0.7587028, -0.4789124, -0.10876167, -0.18576714, 0.49481302, -0.09939133, 0.20352225, -0.5852573, 0.6395335, -0.3011577, -0.8522485, -0.31254715, 0.5950347, -0.26513442, 0.70972127, 0.43091288, -0.041825093, -0.2292053, -0.6451991, -0.34200215, -0.41545817, -0.2689111, -0.9946734, -0.25178003, 0.6669945, 0.17163065, -0.15006264, -0.9421287, -0.019158833, -0.6975499, 0.438868, -0.6849216, 0.03262051, -0.44509438, 0.64882565, -0.5953382, 1.1495787, -0.8011461, 0.20847918, 0.1251037, 0.32168102, -0.21917565, 1.0629005, -0.92278206, -0.37890035, 0.4195118, -0.21815889, 0.2514746, 0.6282729, -0.14128427, 0.050928507, -0.35163182, -0.06737878, -0.9663225, -0.4687798, -0.59459, 0.21002933, 0.048163563, 0.48905462, 0.14316124, 0.028260775, 1.2529061, 0.14390653, -0.21695222, -0.7194682, -0.66993797, -0.70739895, -0.5410352, 0.8340246, -0.2935943, -0.23657572, -0.4150082, 0.20044121, 0.6332451, -0.4892323, -0.016682208, 1.8937812, 0.7091852, 0.14414868, -0.9804469, 1.2162073, 0.17216161, -0.50498605, -0.34003568, 0.16963801, -0.33994526, 0.0731189, -0.41613013, -0.94484633, -0.815923, -0.5739614, 0.94484705, 0.31987455, 0.14467219, -0.14761059, -0.7047535, -1.0639687, 0.40880874, 1.3001518, -0.23591296, 1.0019474, 0.69951487, 0.33188945, 1.2750803, -0.47983044, 0.033220377, 0.12004468, 0.9492074, 0.9103111, -0.052080557, 0.58394325, 0.8401497, -1.830512, -1.4265813, -0.17748688, -0.061487965, -0.1359964, -0.88339686, -0.37029758, -0.13061845, -0.2954845, 0.2814227, 0.25465572, -0.19771555, 0.09913704, -0.15107808, 0.011260349, -0.14225599, -0.11415321, 1.0593241, -0.7078028, 0.5747197, -0.4055798, -0.18129641, -0.47820956, 0.1952592, 0.22990699, 0.5002197, 0.10373032, 0.628042, 0.06865163, 1.0157357, -0.6903584, -0.15411828, 0.6126792, -1.4284332, -1.3705213, -0.07465902, -0.11910443, -0.13134138, 0.41676903, -0.21215296, -0.028965306, 0.3505228, 0.047843248, 0.30888152, -1.1421498, -0.08647778, -1.1076055, -0.78975534, -0.05059923, 0.058172554, 0.27877957, 0.3418617, 0.27528864, -0.0043393373, -0.425253, 0.21216352, 0.02201505, 0.46995455, -0.35277224, 1.1497868, -0.7000632, -0.49699458, -0.36768207, -0.08427355, -0.106513396, -0.15144402, -0.6940467, -0.6297557, 0.4525672, 1.2141936, -0.12161607, 0.24308786, -0.1425119, -0.38016897, 0.91598785, -0.41090524, 0.14860485, 0.28929144, 0.21543092, -0.84538454, 0.0807224, -0.2773164, 0.5301908, -0.7331233, 0.49941978, 0.5512182, -0.5476493, -0.18183059, -0.77233905, -0.15702356, -1.1651708, -0.21300837, 0.018835044, 0.32697025, 0.34967226, 0.51722765, 0.09109617, 0.61710453, 0.062239163, 0.056631085, 0.06611446, 0.46277747, 0.13079983, 0.08349137, -0.17646214, 0.26698142, 0.046738572, 0.6847735, 0.38814327, 0.014033079, -0.04680039, 0.292931, -0.8164349, 0.3852389, 0.19666976, 0.37969127, -0.23450008, 0.45247716, 0.4581556, -0.9366612, 0.5417323, -0.055298187, -0.6215795, 1.218463, -1.3511043, -0.7937524, 0.008464169, -0.9959098, 0.7161945, -0.25348237, -0.68490624, 0.39310396, 0.3586596, -0.7416965, -0.18592128, 0.30235815, 0.63015443, -0.33157557, -0.89634436, -0.5073603, 0.27419057, 0.112835586, 0.471214, -0.9042775, -0.41822886, 0.71185523, 0.6571464, 0.33782732, 0.15355957, -0.1364721, -1.0384371, 0.64586115, 0.5162391, 0.52103496, -1.1132919, 0.1564614, -0.35837764, 0.7777977, -0.5688318, -0.19020915, 0.12580645, 0.23848471, 0.050079808, 1.4870666, 0.74930036, 0.11167382, 0.51369834, 0.0912603, 0.03457948, 0.97924113, -0.2526727, -0.6790167, 1.0118998, 0.17009932, 0.59963554, 0.38631436, 0.5874571, 0.35385707, -0.49165446, -0.43353337, 0.29959297, 0.90330774, 0.008084901, 0.19826728, 0.035730332, -0.26280853, 0.49997848, -0.3445545, 0.25782338, -0.29269776, -0.7271916, -1.1451478, -0.3687011, 1.2749437, 0.28989944, -0.010594554, 0.20570764, -0.039815754, 0.7760036, 0.83210295, -0.37314057, 0.34827492, 0.33832714, 0.2549089, 0.3180246, 0.15750375, 0.37374565, 0.29076517, -1.084236, -0.2536879, 0.09893724, 0.167326, -0.42620236, -0.06183477, -0.85039747, 0.7655713, 0.5407811, 0.135566, 0.61822957, -0.658225, 0.060597345, -1.0510322, 0.29207668, -0.40406957, -0.06383139, 0.8471315, -0.3460373, 0.0568925, 0.42080507, 0.50762975, 0.29434744, -0.07577321, 0.5478096, 0.31866163, 0.77027106, 0.5869493, -0.4031725, 0.34900978, 0.03501825, -0.60266703, -0.12610222, 0.48031133, -0.843012, 0.4924527, -0.8623877, -0.6477808, 0.22316428, 0.52191186, -0.42713517, -0.4163384, 0.02406159, 0.19311489, -0.8280169, 0.7257932, 0.5891742, 0.6126962, -0.107232764, -0.07629745, -0.50356364, 0.6316943, 0.1606891, -0.70639515, -0.12811224, -0.4105088, -0.08755256, -0.40668, -0.5366433, -0.30879006, 0.10060625, 0.28111058, -0.71532774, -0.3630196, 0.59962934, 0.15385062, 0.36727977, -0.45993006, 0.22452451, -0.23574719, 1.6684455, -0.043385856, 1.6276766, -0.16736466, -0.12352954, 1.0252162, -0.27102458, 0.59440255, 0.26338896, -0.2930035, -0.61721444, 0.6569015, -0.34776017, -0.38311705, -0.4351132, 0.751855, -0.44927332, 0.28445652, -1.4778186, -0.5496483, -0.834149, -1.1146356, -0.8802563, 1.0398924, -0.14450291, -0.022082053, -0.009103067, -0.8312893, 3.564548, 0.31639445, 0.43401474, 0.63638914, 0.048858773, -0.24585214, 0.42760444, -0.627559, 0.36051834, -0.75384, 0.3967399, 0.078143656, 0.12599553, 0.86665404, 0.050567865, 0.92432106, -1.5632179, 0.19709128, 0.12208514, -0.078961484, -0.91890043, 0.23671533, 0.47289363, 0.19900943, 0.7240069, 0.16399404, 1.1182141, -1.0169126, -0.1350502, -0.46091932, 1.2807544, 0.35965964, 0.21481083, -0.3007364, -0.39301196, 0.9101389, 0.1932972, 0.15104347, 0.14832743, 0.27131686, -0.067170985, -0.6418764, 0.50354594, 0.25878644, -0.0033070669, 0.70426977, -0.6287618, 0.31597823, 0.45087764, -0.04529953, 0.8379618, -0.3591785, 0.56057227, -0.5669976, -0.84720474, -0.052068297, -0.16401154, 0.30864736, -0.8251212, 0.22997884, -0.28843462, 0.20421404, -0.10270865, 0.12777951, -0.34080166, 0.28729475, 0.63097245, 0.62922233, -0.23039082, -0.9737556, -0.37730604, 0.021021312, -0.18025522, -1.0727465, 0.0019658804, 1.0562756, -1.0607209, 0.55097324, -0.095470026, -0.16923568, 0.29799882, 0.13360816, -0.015510071, -0.3002998, 0.29892552, 0.5038376, 0.07581481, -0.25795814, -0.26878086, -0.018943973, 1.1134932, 0.84816736, 0.07172927, -0.119864315, 0.16197601, 0.55967194, -0.1490119, 0.35443506, -0.12817872, -0.7264169, 0.35164982, 0.5088061, 0.36944637, 0.75947386, 0.22153465, -0.0902444, 0.35916293, -0.22257099, -0.6245021, -0.66597265, -0.2242328, -0.47101194, -0.09299229, -1.0377257, -0.21733049, -0.32486138, -0.23556301, -0.9277732, 0.023987524, -0.5385696, -0.002912309, 0.6834146, 0.06879748, 0.26568368, 1.1300062, -0.17972237, 0.1250636, -0.06957579, -0.9457501, -0.10762876, -0.7763465, 1.5165349, -0.51138073, -0.53803205, -0.7513938, -0.16054633, -0.057135716, 0.56398803, -0.7251428, -0.9011231, -1.1330264, -0.009565931, -0.46391025, -0.3945485, -0.019825712, -0.214825, 0.662374, 0.4089401, -0.25013703, -0.11175172, -0.3359659, -0.73787993, -0.44064045, -0.95422965, 0.24658713, 0.5482323, 0.44154587, 0.15066868, -0.90368706, 0.16147381, 0.23279902, 0.41150323, -0.14870353, 0.4448821, 0.3361582, -0.5416869, 0.66956925, 9.3244016E-4, -0.58035725, -0.9133776, -0.21026349, 0.47709528, 0.559402, -0.096517116, 0.34964085, 0.021026324, -0.052352354, 0.2260392, 0.083108045, -0.82103014, -0.49560097, 0.13991357, 0.72335935, -0.22744378, -0.17416112, -0.06924981, 0.1720519, -0.056980915, -0.0040308535, 0.4777559, 0.34662804, -0.6132766, -0.1805803, -0.58219105, -0.5035861, 0.743928, 0.62252325, -0.43229088, 0.42164406, -0.7834892, 0.19773507, -0.68034565, 0.15410969, -0.46971694, -0.5955516, 0.23321742, 0.61164176, -0.10516539, 0.581982, -0.7406695, 0.31757313, -0.69854766, 0.9880034, -0.84722793, -0.7633326, 0.4578721, 0.10518447, 0.16203061, -0.6790652, -0.47155732, -0.38882074, -0.9170391, 1.0266749, -0.17550212, -0.4792506, -0.0668991, 0.39064267, 0.0947658, 0.8043089, -0.22434905, -0.313821, 0.052670494, -0.048851267, 0.32592362, -0.860603, 0.2698992, 0.3433336, -0.21785763, 1.5819844, 0.88469046, 0.07691138, 0.09752565, -0.42556408, -0.04519853, 0.87291956, -0.6176682, -0.2865502, 0.20136131, 0.36512914, -0.3311012, -0.30614272, -0.26107365, 0.1894452, 0.32637066, 0.35523584, -0.06667226, 0.10347664, -0.11940256, -0.10296476, -0.38421103, 0.6074242, 0.18352178, 0.015820663, -0.14712866, -0.20719282, 0.6038181, -0.15472703, -0.039784297, 0.059039198, 0.4398168, 0.68517715, 0.592921, -0.48001018, 0.29964036, 0.059656337, -0.36691985, -0.11802984, -0.16027823, 0.8514473, 0.061800294, -0.24240336, -0.00616711, -0.2318474, -0.27456677, -0.20014185, 0.39548382, 0.08403352, -0.6075959, 0.7013164, -0.24715367, 0.7730584, -0.5263237, 0.6818461, -0.4345966, -1.9885256, -0.57651246, 0.3897464, -0.22896479, 0.029132985, 0.62822366, -0.3221436, -0.24454945, -0.13972506, 0.07538301, -0.43282226, 0.29167226, 0.26169014, -0.22840403, 0.12716646, 0.5241455, -0.67354554, -0.23412356, 0.1583346, 0.09397203, -0.6005605, -0.062070902, 0.519738, 0.56230676, 0.19490737, 0.09140409, 0.2827071, -0.7554103, 0.9776802, -0.28762445, -0.16992666, -0.27326876, 0.5205804, -0.39026648, 0.8100204, 0.2251311, 0.3743077, 0.41226578, 0.28279757, 0.10248689, 0.78833973, -0.39051318, -0.035605595, 0.6300383, 0.67743725, -0.18472652, -0.3580135, 0.14300483, -0.36656314, 0.09548992, 0.6840508, 0.53377825, 1.0797411, 1.0701865, -0.14112248, -0.1359908, -0.52505445, 0.2282274, 0.8130599, 0.10876868, -0.5497892, -0.06409781, -0.12850465, -0.08437914, -0.348632, -0.55334604, -0.057698317, -0.020369263, 0.0053720847, 0.16307293, -0.8254809, -0.10885659, -0.54735035, -0.9688062, -0.2985726, -0.051860273, -0.13334262, 0.35509858, -0.8054574, -0.28351018, -0.68802255, 0.17037089, -0.7018103, 0.8101351, 0.96281683, -0.053284153, -0.42187208, -0.41856027, -0.7051473, -0.43084157, 0.46245623, -0.6828755, 0.13075721, -0.12911314, -0.28247756, 0.683695, 0.07331526, 0.008655533, 1.0331321, 0.41872248, -0.43458146, 0.11952154, 0.4864054, -0.4770374, -0.672267, -0.7951411, 0.90124786, 0.38761422, -0.06815794, 0.4979946, 0.3519773, -0.51443356, 0.47134402, 0.32008561, -0.52492595, -0.5968779, 0.91214985, 0.62872326, 0.25207788, -0.78720355, -0.65435094, -0.3022893, -0.026059672, 0.03250689, -0.4841232, -0.21127056, 0.94293606, -0.31384826, -1.024962, 0.4258807, -0.5591192, -0.85103065, 0.07572705, -0.029542465, 0.9386782, -0.01834616, -0.41138232, -0.41427138, 0.080845095, -0.021675527, -0.25335732, 0.85154873, -0.83299226, 0.010143421, 0.7232927, 0.60553235, 0.1309088, -0.3839781, -0.5941144, -0.45264992, 0.38672507, 0.21139218, 0.34125578, -0.30670395, 0.5510206, 0.19656421, 0.7967939, -0.61074483, 0.032774314, 0.4495337, -0.4416033, 0.04436638, 0.19213377, 0.25077653, -0.1421333, -0.07981576, -0.80517834, -0.44514215, 0.12253037, 0.5937313, -0.7326427, 0.7710463, -0.47982028, -0.026294831, -0.27366686, 0.59971505, -0.88799405, 0.34242895, 0.011235021, 0.68797493, -0.31184798, -0.2491819, -0.39411223, -0.37572742, 1.597634, 0.5555229, 0.53293955, 0.85264903, -0.014117359, -0.04914263, -0.32758757, -0.42537898, 0.016268618, 1.7822325, 0.014657244, -0.33223224, -1.4506384, 0.8279289, 0.63178736, 0.70278394, 0.16083482, -0.11632228, -0.42550898, 0.2825111, 0.050327733, -0.62059164, 0.24553949, -0.84764546, 0.5793387, -0.19014005, 0.18559122, -0.60808384, -0.22480549, -0.10949272, 0.4119357, 0.48874575, 0.10797066, 0.14826402, 0.95159596, 0.1007035, -0.28172037, -0.78677756, -0.2911378, -0.39184836, 0.18129729, 0.14663315, -0.6903422, -0.6197286, -0.22756599, 0.4553, 0.7559648, -0.19024116, -0.7333675, -0.22558317, -0.10755519, -0.8364387, -0.24587573, 0.61560297, -0.116256624, 0.09515799, -0.61133057, -0.60270244, 0.11373564, -0.478234, 0.054566797, 0.21379222, -0.20055366, 0.4200289, 0.38137415, 0.57250637, -0.8365286, 0.46541566, -1.5011121, 0.007360235, -0.7604555, 0.0025998056, -0.5833547, -0.07466688, 0.39678958, 0.96836436, -0.2345093, -0.18433093, 0.3012629, 0.2799663, -0.70134974, -0.48911846, 0.7690916, -0.06511322, -0.49618146, 0.3662134, -0.6264914, -0.22856562, 0.24773872, 0.3183567, 0.13739681, 0.07009312, 0.23409715, 0.34881467, -0.33139125, 0.28852808, -0.095444344, -0.51926076, 0.51465845, 0.2062692, -0.5242261, -0.46329415, -0.9741153, 0.06456158, 0.030457906, 0.14805505, 0.17728561, 0.27969873, 0.4174524, -0.53553534, -0.050896656, -0.7748257, 0.07999295, -0.064726844, -0.6482009, -0.16539901, 0.52794135, 0.2680578, -0.54837555, -0.846483, -0.1018344, 0.2759287, 0.01647371, -0.30559725, 0.77830505, -0.42698085, 0.22914001, 0.29629123, 0.9014104, -0.6857988, -0.02880317, -0.27855328, 0.5116826, -0.09280562, -0.026375346, -0.82933587, 0.29830056, 0.10016385, -0.9599105, 0.06670639, 0.32166743, -0.12561196, 1.15202, 0.17707397, -0.08005495, -0.039337177, -0.2968356, -0.12169429, -0.36883074, 0.2049313, -0.6679535, 0.031608433, 0.52695143, 0.007821337, -0.1485552, -0.62809414, 0.13040474, -0.15451281, 0.54773754, -0.4706813, 0.24263154, -0.1301415, 0.67641205, -0.62720996, 0.8313544, -0.7381075, -0.14358105, 0.3762475, 0.62239164, -0.045437563, 0.9459873, -0.8233303, -0.7147683, 0.46758357, -0.52135533, 0.06063361, 0.56855184, -0.507306, -0.036665827, -0.6302179, 0.07766994, -0.942735, -0.5909925, -0.2635432, 0.5478883, -0.07890162, 0.32488316, 0.26487243, 0.46853012, 1.1034807, -0.06512659, 0.33847657, -0.61609834, 0.06321365, -0.22743702, -0.87944865, 0.37845594, -0.020726902, -0.59833187, -0.42895967, -0.11077006, 1.0032699, -0.1725022, 0.32639518, 1.6419518, 0.21870343, 0.1484011, -0.7495263, 0.5773338, 0.1948407, -0.26478645, 0.31931522, -0.02530934, -0.18381046, 0.039240766, -0.3821348, -0.880036, -0.40542898, -0.5050127, 1.0508015, 0.6978597, 0.27783167, 0.43318307, -0.686163, -0.95909375, 0.39126918, 0.736118, 0.010625005, 0.4478026, 0.5347271, -0.28854454, 0.7788674, -0.65132344, 0.028316252, -0.24979532, 0.3684371, 0.8357179, -0.35869396, 0.24370271, 0.33024335, -1.4370449, -1.2778331, 0.19882585, -0.017336432, -0.4316948, -1.2735684, -0.26503587, -0.015060261, -0.6085152, 0.22704697, 0.26457584, -0.42646304, 0.03879311, -0.19615118, 0.44677356, -0.32433823, -0.084605284, 1.198679, -0.51367915, 0.36138633, -0.26781407, -0.25285503, 0.10098021, -0.24817827, -0.18135414, -0.17848538, 0.35427713, 0.521286, -0.02674108, 0.4217017, -0.08987662, 0.25608358, 0.50207585, -0.98633564, -1.0628304, -0.3846806, 0.022207262, -0.1283618, 0.37523708, -0.24025467, 0.5153696, 0.46323073, 0.13989824, 0.1561494, -0.77944976, -0.44046345, -0.63301426, -0.34989792, 0.13549271, 0.006190121, 0.24559984, 0.31742877, 0.1545193, -0.44265345, -0.08644013, 0.28001422, 0.15021466, 0.85503155, -0.76575583, 0.86318636, -0.55829847, -0.25753778, -0.7185067, -0.085994214, -0.18091784, 0.446105, -0.77112305, -0.4430915, 0.2551184, 1.1472955, -0.40047967, 0.35478163, -0.4045759, -0.48856065, 0.7408055, -0.13986495, 0.09953445, 0.2774477, 0.2467106, -0.42283788, 0.21039721, 0.10461013, 0.31418386, -0.6786972, 0.964533, 0.6333979, -0.42829648, -0.2897507, -0.9437793, 0.067182526, -0.99148446, -0.31607157, -0.5791597, 0.04460093, 0.2817655, 0.21890405, -0.0091788955, 0.614969, 0.21509607, 0.26194388, -0.028229192, 0.6323737, 0.3229837, -5.941242E-4, 0.1451681, 0.3452308, 0.26828063, 0.82891965, 0.6615142, 0.15845887, -0.1930975, 0.32330292, -0.49461275, 0.33965734, 0.5015075, 0.22370936, -0.038758203, 0.33031383, 0.64308834, -0.22973657, 0.40101275, 0.1735294, -0.62445706, 0.63983095, -1.0835669, -0.59931755, -0.25685513, -1.0129862, 0.148363, -0.3387562, -0.7876695, 0.36497584, 0.4875883, -0.46318775, -0.30246222, 0.24639976, 0.3614344, -0.4353444, -0.7491151, 0.03876262, 0.014877375, 0.5000705, 0.48863775, -0.5708522, -0.29530814, 0.39000627, 0.18866692, 0.13831648, -0.38619447, -0.5484635, -1.1455809, 0.14575654, 0.41666955, 0.17747879, -0.8406549, 0.13223548, -0.45904288, 1.1353003, -0.26693252, -0.12810816, 0.37510347, -0.29213232, -0.43941584, 0.9184803, 0.6855956, 0.2599459, 0.6948795, -0.0708392, -0.12901774, 0.55323, -0.5387498, -0.716477, 0.42386472, 0.12503567, 0.6216118, 0.10394464, 0.8343109, 0.65234077, -0.41163832, -0.39263293, -0.108594045, 0.4115751, 0.16237709, 0.28965876, -0.07473482, -0.23911166, 0.2871039, -0.6131977, 0.513528, -0.11655871, -0.6466727, -1.1273916, -0.19115873, 1.4469596, -0.020101145, -0.11192806, 0.01993516, 0.26601622, 1.1657052, 1.008147, -0.6360585, 0.12956598, 0.9011077, 0.26741764, 0.13538633, -0.082566485, 0.21531783, 0.26441088, -1.1124214, -0.27627683, 0.34551474, 0.15321879, -0.21587288, -0.29057226, -0.5665258, 1.2804754, 0.5072227, 0.2061311, 0.39224344, -0.48967192, 0.2075164, -1.2929554, 0.22832677, -1.1763334, 0.05883432, 0.5320689, -0.19186282, -0.067902, 0.5984157, 0.33769348, 0.24878782, 0.11002658, 0.33792466, 0.547646, 0.7538705, 0.59686947, -0.19582872, 0.39902282, -0.3311249, -0.74637324, -0.14266883, 0.43165115, -0.6139184, 0.29811418, -0.7535113, -0.30266273, 0.53370935, 0.36760342, -0.5749821, -0.68662786, -0.2779321, 0.37260574, -1.1336465, 0.6302474, 0.47815326, 0.9866135, -0.14947067, -0.033082485, -0.2046695, 0.20482336, -0.21032988, -0.52653766, 0.0245497, -0.47625363, -0.12423223, -0.12356821, -0.32638925, -0.0979994, 0.0010491088, 0.29562947, -0.6457077, -0.10971795, 0.06126561, 0.8076332, 0.2573005, -0.21695858, 0.46280462, -0.5214897, 1.3339914, 0.23493724, 1.6153331, 0.18739215, -0.35449666, 0.6756968, -0.35441598, 0.49293745, -0.08351409, -0.24639843, -0.57777464, 0.98248875, 0.0011553783, -0.68022805, -0.1735664, 0.5991789, -0.5056995, 0.28030026, -1.3956647, -0.29886672, -1.040315, -0.6200091, -0.55999726, 0.4394985, 0.25020325, -0.030757431, 0.41339186, -0.99428976, 4.134183, 0.21829394, 0.2768517, 0.24642767, 0.027245255, 0.22640549, 0.47818106, -0.79617405, 0.4751648, -0.4929724, 0.5096883, 0.14533526, 0.087542474, 0.42481625, -0.26212215, 0.94900197, -0.995192, 0.37323165, 0.48663512, 0.16938138, -0.9202455, 0.32618392, 0.3355089, -0.12735334, 0.39952835, -0.4738593, 0.17960149, -0.8438873, -0.15847224, -0.28993642, 1.529727, -0.06471403, 0.040852357, 0.038847372, -0.25056893, 1.0816733, -0.30027992, 0.33796108, 0.057108454, 0.27828, -0.07463636, -0.7907264, 0.89314646, 0.11971448, -0.2797623, 0.56961, -0.5983841, 0.07197225, 0.6231197, -0.16240701, 0.8118333, -0.10884293, 0.36955264, -0.30067077, -0.54466736, 0.23035151, -0.11903405, 0.15843613, -0.9551723, -0.008313894, -0.09104793, -0.34124452, 0.019560076, 0.22333694, -0.46288738, -0.06519584, 0.8732297, 0.4417033, -0.3591715, -0.79684395, -0.18898311, -0.00398656, -0.32608062, -0.624982, -0.43221474, 0.7961611, -1.0244153, 0.6864666, -0.38873324, -0.66227776, 0.18808874, -0.2118657, 0.12453443, -0.20756744, 0.2250452, 0.5361353, -0.38134813, -0.12358688, -0.50916564, 0.06882605, 0.5491102, 0.6088567, 0.043271434, 0.034038477, -0.14568043, 0.34731272, 0.27437162, 0.4291449, -0.5072562, -0.6460547, -0.17843097, 0.4998613, 0.4862506, 0.48174888, 0.43009067, -0.07885784, 0.25953156, -0.44193333, -0.2746965, -0.72802746, -0.24735373, -0.46056688, -0.08113882, -1.2671432, 0.05059053, -0.43514493, 0.09988372, -1.3890023, -0.5439976, -0.5726784, 0.042483523, 0.45590004, -0.12616622, 0.629282, 0.96405625, -0.42434147, 0.29803038, -0.16519342, -0.9395849, -0.230326, -0.83917814, 1.4581625, -0.57237923, -0.5016961, -0.5101177, 0.03989938, -0.16089517, 0.91115934, -0.69840354, -1.4957484, -0.25355923, 0.24498278, -0.03987664, 0.28695616, 0.33610544, 0.42031482, 0.26267177, 0.26665464, -0.036663882, -0.3205201, 0.08044999, -1.3707422, -0.10242602, -1.2773657, 0.44744903, 0.4707493, 1.1146326, 0.52519447, -1.0453299, 0.22108254, 0.3916083, 0.51568663, 0.2354028, 0.50902164, 0.15007426, -0.6983879, 1.0460291, 0.11031413, -0.68165857, -0.867732, 0.08759557, 0.32828143, 0.90392447, -0.74337864, 0.6990192, 0.12273654, 0.1353184, 0.41217592, 0.24795906, -1.3185968, -0.7651147, 0.103916384, 0.6086596, -0.29084563, 0.022982366, 0.28086853, 0.55208766, -0.31949097, -0.01541844, 0.81749123, 0.83401155, -0.14799729, -0.33081663, -0.8713344, -0.20599653, 1.2038018, 0.81881714, -0.62137777, -0.08521465, -0.9437865, -0.19047725, -0.9235109, 0.07554969, -0.54554856, -0.72309697, 0.10257645, 1.2262453, 0.11698446, 0.5399791, -0.6098297, 0.077516764, -0.1635267, 0.7329004, -0.6491352, -0.43532693, 0.13268438, -0.062738866, -0.037672497, -0.6150539, -0.792422, -0.32316244, -1.1831503, 0.8048623, 0.43596715, -0.80266297, 0.20404984, 0.040005, 0.51196873, 0.61864376, -0.3671871, 0.039022297, 0.08777553, 0.34561458, 0.48366174, -1.1842922, 0.108419, 0.09672105, -0.4544338, 1.6715314, 0.8024864, 0.38295293, 0.11245011, -0.13004047, -0.25588313, 0.9442645, -1.106852, -0.3146361, 0.17383303, 0.26125604, -0.836142, -0.2676666, 0.09179972, -0.11250311, 0.35692418, -0.074471295, -0.117300734, 0.47520566, -0.5543069, 0.32387045, -0.66126156, 0.395984, -0.23777974, 0.31760883, -6.269303E-5, -0.42587698, 0.3092674, -0.26971295, 0.12728855, -0.09048116, 0.3214799, 0.6557833, 0.40655518, -0.043354645, 0.23725055, 0.05158411, -0.5487681, 0.47276476, -0.42214486, 0.96318287, 0.101917736, 0.04613815, 0.37172058, 0.35901445, -0.55353534, -0.28215954, 0.646838, 0.055748854, -0.94629276, 0.52053577, -0.096165426, 0.68151516, -0.86083305, 1.2210809, -0.61603034, -1.8547043, -0.70553493, 0.08560893, -0.32475078, -0.07537295, 0.9242262, -0.3031748, -0.039215017, 0.48975095, 0.07386944, -0.635114, 0.5792452, 0.11396569, -0.79614615, 0.47500247, 0.22382374, -0.7640738, -0.7832393, 0.32251167, 0.2957459, 0.19379763, 0.1966333, 0.19957598, 0.47575438, 0.72345144, 0.2891014, -0.07611428, -0.7970295, 0.68839777, -0.65931904, 0.18129885, -0.1070019, 0.4440913, -0.3229485, 0.87062204, 0.0016378155, 0.34254807, 1.0556462, 0.9242675, 0.3841158, 0.19424327, -0.5399717, 0.45922905, 0.4348209, 0.7463028, -0.23992652, -0.60218215, 0.26373464, -0.48176405, 0.3577192, 0.30109936, 0.18007952, 0.97340673, 0.8311445, -0.091018654, -0.43556908, -0.47817314, 0.24427673, 0.86847204, -0.63367134, -0.1392084, 0.20880738, 0.29605484, 0.5102095, 0.0539689, 0.025343515, 0.24565774, 0.20760463, -0.14849266, 0.07748646, -1.0975155, -0.2468316, 0.049564585, -0.81448174, 0.07844066, -0.5533479, -0.12086342, 0.34281364, -0.47970983, 0.012860723, -0.20691025, -0.09066814, -0.6537314, 0.488608, 0.72847027, 0.43217465, -0.3573188, -0.2835165, -0.7994006, -0.60978246, 0.6759259, -0.74162185, 0.021587722, 0.2148367, -0.31782195, 0.15477072, 0.073249355, -0.2504549, 0.9304441, -0.109614864, -0.39431396, -0.13444294, 0.113385625, -0.17943051, -0.13110475, -0.6351985, 0.8168083, 0.7287063, 0.046382003, 0.78491753, 0.12041721, -0.44125587, 0.65859365, 0.1417125, -0.62944174, -0.8578431, 0.5297364, 0.5970799, 0.32134923, -0.6988253, -0.3988505, -0.53683966, -0.5645854, -0.26411146, -0.54879487, -0.08550332, 0.5523895, 0.09527285, -1.4829303, 0.42620313, -0.32207206, -0.80331665, -0.14081834, 0.14321318, 1.0547477, -0.014484324, -0.3733287, -0.6547246, -0.22136927, 0.23872378, -0.114890546, 0.52663624, -0.36137518, -0.10336557, 0.84902483, 0.24802007, 0.2428974, -0.55062777, -0.898774, -0.086360104, 0.42273575, 0.01069665, 0.03268071, -0.22184242, 0.68654114, -0.31356922, 0.99203634, -0.8053663, 0.024493441, 0.52120054, -0.14788416, 0.16501157, 0.71239144, 0.10519813, -0.23112617, -0.30074418, -0.7945606, -0.32828715, 0.1546241, 0.71328896, -0.8631298, 0.6879144, -0.25349656, -0.15505737, -0.52401733, 0.026135508, -0.91197675, 0.4897887, 0.2553321, 0.38357615, -0.5817329, 0.10147074, -0.14365219, -0.07878406, 1.460639, 0.76415765, 0.44990405, 0.9951974, -0.10996676, -0.43003532, -0.6043866, -0.97104216, -0.10857196, 1.7999303, -0.2487742, -0.23330228, -1.9624965, 0.8282924, 0.3562973, 0.99590814, 0.710325, -0.74927074, -0.47313, -0.23652235, 0.17110118, -0.64118886, 0.18618682, -1.0815334, 0.4417191, -0.27619588, 0.13438608, -1.2182668, 0.09222232, -0.046028994, 0.5128414, 0.6309838, 0.17811278, 0.08257908, 0.82218415, 0.24052832, -0.3043413, -1.1845739, -0.31409425, -0.5495012, -0.102475435, 0.6949858, -0.60669345, -0.5356563, -0.12042385, 0.51972234, 0.9788067, 0.27975333, -0.6509743, 0.08709107, -0.3396774, -1.0324789, 0.21493271, 0.64101464, -0.4424937, 0.35320687, -0.8626394, 0.018576376, -0.14504273, 0.0675314, -0.09590454, 0.14231923, -0.32527098, 0.15347226, 0.50280917, -0.12097482, -0.93272054, 0.6082158, -1.5437937, -0.07995024, -0.6858374, 0.39547303, -0.5739462, -0.52489924, 0.041147597, 1.3033543, -0.17370999, -0.22331943, -0.12098679, 0.7863538, -0.6103873, -0.3908378, 1.0210451, -0.33337703, -0.335317, 0.679813, -0.03252794, -0.46655637, 0.58323187, 0.526237, -0.17061844, -0.47416002, -0.35893548, 0.4063307, 0.32042253, -0.0637602, 0.13230446, -0.44979116, 0.5168601, 0.33988982, -0.7665607, 0.0853706, -1.2825401, 0.35769534, -0.21235913, 0.25373393, 0.2737563, 0.4383112, 0.26156312, -0.18157701, -0.82445776, -0.54746836, -0.19033858, -0.14472756, -0.8237075, -0.20849845, 0.09290561, 0.45805925, -0.60196894, -0.9694583, 0.22632071, -0.15821098, -0.07559876, -0.13461533, 0.6933839, -0.32768452, 0.3443336, 0.31391212, 0.9203925, -0.36575687, -0.20933554, -0.31347826, 0.5546571, -0.016795274, -0.092404574, -0.5469727, 0.6365913, -0.43841305, -0.8389967, -0.036488578, 0.61133695, -0.3538103, 0.76916534, 0.2602567, 0.04585594, -0.20960002, -0.69782466, -0.073778585, -0.4628681, -0.31100827, -1.194452, -0.15880762, 0.61074346, 0.01697435, 0.08602919, -1.0204202, -0.1064734, -0.5719034, 0.3842537, -0.61645734, 0.005817363, -0.5069963, 0.73048353, -0.58076227, 1.1014149, -1.002687, 0.26485753, 0.001325082, 0.23775855, -0.1090179, 0.8222375, -0.8824368, -0.60530984, 0.38780227, -0.18472426, 0.18662238, 0.6539168, -0.08568022, 0.0025433525, -0.35558033, 0.019322174, -0.88901633, -0.6802375, -0.69873244, 0.29876226, 0.03279008, 0.41753015, 0.15544944, 0.136213, 1.1869895, 0.13588208, -0.24654882, -0.68050987, -0.6760854, -0.6779837, -0.68511623, 0.96097136, -0.5064433, 0.005498264, -0.47417802, 0.14546248, 0.7594362, -0.367512, -0.098296344, 1.961263, 0.35767633, 0.03230954, -0.69004714, 1.1331533, 0.27895185, -0.49140096, -0.07016089, 0.16740261, -0.34845498, 0.25857598, -0.37114236, -0.92653924, -0.78350365, -0.41225216, 0.69445866, 0.34486955, 0.093205795, -0.066756755, -0.64549917, -1.1127244, 0.37053987, 1.1387469, -0.23592287, 0.80528295, 0.63944227, 0.54414797, 1.0815576, -0.5668222, 0.089382716, 0.13776606, 0.9200868, 0.8992326, -0.27931058, 0.48805022, 0.82883877, -1.7794003, -1.3662231, -0.16744435, 0.084341876, -0.107593, -1.017171, -0.3791846, -0.14377698, -0.27979684, 0.51328593, 0.26247755, -0.27690327, 0.076862276, 0.0780327, -0.07342488, -0.061520025, 0.0024008472, 0.8332128, -0.6966219, 0.4901986, -0.24039306, -0.14298935, -0.24950793, 0.12527625, 0.29839414, 0.7389395, 0.15047178, 0.58706343, 0.12560952, 1.0310695, -0.5962883, -0.18943071, 0.6150714, -1.2840291, -1.3595079, -0.15191634, -0.25942472, -0.17627351, 0.3720213, -0.10289232, 0.056950808, 0.3213657, 0.3321522, 0.053539947, -1.0371126, -0.052774735, -0.87331986, -0.7267541, 0.051209338, 0.1441378, 0.31906247, 0.46871975, 0.18395185, -0.0692848, -0.42856544, 0.01773473, -0.1260064, 0.71401536, -0.27404174, 1.3056145, -0.61608034, -0.3932829, -0.24632904, 0.010613654, -0.21523128, -0.08095754, -0.4983497, -0.626685, 0.64032483, 1.0719864, -0.35518745, 0.31677714, -0.09860298, -0.29361737, 0.98726356, -0.28703505, 0.37888417, 0.2140752, 0.36996755, -0.71319747, 0.2214708, -0.3875488, 0.37793255, -0.7721462, 0.6461019, 0.6115026, -0.5304169, -0.17443098, -0.70448905, -0.021181267, -1.0428503, -0.34047216, -0.06293756, 0.17875059, 0.28179625, 0.44505474, 0.16711755, 0.6964868, 0.2429418, -0.048931554, 0.101600535, 0.29270682, 0.14754868, 0.040776677, -0.2830106, 0.24993977, 0.18217126, 0.5031197, 0.6458861, 0.08088947, -0.06821887, 0.2294434, -0.6025328, 0.4214955, 0.02959657, 0.31607035, 0.048564933, 0.36561626, 0.4328048, -1.0279614, 0.5526877, -0.3101868, -0.7041938, 1.2670145, -1.0038794, -0.7538339, -0.051289015, -0.99725854, 0.54648906, -0.11038782, -0.8033994, 0.31729695, 0.11359299, -0.5800839, -0.29594612, 0.130738, 0.6961497, -0.31145877, -0.6745281, -0.3327659, 0.3130085, 0.12843235, 0.3653333, -0.8100079, -0.22264737, 0.5917342, 0.86295915, 0.3166489, 0.16683327, -0.26316214, -0.8232067, 0.5095601, 0.20595878, 0.45409048, -0.8229478, 0.10812789, -0.47012043, 0.8713862, -0.64504915, -0.24139825, 0.0829124, 0.30529198, -0.04502464, 1.3450638, 0.87469786, 0.1282358, 0.21878737, 0.5608324, -0.023736248, 0.8814906, -0.2450681, -0.64366734, 0.987674, 0.47663254, 0.72472185, 0.20790745, 0.4268311, 0.3406033, -0.40542594, -0.44307786, 0.21143325, 1.1998398, -0.04269371, 0.032475434, -0.028270632, -0.28937843, 0.63828766, -0.4257946, 0.30673802, -0.20225716, -0.8918963, -1.081641, -0.446235, 1.3505905, 0.28334346, -0.113350704, 0.10584864, 0.13026781, 0.9782037, 1.2069069, -0.59382397, 0.13534994, 0.20910484, 0.3964433, -0.08584341, -0.18862218, 0.29279798, 0.10304643, -1.0189443, -0.48712122, 0.089892246, 0.40033635, -0.43739498, -0.09577835, -0.8914217, 0.5634942, 0.46147624, 0.18333669, 0.5018127, -0.57141834, 0.22123447, -0.984082, 0.73240864, -0.42637298, 0.14858729, 0.58898765, -0.41788393, 0.15860158, 0.5590106, 0.5476727, 0.38015527, -0.06930857, 0.63783866, 0.19000062, 0.5320519, 0.85254997, -0.25869924, 0.36578634, 0.059271112, -0.82330275, -0.10596946, 0.32942462, -1.0458459, 0.47975013, -0.9814856, -0.54931, 0.12817167, 0.4720524, -0.60098046, -0.5558935, -0.07903196, 0.08017051, -1.0334187, 0.72646886, 0.28693724, 0.6514715, 0.017122403, 0.059414208, -0.43003318, 0.61294556, 0.15250102, -0.6344637, -0.124711365, -0.40405872, -0.21501787, -0.5084465, -0.6109873, -0.29131338, 0.21077976, 0.4723583, -0.6350576, -0.42727095, 0.3745004, 0.2436617, 0.16013308, -0.266916, 0.41006523, -0.13443582, 1.4617592, -0.09403017, 1.6679444, -0.113599226, -0.1766919, 1.1128019, -0.4637022, 0.6026775, 0.3295456, -0.26246035, -0.58322674, 0.63749, -0.29790995, -0.4552287, -0.34962073, 0.4757661, -0.38596824, 0.40881908, -1.6522696, -0.56499016, -0.9354418, -1.0565773, -0.9105244, 1.0067492, 0.12771598, -0.004504431, 0.23984769, -0.66904426, 3.6624045, 0.2592154, 0.27187067, 0.5508017, -0.10568046, -0.2670927, 0.5288961, -0.6268612, 0.20718782, -0.9910453, 0.4760573, 0.0844937, 0.11704531, 0.7277677, 0.06835682, 0.9558804, -1.4853053, -2.8017908E-4, 0.11895311, -0.11955248, -1.2167906, 0.5527989, 0.5219648, 0.25548583, 0.5149375, 0.123984054, 1.0438063, -1.0745394, -0.09779909, -0.5746613, 1.2606201, 0.4869489, 0.02342626, -0.30612367, -0.4081654, 0.54757965, 0.18535367, 0.089302, 0.14784724, 0.33126256, -0.024330921, -0.46541923, 0.44284585, 0.052763782, 0.093688585, 0.49122953, -0.9165186, 0.34113777, 0.31382066, -0.054380115, 0.8466793, -0.28731346, 0.28629318, -0.57786727, -0.5250714, -0.15221663, 0.029823096, 0.40237293, -0.7914292, 0.24210334, -0.42463204, 0.25620586, -0.21277969, -0.050531507, -0.18733416, 0.16404244, 0.696484, 0.25563902, -0.18624108, -0.8773365, -0.56324744, 0.31544864, -0.31330204, -0.8109294, -0.13510668, 0.9721738, -1.0318075, 0.26569387, 0.038234264, -0.31428084, 0.22263722, 0.06329511, -0.15759473, -0.36926627, 0.17948699, 0.5136905, 0.01984401, -0.19416128, -0.38064262, -0.37309346, 1.102059, 0.7792553, 0.060157903, -0.108390525, 0.11017364, 0.3994228, 0.09555158, 0.5825012, -0.60580367, -1.0827808, -0.1576766, 0.7572717, 0.51690817, 0.76832026, 0.5623794, -0.5242806, 0.10713714, -0.28198227, -0.3057894, -0.4436093, 0.0508234, -0.67036074, -0.50983393, -1.126107, 0.10048007, -0.28169256, 0.06555464, -1.1903594, -0.55183387, -0.4405081, -0.17009944, 0.5612562, 0.047636222, 0.37082034, 0.65144277, -0.21440561, 0.19920659, -0.08983047, -1.3184719, -0.21471508, -0.77892214, 1.0248505, -0.60647166, -0.48059314, -0.38415653, 0.33976716, 0.0074042156, 0.3431964, -0.7637138, -1.562081, 0.21412212, 0.41796106, -0.21860333, -0.036963142, -0.15398574, -0.067759186, 0.6621827, 0.14345872, -0.10131864, -0.15699252, 0.3062003, -0.93177044, 0.110051446, -1.2522842, 0.80647933, 0.19306532, 0.93869627, 0.41989905, -1.2128512, 0.048087396, 0.43417054, 0.51452124, 0.22957322, 0.6538078, 0.045719445, -0.49581295, 0.6129913, 0.2330572, -0.76418656, -0.59514874, 0.10234557, 0.34008834, 0.93430877, -0.7938407, 0.3488256, -0.095158495, 0.39193368, 0.32834923, -0.1460364, -1.1935029, -0.7402658, -0.06672922, 0.34790787, -0.24937785, -0.09675882, 0.54674053, 0.29830703, -0.25361973, 0.26495603, 0.8386657, 0.93270355, -0.30766344, 0.10872549, -0.54271966, -0.2646044, 0.80850345, 0.80533385, -0.3436443, -0.15843843, -1.1156524, -0.37078837, -0.9744277, 0.38333637, -0.7051673, -0.4906921, 0.054198608, 1.0482272, -0.16283801, 0.28291935, -0.2076324, 0.24571949, -0.42660946, 0.6194447, -0.5943218, -0.2044191, 0.80598855, 0.033541154, -0.16847873, -0.4267447, -0.5693771, -0.32211003, -0.80143666, 0.52846223, 0.42857355, -0.2879928, 0.25050047, 0.05486901, -0.059970193, 1.0365646, -0.21031526, -0.2751096, 0.4085902, 0.5967447, 0.46310297, -1.244204, 0.2939693, -0.06727497, -0.65307546, 1.6378098, 0.6602727, 0.3331953, -0.5972358, -0.16830699, -0.4092154, 0.9061645, -0.70522636, -0.30478314, 0.21947536, 0.30807325, -0.5290096, -0.021191731, -0.048273534, 0.052654807, 0.4325883, -0.002106417, 0.22604083, 0.6506453, -0.4128863, 0.06486968, -0.5109035, 0.6262629, -0.59054273, 0.54796576, -0.078081556, -0.22457956, 0.10496932, -0.7126875, -0.07178986, -0.014613241, 0.25202245, 0.6094514, 0.7096744, 0.17859364, -0.07159945, -0.10782984, -1.0702442, 0.2905703, -0.06708715, 0.73710424, 0.025326883, -0.04851279, 0.2838625, 0.100776896, -0.47360796, -0.23008478, 0.7629225, 0.4038585, -1.1927986, 0.7186655, 0.17397834, 0.66196936, -0.3637218, 1.0107775, -0.55020744, -1.4909959, -0.56990623, 0.30201685, -0.20511222, 0.2730165, 0.73218584, 0.048040986, -0.044010743, -0.15303451, -0.17348513, -0.39569393, 0.6480931, 0.10182218, -0.5377528, -0.012679113, -0.007665368, -0.65783006, -0.6718512, 0.36023977, 0.50482917, 0.112826176, -0.16764028, 0.09783888, 0.54286546, 0.82194656, 0.32949015, -0.10446587, -0.66156757, 0.44045573, -0.6881772, -0.12748857, 0.011206888, 0.5880827, -0.3310844, 0.60313576, 0.24298477, 0.18763687, 0.6665168, 0.8176408, 0.63851047, 0.7703525, -0.38874447, 0.29319334, 0.21659724, 0.67248577, -0.04747004, -0.75138336, -0.032682426, -0.58525085, 0.6164005, 0.5252805, 0.067715034, 0.77593464, 0.5756692, 0.01080169, -0.5409408, -0.18088111, 0.28055167, 0.7370628, -0.061915897, -0.14930114, 0.42736712, 0.07878585, 0.6338375, 0.028980128, -0.018971909, 0.24936385, -0.10556009, -0.007052973, -0.08535256, -1.1767282, -0.25823215, -0.16164792, -0.59529424, -0.04154039, -0.43678924, 0.16663226, 0.3614608, -0.4110936, -0.12785242, -0.561177, -0.49575725, -0.53649414, 0.55716574, 0.9938018, 0.3834205, -0.4088232, -0.16438262, -0.8488413, -0.68160176, 0.48920587, -0.35171676, 0.17286812, 0.14482836, -0.4438081, 0.34934083, -0.11522612, -0.18400648, 0.9550849, 0.19140965, -0.25227302, 0.060297303, -0.0070842654, -0.15262157, -0.484868, -0.6926102, 0.84828264, 0.91567695, 0.0016165003, 0.6874639, 0.023342803, -0.5647343, 0.4872593, 0.36987463, -0.53967863, -0.7367035, 0.6690624, 0.36760825, 0.41536736, -0.70216143, -0.78941077, -0.46292698, -0.32272416, 0.00408322, -0.569716, -0.0982589, 0.7778945, -0.22264656, -1.2859204, 0.14981261, -0.4571321, -0.84205663, -0.3931107, -0.13485941, 0.7186496, -0.11406441, -0.19351138, -0.3396683, -0.12722772, 0.0022645625, -0.023715228, 0.7800383, -0.23587298, 0.32181016, 0.6075423, 0.20606756, 0.08583229, -0.3835686, -0.76363343, 0.11516355, 0.26286107, 0.15805645, 0.010979824, -0.28352818, 0.42406383, -0.06747039, 0.7641131, -0.8182565, -0.031834044, 0.59817415, -0.556535, -0.13097134, 0.45006514, 0.45921433, 0.18680452, -0.2353987, -0.39224648, -0.20950153, 0.44744873, 0.7575571, -0.99211806, 1.0048358, -0.21880436, -0.29180026, -0.4883183, 0.11914819, -0.45420957, 0.5537008, 0.038552634, 0.28215736, -0.6505611, -0.05639731, -0.22432365, -0.0753257, 1.534879, 0.6527801, 0.33230194, 0.5043558, -0.17230092, -0.5368485, -0.60196584, -0.972783, -0.35474154, 1.5653621, 0.13357976, -0.23607488, -1.9256357, 0.99502707, 0.56387746, 0.95426637, 0.44848073, -0.6578555, -0.5840174, -0.21664485, -0.06438644, -0.6586791, 0.713435, -0.7542643, 0.4121706, -0.47967133, -0.5214753, -0.86162406, -0.41749653, 0.16635127, 0.67231923, 0.63377875, 0.060160317, -0.16357699, 0.70590246, 0.24508043, -0.31862876, -1.0028367, -0.1415234, -0.4981313, -0.07634404, 0.5626511, -0.5439674, -0.41470236, -0.32987338, 0.38528684, 0.8707138, 0.61265385, -0.7561777, -0.058350243, -0.29060918, -0.8828205, -0.32191333, 0.7171919, -0.6715127, 0.25353637, -0.85777193, -0.22826701, -0.10268143, -0.3677761, -0.21263666, 0.39470083, -0.50553197, 0.104695916, 0.38097295, 0.37870398, -0.7951013, 0.5898909, -1.4096434, 0.18723375, -0.67144465, 0.08446455, -0.32043055, -0.21069425, 0.060452625, 0.89954424, -0.33245453, 0.060212478, -0.16919714, 0.51581824, -0.46913767, -0.43260145, 0.8914732, -0.17595634, -0.39337397, 0.5862695, -0.165371, -0.41703492, 0.2300126, 0.8531972, 6.863475E-4, 0.018732369, -0.19274993, 0.11807219, 0.16294602, -0.13752386, 0.17776681, -0.7283606, 0.5255629, 0.21245965, -0.61398387, -0.019701332, -1.1922736, 0.072056726, -0.15926456, 0.06668207, 0.6565079, 0.3800544, 0.2927567, -0.18829279, -0.47632927, -0.5828585, -0.2932791, -0.32696068, -0.44982386, -0.1601027, 0.23962039, 0.35986, -0.6936998, -0.4130165, -0.028386503, 0.1189172, -0.23614475, -0.13688965, 0.8730439, -0.3260798, 0.6230809, -0.009794818, 0.64238536, -0.30446264, -0.1213474, -0.21677762, 0.64032716, -0.09058951, 0.32761735, -0.8952577, 0.7286184, -0.28435072, -1.0795968, 0.07461093, 0.5260262, 0.081124514, 1.1400597, 0.20557263, -0.22531477, -0.013032559, -0.63784456, -0.25429648, -0.43621144, -0.25980812, -0.68846905, 0.018888742, 0.40777546, 0.31415194, -0.06978384, -0.83367103, -0.47623697, -0.50554305, 0.050676435, -0.54136133, 0.09123197, -0.46119207, 0.8309509, -0.9467837, 1.3522601, -0.56323236, 0.04193849, -0.083614424, 0.65520114, -0.07264876, 1.2610217, -0.6354654, -0.54056776, 0.70698595, 0.00911441, 0.20147234, 0.8186352, -0.38808322, -0.081993535, -0.18767877, 0.27850354, -0.8085504, -0.6826043, -0.70434916, 0.28125268, -0.00417158, 0.1764245, 0.1252622, 0.13679127, 1.1405021, -0.16482627, -0.04663332, -0.58190393, -0.45656186, -0.49414352, -0.6545142, 0.7316151, -0.75474155, -0.13049766, -0.78929186, -0.1713476, 0.68869865, -0.1354918, -0.12297894, 1.374426, 0.53188884, -0.19543867, -0.7560643, 0.7825549, -0.20464867, -0.6691693, -0.024741076, 0.15538393, -0.20939259, 0.09335803, -0.32170793, -0.9581545, -0.3086296, -0.45974192, 0.9343871, 0.28155223, 0.026325535, 0.3607343, -0.51085424, -0.68860966, 0.51546973, 0.9578018, -0.32939222, 0.88570464, 0.8727469, 0.282832, 1.3196431, -0.46789652, 0.18751012, -0.009741772, 0.7062707, 0.7235945, -0.44040543, 0.32659394, 0.82885027, -1.513391, -1.0347612, -0.31969503, -0.17150323, -0.31322023, -1.0168256, -0.39043573, -0.32385135, -0.62966126, 0.4967361, 0.14318325, -0.02364469, -0.18822855, 0.36839056, 0.31844568, -0.25449395, 0.2378134, 1.1323748, -0.57734036, 0.57482517, -0.25512508, -0.3082748, -0.19442557, -0.1397948, -0.37038362, 0.7746373, 0.19150639, 0.057238307, -0.5009022, 0.7646541, -0.3515749, -0.1592197, 0.671271, -1.4349705, -0.87009597, -0.58153695, -0.0132568665, -0.26201454, 0.46259606, -0.24323648, 0.4780776, 0.24452041, 0.022693053, 0.21807481, -1.0536666, -0.3690221, -0.9724109, -0.5958498, 0.2780582, 0.17680575, 0.30712324, 0.33505383, 0.24084339, 0.3497074, -0.066905096, -0.046884567, -0.19839972, 0.49531293, -0.1463247, 0.68853134, -0.57161236, -0.5265372, -0.46173963, -0.29136887, -0.09823992, -0.25131285, -0.49662158, -0.29860687, 0.4173069, 0.61001307, -0.23230451, 0.33880717, -0.38124043, -0.62723, 0.7280858, -0.41596067, 0.12235218, -0.046359077, 0.1374916, -1.0030403, 0.076998085, 0.010334268, 0.16277502, -0.75184274, -0.045661084, 0.6897451, -0.5234157, -0.20258962, -0.35811937, -0.16314638, -1.2877578, -0.29840237, 0.11212779, 0.1864383, 0.30804637, 0.47436863, 0.07938605, 0.23727947, 0.15619943, 0.15607107, 0.3661412, 0.19492516, 0.52977335, 0.14330177, -0.39681092, 0.1595948, -0.17317334, 0.92330325, 0.95668155, 0.16457509, -0.082535796, 0.33720917, -0.6979915, -0.18996246, -0.18736917, 0.0076782946, 0.04778067, 0.4375449, 0.4449576, -0.5646165, 0.4824912, -0.73924667, -0.41778222, 1.228386, -1.4113506, -0.5091015, 0.018879347, -1.0306215, 0.3441526, -0.29703033, -0.76199734, 0.48998946, 0.0538232, -0.6444448, -0.55421084, 0.46473855, 0.41143027, 0.023548841, -0.5623564, -0.15067895, 0.5425395, 0.02348781, 0.33763394, -0.99986434, -0.40732938, 0.64412487, 0.61347324, 0.1844104, 0.060828157, 0.19362581, -0.89388067, 0.44956368, 0.61369896, 0.52955574, -0.93781817, 0.3274699, -0.2934738, 0.886754, -0.7060228, -0.09946883, 0.28589666, 0.38918224, 0.019775577, 0.8416462, 0.60078466, 0.22841358, 0.7777619, 0.048576668, 0.12920377, 0.708591, -0.17719474, -0.62505966, 1.0092452, 0.61805975, 0.53742653, 0.11385523, 0.30024686, 0.50781274, -0.65055555, -0.3315245, 0.089441545, 0.6801583, -0.055591352, 0.5085515, 0.080202654, -0.6231575, 0.7095781, -0.09222566, -0.0023482144, -0.2301088, -0.78504163, -0.89850014, -0.61895406, 1.4755174, 0.44006103, 0.3736515, 0.2789185, 0.3126807, 1.0981504, 0.5982582, -0.5319362, 0.2933641, 0.59055275, 0.449096, 0.09719907, 0.23644274, 0.4262668, 0.19561322, -0.99225354, -0.27452955, 0.0054776296, 0.42809853, -0.3454189, 0.024061855, -0.7582559, 0.4612135, 0.5061168, 0.16127184, 0.2933835, -0.74961704, -0.08755819, -1.038512, 0.52964205, -0.6356245, -0.039177597, 0.8408139, -0.43552092, -0.22568429, 0.6004227, 0.5666311, 0.34723854, 0.17451535, 0.46295786, 0.57787806, 0.5428326, 0.93625444, 0.25844303, 0.71137315, -0.17457405, -0.9393191, -0.0062135123, 0.7324282, -0.8502125, 0.21925573, -0.6307975, -0.40189654, 0.27061498, 0.65880245, -0.59898424, -0.7496212, 0.03331019, 0.19341184, -0.50549847, 0.76212996, 0.35790926, 0.7870286, -0.0400087, 0.055058934, -0.5947467, 0.26547173, 0.13392746, -1.1119648, -0.17382655, -0.5744398, 0.111572, -0.59631276, -0.62594944, -0.097791016, -0.35199642, 0.2313174, -0.58278424, -0.08641501, 0.34744838, 0.34512728, 0.500954, -0.7685111, 0.46870387, -0.10193086, 1.6084917, -0.03636925, 1.4086537, -0.063865475, -0.0015128739, 0.92001283, -0.38939625, 0.45528454, 0.31051323, 0.1577892, -0.5681765, 0.7005183, -0.5051335, -0.34040785, -0.28615594, 0.8032139, -0.46363586, 0.21622391, -1.2667955, -0.29988098, -0.81864244, -0.8201505, -1.1678752, 0.75056106, 0.098227546, -0.010810759, -0.014191384, -0.42939845, 3.9035187, 0.15681595, 0.2582419, 0.4887771, 0.1525703, -0.02428957, 0.66500604, -0.5359085, 0.22960104, -0.7852579, 0.15039048, 0.06367845, 0.3528753, 0.9337709, -0.20073745, 1.0146337, -1.0692636, -0.24778748, 0.23142752, -0.14437445, -1.2041767, 0.28693214, 0.37165838, -0.035585634, 0.52149665, -0.11201562, 0.60554165, -1.043031, 0.06837402, -0.4101506, 0.8253852, 0.12620798, 0.22745697, -0.13505921, -0.45202237, 1.1835434, 0.25073954, 0.1395775, 0.10847205, 0.25401965, -0.37892976, -0.6354462, 0.36379182, 0.1980045, 0.09259137, 0.7982754, -1.1515712, -0.24035174, 0.6636571, -0.15318638, 0.58441776, -0.48915377, 0.5170015, -0.2060879, -0.7129818, -0.1414245, -0.43068886, 0.18446523, -0.9598793, -0.2197116, -0.19919111, 0.12266955, -0.10918245, 0.35740358, -0.3485523, -0.22071102, 0.5921739, 0.5802294, -0.22553721, -0.7331374, -0.5409138, 0.4591624, -0.25060326, -0.6027513, 0.1528463, 1.0014454, -0.9771162, 0.30428672, -0.31012374, -0.36872467, -0.45164657, 0.3022587, -0.3332075, -0.05958897, 0.5864512, 0.29134268, -0.2936555, 0.14974032, -0.21069044, -0.21046856, 1.0327365, 0.87497103, -0.29114136, -0.12409274, 0.30638078, -0.008108355, -0.074863106, 0.1823267, -0.92456347, -1.2252402, 0.023988292, 0.29588172, 0.28956586, 0.92870545, 0.6245167, -0.17748761, 0.49881747, -0.0013700202, -0.6062493, -0.5211433, -0.044155214, -0.58735853, -0.3184926, -1.1066936, 0.31925192, 0.055742487, -0.11290029, -1.2357664, -0.013144705, -0.5662862, 0.06639056, 0.35374135, 0.38557136, 0.20628467, 0.5110246, -0.42163143, 0.12925106, -0.24695382, -1.1608903, -0.15010446, -0.3606254, 1.2112582, -0.5199689, -0.24509984, -0.57505196, 0.06266602, -0.05476774, 0.5543311, -0.6631306, -0.90839344, 0.056663997, 0.39264026, 0.006514296, -0.03379453, -0.06360012, 0.2962194, 0.43456346, 0.29512823, 0.15175281, 0.034137387, -0.15923557, -0.86211294, 0.07326408, -0.80600816, 0.67977273, 0.49671376, 0.6821382, 0.27394387, -1.536363, 0.57825166, 0.7842151, 0.2394658, 0.09236379, 0.6696022, 0.22107342, -0.5844541, 0.68800783, 0.35063517, -0.7489135, -0.84657335, 0.13539974, 0.011126772, 0.83486915, -0.3726464, 0.38500214, 0.15931323, 0.24204169, 0.31334576, -0.38999516, -1.0564649, -0.8066621, 0.32243422, 0.08050046, -0.100161314, 0.1417718, 0.26810834, 0.27799317, -0.24338469, -0.1273042, 0.47630495, 0.761901, -0.31447634, 0.0041330475, -0.6132874, -0.35413107, 0.50921535, 0.92908055, -0.7377505, 0.17884433, -0.97206813, -0.31223825, -1.1257086, 0.054560035, -0.5985438, -0.5419079, 0.34310243, 1.1592656, 0.12414108, 0.6306039, -0.29405472, 0.36001867, -0.26069996, 0.6843612, -0.69717747, -0.25637287, 0.7413816, -0.09426433, 0.007948817, -0.05839423, -0.37699413, -0.54838955, -0.5196219, 0.7450251, 0.5604553, -0.19528422, 0.153679, -0.037510846, 0.21829069, 0.63829726, -0.11303048, 0.0413495, 0.42149734, 0.5452131, 0.12912615, -0.9724758, 0.47631884, -0.11178413, -0.78062665, 1.6786276, 0.88644165, 0.25348303, -0.57685983, -0.10731165, -0.6602384, 0.66389215, -0.7689, 0.1496639, 0.6415253, 0.500464, -0.24878055, -0.07939838, 0.13462633, 0.013040431, 0.73763734, 0.06980479, -0.18928413, 0.6980672, -0.33711007, 0.115530476, -0.61564434, 0.2487322, -0.04897301, 0.13430814, -0.2164018, -0.3666767, -0.095899746, -0.44386792, -0.17055167, -0.036105186, 0.43075958, 0.534845, 0.17878997, 0.06367618, -0.05834858, -0.2430348, -0.6089918, -0.047322188, 0.080885276, 0.5262991, -0.21075973, 0.10692868, 0.13799505, 0.08237328, -0.60258526, -0.51029414, 0.716713, 0.27913976, -1.1312143, 0.69941586, 0.08650997, 0.6624551, -0.70263344, 1.0370399, -0.4800526, -1.3264769, -0.5724056, 0.48490354, -0.36758322, 0.14180458, 1.0191479, -0.16142865, -0.15934804, -0.06126994, -0.12419982, -0.2052495, 0.46710333, 0.25446153, -0.09749228, 0.2416552, 0.13107337, -0.62425584, -0.4665196, 0.41823313, 0.017742202, -0.11604845, -0.014583001, -0.04743681, 0.48962507, 0.5726147, -0.15344103, -0.043124318, -0.4611046, 0.5476682, -0.6814534, -0.13700399, -0.25768772, 0.47459337, -0.5468129, 0.964742, 0.26113805, 0.29224998, 0.69866586, 0.5390306, 0.23548684, 0.5616739, -0.4996161, -0.0531639, 0.15483534, 0.3004987, -0.15385841, -0.6523655, 0.52095807, -0.61126125, 0.29399925, 0.022592522, 0.0036164224, 0.9010767, 0.66380125, 0.22740883, -0.8602492, 0.067954, 0.3547017, 0.4408105, -0.13458662, -0.23914078, 0.20854351, 0.24268481, 0.46751034, 0.36705163, 0.043406673, 0.036361203, 0.05552602, -0.071449906, 0.041502196, -1.2105745, -0.028304726, -0.039797705, -0.66858214, -0.088372126, -0.5237669, 0.16090764, -0.04407379, -0.6910071, 0.054006502, -0.28989974, -0.24306267, -0.61034966, 0.5553436, 0.6809772, 0.096716136, -0.51710796, -0.098939195, -0.3180539, -0.32514825, 0.38779578, -0.7734561, 0.15372227, 0.087640285, -0.4327031, 0.096745, -0.06493625, 0.029305357, 1.0426801, 0.116323724, -0.46691078, 0.011199217, 0.1469512, -0.108034305, -0.24094029, -1.0067587, 0.86667746, 0.681321, -0.34006357, 0.6885098, 0.21300186, -0.55701715, 0.582534, 0.26671684, -0.28656054, -0.7581177, 0.83850646, 0.6659291, 0.63540286, -0.82415324, -0.76791, -0.42685413, -0.1978186, 0.1188646, -0.35998422, -0.4153101, 0.63527155, 0.012389898, -1.5216818, 0.10454872, -0.15033387, -1.1138442, -0.363461, -0.31349632, 0.73108214, -0.13952224, -0.29330423, -0.40340406, 0.19570658, -0.13253699, -0.15259932, 0.8772184, -0.6289534, 0.24124396, 0.8863129, 0.013752261, 0.11636713, -0.2878188, -0.6748302, 0.26673093, 0.074429825, 0.18423261, 0.33583167, -0.31168482, 0.18303514, -0.110326886, 1.0521882, -0.8914687, -0.041218713, 0.7925176, -0.38259062, 0.0699002, 0.39020306, 0.3406126, -0.025504138, 0.030163972, -0.8205811, 0.27958557, 0.42331424, 0.7152617, -0.5693195, 0.79709387, -0.052060973, -0.2502512, -0.5891158, 0.43469584, -0.41373527, 0.6146908, 0.076879665, 0.31544682, -0.5227765, 0.08362824, -0.23998299, -0.06326865, 0.977748, 0.699623, 0.34662923, 0.4053547, -0.57229793, -0.360397, -0.68081236, -0.89546853, -0.38550287, 1.4982802, 0.1295377, 0.03139779, -1.4845395, 0.6942864, 0.52807, 0.8333225, 0.49081743, -0.3854397, -0.5561076, -0.2873355, 0.35955435, -0.40604037, 0.3067069, -0.9793556, 0.54424125, 0.05487563, -0.17266905, -1.1705602, 0.23105747, -0.096690014, 0.66326594, 0.50486475, -0.104512066, -0.17203951, 0.84721786, 0.010612169, -0.2766949, -0.7051157, -0.4017008, -0.63575864, 0.06809341, 0.36169913, -0.83321065, -0.3977779, -0.75799507, 0.45688114, 0.8228988, 0.3614043, -0.3872057, -0.23848563, -0.2693749, -0.90534234, 0.062407956, 0.79575527, -0.28577504, 0.11576642, -0.85940045, -0.2364341, 0.09936187, -0.6178453, -0.2623395, 0.4881133, -0.96528625, -0.002703242, 0.32168373, 0.23600036, -0.5019947, 0.62138635, -1.4865868, -0.15790486, -0.6669983, 0.06801675, -0.5628619, -0.31371945, 0.6114257, 0.96458405, -0.064005196, -0.219717, -0.09132044, 0.547687, -0.633611, -0.21194346, 0.5262808, -0.2213456, -0.47458994, 0.39729577, -0.15099177, -0.43005282, 0.53780806, 0.54377115, -0.124503836, -0.3869376, -0.4276981, -0.017099984, 0.10659635, 0.023432303, -0.023488503, -0.5943924, 0.44783092, 0.21988973, -0.2587016, 0.054121852, -0.98205125, 0.66049236, -0.1100941, 0.40253222, 0.4989391, 0.18264665, 0.024417441, -0.1577205, -0.33052993, -0.40380287, -0.3190465, -0.432463, -0.36828405, -0.5821203, -0.027871974, 0.3407156, -1.0126361, -0.44199046, -0.089746, 0.19934487, 0.24793631, 0.07480049, 0.3483074, -0.468999, 0.49423718, -0.024303712, 0.7697083, -0.5001096, 0.02921876, -0.2797136, 0.5004291, -0.19378904, 0.33850992, -0.5845366, 0.54080933, -0.4231968, -0.8276037, -0.21587685, 0.4471876, 0.17945103, 0.8905926, 0.45168063, 0.120928615, -0.19128208, -0.9465436, -0.4261623, -0.56029624, -0.15703607, -0.70728654, -0.37483913, 0.49776262, 0.25170207, 0.12126787, -1.2433228, 0.06759076, -0.42357254, 0.37723503, -0.37966526, 0.16530818, -0.6875407, 0.6304193, -1.0195813, 1.1075277, -0.78990626, 0.39701256, 0.0069374703, 0.7567582, -0.09521173, 0.67897403, -0.46449107, -0.7232551, 0.6319999, 0.13682938, 0.38638604, 0.4707066, -0.36580908, 0.2677807, 0.34033567, -0.1596111, -0.9749413, -0.37226206, -0.6223806, 0.2617854, 0.103502214, -0.008744709, 0.051227644, 0.351737, 1.1481045, 0.14042997, -0.5311719, -0.49255943, -0.8199234, -0.64042944, -0.21486312, 0.6096419, -0.52185607, -0.2824444, -0.79940456, 0.1712943, 0.4599559, -0.08197235, 0.35854346, 1.6623292, 0.45101458, -0.066510625, -1.0427458, 0.62489176, -0.22252423, -0.5163516, 0.07532082, 0.13290837, 0.13375865, -0.16612516, -0.15780056, -0.94008225, -0.29751578, -0.57456505, 1.1763555, -0.05414252, 0.37103045, 0.19796538, -0.43615937, -0.68003327, 0.3122042, 1.2015585, -0.24554463, 0.8153871, 0.7607808, 0.059229776, 1.3229659, -0.24295142, 0.17053288, 0.048269182, 0.9410707, 0.9070906, 0.06965003, 0.27366185, 0.8945579, -1.2575924, -1.2471954, -0.5133816, -0.03719949, -0.040453598, -0.6262046, -0.22496824, -0.5460526, -0.6761229, 0.38598374, 0.30903018, 0.3048585, 0.05681765, 1.035404, 0.3265798, -0.65159935, 0.012538631, 1.1262999, -0.5801894, 0.6140626, 0.030489383, -0.20633727, -0.091095164, 0.07008093, 0.20600188, 0.42286634, 0.24940234, 0.336841, -0.28344682, 0.15419483, -0.45846593, -0.2657172, 0.30148643, -0.9636932, -0.83163893, -0.15322179, -0.083657995, -0.24991873, 0.2650725, -0.21684909, 0.45393792, 0.2698332, 0.0074559078, 0.4958383, -0.61557376, -0.25072846, -1.2557454, -0.6115327, -0.24550119, -0.04877276, 0.06557663, 0.3164962, 0.2010736, 0.20483038, 0.098864615, 0.4129772, 0.24178419, 0.45724168, -0.4674123, 0.8200659, -0.50947297, -0.449177, -0.30873096, -0.00341261, -0.05515168, -0.5907586, -0.33790907, -0.651591, 0.40981805, 0.7774349, -0.11609654, 0.120979905, -0.17329918, -0.36349046, 0.5757807, -0.30231762, 0.16941534, 0.18787259, 0.016418763, -0.9578842, -0.080765896, -0.023937378, 0.13233513, -0.6668092, -0.18915473, 0.6900721, -0.81779176, -0.3249238, -0.19014584, -0.26334095, -0.9522248, -0.020303745, -0.1590526, 0.45100468, 0.30653527, 0.19623548, 0.3372883, 0.4808515, 0.053027716, 0.039079703, 0.063242614, 0.1595489, 0.36108032, -0.06620808, -0.37538713, 0.023618475, 0.01085633, 0.69008404, 0.27196503, -0.04092282, -0.2127317, 0.2757614, -0.30057618, 0.18570052, -0.19186738, 0.3087836, -0.25180426, 0.26582882, 0.4608781, -0.21650104, 0.2283323, -0.31646472, -0.692105, 1.3698722, -1.257715, -0.45968327, 0.08766882, -0.62902015, 0.52597046, -0.24926928, -0.85368836, 0.53539294, 0.18897045, -0.8144592, -0.24593538, 0.45442003, 0.43394864, -0.021025106, -0.56448966, -0.48068237, 0.57226974, -0.1455751, 0.3920177, -0.805578, -0.3599915, 0.36887014, 0.40636414, -0.38607797, 0.25946122, -0.5041137, -0.7237108, 0.20406774, 0.26659763, 0.50632215, -1.1882919, 0.31482235, -0.16788547, 1.0427362, -0.30384532, 0.25440946, 0.36111465, -0.04078348, -0.08545423, 0.92903745, 0.4287195, 0.38892937, 0.6466388, 0.011067346, 0.10231955, 0.72308904, -0.13572344, -0.31354204, 0.68488604, 0.4170978, 0.42884508, 0.10300704, 0.7566359, 0.17373186, -0.41658837, -0.43844083, -0.086458325, 0.52654135, -0.043467827, 0.6249003, -0.25258037, -0.729916, 0.6514588, -0.21865344, 0.05354707, -0.038330674, -1.0014257, -0.64724433, -0.36293414, 1.4632056, 0.2517041, 0.034037836, 0.24289103, 0.09087169, 0.8479298, 0.55847895, -0.71819776, 0.22156405, 0.59628755, 0.092399985, -0.04420072, -0.3075664, 0.30672166, -0.07358368, -0.9896834, -0.030702464, 0.45216998, 0.23109157, -0.3755612, 0.16779788, -0.6244628, 0.7411318, 0.24217345, 0.17737857, 0.48295784, -0.8859237, -0.24001184, -0.75387233, 0.67960876, -0.83024853, -0.14399245, 0.8452935, -0.3518325, -0.047979936, -0.02630499, 0.5509351, 0.4625635, -0.16918442, 0.30742225, 0.16386184, 0.67220664, 0.6280037, 0.28628358, 0.5660928, -0.1181638, -0.7434205, 0.20981479, 0.30287597, -0.69003713, 0.2184324, -0.76819944, -0.6346251, -0.08185301, 0.4818785, -0.51540446, -0.41744098, -0.09777721, -0.13589545, -0.60600513, 0.5247147, 0.3843186, 0.7094564, -0.16184524, -0.10725272, -0.4548275, 0.19113028, -0.047529392, -1.2795435, 0.17554286, -0.11416066, 0.13803561, -0.15642008, -0.6183412, -0.09616114, -0.37894952, 0.41909993, -0.662439, -0.114946306, 0.24334419, 0.22668067, 0.12224765, -0.63632286, 0.09084573, -0.23651299, 1.572324, 0.2178188, 1.1743072, 0.07571864, -0.1768858, 0.46413594, -0.48011255, 0.60569423, 0.15971124, 0.15805168, -0.9414262, 0.52399147, -0.007178193, -0.5215467, -0.59056896, 0.8559839, -0.2467039, -0.12033293, -0.9019515, -0.59779, -0.7349234, -0.8292922, -0.8635217, 0.5185263, -0.14540526, -0.26934415, 0.09875953, -1.1647751, 4.1182427, 0.46481997, 0.20087855, 0.9354643, 0.105424814, -0.004540026, 0.31147802, -0.6534193, 0.49501762, -0.45092684, 0.26379517, 0.448524, 0.34865677, 0.33569512, -0.016880259, 0.931842, -1.0148392, 0.20927775, 0.27847856, 0.15899846, -1.0693281, 0.1423664, 0.25981626, -0.025161192, 0.37412122, -0.29079884, 0.65601414, -1.0225062, -0.09605144, -0.14980899, 1.4953828, -0.1718415, 0.4066242, -0.08655246, -0.24063088, 1.2393714, 0.30284256, 0.36995012, 0.13408722, 0.30496278, -0.46151608, -0.6467823, 0.6863592, 0.3977234, 0.24254265, 0.30088937, -0.91632855, 0.22041345, 0.21627867, 0.036953487, 0.8198882, -0.38644162, 0.5111023, -0.6528836, -0.05132746, -0.048061155, -0.6670724, 0.32652795, -0.93728834, 0.17837188, -0.07624923, 0.18451518, -0.23230648, 0.34793568, -0.30258647, 0.12964638, 0.51428103, 0.8286943, -0.33250588, -0.6536644, -0.5854663, 0.42078778, 0.0033747032, -1.1266797, 0.10867215, 0.7423345, -0.83774376, 0.77926403, -0.058730222, -0.47217268, -0.092801005, 0.33792138, -0.05150798, -0.31443495, 0.27053922, 0.27824974, -0.11275067, -0.09057309, -0.2926527, 0.06173639, 1.3071758, 0.4730829, -0.14173776, -0.5784081, 0.2668654, 0.23815082, 0.28242433, 0.4774975, -0.54650855, -1.0264833, -0.47225332, 0.8703695, 0.63991624, 0.74452734, 0.42014164, -0.03533741, 0.06514102, -0.09643583, -0.8522862, -1.026076, 0.2499778, -0.42779097, -0.22190364, -0.076258555, 0.44808066, -0.71214545, -0.33959672, -1.3720645, 0.32767367, -0.713407, 0.7200092, 0.54970694, 0.038314663, 0.31601653, 0.82536983, -0.3402146, -0.15020594, -0.38107064, -1.594133, -0.20284157, -0.5158298, 1.4197085, -0.8124861, -0.42961958, -0.9616828, -0.31844, 0.09133983, 0.83976585, -0.69099605, -0.7764937, -0.5044535, -0.021224841, -1.0946624, 0.061164968, -0.008315772, -0.09962118, 0.7529673, 0.13280208, 0.32369834, -0.018207334, 0.30298617, -1.3468391, -0.010767452, -1.2652732, 0.3044045, 0.6346315, 0.41673356, 0.3533945, -1.4007373, 0.73925, 0.4769547, 0.45146942, -0.17096666, 0.53908443, 0.1459171, -0.5496129, 0.8112877, 0.22813308, -0.86315006, -1.0600767, 0.49666116, 0.6343291, 0.9384711, -0.67448175, 0.65366536, 0.12925006, 0.32494718, 0.7210598, -0.119817495, -1.8780767, -1.1060218, 0.26940116, 0.8603358, -0.37159148, 0.22237892, -0.026965573, 1.4551806, -0.04102008, 0.18953791, 1.2205132, 1.3830074, -0.6203029, 0.105550446, -0.9172137, -0.2631466, 1.2078451, 1.1561841, -0.88699704, 0.33485472, -1.1039261, -0.15662864, -0.8889108, -0.021704465, -0.7190207, -0.4444397, -0.09743556, 1.0252041, 0.27867004, 0.47697592, -0.25137198, 0.8654594, -0.5946547, 1.1985759, -0.7184543, -0.37799215, 0.8081364, 0.13715135, 0.03568732, -0.6331051, -0.65091616, -0.63724107, -1.1073422, 0.83576024, 0.01433241, -0.25773996, 0.19880387, 0.26008373, 0.12768374, 1.1019219, -0.48458183, 0.046535883, -0.06099293, 0.5994473, 0.82844126, -1.4832599, 0.76427746, 0.2744197, -0.63113993, 3.4523046, 1.0266101, 0.27708215, -0.41686982, -0.5191848, -0.06873581, 1.3051794, -1.1570866, -0.13528334, 0.36869058, 1.023516, -0.06851939, -0.42901027, -0.061269097, 0.34303978, 0.78846973, -0.10224266, -0.26698807, 0.36766642, -0.052483615, 0.30429786, -0.5263308, 0.8598371, -0.22671875, 0.18051147, -0.08662229, -0.3279599, 0.2018461, -0.6478263, -0.17370462, 0.13946049, 0.68857074, 0.7604215, 0.66072303, -0.2236945, 0.0344449, 0.39498496, -0.86348784, 0.2021577, -0.554239, 1.241565, -0.19903407, 0.096936144, 0.6406258, -0.34654585, -0.73143643, -0.13212292, 0.64585644, 0.20416865, -1.3674644, 0.81159735, -0.53180194, 0.44403616, -0.4629941, 0.8237217, -0.6575767, -1.9094594, -1.0068313, 0.1886729, -0.54099613, -0.31080106, 0.52114534, -0.4064729, -0.3517636, 0.52113307, -0.37713295, -0.54287195, 0.90217155, 0.75736386, -0.057880785, 0.65335006, 0.5185984, -0.6316754, -1.008395, 0.5784696, 0.15871945, -0.096895896, 0.030775126, 0.019246973, 0.635904, 0.7580727, 0.603296, -0.39326644, -0.775648, 0.6632834, -0.76522464, -0.15057506, 0.13213232, 0.8701612, -0.051690824, 0.886158, 0.059451666, 0.39455524, 1.1942627, 0.80077326, 0.30792174, 0.72980845, -0.58946186, 0.11602919, 0.6559696, 0.8268997, -0.20558739, -0.9376819, 0.4666886, -0.6281039, 0.45548218, 0.08520936, 0.19750595, 1.5127107, 0.83545053, 0.3510535, -0.8958543, -0.75617564, 0.894642, 1.4720694, -0.1355076, -0.6986217, 0.29143137, 0.34363377, 0.18577126, 0.26836568, -0.13981187, 0.19420178, -0.1310125, 0.106808856, -0.11584908, -1.3767927, -0.048521705, -0.12314682, -0.70627797, 0.10515572, -0.5317391, 0.5002598, 0.422907, -1.0648339, -0.11869705, -0.93817717, -0.47067133, -1.0766637, 0.7890926, 1.0871282, 0.077466965, -0.022941213, -0.34052557, -0.46262902, -0.21314916, 0.63874835, -0.8034802, -0.12524417, -0.2280509, -0.45375586, 0.11442453, 0.17320183, -0.16676669, 1.2585441, -0.26324847, -1.0815029, 0.48728508, 0.40939358, -0.2852892, -0.01987523, -1.0332665, 1.4922973, 1.2905895, -0.3012445, 1.1206418, 0.58634394, -0.5885947, 1.027236, 0.5461434, -0.56589985, -2.160386, 0.9977782, 1.4122514, 0.35012767, -0.8348484, -0.91156083, -0.44733608, 0.06918893, 0.073672324, -0.49986246, -0.36920917, 1.2300003, -0.028686464, -1.9602597, 0.3586868, -0.5751905, -1.2226559, -0.160415, -0.45962837, 0.7730631, 0.15213728, -0.40129295, -0.3763386, 0.25027445, -0.017731309, -0.35444453, 1.0308242, -0.68111396, 0.027753418, 1.1759561, 0.1284143, -0.1538926, -0.06069766, -0.5967487, -0.46134785, 0.65801346, 0.38983122, -0.13866639, -0.1946084, 0.39163414, -0.05783741, 1.3692302, -1.1921241, 0.12407765, 0.62342554, -0.22950053, -0.15749526, 0.42076403, -0.15916803, -0.6903404, 0.38964617, -0.96953917, 0.1617446, 0.15616782, 0.94165206, -0.7990292, 1.0704751, -0.3479437, 0.014394938, -0.27818298, -0.2686414, -0.8608855, 1.1030215, 0.30865127, 0.56293905, -0.5808595, -0.09553954, -0.5470532, -0.24101052, 1.7932336, 0.5933583, 0.22850809, 0.6440879, -0.13777807, -0.40607083, -0.14935976, -1.0655402, -0.08556904, 1.5463837, -0.2037431, -0.049918488, -1.948359, 1.3937284, 0.8913616, 0.6618716, 0.29112825, -0.9333397, -0.64939773, -0.1519076, 0.43093035, -0.90897346, 0.23105648, -1.6697718, 0.80526376, -0.10556382, -0.29879344, -1.1856492, -0.08865876, -0.3910298, 0.99155366, 0.05003587, -0.25817716, -0.203244, 1.0919954, 0.43314368, -0.36503968, -1.4359604, -0.27645838, -0.82746905, 0.27085295, 0.6530822, -1.179947, -0.5469275, -0.8221712, 0.4316565, 0.8877416, -0.22656713, -0.9242201, -0.30603468, -0.2247964, -0.8370084, -0.35373253, 0.91914237, -0.030093975, 0.6547502, -1.4251751, -0.17141008, -0.10287389, -0.16700989, -0.17503524, 0.30245206, -0.10866988, 0.11191217, 0.87262994, -0.3063119, -0.8902056, 0.56295437, -1.9272543, -0.0981302, -0.67028433, 0.23364708, -0.6498273, -0.37664372, 0.23457718, 1.4059585, -0.1313058, -0.30622694, -0.021324791, 0.7439346, -1.2513928, -0.34206432, 1.3767378, -0.2954388, -0.5523714, 0.60395724, -0.29732507, -0.2831665, 0.24392214, 0.5988505, 0.0795792, -0.29516765, -0.25286347, 0.10891355, -0.043641455, -0.21956724, -0.1222059, -0.90728974, 0.46377242, 0.49633765, -0.20564441, -0.520319, -1.6375936, -0.0139881335, -0.4310044, 0.5800617, 0.28061712, 0.47284612, -0.07800144, -0.51974624, -0.5967198, -0.2567559, -0.40850466, -0.36360377, -0.61648047, -0.5654142, 0.48337257, 0.21692866, -1.1690227, -0.53939724, 0.2567819, 0.52827764, -0.27963173, -0.038007528, 0.5720037, -0.8600977, 0.13065897, 0.19105779, 0.9926014, -0.50321037, -0.4309987, 0.19077024, 0.7039192, -0.09141481, 0.84667844, -0.77341396, 0.5661096, 0.15038273, -1.0883207, -0.30914208, 0.39496368, -0.06485534, 1.641904, 0.6762734, -0.3347199, -0.8617406, -0.6995804, -0.19845611, -0.5784028, -0.47562283, -1.4047565, -1.0122284, 1.0451913, 0.3910407, 0.21691439, -0.5442791, 0.3343481, -0.33234861, 0.66286534, -0.6073909, -0.23710439, -0.8782153, 0.6301357, -0.78039706, 1.0811063, -0.94600165, 0.50099385, -0.20203432, 0.8153803, 0.4326697, 0.9829363, -1.1359497, -0.5724925, 0.46652472, 0.020673493, 0.17816944, 0.64396065, -0.95867497, 0.8279188, -0.80351615, -0.085244454, -1.0182021, -0.48280728, -0.68415624, 0.26940063, 0.17725682, 0.6659137, 0.343051, -0.036139507, 1.9253529, 0.330179, -0.18667798, -0.7256044, -0.5135883, -0.6487113, -0.8936575, 0.7452832, -0.12287533, -0.11825, -0.70136374, 0.14688696, 1.4273101, -0.15633577, 0.6255618, 2.1027944, 0.8671121, -0.36143222, -1.1867063, 1.1065185, 0.8098748, -0.45667458, -0.24226767, 0.0025809854, -0.25722653, 0.19070284, -0.5484266, -0.6555022, -1.0337746, -0.42591894, 1.7423811, 0.654865, 0.64011616, 0.16377617, -1.2083119, -1.4860584, 0.70743257, 1.1795193, 0.07058562, 0.8440395, 1.0345922, 0.28286603, 1.0439405, -0.31949413, 0.6272188, -0.19404978, 1.5465806, 0.8578423, -0.27853975, 0.66072625, 1.2355281, -2.0446782, -1.7492697, 0.0030216204, -0.56266546, -0.6697648, -0.68279344, -0.35443568, -0.54446316, -0.6759806, 0.1435076, 0.28134957, -0.15788919, 0.24428463, 0.014099263, 0.46920812, -0.85195917, 0.0012707915, 1.3709744, -1.0901219, 0.64788854, -0.14823869, -0.085778356, 0.13496846, -0.24483931, 0.4524359, -0.034560725, 0.63981885, 0.35658672, -0.30224392, 1.0347067, -0.85791016, -0.14240645, 0.79247826, -1.1686097, -1.586391, -0.8209819, -0.119535595, -0.2052218, 0.34335265, -0.6570797, -0.2210782, 0.6748208, -0.09502657, 0.24686556, -1.2017366, -0.63983685, -1.5916613, -1.184105, -0.123895474, -0.03346053, 0.2209342, 0.61311907, 0.3206372, -0.118494704, -0.3988993, 0.3909913, -0.36862627, 0.5302286, -0.6324911, 0.94080716, -0.6024734, -0.38162777, -0.4316226, -0.3143518, -0.36463666, -0.20017555, -0.8736055, -0.9380112, 0.45671174, 1.5155923, -0.09486201, 0.9695505, -0.13833332, -0.6298378, 0.8931586, -0.6301222, -0.26646182, 0.46902105, 0.13617973, -1.3055613, 0.30406374, -0.09564643, 0.10455055, -1.0269212, 0.12177908, 1.1355569, -0.6378392, -0.6559861, -0.78072715, -0.68091595, -1.3237638, -0.4806199, -0.16236575, 0.22558266, 0.4245454, 0.6258281, 0.2573674, 0.92344415, 0.108896874, 0.4044994, 0.06719699, 0.66419035, 0.34098536, 0.58486176, -0.41998512, 0.5359888, 0.61129946, 0.5190456, 0.983025, 0.310331, -0.32300448, 0.35044804, -0.97328913, -0.06142584, -0.34457424, 0.42320502, -0.2103809, 0.94158864, 0.751986, -0.41664547, 0.5273929, -0.023898497, -0.58526397, 0.91506046, -1.587615, -0.62792873, 0.20285669, -1.3050082, 0.62498814, -0.4249226, -1.0144218, 0.409593, 0.27104688, -0.9462727, -0.24467865, 0.86334205, 0.45995265, -0.12513909, -0.70971626, -0.19246241, 0.042387776, 0.07669194, 0.115074575, -1.269335, -0.09286548, 0.54315686, 0.34751275, 0.06670852, 0.14310578, 0.02031393, -1.4052739, 0.34125116, 0.34491134, 0.47022027, -0.80838424, 0.43571746, -0.5313221, 0.8576949, -0.2583056, -0.1817374, 0.4537858, -0.14710322, -0.4226152, 1.6146483, 0.88158476, -0.3151336, 1.2690797, 0.11899912, 0.3866578, 0.76637596, 1.5090572, -0.67779464, 0.9428768, 0.6889142, 0.6410521, 0.28004602, 0.7718466, 0.7421934, -0.28616107, -0.914406, 0.18280843, 0.77757883, -0.37666446, 0.607708, -0.28850508, -0.14639486, 1.0358485, -0.57612544, -0.03077536, -0.09469912, -0.5002359, -1.5291424, -0.5715195, 1.1232437, 0.032881796, 0.24273214, 0.114872776, 0.21159294, 0.86429787, 1.2115531, -0.53747576, 0.5324311, 1.046557, 0.3009321, 0.33693448, 0.033356756, 0.44364536, -0.02425829, -1.4809191, -0.15717486, 0.19116181, -0.09143227, -0.27159914, -0.10439899, -0.74533814, 0.82421553, -0.20139456, -0.0032766405, 0.9916576, -1.0329632, 0.19601333, -1.2602824, 0.2017543, -0.64100575, -0.35785395, 1.0780927, -0.14836146, 0.018262547, 0.9442348, 0.83696884, 0.6329565, -0.093982756, 0.7140547, 0.21587613, 1.2869248, 0.60281265, -0.47821552, 0.43734503, 0.25959963, -0.16328156, -0.12055825, 0.4622288, -0.9157813, 0.5098907, -0.31852883, -1.0538068, 0.63930315, 1.0165753, -0.8952555, -1.1551671, -0.07045259, 0.33253628, -1.4805075, 0.5346395, 0.40822038, 0.78947777, 0.056913875, -0.23994705, -0.47662988, 0.12904635, -0.3096597, -1.2386975, 0.027118616, -0.297474, -0.34640983, -0.7081305, -0.987574, -0.4112696, -0.16663915, -0.14638874, -1.0458425, 0.054047197, 0.99362266, 0.47721052, 0.39771488, -0.4090625, 0.1835733, 0.006618239, 1.8029044, -0.5752119, 1.7840273, 0.14250731, -0.8179414, 1.0404874, -0.7235668, 0.43460107, -0.17297104, -0.66153497, -0.53459716, 1.4169344, -0.25907004, -1.0876834, -0.121780336, 0.9376321, 0.087307006, 0.1502156, -1.3873982, -0.47126013, -0.72027636, -1.0648152, -1.0333831, 0.28081003, 0.0047804266, -0.41970125, 0.12368576, -1.0056207, 1.314159, 0.8322662, 0.50192, 0.6606601, 0.19176152, 0.22359805, 0.6299454, -0.8784206, 0.8435247, -0.62076545, 0.46503085, 0.4955411, 0.47523603, 0.59475726, -0.15033536, 1.5292126, -1.6526178, 0.77440363, 0.21343376, -0.1102623, -0.8003335, 0.12464988, 0.1694136, -0.092712775, 1.1573013, 0.26682746, 0.8170211, -1.0412548, 0.09060685, -0.18826349, 1.1423111, 0.03361123, 0.54229814, -0.31807727, -0.034259863, 1.3871967, -0.05026304, 0.28581905, 0.11886263, 0.7556672, 0.09417425, -1.0077528, 0.9749789, 0.031945437, 0.1542672, 0.44604713, -1.1202078, 0.24686609, 0.5521793, -0.26565984, 1.3768492, -0.41607288, 0.89860183, -0.9901299, -0.55397356, 0.3160442, -0.2748052, -0.028745566, -0.60326695, 0.1855664, 0.014004639, 0.043385062, -0.3658645, 0.21059687, -0.45689726, 0.2032052, 0.73326206, 0.35434416, 0.019100547, -1.4163734, -0.44338754, 0.26873967, -0.5155286, -1.3091766, 0.083646804, 1.3032191, -1.2324255, 0.9689458, -0.50306034, -0.13216153, -0.31209743, 0.42126146, 0.24715918, -0.36722437, 0.8198192, 0.7839475, -0.4742727, -0.23958692, -0.53167427, 0.36589828, 1.4970611, 1.1297909, -0.09345523, -0.7373089, -0.6823638] -2025-10-16 19:28:19 [main] INFO experimental.OnnxTest - ------------------------ -2025-10-16 19:28:19 [main] INFO experimental.OnnxTest - tokenizer加载耗时: 4070 -2025-10-16 19:28:19 [main] INFO experimental.OnnxTest - tokenizer计算耗时: 1 -2025-10-16 19:28:19 [main] INFO experimental.OnnxTest - 模型加载耗时: 587 -2025-10-16 19:28:19 [main] INFO experimental.OnnxTest - 模型数据准备耗时: 2 -2025-10-16 19:28:19 [main] INFO experimental.OnnxTest - 模型计算耗时: 14 -2025-10-16 19:28:50 [main] INFO ai.djl.util.Platform - Found matching platform from: jar:file:/home/slhaf/.m2/repository/ai/djl/huggingface/tokenizers/0.34.0/tokenizers-0.34.0.jar!/native/lib/tokenizers.properties -2025-10-16 19:28:50 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Using cache dir: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 -2025-10-16 19:28:50 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading huggingface library from: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 -2025-10-16 19:28:50 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading native library: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64/libtokenizers.so -2025-10-16 19:28:50 [main] WARN a.d.h.t.HuggingFaceTokenizer - maxLength is not explicitly specified, use modelMaxLength: 512 -2025-10-16 19:28:50 [main] INFO experimental.OnnxTest - [0.51123345, 0.43754324, 0.22250144, -0.49621642, -0.59625536, -0.24450612, 0.5863322, 0.46978277, 0.5778739, 0.6761688, -0.0854191, 0.36117497, -0.24092007, -0.19524571, -0.7976704, -0.044580948, -0.53635055, -0.11370213, -1.1403378, 0.2129236, -0.34120926, 0.001864681, -1.3665671, -0.22030343, -0.830733, 0.099989876, 0.4966247, -0.066141784, 0.41148925, 0.729914, -0.29459542, 0.29208705, -0.3367949, -1.0972055, -0.024628287, -0.6583721, 1.253141, -0.61462474, -0.518246, -0.53295904, 0.12913027, 0.04108283, 0.55130756, -0.8039789, -1.2061563, -0.34272343, 0.27257943, -0.13096467, 0.18428354, 0.2605311, 0.057498857, 0.7461083, 0.1835212, 0.021440782, -0.20071763, 0.04362084, -1.3614484, -0.1095237, -1.0870106, 0.40957803, 0.7201999, 0.98604536, 0.39732328, -1.3224756, 0.40671548, 0.406975, 0.50348455, 0.22034347, 0.5530567, 0.25672144, -0.6594347, 0.96159023, 0.07775575, -0.7792945, -1.0163779, 0.36998796, 0.5171132, 0.79771215, -0.5552498, 0.80050594, 0.14805704, 0.2997373, 0.26703542, 0.08637628, -1.4002664, -0.813782, 0.25788978, 0.5414073, -0.46593362, -0.027594358, 0.29689378, 0.65353656, -0.31033817, 0.08076967, 0.76214606, 0.8415609, -0.3084258, -0.32594687, -0.72558767, -0.3289697, 1.0932022, 0.87115157, -0.89196694, -0.18925445, -0.9785898, -0.2336246, -0.9026102, 0.088704094, -0.7258216, -0.6594782, 0.09606822, 1.0850618, 0.0013394654, 0.38363743, -0.3874976, 0.20100841, -0.4128504, 0.74124134, -0.6654147, -0.5718573, 0.27072686, -0.046442233, -0.2115764, -0.7070531, -0.9749727, -0.4404279, -1.3043284, 0.93771523, 0.30211914, -0.59651214, 0.12527934, 0.089207426, 0.51316845, 0.8074455, -0.5485792, 0.07305289, 0.10457601, 0.24046482, 0.5214334, -1.1262523, 0.16574118, 0.01661903, -0.72924286, 1.7897038, 0.7391656, 0.26545036, -0.24889244, 0.019522466, -0.38037547, 0.9288784, -0.90373176, -0.2429637, 0.13991763, 0.4122005, -0.6420515, -0.045609288, -0.055985063, 0.121364415, 0.28139967, -0.0052891895, -0.106420964, 0.56713265, -0.46813145, 0.19711205, -0.58464926, 0.3698026, -0.2838148, 0.12638272, 0.01481974, -0.2993888, 0.14940853, -0.4162319, -0.045515813, -0.07729791, 0.47421545, 0.46603337, 0.62959045, 0.1828863, 0.2002228, 0.07522717, -0.50393486, 0.37032261, -0.35638678, 0.8902856, -0.033868957, 0.100021124, 0.43048963, 0.3153236, -0.6283139, -0.24138638, 0.81751156, 0.2257601, -1.2130985, 0.44707552, 0.0037308559, 0.5666142, -0.8444263, 1.204924, -0.65543765, -1.9701289, -0.8207577, 0.08641613, -0.4112931, -0.20802015, 0.87505317, -0.13793634, 0.07145847, 0.31840786, -0.092020944, -0.80500084, 0.58076894, 0.117715076, -0.67379886, 0.45848575, 0.4390001, -0.7055742, -0.712911, 0.33785975, 0.42191327, 0.121282555, 0.13419384, 0.17775199, 0.5506595, 0.67962146, 0.4780363, -0.03222577, -0.8667363, 0.8303137, -0.541459, 0.062450707, 0.03477095, 0.49735057, -0.3892, 0.8767689, -0.06756614, 0.35541242, 0.94193155, 0.8131012, 0.58299375, 0.1854296, -0.60147816, 0.4282838, 0.5299751, 0.7330451, -0.3257398, -0.58661395, 0.5521986, -0.606695, 0.44539154, 0.41345364, -0.023682468, 1.0244411, 0.8901564, -0.025144015, -0.6341725, -0.4240578, 0.31344998, 1.0556707, -0.7415066, -0.32343262, 0.1841922, 0.36124998, 0.5530684, 0.29907, -0.02951768, 0.19808297, 0.08838599, 0.05037989, -0.049141884, -1.1747736, 0.03532947, 0.07290274, -0.7062243, -0.027512219, -0.5645471, -0.034089435, 0.4769841, -0.5791185, -0.062474817, -0.5574461, -0.07675014, -0.58530134, 0.5648111, 0.7009718, 0.19080682, -0.37462634, -0.38008162, -0.8266342, -0.56594104, 0.6085925, -0.8169755, 0.2305794, 0.022104293, -0.32453218, 0.029340252, 0.12966694, -0.35197243, 1.0937076, -0.08106287, -0.630723, -0.07665277, 0.09807674, -0.15652439, -0.032777905, -0.59978753, 0.7365465, 0.8591844, -0.16815796, 0.8361499, 0.27674484, -0.3099411, 0.60480386, 0.23437774, -0.7338224, -0.9829839, 0.67439365, 0.742201, 0.42505273, -0.68957865, -0.47552192, -0.5682225, -0.5110189, -0.28437212, -0.565194, -0.19356139, 0.63973606, -0.014390081, -1.646161, 0.2918704, -0.4594489, -0.8228203, -0.16133638, 0.07148346, 0.9419251, -0.019150853, -0.4403408, -0.56392926, 0.12463045, 0.24700657, -0.19791731, 0.6058087, -0.5370069, -0.051276788, 0.9354616, -0.055462413, 0.050041005, -0.6077635, -0.68125796, -0.13532986, 0.36517376, -0.019653555, -0.03586552, -0.1600579, 0.67996794, -0.25741813, 0.9547673, -0.910809, -0.009982694, 0.7332152, -0.20394151, -0.09925252, 0.5988749, 0.10125684, -0.2892084, 0.09639569, -0.9270706, -0.14898436, 0.23913115, 0.7453801, -1.0168681, 0.80838275, -0.27111107, -0.14699328, -0.68104225, 0.19166322, -0.79916215, 0.43923154, 0.16553934, 0.33551145, -0.5704513, -0.070023894, -0.3918103, -0.17701462, 1.6619401, 0.674843, 0.23895527, 0.80687135, -0.01851894, -0.34060583, -0.58362544, -0.96381485, -0.19843449, 1.6370385, -0.44541967, -0.13564552, -1.7383175, 0.94101083, 0.4386875, 0.8844557, 0.7002662, -0.72894764, -0.6103935, -0.32648364, 0.054746274, -0.6872155, 0.18739484, -1.0520368, 0.6648933, -0.2648567, -0.06654116, -1.3043286, 0.22864798, -0.10361338, 0.594177, 0.5787685, 0.1750473, -0.0105097145, 0.91527426, 0.25346497, -0.27341178, -1.1472199, -0.31140554, -0.49403697, -0.13216135, 0.7429359, -0.57663065, -0.5814875, -0.46789917, 0.62059444, 1.0459176, 0.105841815, -0.8354111, -0.09153462, -0.4892223, -0.9736461, 0.03827665, 0.6993418, -0.5639835, 0.3098794, -0.8142145, 0.047523424, -0.21321937, -0.034833632, -0.010952409, -0.041929975, -0.28044957, 0.060209088, 0.50224316, -0.046635136, -0.85428065, 0.73049414, -1.4654225, 0.11870827, -0.66137636, 0.27924734, -0.7339802, -0.42894232, 0.17209588, 1.1703713, -0.1511008, -0.27938917, -0.13280374, 0.86497086, -0.4407706, -0.3784376, 1.2453586, -0.21126446, -0.15996158, 0.48933926, -0.27048388, -0.2984165, 0.7081715, 0.58110875, -0.06946933, -0.27087092, -0.23854852, 0.36320952, 0.3962092, 0.11321919, 0.10443739, -0.56340504, 0.49124345, 0.6088691, -0.70054543, -0.09448326, -1.4692224, 0.24175254, -0.18142638, 0.3656459, 0.3561722, 0.39745298, 0.35550624, -0.25403917, -0.8084114, -0.3391734, -0.14518976, -0.31460696, -0.8502122, -0.20892489, 0.040290922, 0.36273193, -0.76562995, -0.80031925, 0.060696647, -0.15262939, -0.061190173, -0.09423466, 0.6150074, -0.5358167, 0.3251421, 0.28123394, 0.7587028, -0.4789124, -0.10876167, -0.18576714, 0.49481302, -0.09939133, 0.20352225, -0.5852573, 0.6395335, -0.3011577, -0.8522485, -0.31254715, 0.5950347, -0.26513442, 0.70972127, 0.43091288, -0.041825093, -0.2292053, -0.6451991, -0.34200215, -0.41545817, -0.2689111, -0.9946734, -0.25178003, 0.6669945, 0.17163065, -0.15006264, -0.9421287, -0.019158833, -0.6975499, 0.438868, -0.6849216, 0.03262051, -0.44509438, 0.64882565, -0.5953382, 1.1495787, -0.8011461, 0.20847918, 0.1251037, 0.32168102, -0.21917565, 1.0629005, -0.92278206, -0.37890035, 0.4195118, -0.21815889, 0.2514746, 0.6282729, -0.14128427, 0.050928507, -0.35163182, -0.06737878, -0.9663225, -0.4687798, -0.59459, 0.21002933, 0.048163563, 0.48905462, 0.14316124, 0.028260775, 1.2529061, 0.14390653, -0.21695222, -0.7194682, -0.66993797, -0.70739895, -0.5410352, 0.8340246, -0.2935943, -0.23657572, -0.4150082, 0.20044121, 0.6332451, -0.4892323, -0.016682208, 1.8937812, 0.7091852, 0.14414868, -0.9804469, 1.2162073, 0.17216161, -0.50498605, -0.34003568, 0.16963801, -0.33994526, 0.0731189, -0.41613013, -0.94484633, -0.815923, -0.5739614, 0.94484705, 0.31987455, 0.14467219, -0.14761059, -0.7047535, -1.0639687, 0.40880874, 1.3001518, -0.23591296, 1.0019474, 0.69951487, 0.33188945, 1.2750803, -0.47983044, 0.033220377, 0.12004468, 0.9492074, 0.9103111, -0.052080557, 0.58394325, 0.8401497, -1.830512, -1.4265813, -0.17748688, -0.061487965, -0.1359964, -0.88339686, -0.37029758, -0.13061845, -0.2954845, 0.2814227, 0.25465572, -0.19771555, 0.09913704, -0.15107808, 0.011260349, -0.14225599, -0.11415321, 1.0593241, -0.7078028, 0.5747197, -0.4055798, -0.18129641, -0.47820956, 0.1952592, 0.22990699, 0.5002197, 0.10373032, 0.628042, 0.06865163, 1.0157357, -0.6903584, -0.15411828, 0.6126792, -1.4284332, -1.3705213, -0.07465902, -0.11910443, -0.13134138, 0.41676903, -0.21215296, -0.028965306, 0.3505228, 0.047843248, 0.30888152, -1.1421498, -0.08647778, -1.1076055, -0.78975534, -0.05059923, 0.058172554, 0.27877957, 0.3418617, 0.27528864, -0.0043393373, -0.425253, 0.21216352, 0.02201505, 0.46995455, -0.35277224, 1.1497868, -0.7000632, -0.49699458, -0.36768207, -0.08427355, -0.106513396, -0.15144402, -0.6940467, -0.6297557, 0.4525672, 1.2141936, -0.12161607, 0.24308786, -0.1425119, -0.38016897, 0.91598785, -0.41090524, 0.14860485, 0.28929144, 0.21543092, -0.84538454, 0.0807224, -0.2773164, 0.5301908, -0.7331233, 0.49941978, 0.5512182, -0.5476493, -0.18183059, -0.77233905, -0.15702356, -1.1651708, -0.21300837, 0.018835044, 0.32697025, 0.34967226, 0.51722765, 0.09109617, 0.61710453, 0.062239163, 0.056631085, 0.06611446, 0.46277747, 0.13079983, 0.08349137, -0.17646214, 0.26698142, 0.046738572, 0.6847735, 0.38814327, 0.014033079, -0.04680039, 0.292931, -0.8164349, 0.3852389, 0.19666976, 0.37969127, -0.23450008, 0.45247716, 0.4581556, -0.9366612, 0.5417323, -0.055298187, -0.6215795, 1.218463, -1.3511043, -0.7937524, 0.008464169, -0.9959098, 0.7161945, -0.25348237, -0.68490624, 0.39310396, 0.3586596, -0.7416965, -0.18592128, 0.30235815, 0.63015443, -0.33157557, -0.89634436, -0.5073603, 0.27419057, 0.112835586, 0.471214, -0.9042775, -0.41822886, 0.71185523, 0.6571464, 0.33782732, 0.15355957, -0.1364721, -1.0384371, 0.64586115, 0.5162391, 0.52103496, -1.1132919, 0.1564614, -0.35837764, 0.7777977, -0.5688318, -0.19020915, 0.12580645, 0.23848471, 0.050079808, 1.4870666, 0.74930036, 0.11167382, 0.51369834, 0.0912603, 0.03457948, 0.97924113, -0.2526727, -0.6790167, 1.0118998, 0.17009932, 0.59963554, 0.38631436, 0.5874571, 0.35385707, -0.49165446, -0.43353337, 0.29959297, 0.90330774, 0.008084901, 0.19826728, 0.035730332, -0.26280853, 0.49997848, -0.3445545, 0.25782338, -0.29269776, -0.7271916, -1.1451478, -0.3687011, 1.2749437, 0.28989944, -0.010594554, 0.20570764, -0.039815754, 0.7760036, 0.83210295, -0.37314057, 0.34827492, 0.33832714, 0.2549089, 0.3180246, 0.15750375, 0.37374565, 0.29076517, -1.084236, -0.2536879, 0.09893724, 0.167326, -0.42620236, -0.06183477, -0.85039747, 0.7655713, 0.5407811, 0.135566, 0.61822957, -0.658225, 0.060597345, -1.0510322, 0.29207668, -0.40406957, -0.06383139, 0.8471315, -0.3460373, 0.0568925, 0.42080507, 0.50762975, 0.29434744, -0.07577321, 0.5478096, 0.31866163, 0.77027106, 0.5869493, -0.4031725, 0.34900978, 0.03501825, -0.60266703, -0.12610222, 0.48031133, -0.843012, 0.4924527, -0.8623877, -0.6477808, 0.22316428, 0.52191186, -0.42713517, -0.4163384, 0.02406159, 0.19311489, -0.8280169, 0.7257932, 0.5891742, 0.6126962, -0.107232764, -0.07629745, -0.50356364, 0.6316943, 0.1606891, -0.70639515, -0.12811224, -0.4105088, -0.08755256, -0.40668, -0.5366433, -0.30879006, 0.10060625, 0.28111058, -0.71532774, -0.3630196, 0.59962934, 0.15385062, 0.36727977, -0.45993006, 0.22452451, -0.23574719, 1.6684455, -0.043385856, 1.6276766, -0.16736466, -0.12352954, 1.0252162, -0.27102458, 0.59440255, 0.26338896, -0.2930035, -0.61721444, 0.6569015, -0.34776017, -0.38311705, -0.4351132, 0.751855, -0.44927332, 0.28445652, -1.4778186, -0.5496483, -0.834149, -1.1146356, -0.8802563, 1.0398924, -0.14450291, -0.022082053, -0.009103067, -0.8312893, 3.564548, 0.31639445, 0.43401474, 0.63638914, 0.048858773, -0.24585214, 0.42760444, -0.627559, 0.36051834, -0.75384, 0.3967399, 0.078143656, 0.12599553, 0.86665404, 0.050567865, 0.92432106, -1.5632179, 0.19709128, 0.12208514, -0.078961484, -0.91890043, 0.23671533, 0.47289363, 0.19900943, 0.7240069, 0.16399404, 1.1182141, -1.0169126, -0.1350502, -0.46091932, 1.2807544, 0.35965964, 0.21481083, -0.3007364, -0.39301196, 0.9101389, 0.1932972, 0.15104347, 0.14832743, 0.27131686, -0.067170985, -0.6418764, 0.50354594, 0.25878644, -0.0033070669, 0.70426977, -0.6287618, 0.31597823, 0.45087764, -0.04529953, 0.8379618, -0.3591785, 0.56057227, -0.5669976, -0.84720474, -0.052068297, -0.16401154, 0.30864736, -0.8251212, 0.22997884, -0.28843462, 0.20421404, -0.10270865, 0.12777951, -0.34080166, 0.28729475, 0.63097245, 0.62922233, -0.23039082, -0.9737556, -0.37730604, 0.021021312, -0.18025522, -1.0727465, 0.0019658804, 1.0562756, -1.0607209, 0.55097324, -0.095470026, -0.16923568, 0.29799882, 0.13360816, -0.015510071, -0.3002998, 0.29892552, 0.5038376, 0.07581481, -0.25795814, -0.26878086, -0.018943973, 1.1134932, 0.84816736, 0.07172927, -0.119864315, 0.16197601, 0.55967194, -0.1490119, 0.35443506, -0.12817872, -0.7264169, 0.35164982, 0.5088061, 0.36944637, 0.75947386, 0.22153465, -0.0902444, 0.35916293, -0.22257099, -0.6245021, -0.66597265, -0.2242328, -0.47101194, -0.09299229, -1.0377257, -0.21733049, -0.32486138, -0.23556301, -0.9277732, 0.023987524, -0.5385696, -0.002912309, 0.6834146, 0.06879748, 0.26568368, 1.1300062, -0.17972237, 0.1250636, -0.06957579, -0.9457501, -0.10762876, -0.7763465, 1.5165349, -0.51138073, -0.53803205, -0.7513938, -0.16054633, -0.057135716, 0.56398803, -0.7251428, -0.9011231, -1.1330264, -0.009565931, -0.46391025, -0.3945485, -0.019825712, -0.214825, 0.662374, 0.4089401, -0.25013703, -0.11175172, -0.3359659, -0.73787993, -0.44064045, -0.95422965, 0.24658713, 0.5482323, 0.44154587, 0.15066868, -0.90368706, 0.16147381, 0.23279902, 0.41150323, -0.14870353, 0.4448821, 0.3361582, -0.5416869, 0.66956925, 9.3244016E-4, -0.58035725, -0.9133776, -0.21026349, 0.47709528, 0.559402, -0.096517116, 0.34964085, 0.021026324, -0.052352354, 0.2260392, 0.083108045, -0.82103014, -0.49560097, 0.13991357, 0.72335935, -0.22744378, -0.17416112, -0.06924981, 0.1720519, -0.056980915, -0.0040308535, 0.4777559, 0.34662804, -0.6132766, -0.1805803, -0.58219105, -0.5035861, 0.743928, 0.62252325, -0.43229088, 0.42164406, -0.7834892, 0.19773507, -0.68034565, 0.15410969, -0.46971694, -0.5955516, 0.23321742, 0.61164176, -0.10516539, 0.581982, -0.7406695, 0.31757313, -0.69854766, 0.9880034, -0.84722793, -0.7633326, 0.4578721, 0.10518447, 0.16203061, -0.6790652, -0.47155732, -0.38882074, -0.9170391, 1.0266749, -0.17550212, -0.4792506, -0.0668991, 0.39064267, 0.0947658, 0.8043089, -0.22434905, -0.313821, 0.052670494, -0.048851267, 0.32592362, -0.860603, 0.2698992, 0.3433336, -0.21785763, 1.5819844, 0.88469046, 0.07691138, 0.09752565, -0.42556408, -0.04519853, 0.87291956, -0.6176682, -0.2865502, 0.20136131, 0.36512914, -0.3311012, -0.30614272, -0.26107365, 0.1894452, 0.32637066, 0.35523584, -0.06667226, 0.10347664, -0.11940256, -0.10296476, -0.38421103, 0.6074242, 0.18352178, 0.015820663, -0.14712866, -0.20719282, 0.6038181, -0.15472703, -0.039784297, 0.059039198, 0.4398168, 0.68517715, 0.592921, -0.48001018, 0.29964036, 0.059656337, -0.36691985, -0.11802984, -0.16027823, 0.8514473, 0.061800294, -0.24240336, -0.00616711, -0.2318474, -0.27456677, -0.20014185, 0.39548382, 0.08403352, -0.6075959, 0.7013164, -0.24715367, 0.7730584, -0.5263237, 0.6818461, -0.4345966, -1.9885256, -0.57651246, 0.3897464, -0.22896479, 0.029132985, 0.62822366, -0.3221436, -0.24454945, -0.13972506, 0.07538301, -0.43282226, 0.29167226, 0.26169014, -0.22840403, 0.12716646, 0.5241455, -0.67354554, -0.23412356, 0.1583346, 0.09397203, -0.6005605, -0.062070902, 0.519738, 0.56230676, 0.19490737, 0.09140409, 0.2827071, -0.7554103, 0.9776802, -0.28762445, -0.16992666, -0.27326876, 0.5205804, -0.39026648, 0.8100204, 0.2251311, 0.3743077, 0.41226578, 0.28279757, 0.10248689, 0.78833973, -0.39051318, -0.035605595, 0.6300383, 0.67743725, -0.18472652, -0.3580135, 0.14300483, -0.36656314, 0.09548992, 0.6840508, 0.53377825, 1.0797411, 1.0701865, -0.14112248, -0.1359908, -0.52505445, 0.2282274, 0.8130599, 0.10876868, -0.5497892, -0.06409781, -0.12850465, -0.08437914, -0.348632, -0.55334604, -0.057698317, -0.020369263, 0.0053720847, 0.16307293, -0.8254809, -0.10885659, -0.54735035, -0.9688062, -0.2985726, -0.051860273, -0.13334262, 0.35509858, -0.8054574, -0.28351018, -0.68802255, 0.17037089, -0.7018103, 0.8101351, 0.96281683, -0.053284153, -0.42187208, -0.41856027, -0.7051473, -0.43084157, 0.46245623, -0.6828755, 0.13075721, -0.12911314, -0.28247756, 0.683695, 0.07331526, 0.008655533, 1.0331321, 0.41872248, -0.43458146, 0.11952154, 0.4864054, -0.4770374, -0.672267, -0.7951411, 0.90124786, 0.38761422, -0.06815794, 0.4979946, 0.3519773, -0.51443356, 0.47134402, 0.32008561, -0.52492595, -0.5968779, 0.91214985, 0.62872326, 0.25207788, -0.78720355, -0.65435094, -0.3022893, -0.026059672, 0.03250689, -0.4841232, -0.21127056, 0.94293606, -0.31384826, -1.024962, 0.4258807, -0.5591192, -0.85103065, 0.07572705, -0.029542465, 0.9386782, -0.01834616, -0.41138232, -0.41427138, 0.080845095, -0.021675527, -0.25335732, 0.85154873, -0.83299226, 0.010143421, 0.7232927, 0.60553235, 0.1309088, -0.3839781, -0.5941144, -0.45264992, 0.38672507, 0.21139218, 0.34125578, -0.30670395, 0.5510206, 0.19656421, 0.7967939, -0.61074483, 0.032774314, 0.4495337, -0.4416033, 0.04436638, 0.19213377, 0.25077653, -0.1421333, -0.07981576, -0.80517834, -0.44514215, 0.12253037, 0.5937313, -0.7326427, 0.7710463, -0.47982028, -0.026294831, -0.27366686, 0.59971505, -0.88799405, 0.34242895, 0.011235021, 0.68797493, -0.31184798, -0.2491819, -0.39411223, -0.37572742, 1.597634, 0.5555229, 0.53293955, 0.85264903, -0.014117359, -0.04914263, -0.32758757, -0.42537898, 0.016268618, 1.7822325, 0.014657244, -0.33223224, -1.4506384, 0.8279289, 0.63178736, 0.70278394, 0.16083482, -0.11632228, -0.42550898, 0.2825111, 0.050327733, -0.62059164, 0.24553949, -0.84764546, 0.5793387, -0.19014005, 0.18559122, -0.60808384, -0.22480549, -0.10949272, 0.4119357, 0.48874575, 0.10797066, 0.14826402, 0.95159596, 0.1007035, -0.28172037, -0.78677756, -0.2911378, -0.39184836, 0.18129729, 0.14663315, -0.6903422, -0.6197286, -0.22756599, 0.4553, 0.7559648, -0.19024116, -0.7333675, -0.22558317, -0.10755519, -0.8364387, -0.24587573, 0.61560297, -0.116256624, 0.09515799, -0.61133057, -0.60270244, 0.11373564, -0.478234, 0.054566797, 0.21379222, -0.20055366, 0.4200289, 0.38137415, 0.57250637, -0.8365286, 0.46541566, -1.5011121, 0.007360235, -0.7604555, 0.0025998056, -0.5833547, -0.07466688, 0.39678958, 0.96836436, -0.2345093, -0.18433093, 0.3012629, 0.2799663, -0.70134974, -0.48911846, 0.7690916, -0.06511322, -0.49618146, 0.3662134, -0.6264914, -0.22856562, 0.24773872, 0.3183567, 0.13739681, 0.07009312, 0.23409715, 0.34881467, -0.33139125, 0.28852808, -0.095444344, -0.51926076, 0.51465845, 0.2062692, -0.5242261, -0.46329415, -0.9741153, 0.06456158, 0.030457906, 0.14805505, 0.17728561, 0.27969873, 0.4174524, -0.53553534, -0.050896656, -0.7748257, 0.07999295, -0.064726844, -0.6482009, -0.16539901, 0.52794135, 0.2680578, -0.54837555, -0.846483, -0.1018344, 0.2759287, 0.01647371, -0.30559725, 0.77830505, -0.42698085, 0.22914001, 0.29629123, 0.9014104, -0.6857988, -0.02880317, -0.27855328, 0.5116826, -0.09280562, -0.026375346, -0.82933587, 0.29830056, 0.10016385, -0.9599105, 0.06670639, 0.32166743, -0.12561196, 1.15202, 0.17707397, -0.08005495, -0.039337177, -0.2968356, -0.12169429, -0.36883074, 0.2049313, -0.6679535, 0.031608433, 0.52695143, 0.007821337, -0.1485552, -0.62809414, 0.13040474, -0.15451281, 0.54773754, -0.4706813, 0.24263154, -0.1301415, 0.67641205, -0.62720996, 0.8313544, -0.7381075, -0.14358105, 0.3762475, 0.62239164, -0.045437563, 0.9459873, -0.8233303, -0.7147683, 0.46758357, -0.52135533, 0.06063361, 0.56855184, -0.507306, -0.036665827, -0.6302179, 0.07766994, -0.942735, -0.5909925, -0.2635432, 0.5478883, -0.07890162, 0.32488316, 0.26487243, 0.46853012, 1.1034807, -0.06512659, 0.33847657, -0.61609834, 0.06321365, -0.22743702, -0.87944865, 0.37845594, -0.020726902, -0.59833187, -0.42895967, -0.11077006, 1.0032699, -0.1725022, 0.32639518, 1.6419518, 0.21870343, 0.1484011, -0.7495263, 0.5773338, 0.1948407, -0.26478645, 0.31931522, -0.02530934, -0.18381046, 0.039240766, -0.3821348, -0.880036, -0.40542898, -0.5050127, 1.0508015, 0.6978597, 0.27783167, 0.43318307, -0.686163, -0.95909375, 0.39126918, 0.736118, 0.010625005, 0.4478026, 0.5347271, -0.28854454, 0.7788674, -0.65132344, 0.028316252, -0.24979532, 0.3684371, 0.8357179, -0.35869396, 0.24370271, 0.33024335, -1.4370449, -1.2778331, 0.19882585, -0.017336432, -0.4316948, -1.2735684, -0.26503587, -0.015060261, -0.6085152, 0.22704697, 0.26457584, -0.42646304, 0.03879311, -0.19615118, 0.44677356, -0.32433823, -0.084605284, 1.198679, -0.51367915, 0.36138633, -0.26781407, -0.25285503, 0.10098021, -0.24817827, -0.18135414, -0.17848538, 0.35427713, 0.521286, -0.02674108, 0.4217017, -0.08987662, 0.25608358, 0.50207585, -0.98633564, -1.0628304, -0.3846806, 0.022207262, -0.1283618, 0.37523708, -0.24025467, 0.5153696, 0.46323073, 0.13989824, 0.1561494, -0.77944976, -0.44046345, -0.63301426, -0.34989792, 0.13549271, 0.006190121, 0.24559984, 0.31742877, 0.1545193, -0.44265345, -0.08644013, 0.28001422, 0.15021466, 0.85503155, -0.76575583, 0.86318636, -0.55829847, -0.25753778, -0.7185067, -0.085994214, -0.18091784, 0.446105, -0.77112305, -0.4430915, 0.2551184, 1.1472955, -0.40047967, 0.35478163, -0.4045759, -0.48856065, 0.7408055, -0.13986495, 0.09953445, 0.2774477, 0.2467106, -0.42283788, 0.21039721, 0.10461013, 0.31418386, -0.6786972, 0.964533, 0.6333979, -0.42829648, -0.2897507, -0.9437793, 0.067182526, -0.99148446, -0.31607157, -0.5791597, 0.04460093, 0.2817655, 0.21890405, -0.0091788955, 0.614969, 0.21509607, 0.26194388, -0.028229192, 0.6323737, 0.3229837, -5.941242E-4, 0.1451681, 0.3452308, 0.26828063, 0.82891965, 0.6615142, 0.15845887, -0.1930975, 0.32330292, -0.49461275, 0.33965734, 0.5015075, 0.22370936, -0.038758203, 0.33031383, 0.64308834, -0.22973657, 0.40101275, 0.1735294, -0.62445706, 0.63983095, -1.0835669, -0.59931755, -0.25685513, -1.0129862, 0.148363, -0.3387562, -0.7876695, 0.36497584, 0.4875883, -0.46318775, -0.30246222, 0.24639976, 0.3614344, -0.4353444, -0.7491151, 0.03876262, 0.014877375, 0.5000705, 0.48863775, -0.5708522, -0.29530814, 0.39000627, 0.18866692, 0.13831648, -0.38619447, -0.5484635, -1.1455809, 0.14575654, 0.41666955, 0.17747879, -0.8406549, 0.13223548, -0.45904288, 1.1353003, -0.26693252, -0.12810816, 0.37510347, -0.29213232, -0.43941584, 0.9184803, 0.6855956, 0.2599459, 0.6948795, -0.0708392, -0.12901774, 0.55323, -0.5387498, -0.716477, 0.42386472, 0.12503567, 0.6216118, 0.10394464, 0.8343109, 0.65234077, -0.41163832, -0.39263293, -0.108594045, 0.4115751, 0.16237709, 0.28965876, -0.07473482, -0.23911166, 0.2871039, -0.6131977, 0.513528, -0.11655871, -0.6466727, -1.1273916, -0.19115873, 1.4469596, -0.020101145, -0.11192806, 0.01993516, 0.26601622, 1.1657052, 1.008147, -0.6360585, 0.12956598, 0.9011077, 0.26741764, 0.13538633, -0.082566485, 0.21531783, 0.26441088, -1.1124214, -0.27627683, 0.34551474, 0.15321879, -0.21587288, -0.29057226, -0.5665258, 1.2804754, 0.5072227, 0.2061311, 0.39224344, -0.48967192, 0.2075164, -1.2929554, 0.22832677, -1.1763334, 0.05883432, 0.5320689, -0.19186282, -0.067902, 0.5984157, 0.33769348, 0.24878782, 0.11002658, 0.33792466, 0.547646, 0.7538705, 0.59686947, -0.19582872, 0.39902282, -0.3311249, -0.74637324, -0.14266883, 0.43165115, -0.6139184, 0.29811418, -0.7535113, -0.30266273, 0.53370935, 0.36760342, -0.5749821, -0.68662786, -0.2779321, 0.37260574, -1.1336465, 0.6302474, 0.47815326, 0.9866135, -0.14947067, -0.033082485, -0.2046695, 0.20482336, -0.21032988, -0.52653766, 0.0245497, -0.47625363, -0.12423223, -0.12356821, -0.32638925, -0.0979994, 0.0010491088, 0.29562947, -0.6457077, -0.10971795, 0.06126561, 0.8076332, 0.2573005, -0.21695858, 0.46280462, -0.5214897, 1.3339914, 0.23493724, 1.6153331, 0.18739215, -0.35449666, 0.6756968, -0.35441598, 0.49293745, -0.08351409, -0.24639843, -0.57777464, 0.98248875, 0.0011553783, -0.68022805, -0.1735664, 0.5991789, -0.5056995, 0.28030026, -1.3956647, -0.29886672, -1.040315, -0.6200091, -0.55999726, 0.4394985, 0.25020325, -0.030757431, 0.41339186, -0.99428976, 4.134183, 0.21829394, 0.2768517, 0.24642767, 0.027245255, 0.22640549, 0.47818106, -0.79617405, 0.4751648, -0.4929724, 0.5096883, 0.14533526, 0.087542474, 0.42481625, -0.26212215, 0.94900197, -0.995192, 0.37323165, 0.48663512, 0.16938138, -0.9202455, 0.32618392, 0.3355089, -0.12735334, 0.39952835, -0.4738593, 0.17960149, -0.8438873, -0.15847224, -0.28993642, 1.529727, -0.06471403, 0.040852357, 0.038847372, -0.25056893, 1.0816733, -0.30027992, 0.33796108, 0.057108454, 0.27828, -0.07463636, -0.7907264, 0.89314646, 0.11971448, -0.2797623, 0.56961, -0.5983841, 0.07197225, 0.6231197, -0.16240701, 0.8118333, -0.10884293, 0.36955264, -0.30067077, -0.54466736, 0.23035151, -0.11903405, 0.15843613, -0.9551723, -0.008313894, -0.09104793, -0.34124452, 0.019560076, 0.22333694, -0.46288738, -0.06519584, 0.8732297, 0.4417033, -0.3591715, -0.79684395, -0.18898311, -0.00398656, -0.32608062, -0.624982, -0.43221474, 0.7961611, -1.0244153, 0.6864666, -0.38873324, -0.66227776, 0.18808874, -0.2118657, 0.12453443, -0.20756744, 0.2250452, 0.5361353, -0.38134813, -0.12358688, -0.50916564, 0.06882605, 0.5491102, 0.6088567, 0.043271434, 0.034038477, -0.14568043, 0.34731272, 0.27437162, 0.4291449, -0.5072562, -0.6460547, -0.17843097, 0.4998613, 0.4862506, 0.48174888, 0.43009067, -0.07885784, 0.25953156, -0.44193333, -0.2746965, -0.72802746, -0.24735373, -0.46056688, -0.08113882, -1.2671432, 0.05059053, -0.43514493, 0.09988372, -1.3890023, -0.5439976, -0.5726784, 0.042483523, 0.45590004, -0.12616622, 0.629282, 0.96405625, -0.42434147, 0.29803038, -0.16519342, -0.9395849, -0.230326, -0.83917814, 1.4581625, -0.57237923, -0.5016961, -0.5101177, 0.03989938, -0.16089517, 0.91115934, -0.69840354, -1.4957484, -0.25355923, 0.24498278, -0.03987664, 0.28695616, 0.33610544, 0.42031482, 0.26267177, 0.26665464, -0.036663882, -0.3205201, 0.08044999, -1.3707422, -0.10242602, -1.2773657, 0.44744903, 0.4707493, 1.1146326, 0.52519447, -1.0453299, 0.22108254, 0.3916083, 0.51568663, 0.2354028, 0.50902164, 0.15007426, -0.6983879, 1.0460291, 0.11031413, -0.68165857, -0.867732, 0.08759557, 0.32828143, 0.90392447, -0.74337864, 0.6990192, 0.12273654, 0.1353184, 0.41217592, 0.24795906, -1.3185968, -0.7651147, 0.103916384, 0.6086596, -0.29084563, 0.022982366, 0.28086853, 0.55208766, -0.31949097, -0.01541844, 0.81749123, 0.83401155, -0.14799729, -0.33081663, -0.8713344, -0.20599653, 1.2038018, 0.81881714, -0.62137777, -0.08521465, -0.9437865, -0.19047725, -0.9235109, 0.07554969, -0.54554856, -0.72309697, 0.10257645, 1.2262453, 0.11698446, 0.5399791, -0.6098297, 0.077516764, -0.1635267, 0.7329004, -0.6491352, -0.43532693, 0.13268438, -0.062738866, -0.037672497, -0.6150539, -0.792422, -0.32316244, -1.1831503, 0.8048623, 0.43596715, -0.80266297, 0.20404984, 0.040005, 0.51196873, 0.61864376, -0.3671871, 0.039022297, 0.08777553, 0.34561458, 0.48366174, -1.1842922, 0.108419, 0.09672105, -0.4544338, 1.6715314, 0.8024864, 0.38295293, 0.11245011, -0.13004047, -0.25588313, 0.9442645, -1.106852, -0.3146361, 0.17383303, 0.26125604, -0.836142, -0.2676666, 0.09179972, -0.11250311, 0.35692418, -0.074471295, -0.117300734, 0.47520566, -0.5543069, 0.32387045, -0.66126156, 0.395984, -0.23777974, 0.31760883, -6.269303E-5, -0.42587698, 0.3092674, -0.26971295, 0.12728855, -0.09048116, 0.3214799, 0.6557833, 0.40655518, -0.043354645, 0.23725055, 0.05158411, -0.5487681, 0.47276476, -0.42214486, 0.96318287, 0.101917736, 0.04613815, 0.37172058, 0.35901445, -0.55353534, -0.28215954, 0.646838, 0.055748854, -0.94629276, 0.52053577, -0.096165426, 0.68151516, -0.86083305, 1.2210809, -0.61603034, -1.8547043, -0.70553493, 0.08560893, -0.32475078, -0.07537295, 0.9242262, -0.3031748, -0.039215017, 0.48975095, 0.07386944, -0.635114, 0.5792452, 0.11396569, -0.79614615, 0.47500247, 0.22382374, -0.7640738, -0.7832393, 0.32251167, 0.2957459, 0.19379763, 0.1966333, 0.19957598, 0.47575438, 0.72345144, 0.2891014, -0.07611428, -0.7970295, 0.68839777, -0.65931904, 0.18129885, -0.1070019, 0.4440913, -0.3229485, 0.87062204, 0.0016378155, 0.34254807, 1.0556462, 0.9242675, 0.3841158, 0.19424327, -0.5399717, 0.45922905, 0.4348209, 0.7463028, -0.23992652, -0.60218215, 0.26373464, -0.48176405, 0.3577192, 0.30109936, 0.18007952, 0.97340673, 0.8311445, -0.091018654, -0.43556908, -0.47817314, 0.24427673, 0.86847204, -0.63367134, -0.1392084, 0.20880738, 0.29605484, 0.5102095, 0.0539689, 0.025343515, 0.24565774, 0.20760463, -0.14849266, 0.07748646, -1.0975155, -0.2468316, 0.049564585, -0.81448174, 0.07844066, -0.5533479, -0.12086342, 0.34281364, -0.47970983, 0.012860723, -0.20691025, -0.09066814, -0.6537314, 0.488608, 0.72847027, 0.43217465, -0.3573188, -0.2835165, -0.7994006, -0.60978246, 0.6759259, -0.74162185, 0.021587722, 0.2148367, -0.31782195, 0.15477072, 0.073249355, -0.2504549, 0.9304441, -0.109614864, -0.39431396, -0.13444294, 0.113385625, -0.17943051, -0.13110475, -0.6351985, 0.8168083, 0.7287063, 0.046382003, 0.78491753, 0.12041721, -0.44125587, 0.65859365, 0.1417125, -0.62944174, -0.8578431, 0.5297364, 0.5970799, 0.32134923, -0.6988253, -0.3988505, -0.53683966, -0.5645854, -0.26411146, -0.54879487, -0.08550332, 0.5523895, 0.09527285, -1.4829303, 0.42620313, -0.32207206, -0.80331665, -0.14081834, 0.14321318, 1.0547477, -0.014484324, -0.3733287, -0.6547246, -0.22136927, 0.23872378, -0.114890546, 0.52663624, -0.36137518, -0.10336557, 0.84902483, 0.24802007, 0.2428974, -0.55062777, -0.898774, -0.086360104, 0.42273575, 0.01069665, 0.03268071, -0.22184242, 0.68654114, -0.31356922, 0.99203634, -0.8053663, 0.024493441, 0.52120054, -0.14788416, 0.16501157, 0.71239144, 0.10519813, -0.23112617, -0.30074418, -0.7945606, -0.32828715, 0.1546241, 0.71328896, -0.8631298, 0.6879144, -0.25349656, -0.15505737, -0.52401733, 0.026135508, -0.91197675, 0.4897887, 0.2553321, 0.38357615, -0.5817329, 0.10147074, -0.14365219, -0.07878406, 1.460639, 0.76415765, 0.44990405, 0.9951974, -0.10996676, -0.43003532, -0.6043866, -0.97104216, -0.10857196, 1.7999303, -0.2487742, -0.23330228, -1.9624965, 0.8282924, 0.3562973, 0.99590814, 0.710325, -0.74927074, -0.47313, -0.23652235, 0.17110118, -0.64118886, 0.18618682, -1.0815334, 0.4417191, -0.27619588, 0.13438608, -1.2182668, 0.09222232, -0.046028994, 0.5128414, 0.6309838, 0.17811278, 0.08257908, 0.82218415, 0.24052832, -0.3043413, -1.1845739, -0.31409425, -0.5495012, -0.102475435, 0.6949858, -0.60669345, -0.5356563, -0.12042385, 0.51972234, 0.9788067, 0.27975333, -0.6509743, 0.08709107, -0.3396774, -1.0324789, 0.21493271, 0.64101464, -0.4424937, 0.35320687, -0.8626394, 0.018576376, -0.14504273, 0.0675314, -0.09590454, 0.14231923, -0.32527098, 0.15347226, 0.50280917, -0.12097482, -0.93272054, 0.6082158, -1.5437937, -0.07995024, -0.6858374, 0.39547303, -0.5739462, -0.52489924, 0.041147597, 1.3033543, -0.17370999, -0.22331943, -0.12098679, 0.7863538, -0.6103873, -0.3908378, 1.0210451, -0.33337703, -0.335317, 0.679813, -0.03252794, -0.46655637, 0.58323187, 0.526237, -0.17061844, -0.47416002, -0.35893548, 0.4063307, 0.32042253, -0.0637602, 0.13230446, -0.44979116, 0.5168601, 0.33988982, -0.7665607, 0.0853706, -1.2825401, 0.35769534, -0.21235913, 0.25373393, 0.2737563, 0.4383112, 0.26156312, -0.18157701, -0.82445776, -0.54746836, -0.19033858, -0.14472756, -0.8237075, -0.20849845, 0.09290561, 0.45805925, -0.60196894, -0.9694583, 0.22632071, -0.15821098, -0.07559876, -0.13461533, 0.6933839, -0.32768452, 0.3443336, 0.31391212, 0.9203925, -0.36575687, -0.20933554, -0.31347826, 0.5546571, -0.016795274, -0.092404574, -0.5469727, 0.6365913, -0.43841305, -0.8389967, -0.036488578, 0.61133695, -0.3538103, 0.76916534, 0.2602567, 0.04585594, -0.20960002, -0.69782466, -0.073778585, -0.4628681, -0.31100827, -1.194452, -0.15880762, 0.61074346, 0.01697435, 0.08602919, -1.0204202, -0.1064734, -0.5719034, 0.3842537, -0.61645734, 0.005817363, -0.5069963, 0.73048353, -0.58076227, 1.1014149, -1.002687, 0.26485753, 0.001325082, 0.23775855, -0.1090179, 0.8222375, -0.8824368, -0.60530984, 0.38780227, -0.18472426, 0.18662238, 0.6539168, -0.08568022, 0.0025433525, -0.35558033, 0.019322174, -0.88901633, -0.6802375, -0.69873244, 0.29876226, 0.03279008, 0.41753015, 0.15544944, 0.136213, 1.1869895, 0.13588208, -0.24654882, -0.68050987, -0.6760854, -0.6779837, -0.68511623, 0.96097136, -0.5064433, 0.005498264, -0.47417802, 0.14546248, 0.7594362, -0.367512, -0.098296344, 1.961263, 0.35767633, 0.03230954, -0.69004714, 1.1331533, 0.27895185, -0.49140096, -0.07016089, 0.16740261, -0.34845498, 0.25857598, -0.37114236, -0.92653924, -0.78350365, -0.41225216, 0.69445866, 0.34486955, 0.093205795, -0.066756755, -0.64549917, -1.1127244, 0.37053987, 1.1387469, -0.23592287, 0.80528295, 0.63944227, 0.54414797, 1.0815576, -0.5668222, 0.089382716, 0.13776606, 0.9200868, 0.8992326, -0.27931058, 0.48805022, 0.82883877, -1.7794003, -1.3662231, -0.16744435, 0.084341876, -0.107593, -1.017171, -0.3791846, -0.14377698, -0.27979684, 0.51328593, 0.26247755, -0.27690327, 0.076862276, 0.0780327, -0.07342488, -0.061520025, 0.0024008472, 0.8332128, -0.6966219, 0.4901986, -0.24039306, -0.14298935, -0.24950793, 0.12527625, 0.29839414, 0.7389395, 0.15047178, 0.58706343, 0.12560952, 1.0310695, -0.5962883, -0.18943071, 0.6150714, -1.2840291, -1.3595079, -0.15191634, -0.25942472, -0.17627351, 0.3720213, -0.10289232, 0.056950808, 0.3213657, 0.3321522, 0.053539947, -1.0371126, -0.052774735, -0.87331986, -0.7267541, 0.051209338, 0.1441378, 0.31906247, 0.46871975, 0.18395185, -0.0692848, -0.42856544, 0.01773473, -0.1260064, 0.71401536, -0.27404174, 1.3056145, -0.61608034, -0.3932829, -0.24632904, 0.010613654, -0.21523128, -0.08095754, -0.4983497, -0.626685, 0.64032483, 1.0719864, -0.35518745, 0.31677714, -0.09860298, -0.29361737, 0.98726356, -0.28703505, 0.37888417, 0.2140752, 0.36996755, -0.71319747, 0.2214708, -0.3875488, 0.37793255, -0.7721462, 0.6461019, 0.6115026, -0.5304169, -0.17443098, -0.70448905, -0.021181267, -1.0428503, -0.34047216, -0.06293756, 0.17875059, 0.28179625, 0.44505474, 0.16711755, 0.6964868, 0.2429418, -0.048931554, 0.101600535, 0.29270682, 0.14754868, 0.040776677, -0.2830106, 0.24993977, 0.18217126, 0.5031197, 0.6458861, 0.08088947, -0.06821887, 0.2294434, -0.6025328, 0.4214955, 0.02959657, 0.31607035, 0.048564933, 0.36561626, 0.4328048, -1.0279614, 0.5526877, -0.3101868, -0.7041938, 1.2670145, -1.0038794, -0.7538339, -0.051289015, -0.99725854, 0.54648906, -0.11038782, -0.8033994, 0.31729695, 0.11359299, -0.5800839, -0.29594612, 0.130738, 0.6961497, -0.31145877, -0.6745281, -0.3327659, 0.3130085, 0.12843235, 0.3653333, -0.8100079, -0.22264737, 0.5917342, 0.86295915, 0.3166489, 0.16683327, -0.26316214, -0.8232067, 0.5095601, 0.20595878, 0.45409048, -0.8229478, 0.10812789, -0.47012043, 0.8713862, -0.64504915, -0.24139825, 0.0829124, 0.30529198, -0.04502464, 1.3450638, 0.87469786, 0.1282358, 0.21878737, 0.5608324, -0.023736248, 0.8814906, -0.2450681, -0.64366734, 0.987674, 0.47663254, 0.72472185, 0.20790745, 0.4268311, 0.3406033, -0.40542594, -0.44307786, 0.21143325, 1.1998398, -0.04269371, 0.032475434, -0.028270632, -0.28937843, 0.63828766, -0.4257946, 0.30673802, -0.20225716, -0.8918963, -1.081641, -0.446235, 1.3505905, 0.28334346, -0.113350704, 0.10584864, 0.13026781, 0.9782037, 1.2069069, -0.59382397, 0.13534994, 0.20910484, 0.3964433, -0.08584341, -0.18862218, 0.29279798, 0.10304643, -1.0189443, -0.48712122, 0.089892246, 0.40033635, -0.43739498, -0.09577835, -0.8914217, 0.5634942, 0.46147624, 0.18333669, 0.5018127, -0.57141834, 0.22123447, -0.984082, 0.73240864, -0.42637298, 0.14858729, 0.58898765, -0.41788393, 0.15860158, 0.5590106, 0.5476727, 0.38015527, -0.06930857, 0.63783866, 0.19000062, 0.5320519, 0.85254997, -0.25869924, 0.36578634, 0.059271112, -0.82330275, -0.10596946, 0.32942462, -1.0458459, 0.47975013, -0.9814856, -0.54931, 0.12817167, 0.4720524, -0.60098046, -0.5558935, -0.07903196, 0.08017051, -1.0334187, 0.72646886, 0.28693724, 0.6514715, 0.017122403, 0.059414208, -0.43003318, 0.61294556, 0.15250102, -0.6344637, -0.124711365, -0.40405872, -0.21501787, -0.5084465, -0.6109873, -0.29131338, 0.21077976, 0.4723583, -0.6350576, -0.42727095, 0.3745004, 0.2436617, 0.16013308, -0.266916, 0.41006523, -0.13443582, 1.4617592, -0.09403017, 1.6679444, -0.113599226, -0.1766919, 1.1128019, -0.4637022, 0.6026775, 0.3295456, -0.26246035, -0.58322674, 0.63749, -0.29790995, -0.4552287, -0.34962073, 0.4757661, -0.38596824, 0.40881908, -1.6522696, -0.56499016, -0.9354418, -1.0565773, -0.9105244, 1.0067492, 0.12771598, -0.004504431, 0.23984769, -0.66904426, 3.6624045, 0.2592154, 0.27187067, 0.5508017, -0.10568046, -0.2670927, 0.5288961, -0.6268612, 0.20718782, -0.9910453, 0.4760573, 0.0844937, 0.11704531, 0.7277677, 0.06835682, 0.9558804, -1.4853053, -2.8017908E-4, 0.11895311, -0.11955248, -1.2167906, 0.5527989, 0.5219648, 0.25548583, 0.5149375, 0.123984054, 1.0438063, -1.0745394, -0.09779909, -0.5746613, 1.2606201, 0.4869489, 0.02342626, -0.30612367, -0.4081654, 0.54757965, 0.18535367, 0.089302, 0.14784724, 0.33126256, -0.024330921, -0.46541923, 0.44284585, 0.052763782, 0.093688585, 0.49122953, -0.9165186, 0.34113777, 0.31382066, -0.054380115, 0.8466793, -0.28731346, 0.28629318, -0.57786727, -0.5250714, -0.15221663, 0.029823096, 0.40237293, -0.7914292, 0.24210334, -0.42463204, 0.25620586, -0.21277969, -0.050531507, -0.18733416, 0.16404244, 0.696484, 0.25563902, -0.18624108, -0.8773365, -0.56324744, 0.31544864, -0.31330204, -0.8109294, -0.13510668, 0.9721738, -1.0318075, 0.26569387, 0.038234264, -0.31428084, 0.22263722, 0.06329511, -0.15759473, -0.36926627, 0.17948699, 0.5136905, 0.01984401, -0.19416128, -0.38064262, -0.37309346, 1.102059, 0.7792553, 0.060157903, -0.108390525, 0.11017364, 0.3994228, 0.09555158, 0.5825012, -0.60580367, -1.0827808, -0.1576766, 0.7572717, 0.51690817, 0.76832026, 0.5623794, -0.5242806, 0.10713714, -0.28198227, -0.3057894, -0.4436093, 0.0508234, -0.67036074, -0.50983393, -1.126107, 0.10048007, -0.28169256, 0.06555464, -1.1903594, -0.55183387, -0.4405081, -0.17009944, 0.5612562, 0.047636222, 0.37082034, 0.65144277, -0.21440561, 0.19920659, -0.08983047, -1.3184719, -0.21471508, -0.77892214, 1.0248505, -0.60647166, -0.48059314, -0.38415653, 0.33976716, 0.0074042156, 0.3431964, -0.7637138, -1.562081, 0.21412212, 0.41796106, -0.21860333, -0.036963142, -0.15398574, -0.067759186, 0.6621827, 0.14345872, -0.10131864, -0.15699252, 0.3062003, -0.93177044, 0.110051446, -1.2522842, 0.80647933, 0.19306532, 0.93869627, 0.41989905, -1.2128512, 0.048087396, 0.43417054, 0.51452124, 0.22957322, 0.6538078, 0.045719445, -0.49581295, 0.6129913, 0.2330572, -0.76418656, -0.59514874, 0.10234557, 0.34008834, 0.93430877, -0.7938407, 0.3488256, -0.095158495, 0.39193368, 0.32834923, -0.1460364, -1.1935029, -0.7402658, -0.06672922, 0.34790787, -0.24937785, -0.09675882, 0.54674053, 0.29830703, -0.25361973, 0.26495603, 0.8386657, 0.93270355, -0.30766344, 0.10872549, -0.54271966, -0.2646044, 0.80850345, 0.80533385, -0.3436443, -0.15843843, -1.1156524, -0.37078837, -0.9744277, 0.38333637, -0.7051673, -0.4906921, 0.054198608, 1.0482272, -0.16283801, 0.28291935, -0.2076324, 0.24571949, -0.42660946, 0.6194447, -0.5943218, -0.2044191, 0.80598855, 0.033541154, -0.16847873, -0.4267447, -0.5693771, -0.32211003, -0.80143666, 0.52846223, 0.42857355, -0.2879928, 0.25050047, 0.05486901, -0.059970193, 1.0365646, -0.21031526, -0.2751096, 0.4085902, 0.5967447, 0.46310297, -1.244204, 0.2939693, -0.06727497, -0.65307546, 1.6378098, 0.6602727, 0.3331953, -0.5972358, -0.16830699, -0.4092154, 0.9061645, -0.70522636, -0.30478314, 0.21947536, 0.30807325, -0.5290096, -0.021191731, -0.048273534, 0.052654807, 0.4325883, -0.002106417, 0.22604083, 0.6506453, -0.4128863, 0.06486968, -0.5109035, 0.6262629, -0.59054273, 0.54796576, -0.078081556, -0.22457956, 0.10496932, -0.7126875, -0.07178986, -0.014613241, 0.25202245, 0.6094514, 0.7096744, 0.17859364, -0.07159945, -0.10782984, -1.0702442, 0.2905703, -0.06708715, 0.73710424, 0.025326883, -0.04851279, 0.2838625, 0.100776896, -0.47360796, -0.23008478, 0.7629225, 0.4038585, -1.1927986, 0.7186655, 0.17397834, 0.66196936, -0.3637218, 1.0107775, -0.55020744, -1.4909959, -0.56990623, 0.30201685, -0.20511222, 0.2730165, 0.73218584, 0.048040986, -0.044010743, -0.15303451, -0.17348513, -0.39569393, 0.6480931, 0.10182218, -0.5377528, -0.012679113, -0.007665368, -0.65783006, -0.6718512, 0.36023977, 0.50482917, 0.112826176, -0.16764028, 0.09783888, 0.54286546, 0.82194656, 0.32949015, -0.10446587, -0.66156757, 0.44045573, -0.6881772, -0.12748857, 0.011206888, 0.5880827, -0.3310844, 0.60313576, 0.24298477, 0.18763687, 0.6665168, 0.8176408, 0.63851047, 0.7703525, -0.38874447, 0.29319334, 0.21659724, 0.67248577, -0.04747004, -0.75138336, -0.032682426, -0.58525085, 0.6164005, 0.5252805, 0.067715034, 0.77593464, 0.5756692, 0.01080169, -0.5409408, -0.18088111, 0.28055167, 0.7370628, -0.061915897, -0.14930114, 0.42736712, 0.07878585, 0.6338375, 0.028980128, -0.018971909, 0.24936385, -0.10556009, -0.007052973, -0.08535256, -1.1767282, -0.25823215, -0.16164792, -0.59529424, -0.04154039, -0.43678924, 0.16663226, 0.3614608, -0.4110936, -0.12785242, -0.561177, -0.49575725, -0.53649414, 0.55716574, 0.9938018, 0.3834205, -0.4088232, -0.16438262, -0.8488413, -0.68160176, 0.48920587, -0.35171676, 0.17286812, 0.14482836, -0.4438081, 0.34934083, -0.11522612, -0.18400648, 0.9550849, 0.19140965, -0.25227302, 0.060297303, -0.0070842654, -0.15262157, -0.484868, -0.6926102, 0.84828264, 0.91567695, 0.0016165003, 0.6874639, 0.023342803, -0.5647343, 0.4872593, 0.36987463, -0.53967863, -0.7367035, 0.6690624, 0.36760825, 0.41536736, -0.70216143, -0.78941077, -0.46292698, -0.32272416, 0.00408322, -0.569716, -0.0982589, 0.7778945, -0.22264656, -1.2859204, 0.14981261, -0.4571321, -0.84205663, -0.3931107, -0.13485941, 0.7186496, -0.11406441, -0.19351138, -0.3396683, -0.12722772, 0.0022645625, -0.023715228, 0.7800383, -0.23587298, 0.32181016, 0.6075423, 0.20606756, 0.08583229, -0.3835686, -0.76363343, 0.11516355, 0.26286107, 0.15805645, 0.010979824, -0.28352818, 0.42406383, -0.06747039, 0.7641131, -0.8182565, -0.031834044, 0.59817415, -0.556535, -0.13097134, 0.45006514, 0.45921433, 0.18680452, -0.2353987, -0.39224648, -0.20950153, 0.44744873, 0.7575571, -0.99211806, 1.0048358, -0.21880436, -0.29180026, -0.4883183, 0.11914819, -0.45420957, 0.5537008, 0.038552634, 0.28215736, -0.6505611, -0.05639731, -0.22432365, -0.0753257, 1.534879, 0.6527801, 0.33230194, 0.5043558, -0.17230092, -0.5368485, -0.60196584, -0.972783, -0.35474154, 1.5653621, 0.13357976, -0.23607488, -1.9256357, 0.99502707, 0.56387746, 0.95426637, 0.44848073, -0.6578555, -0.5840174, -0.21664485, -0.06438644, -0.6586791, 0.713435, -0.7542643, 0.4121706, -0.47967133, -0.5214753, -0.86162406, -0.41749653, 0.16635127, 0.67231923, 0.63377875, 0.060160317, -0.16357699, 0.70590246, 0.24508043, -0.31862876, -1.0028367, -0.1415234, -0.4981313, -0.07634404, 0.5626511, -0.5439674, -0.41470236, -0.32987338, 0.38528684, 0.8707138, 0.61265385, -0.7561777, -0.058350243, -0.29060918, -0.8828205, -0.32191333, 0.7171919, -0.6715127, 0.25353637, -0.85777193, -0.22826701, -0.10268143, -0.3677761, -0.21263666, 0.39470083, -0.50553197, 0.104695916, 0.38097295, 0.37870398, -0.7951013, 0.5898909, -1.4096434, 0.18723375, -0.67144465, 0.08446455, -0.32043055, -0.21069425, 0.060452625, 0.89954424, -0.33245453, 0.060212478, -0.16919714, 0.51581824, -0.46913767, -0.43260145, 0.8914732, -0.17595634, -0.39337397, 0.5862695, -0.165371, -0.41703492, 0.2300126, 0.8531972, 6.863475E-4, 0.018732369, -0.19274993, 0.11807219, 0.16294602, -0.13752386, 0.17776681, -0.7283606, 0.5255629, 0.21245965, -0.61398387, -0.019701332, -1.1922736, 0.072056726, -0.15926456, 0.06668207, 0.6565079, 0.3800544, 0.2927567, -0.18829279, -0.47632927, -0.5828585, -0.2932791, -0.32696068, -0.44982386, -0.1601027, 0.23962039, 0.35986, -0.6936998, -0.4130165, -0.028386503, 0.1189172, -0.23614475, -0.13688965, 0.8730439, -0.3260798, 0.6230809, -0.009794818, 0.64238536, -0.30446264, -0.1213474, -0.21677762, 0.64032716, -0.09058951, 0.32761735, -0.8952577, 0.7286184, -0.28435072, -1.0795968, 0.07461093, 0.5260262, 0.081124514, 1.1400597, 0.20557263, -0.22531477, -0.013032559, -0.63784456, -0.25429648, -0.43621144, -0.25980812, -0.68846905, 0.018888742, 0.40777546, 0.31415194, -0.06978384, -0.83367103, -0.47623697, -0.50554305, 0.050676435, -0.54136133, 0.09123197, -0.46119207, 0.8309509, -0.9467837, 1.3522601, -0.56323236, 0.04193849, -0.083614424, 0.65520114, -0.07264876, 1.2610217, -0.6354654, -0.54056776, 0.70698595, 0.00911441, 0.20147234, 0.8186352, -0.38808322, -0.081993535, -0.18767877, 0.27850354, -0.8085504, -0.6826043, -0.70434916, 0.28125268, -0.00417158, 0.1764245, 0.1252622, 0.13679127, 1.1405021, -0.16482627, -0.04663332, -0.58190393, -0.45656186, -0.49414352, -0.6545142, 0.7316151, -0.75474155, -0.13049766, -0.78929186, -0.1713476, 0.68869865, -0.1354918, -0.12297894, 1.374426, 0.53188884, -0.19543867, -0.7560643, 0.7825549, -0.20464867, -0.6691693, -0.024741076, 0.15538393, -0.20939259, 0.09335803, -0.32170793, -0.9581545, -0.3086296, -0.45974192, 0.9343871, 0.28155223, 0.026325535, 0.3607343, -0.51085424, -0.68860966, 0.51546973, 0.9578018, -0.32939222, 0.88570464, 0.8727469, 0.282832, 1.3196431, -0.46789652, 0.18751012, -0.009741772, 0.7062707, 0.7235945, -0.44040543, 0.32659394, 0.82885027, -1.513391, -1.0347612, -0.31969503, -0.17150323, -0.31322023, -1.0168256, -0.39043573, -0.32385135, -0.62966126, 0.4967361, 0.14318325, -0.02364469, -0.18822855, 0.36839056, 0.31844568, -0.25449395, 0.2378134, 1.1323748, -0.57734036, 0.57482517, -0.25512508, -0.3082748, -0.19442557, -0.1397948, -0.37038362, 0.7746373, 0.19150639, 0.057238307, -0.5009022, 0.7646541, -0.3515749, -0.1592197, 0.671271, -1.4349705, -0.87009597, -0.58153695, -0.0132568665, -0.26201454, 0.46259606, -0.24323648, 0.4780776, 0.24452041, 0.022693053, 0.21807481, -1.0536666, -0.3690221, -0.9724109, -0.5958498, 0.2780582, 0.17680575, 0.30712324, 0.33505383, 0.24084339, 0.3497074, -0.066905096, -0.046884567, -0.19839972, 0.49531293, -0.1463247, 0.68853134, -0.57161236, -0.5265372, -0.46173963, -0.29136887, -0.09823992, -0.25131285, -0.49662158, -0.29860687, 0.4173069, 0.61001307, -0.23230451, 0.33880717, -0.38124043, -0.62723, 0.7280858, -0.41596067, 0.12235218, -0.046359077, 0.1374916, -1.0030403, 0.076998085, 0.010334268, 0.16277502, -0.75184274, -0.045661084, 0.6897451, -0.5234157, -0.20258962, -0.35811937, -0.16314638, -1.2877578, -0.29840237, 0.11212779, 0.1864383, 0.30804637, 0.47436863, 0.07938605, 0.23727947, 0.15619943, 0.15607107, 0.3661412, 0.19492516, 0.52977335, 0.14330177, -0.39681092, 0.1595948, -0.17317334, 0.92330325, 0.95668155, 0.16457509, -0.082535796, 0.33720917, -0.6979915, -0.18996246, -0.18736917, 0.0076782946, 0.04778067, 0.4375449, 0.4449576, -0.5646165, 0.4824912, -0.73924667, -0.41778222, 1.228386, -1.4113506, -0.5091015, 0.018879347, -1.0306215, 0.3441526, -0.29703033, -0.76199734, 0.48998946, 0.0538232, -0.6444448, -0.55421084, 0.46473855, 0.41143027, 0.023548841, -0.5623564, -0.15067895, 0.5425395, 0.02348781, 0.33763394, -0.99986434, -0.40732938, 0.64412487, 0.61347324, 0.1844104, 0.060828157, 0.19362581, -0.89388067, 0.44956368, 0.61369896, 0.52955574, -0.93781817, 0.3274699, -0.2934738, 0.886754, -0.7060228, -0.09946883, 0.28589666, 0.38918224, 0.019775577, 0.8416462, 0.60078466, 0.22841358, 0.7777619, 0.048576668, 0.12920377, 0.708591, -0.17719474, -0.62505966, 1.0092452, 0.61805975, 0.53742653, 0.11385523, 0.30024686, 0.50781274, -0.65055555, -0.3315245, 0.089441545, 0.6801583, -0.055591352, 0.5085515, 0.080202654, -0.6231575, 0.7095781, -0.09222566, -0.0023482144, -0.2301088, -0.78504163, -0.89850014, -0.61895406, 1.4755174, 0.44006103, 0.3736515, 0.2789185, 0.3126807, 1.0981504, 0.5982582, -0.5319362, 0.2933641, 0.59055275, 0.449096, 0.09719907, 0.23644274, 0.4262668, 0.19561322, -0.99225354, -0.27452955, 0.0054776296, 0.42809853, -0.3454189, 0.024061855, -0.7582559, 0.4612135, 0.5061168, 0.16127184, 0.2933835, -0.74961704, -0.08755819, -1.038512, 0.52964205, -0.6356245, -0.039177597, 0.8408139, -0.43552092, -0.22568429, 0.6004227, 0.5666311, 0.34723854, 0.17451535, 0.46295786, 0.57787806, 0.5428326, 0.93625444, 0.25844303, 0.71137315, -0.17457405, -0.9393191, -0.0062135123, 0.7324282, -0.8502125, 0.21925573, -0.6307975, -0.40189654, 0.27061498, 0.65880245, -0.59898424, -0.7496212, 0.03331019, 0.19341184, -0.50549847, 0.76212996, 0.35790926, 0.7870286, -0.0400087, 0.055058934, -0.5947467, 0.26547173, 0.13392746, -1.1119648, -0.17382655, -0.5744398, 0.111572, -0.59631276, -0.62594944, -0.097791016, -0.35199642, 0.2313174, -0.58278424, -0.08641501, 0.34744838, 0.34512728, 0.500954, -0.7685111, 0.46870387, -0.10193086, 1.6084917, -0.03636925, 1.4086537, -0.063865475, -0.0015128739, 0.92001283, -0.38939625, 0.45528454, 0.31051323, 0.1577892, -0.5681765, 0.7005183, -0.5051335, -0.34040785, -0.28615594, 0.8032139, -0.46363586, 0.21622391, -1.2667955, -0.29988098, -0.81864244, -0.8201505, -1.1678752, 0.75056106, 0.098227546, -0.010810759, -0.014191384, -0.42939845, 3.9035187, 0.15681595, 0.2582419, 0.4887771, 0.1525703, -0.02428957, 0.66500604, -0.5359085, 0.22960104, -0.7852579, 0.15039048, 0.06367845, 0.3528753, 0.9337709, -0.20073745, 1.0146337, -1.0692636, -0.24778748, 0.23142752, -0.14437445, -1.2041767, 0.28693214, 0.37165838, -0.035585634, 0.52149665, -0.11201562, 0.60554165, -1.043031, 0.06837402, -0.4101506, 0.8253852, 0.12620798, 0.22745697, -0.13505921, -0.45202237, 1.1835434, 0.25073954, 0.1395775, 0.10847205, 0.25401965, -0.37892976, -0.6354462, 0.36379182, 0.1980045, 0.09259137, 0.7982754, -1.1515712, -0.24035174, 0.6636571, -0.15318638, 0.58441776, -0.48915377, 0.5170015, -0.2060879, -0.7129818, -0.1414245, -0.43068886, 0.18446523, -0.9598793, -0.2197116, -0.19919111, 0.12266955, -0.10918245, 0.35740358, -0.3485523, -0.22071102, 0.5921739, 0.5802294, -0.22553721, -0.7331374, -0.5409138, 0.4591624, -0.25060326, -0.6027513, 0.1528463, 1.0014454, -0.9771162, 0.30428672, -0.31012374, -0.36872467, -0.45164657, 0.3022587, -0.3332075, -0.05958897, 0.5864512, 0.29134268, -0.2936555, 0.14974032, -0.21069044, -0.21046856, 1.0327365, 0.87497103, -0.29114136, -0.12409274, 0.30638078, -0.008108355, -0.074863106, 0.1823267, -0.92456347, -1.2252402, 0.023988292, 0.29588172, 0.28956586, 0.92870545, 0.6245167, -0.17748761, 0.49881747, -0.0013700202, -0.6062493, -0.5211433, -0.044155214, -0.58735853, -0.3184926, -1.1066936, 0.31925192, 0.055742487, -0.11290029, -1.2357664, -0.013144705, -0.5662862, 0.06639056, 0.35374135, 0.38557136, 0.20628467, 0.5110246, -0.42163143, 0.12925106, -0.24695382, -1.1608903, -0.15010446, -0.3606254, 1.2112582, -0.5199689, -0.24509984, -0.57505196, 0.06266602, -0.05476774, 0.5543311, -0.6631306, -0.90839344, 0.056663997, 0.39264026, 0.006514296, -0.03379453, -0.06360012, 0.2962194, 0.43456346, 0.29512823, 0.15175281, 0.034137387, -0.15923557, -0.86211294, 0.07326408, -0.80600816, 0.67977273, 0.49671376, 0.6821382, 0.27394387, -1.536363, 0.57825166, 0.7842151, 0.2394658, 0.09236379, 0.6696022, 0.22107342, -0.5844541, 0.68800783, 0.35063517, -0.7489135, -0.84657335, 0.13539974, 0.011126772, 0.83486915, -0.3726464, 0.38500214, 0.15931323, 0.24204169, 0.31334576, -0.38999516, -1.0564649, -0.8066621, 0.32243422, 0.08050046, -0.100161314, 0.1417718, 0.26810834, 0.27799317, -0.24338469, -0.1273042, 0.47630495, 0.761901, -0.31447634, 0.0041330475, -0.6132874, -0.35413107, 0.50921535, 0.92908055, -0.7377505, 0.17884433, -0.97206813, -0.31223825, -1.1257086, 0.054560035, -0.5985438, -0.5419079, 0.34310243, 1.1592656, 0.12414108, 0.6306039, -0.29405472, 0.36001867, -0.26069996, 0.6843612, -0.69717747, -0.25637287, 0.7413816, -0.09426433, 0.007948817, -0.05839423, -0.37699413, -0.54838955, -0.5196219, 0.7450251, 0.5604553, -0.19528422, 0.153679, -0.037510846, 0.21829069, 0.63829726, -0.11303048, 0.0413495, 0.42149734, 0.5452131, 0.12912615, -0.9724758, 0.47631884, -0.11178413, -0.78062665, 1.6786276, 0.88644165, 0.25348303, -0.57685983, -0.10731165, -0.6602384, 0.66389215, -0.7689, 0.1496639, 0.6415253, 0.500464, -0.24878055, -0.07939838, 0.13462633, 0.013040431, 0.73763734, 0.06980479, -0.18928413, 0.6980672, -0.33711007, 0.115530476, -0.61564434, 0.2487322, -0.04897301, 0.13430814, -0.2164018, -0.3666767, -0.095899746, -0.44386792, -0.17055167, -0.036105186, 0.43075958, 0.534845, 0.17878997, 0.06367618, -0.05834858, -0.2430348, -0.6089918, -0.047322188, 0.080885276, 0.5262991, -0.21075973, 0.10692868, 0.13799505, 0.08237328, -0.60258526, -0.51029414, 0.716713, 0.27913976, -1.1312143, 0.69941586, 0.08650997, 0.6624551, -0.70263344, 1.0370399, -0.4800526, -1.3264769, -0.5724056, 0.48490354, -0.36758322, 0.14180458, 1.0191479, -0.16142865, -0.15934804, -0.06126994, -0.12419982, -0.2052495, 0.46710333, 0.25446153, -0.09749228, 0.2416552, 0.13107337, -0.62425584, -0.4665196, 0.41823313, 0.017742202, -0.11604845, -0.014583001, -0.04743681, 0.48962507, 0.5726147, -0.15344103, -0.043124318, -0.4611046, 0.5476682, -0.6814534, -0.13700399, -0.25768772, 0.47459337, -0.5468129, 0.964742, 0.26113805, 0.29224998, 0.69866586, 0.5390306, 0.23548684, 0.5616739, -0.4996161, -0.0531639, 0.15483534, 0.3004987, -0.15385841, -0.6523655, 0.52095807, -0.61126125, 0.29399925, 0.022592522, 0.0036164224, 0.9010767, 0.66380125, 0.22740883, -0.8602492, 0.067954, 0.3547017, 0.4408105, -0.13458662, -0.23914078, 0.20854351, 0.24268481, 0.46751034, 0.36705163, 0.043406673, 0.036361203, 0.05552602, -0.071449906, 0.041502196, -1.2105745, -0.028304726, -0.039797705, -0.66858214, -0.088372126, -0.5237669, 0.16090764, -0.04407379, -0.6910071, 0.054006502, -0.28989974, -0.24306267, -0.61034966, 0.5553436, 0.6809772, 0.096716136, -0.51710796, -0.098939195, -0.3180539, -0.32514825, 0.38779578, -0.7734561, 0.15372227, 0.087640285, -0.4327031, 0.096745, -0.06493625, 0.029305357, 1.0426801, 0.116323724, -0.46691078, 0.011199217, 0.1469512, -0.108034305, -0.24094029, -1.0067587, 0.86667746, 0.681321, -0.34006357, 0.6885098, 0.21300186, -0.55701715, 0.582534, 0.26671684, -0.28656054, -0.7581177, 0.83850646, 0.6659291, 0.63540286, -0.82415324, -0.76791, -0.42685413, -0.1978186, 0.1188646, -0.35998422, -0.4153101, 0.63527155, 0.012389898, -1.5216818, 0.10454872, -0.15033387, -1.1138442, -0.363461, -0.31349632, 0.73108214, -0.13952224, -0.29330423, -0.40340406, 0.19570658, -0.13253699, -0.15259932, 0.8772184, -0.6289534, 0.24124396, 0.8863129, 0.013752261, 0.11636713, -0.2878188, -0.6748302, 0.26673093, 0.074429825, 0.18423261, 0.33583167, -0.31168482, 0.18303514, -0.110326886, 1.0521882, -0.8914687, -0.041218713, 0.7925176, -0.38259062, 0.0699002, 0.39020306, 0.3406126, -0.025504138, 0.030163972, -0.8205811, 0.27958557, 0.42331424, 0.7152617, -0.5693195, 0.79709387, -0.052060973, -0.2502512, -0.5891158, 0.43469584, -0.41373527, 0.6146908, 0.076879665, 0.31544682, -0.5227765, 0.08362824, -0.23998299, -0.06326865, 0.977748, 0.699623, 0.34662923, 0.4053547, -0.57229793, -0.360397, -0.68081236, -0.89546853, -0.38550287, 1.4982802, 0.1295377, 0.03139779, -1.4845395, 0.6942864, 0.52807, 0.8333225, 0.49081743, -0.3854397, -0.5561076, -0.2873355, 0.35955435, -0.40604037, 0.3067069, -0.9793556, 0.54424125, 0.05487563, -0.17266905, -1.1705602, 0.23105747, -0.096690014, 0.66326594, 0.50486475, -0.104512066, -0.17203951, 0.84721786, 0.010612169, -0.2766949, -0.7051157, -0.4017008, -0.63575864, 0.06809341, 0.36169913, -0.83321065, -0.3977779, -0.75799507, 0.45688114, 0.8228988, 0.3614043, -0.3872057, -0.23848563, -0.2693749, -0.90534234, 0.062407956, 0.79575527, -0.28577504, 0.11576642, -0.85940045, -0.2364341, 0.09936187, -0.6178453, -0.2623395, 0.4881133, -0.96528625, -0.002703242, 0.32168373, 0.23600036, -0.5019947, 0.62138635, -1.4865868, -0.15790486, -0.6669983, 0.06801675, -0.5628619, -0.31371945, 0.6114257, 0.96458405, -0.064005196, -0.219717, -0.09132044, 0.547687, -0.633611, -0.21194346, 0.5262808, -0.2213456, -0.47458994, 0.39729577, -0.15099177, -0.43005282, 0.53780806, 0.54377115, -0.124503836, -0.3869376, -0.4276981, -0.017099984, 0.10659635, 0.023432303, -0.023488503, -0.5943924, 0.44783092, 0.21988973, -0.2587016, 0.054121852, -0.98205125, 0.66049236, -0.1100941, 0.40253222, 0.4989391, 0.18264665, 0.024417441, -0.1577205, -0.33052993, -0.40380287, -0.3190465, -0.432463, -0.36828405, -0.5821203, -0.027871974, 0.3407156, -1.0126361, -0.44199046, -0.089746, 0.19934487, 0.24793631, 0.07480049, 0.3483074, -0.468999, 0.49423718, -0.024303712, 0.7697083, -0.5001096, 0.02921876, -0.2797136, 0.5004291, -0.19378904, 0.33850992, -0.5845366, 0.54080933, -0.4231968, -0.8276037, -0.21587685, 0.4471876, 0.17945103, 0.8905926, 0.45168063, 0.120928615, -0.19128208, -0.9465436, -0.4261623, -0.56029624, -0.15703607, -0.70728654, -0.37483913, 0.49776262, 0.25170207, 0.12126787, -1.2433228, 0.06759076, -0.42357254, 0.37723503, -0.37966526, 0.16530818, -0.6875407, 0.6304193, -1.0195813, 1.1075277, -0.78990626, 0.39701256, 0.0069374703, 0.7567582, -0.09521173, 0.67897403, -0.46449107, -0.7232551, 0.6319999, 0.13682938, 0.38638604, 0.4707066, -0.36580908, 0.2677807, 0.34033567, -0.1596111, -0.9749413, -0.37226206, -0.6223806, 0.2617854, 0.103502214, -0.008744709, 0.051227644, 0.351737, 1.1481045, 0.14042997, -0.5311719, -0.49255943, -0.8199234, -0.64042944, -0.21486312, 0.6096419, -0.52185607, -0.2824444, -0.79940456, 0.1712943, 0.4599559, -0.08197235, 0.35854346, 1.6623292, 0.45101458, -0.066510625, -1.0427458, 0.62489176, -0.22252423, -0.5163516, 0.07532082, 0.13290837, 0.13375865, -0.16612516, -0.15780056, -0.94008225, -0.29751578, -0.57456505, 1.1763555, -0.05414252, 0.37103045, 0.19796538, -0.43615937, -0.68003327, 0.3122042, 1.2015585, -0.24554463, 0.8153871, 0.7607808, 0.059229776, 1.3229659, -0.24295142, 0.17053288, 0.048269182, 0.9410707, 0.9070906, 0.06965003, 0.27366185, 0.8945579, -1.2575924, -1.2471954, -0.5133816, -0.03719949, -0.040453598, -0.6262046, -0.22496824, -0.5460526, -0.6761229, 0.38598374, 0.30903018, 0.3048585, 0.05681765, 1.035404, 0.3265798, -0.65159935, 0.012538631, 1.1262999, -0.5801894, 0.6140626, 0.030489383, -0.20633727, -0.091095164, 0.07008093, 0.20600188, 0.42286634, 0.24940234, 0.336841, -0.28344682, 0.15419483, -0.45846593, -0.2657172, 0.30148643, -0.9636932, -0.83163893, -0.15322179, -0.083657995, -0.24991873, 0.2650725, -0.21684909, 0.45393792, 0.2698332, 0.0074559078, 0.4958383, -0.61557376, -0.25072846, -1.2557454, -0.6115327, -0.24550119, -0.04877276, 0.06557663, 0.3164962, 0.2010736, 0.20483038, 0.098864615, 0.4129772, 0.24178419, 0.45724168, -0.4674123, 0.8200659, -0.50947297, -0.449177, -0.30873096, -0.00341261, -0.05515168, -0.5907586, -0.33790907, -0.651591, 0.40981805, 0.7774349, -0.11609654, 0.120979905, -0.17329918, -0.36349046, 0.5757807, -0.30231762, 0.16941534, 0.18787259, 0.016418763, -0.9578842, -0.080765896, -0.023937378, 0.13233513, -0.6668092, -0.18915473, 0.6900721, -0.81779176, -0.3249238, -0.19014584, -0.26334095, -0.9522248, -0.020303745, -0.1590526, 0.45100468, 0.30653527, 0.19623548, 0.3372883, 0.4808515, 0.053027716, 0.039079703, 0.063242614, 0.1595489, 0.36108032, -0.06620808, -0.37538713, 0.023618475, 0.01085633, 0.69008404, 0.27196503, -0.04092282, -0.2127317, 0.2757614, -0.30057618, 0.18570052, -0.19186738, 0.3087836, -0.25180426, 0.26582882, 0.4608781, -0.21650104, 0.2283323, -0.31646472, -0.692105, 1.3698722, -1.257715, -0.45968327, 0.08766882, -0.62902015, 0.52597046, -0.24926928, -0.85368836, 0.53539294, 0.18897045, -0.8144592, -0.24593538, 0.45442003, 0.43394864, -0.021025106, -0.56448966, -0.48068237, 0.57226974, -0.1455751, 0.3920177, -0.805578, -0.3599915, 0.36887014, 0.40636414, -0.38607797, 0.25946122, -0.5041137, -0.7237108, 0.20406774, 0.26659763, 0.50632215, -1.1882919, 0.31482235, -0.16788547, 1.0427362, -0.30384532, 0.25440946, 0.36111465, -0.04078348, -0.08545423, 0.92903745, 0.4287195, 0.38892937, 0.6466388, 0.011067346, 0.10231955, 0.72308904, -0.13572344, -0.31354204, 0.68488604, 0.4170978, 0.42884508, 0.10300704, 0.7566359, 0.17373186, -0.41658837, -0.43844083, -0.086458325, 0.52654135, -0.043467827, 0.6249003, -0.25258037, -0.729916, 0.6514588, -0.21865344, 0.05354707, -0.038330674, -1.0014257, -0.64724433, -0.36293414, 1.4632056, 0.2517041, 0.034037836, 0.24289103, 0.09087169, 0.8479298, 0.55847895, -0.71819776, 0.22156405, 0.59628755, 0.092399985, -0.04420072, -0.3075664, 0.30672166, -0.07358368, -0.9896834, -0.030702464, 0.45216998, 0.23109157, -0.3755612, 0.16779788, -0.6244628, 0.7411318, 0.24217345, 0.17737857, 0.48295784, -0.8859237, -0.24001184, -0.75387233, 0.67960876, -0.83024853, -0.14399245, 0.8452935, -0.3518325, -0.047979936, -0.02630499, 0.5509351, 0.4625635, -0.16918442, 0.30742225, 0.16386184, 0.67220664, 0.6280037, 0.28628358, 0.5660928, -0.1181638, -0.7434205, 0.20981479, 0.30287597, -0.69003713, 0.2184324, -0.76819944, -0.6346251, -0.08185301, 0.4818785, -0.51540446, -0.41744098, -0.09777721, -0.13589545, -0.60600513, 0.5247147, 0.3843186, 0.7094564, -0.16184524, -0.10725272, -0.4548275, 0.19113028, -0.047529392, -1.2795435, 0.17554286, -0.11416066, 0.13803561, -0.15642008, -0.6183412, -0.09616114, -0.37894952, 0.41909993, -0.662439, -0.114946306, 0.24334419, 0.22668067, 0.12224765, -0.63632286, 0.09084573, -0.23651299, 1.572324, 0.2178188, 1.1743072, 0.07571864, -0.1768858, 0.46413594, -0.48011255, 0.60569423, 0.15971124, 0.15805168, -0.9414262, 0.52399147, -0.007178193, -0.5215467, -0.59056896, 0.8559839, -0.2467039, -0.12033293, -0.9019515, -0.59779, -0.7349234, -0.8292922, -0.8635217, 0.5185263, -0.14540526, -0.26934415, 0.09875953, -1.1647751, 4.1182427, 0.46481997, 0.20087855, 0.9354643, 0.105424814, -0.004540026, 0.31147802, -0.6534193, 0.49501762, -0.45092684, 0.26379517, 0.448524, 0.34865677, 0.33569512, -0.016880259, 0.931842, -1.0148392, 0.20927775, 0.27847856, 0.15899846, -1.0693281, 0.1423664, 0.25981626, -0.025161192, 0.37412122, -0.29079884, 0.65601414, -1.0225062, -0.09605144, -0.14980899, 1.4953828, -0.1718415, 0.4066242, -0.08655246, -0.24063088, 1.2393714, 0.30284256, 0.36995012, 0.13408722, 0.30496278, -0.46151608, -0.6467823, 0.6863592, 0.3977234, 0.24254265, 0.30088937, -0.91632855, 0.22041345, 0.21627867, 0.036953487, 0.8198882, -0.38644162, 0.5111023, -0.6528836, -0.05132746, -0.048061155, -0.6670724, 0.32652795, -0.93728834, 0.17837188, -0.07624923, 0.18451518, -0.23230648, 0.34793568, -0.30258647, 0.12964638, 0.51428103, 0.8286943, -0.33250588, -0.6536644, -0.5854663, 0.42078778, 0.0033747032, -1.1266797, 0.10867215, 0.7423345, -0.83774376, 0.77926403, -0.058730222, -0.47217268, -0.092801005, 0.33792138, -0.05150798, -0.31443495, 0.27053922, 0.27824974, -0.11275067, -0.09057309, -0.2926527, 0.06173639, 1.3071758, 0.4730829, -0.14173776, -0.5784081, 0.2668654, 0.23815082, 0.28242433, 0.4774975, -0.54650855, -1.0264833, -0.47225332, 0.8703695, 0.63991624, 0.74452734, 0.42014164, -0.03533741, 0.06514102, -0.09643583, -0.8522862, -1.026076, 0.2499778, -0.42779097, -0.22190364, -0.076258555, 0.44808066, -0.71214545, -0.33959672, -1.3720645, 0.32767367, -0.713407, 0.7200092, 0.54970694, 0.038314663, 0.31601653, 0.82536983, -0.3402146, -0.15020594, -0.38107064, -1.594133, -0.20284157, -0.5158298, 1.4197085, -0.8124861, -0.42961958, -0.9616828, -0.31844, 0.09133983, 0.83976585, -0.69099605, -0.7764937, -0.5044535, -0.021224841, -1.0946624, 0.061164968, -0.008315772, -0.09962118, 0.7529673, 0.13280208, 0.32369834, -0.018207334, 0.30298617, -1.3468391, -0.010767452, -1.2652732, 0.3044045, 0.6346315, 0.41673356, 0.3533945, -1.4007373, 0.73925, 0.4769547, 0.45146942, -0.17096666, 0.53908443, 0.1459171, -0.5496129, 0.8112877, 0.22813308, -0.86315006, -1.0600767, 0.49666116, 0.6343291, 0.9384711, -0.67448175, 0.65366536, 0.12925006, 0.32494718, 0.7210598, -0.119817495, -1.8780767, -1.1060218, 0.26940116, 0.8603358, -0.37159148, 0.22237892, -0.026965573, 1.4551806, -0.04102008, 0.18953791, 1.2205132, 1.3830074, -0.6203029, 0.105550446, -0.9172137, -0.2631466, 1.2078451, 1.1561841, -0.88699704, 0.33485472, -1.1039261, -0.15662864, -0.8889108, -0.021704465, -0.7190207, -0.4444397, -0.09743556, 1.0252041, 0.27867004, 0.47697592, -0.25137198, 0.8654594, -0.5946547, 1.1985759, -0.7184543, -0.37799215, 0.8081364, 0.13715135, 0.03568732, -0.6331051, -0.65091616, -0.63724107, -1.1073422, 0.83576024, 0.01433241, -0.25773996, 0.19880387, 0.26008373, 0.12768374, 1.1019219, -0.48458183, 0.046535883, -0.06099293, 0.5994473, 0.82844126, -1.4832599, 0.76427746, 0.2744197, -0.63113993, 3.4523046, 1.0266101, 0.27708215, -0.41686982, -0.5191848, -0.06873581, 1.3051794, -1.1570866, -0.13528334, 0.36869058, 1.023516, -0.06851939, -0.42901027, -0.061269097, 0.34303978, 0.78846973, -0.10224266, -0.26698807, 0.36766642, -0.052483615, 0.30429786, -0.5263308, 0.8598371, -0.22671875, 0.18051147, -0.08662229, -0.3279599, 0.2018461, -0.6478263, -0.17370462, 0.13946049, 0.68857074, 0.7604215, 0.66072303, -0.2236945, 0.0344449, 0.39498496, -0.86348784, 0.2021577, -0.554239, 1.241565, -0.19903407, 0.096936144, 0.6406258, -0.34654585, -0.73143643, -0.13212292, 0.64585644, 0.20416865, -1.3674644, 0.81159735, -0.53180194, 0.44403616, -0.4629941, 0.8237217, -0.6575767, -1.9094594, -1.0068313, 0.1886729, -0.54099613, -0.31080106, 0.52114534, -0.4064729, -0.3517636, 0.52113307, -0.37713295, -0.54287195, 0.90217155, 0.75736386, -0.057880785, 0.65335006, 0.5185984, -0.6316754, -1.008395, 0.5784696, 0.15871945, -0.096895896, 0.030775126, 0.019246973, 0.635904, 0.7580727, 0.603296, -0.39326644, -0.775648, 0.6632834, -0.76522464, -0.15057506, 0.13213232, 0.8701612, -0.051690824, 0.886158, 0.059451666, 0.39455524, 1.1942627, 0.80077326, 0.30792174, 0.72980845, -0.58946186, 0.11602919, 0.6559696, 0.8268997, -0.20558739, -0.9376819, 0.4666886, -0.6281039, 0.45548218, 0.08520936, 0.19750595, 1.5127107, 0.83545053, 0.3510535, -0.8958543, -0.75617564, 0.894642, 1.4720694, -0.1355076, -0.6986217, 0.29143137, 0.34363377, 0.18577126, 0.26836568, -0.13981187, 0.19420178, -0.1310125, 0.106808856, -0.11584908, -1.3767927, -0.048521705, -0.12314682, -0.70627797, 0.10515572, -0.5317391, 0.5002598, 0.422907, -1.0648339, -0.11869705, -0.93817717, -0.47067133, -1.0766637, 0.7890926, 1.0871282, 0.077466965, -0.022941213, -0.34052557, -0.46262902, -0.21314916, 0.63874835, -0.8034802, -0.12524417, -0.2280509, -0.45375586, 0.11442453, 0.17320183, -0.16676669, 1.2585441, -0.26324847, -1.0815029, 0.48728508, 0.40939358, -0.2852892, -0.01987523, -1.0332665, 1.4922973, 1.2905895, -0.3012445, 1.1206418, 0.58634394, -0.5885947, 1.027236, 0.5461434, -0.56589985, -2.160386, 0.9977782, 1.4122514, 0.35012767, -0.8348484, -0.91156083, -0.44733608, 0.06918893, 0.073672324, -0.49986246, -0.36920917, 1.2300003, -0.028686464, -1.9602597, 0.3586868, -0.5751905, -1.2226559, -0.160415, -0.45962837, 0.7730631, 0.15213728, -0.40129295, -0.3763386, 0.25027445, -0.017731309, -0.35444453, 1.0308242, -0.68111396, 0.027753418, 1.1759561, 0.1284143, -0.1538926, -0.06069766, -0.5967487, -0.46134785, 0.65801346, 0.38983122, -0.13866639, -0.1946084, 0.39163414, -0.05783741, 1.3692302, -1.1921241, 0.12407765, 0.62342554, -0.22950053, -0.15749526, 0.42076403, -0.15916803, -0.6903404, 0.38964617, -0.96953917, 0.1617446, 0.15616782, 0.94165206, -0.7990292, 1.0704751, -0.3479437, 0.014394938, -0.27818298, -0.2686414, -0.8608855, 1.1030215, 0.30865127, 0.56293905, -0.5808595, -0.09553954, -0.5470532, -0.24101052, 1.7932336, 0.5933583, 0.22850809, 0.6440879, -0.13777807, -0.40607083, -0.14935976, -1.0655402, -0.08556904, 1.5463837, -0.2037431, -0.049918488, -1.948359, 1.3937284, 0.8913616, 0.6618716, 0.29112825, -0.9333397, -0.64939773, -0.1519076, 0.43093035, -0.90897346, 0.23105648, -1.6697718, 0.80526376, -0.10556382, -0.29879344, -1.1856492, -0.08865876, -0.3910298, 0.99155366, 0.05003587, -0.25817716, -0.203244, 1.0919954, 0.43314368, -0.36503968, -1.4359604, -0.27645838, -0.82746905, 0.27085295, 0.6530822, -1.179947, -0.5469275, -0.8221712, 0.4316565, 0.8877416, -0.22656713, -0.9242201, -0.30603468, -0.2247964, -0.8370084, -0.35373253, 0.91914237, -0.030093975, 0.6547502, -1.4251751, -0.17141008, -0.10287389, -0.16700989, -0.17503524, 0.30245206, -0.10866988, 0.11191217, 0.87262994, -0.3063119, -0.8902056, 0.56295437, -1.9272543, -0.0981302, -0.67028433, 0.23364708, -0.6498273, -0.37664372, 0.23457718, 1.4059585, -0.1313058, -0.30622694, -0.021324791, 0.7439346, -1.2513928, -0.34206432, 1.3767378, -0.2954388, -0.5523714, 0.60395724, -0.29732507, -0.2831665, 0.24392214, 0.5988505, 0.0795792, -0.29516765, -0.25286347, 0.10891355, -0.043641455, -0.21956724, -0.1222059, -0.90728974, 0.46377242, 0.49633765, -0.20564441, -0.520319, -1.6375936, -0.0139881335, -0.4310044, 0.5800617, 0.28061712, 0.47284612, -0.07800144, -0.51974624, -0.5967198, -0.2567559, -0.40850466, -0.36360377, -0.61648047, -0.5654142, 0.48337257, 0.21692866, -1.1690227, -0.53939724, 0.2567819, 0.52827764, -0.27963173, -0.038007528, 0.5720037, -0.8600977, 0.13065897, 0.19105779, 0.9926014, -0.50321037, -0.4309987, 0.19077024, 0.7039192, -0.09141481, 0.84667844, -0.77341396, 0.5661096, 0.15038273, -1.0883207, -0.30914208, 0.39496368, -0.06485534, 1.641904, 0.6762734, -0.3347199, -0.8617406, -0.6995804, -0.19845611, -0.5784028, -0.47562283, -1.4047565, -1.0122284, 1.0451913, 0.3910407, 0.21691439, -0.5442791, 0.3343481, -0.33234861, 0.66286534, -0.6073909, -0.23710439, -0.8782153, 0.6301357, -0.78039706, 1.0811063, -0.94600165, 0.50099385, -0.20203432, 0.8153803, 0.4326697, 0.9829363, -1.1359497, -0.5724925, 0.46652472, 0.020673493, 0.17816944, 0.64396065, -0.95867497, 0.8279188, -0.80351615, -0.085244454, -1.0182021, -0.48280728, -0.68415624, 0.26940063, 0.17725682, 0.6659137, 0.343051, -0.036139507, 1.9253529, 0.330179, -0.18667798, -0.7256044, -0.5135883, -0.6487113, -0.8936575, 0.7452832, -0.12287533, -0.11825, -0.70136374, 0.14688696, 1.4273101, -0.15633577, 0.6255618, 2.1027944, 0.8671121, -0.36143222, -1.1867063, 1.1065185, 0.8098748, -0.45667458, -0.24226767, 0.0025809854, -0.25722653, 0.19070284, -0.5484266, -0.6555022, -1.0337746, -0.42591894, 1.7423811, 0.654865, 0.64011616, 0.16377617, -1.2083119, -1.4860584, 0.70743257, 1.1795193, 0.07058562, 0.8440395, 1.0345922, 0.28286603, 1.0439405, -0.31949413, 0.6272188, -0.19404978, 1.5465806, 0.8578423, -0.27853975, 0.66072625, 1.2355281, -2.0446782, -1.7492697, 0.0030216204, -0.56266546, -0.6697648, -0.68279344, -0.35443568, -0.54446316, -0.6759806, 0.1435076, 0.28134957, -0.15788919, 0.24428463, 0.014099263, 0.46920812, -0.85195917, 0.0012707915, 1.3709744, -1.0901219, 0.64788854, -0.14823869, -0.085778356, 0.13496846, -0.24483931, 0.4524359, -0.034560725, 0.63981885, 0.35658672, -0.30224392, 1.0347067, -0.85791016, -0.14240645, 0.79247826, -1.1686097, -1.586391, -0.8209819, -0.119535595, -0.2052218, 0.34335265, -0.6570797, -0.2210782, 0.6748208, -0.09502657, 0.24686556, -1.2017366, -0.63983685, -1.5916613, -1.184105, -0.123895474, -0.03346053, 0.2209342, 0.61311907, 0.3206372, -0.118494704, -0.3988993, 0.3909913, -0.36862627, 0.5302286, -0.6324911, 0.94080716, -0.6024734, -0.38162777, -0.4316226, -0.3143518, -0.36463666, -0.20017555, -0.8736055, -0.9380112, 0.45671174, 1.5155923, -0.09486201, 0.9695505, -0.13833332, -0.6298378, 0.8931586, -0.6301222, -0.26646182, 0.46902105, 0.13617973, -1.3055613, 0.30406374, -0.09564643, 0.10455055, -1.0269212, 0.12177908, 1.1355569, -0.6378392, -0.6559861, -0.78072715, -0.68091595, -1.3237638, -0.4806199, -0.16236575, 0.22558266, 0.4245454, 0.6258281, 0.2573674, 0.92344415, 0.108896874, 0.4044994, 0.06719699, 0.66419035, 0.34098536, 0.58486176, -0.41998512, 0.5359888, 0.61129946, 0.5190456, 0.983025, 0.310331, -0.32300448, 0.35044804, -0.97328913, -0.06142584, -0.34457424, 0.42320502, -0.2103809, 0.94158864, 0.751986, -0.41664547, 0.5273929, -0.023898497, -0.58526397, 0.91506046, -1.587615, -0.62792873, 0.20285669, -1.3050082, 0.62498814, -0.4249226, -1.0144218, 0.409593, 0.27104688, -0.9462727, -0.24467865, 0.86334205, 0.45995265, -0.12513909, -0.70971626, -0.19246241, 0.042387776, 0.07669194, 0.115074575, -1.269335, -0.09286548, 0.54315686, 0.34751275, 0.06670852, 0.14310578, 0.02031393, -1.4052739, 0.34125116, 0.34491134, 0.47022027, -0.80838424, 0.43571746, -0.5313221, 0.8576949, -0.2583056, -0.1817374, 0.4537858, -0.14710322, -0.4226152, 1.6146483, 0.88158476, -0.3151336, 1.2690797, 0.11899912, 0.3866578, 0.76637596, 1.5090572, -0.67779464, 0.9428768, 0.6889142, 0.6410521, 0.28004602, 0.7718466, 0.7421934, -0.28616107, -0.914406, 0.18280843, 0.77757883, -0.37666446, 0.607708, -0.28850508, -0.14639486, 1.0358485, -0.57612544, -0.03077536, -0.09469912, -0.5002359, -1.5291424, -0.5715195, 1.1232437, 0.032881796, 0.24273214, 0.114872776, 0.21159294, 0.86429787, 1.2115531, -0.53747576, 0.5324311, 1.046557, 0.3009321, 0.33693448, 0.033356756, 0.44364536, -0.02425829, -1.4809191, -0.15717486, 0.19116181, -0.09143227, -0.27159914, -0.10439899, -0.74533814, 0.82421553, -0.20139456, -0.0032766405, 0.9916576, -1.0329632, 0.19601333, -1.2602824, 0.2017543, -0.64100575, -0.35785395, 1.0780927, -0.14836146, 0.018262547, 0.9442348, 0.83696884, 0.6329565, -0.093982756, 0.7140547, 0.21587613, 1.2869248, 0.60281265, -0.47821552, 0.43734503, 0.25959963, -0.16328156, -0.12055825, 0.4622288, -0.9157813, 0.5098907, -0.31852883, -1.0538068, 0.63930315, 1.0165753, -0.8952555, -1.1551671, -0.07045259, 0.33253628, -1.4805075, 0.5346395, 0.40822038, 0.78947777, 0.056913875, -0.23994705, -0.47662988, 0.12904635, -0.3096597, -1.2386975, 0.027118616, -0.297474, -0.34640983, -0.7081305, -0.987574, -0.4112696, -0.16663915, -0.14638874, -1.0458425, 0.054047197, 0.99362266, 0.47721052, 0.39771488, -0.4090625, 0.1835733, 0.006618239, 1.8029044, -0.5752119, 1.7840273, 0.14250731, -0.8179414, 1.0404874, -0.7235668, 0.43460107, -0.17297104, -0.66153497, -0.53459716, 1.4169344, -0.25907004, -1.0876834, -0.121780336, 0.9376321, 0.087307006, 0.1502156, -1.3873982, -0.47126013, -0.72027636, -1.0648152, -1.0333831, 0.28081003, 0.0047804266, -0.41970125, 0.12368576, -1.0056207, 1.314159, 0.8322662, 0.50192, 0.6606601, 0.19176152, 0.22359805, 0.6299454, -0.8784206, 0.8435247, -0.62076545, 0.46503085, 0.4955411, 0.47523603, 0.59475726, -0.15033536, 1.5292126, -1.6526178, 0.77440363, 0.21343376, -0.1102623, -0.8003335, 0.12464988, 0.1694136, -0.092712775, 1.1573013, 0.26682746, 0.8170211, -1.0412548, 0.09060685, -0.18826349, 1.1423111, 0.03361123, 0.54229814, -0.31807727, -0.034259863, 1.3871967, -0.05026304, 0.28581905, 0.11886263, 0.7556672, 0.09417425, -1.0077528, 0.9749789, 0.031945437, 0.1542672, 0.44604713, -1.1202078, 0.24686609, 0.5521793, -0.26565984, 1.3768492, -0.41607288, 0.89860183, -0.9901299, -0.55397356, 0.3160442, -0.2748052, -0.028745566, -0.60326695, 0.1855664, 0.014004639, 0.043385062, -0.3658645, 0.21059687, -0.45689726, 0.2032052, 0.73326206, 0.35434416, 0.019100547, -1.4163734, -0.44338754, 0.26873967, -0.5155286, -1.3091766, 0.083646804, 1.3032191, -1.2324255, 0.9689458, -0.50306034, -0.13216153, -0.31209743, 0.42126146, 0.24715918, -0.36722437, 0.8198192, 0.7839475, -0.4742727, -0.23958692, -0.53167427, 0.36589828, 1.4970611, 1.1297909, -0.09345523, -0.7373089, -0.6823638] -2025-10-16 19:28:50 [main] INFO experimental.OnnxTest - ------------------------ -2025-10-16 19:28:50 [main] INFO experimental.OnnxTest - tokenizer加载耗时: 4073ms -2025-10-16 19:28:50 [main] INFO experimental.OnnxTest - tokenizer计算耗时: 1ms -2025-10-16 19:28:50 [main] INFO experimental.OnnxTest - 模型加载耗时: 558ms -2025-10-16 19:28:50 [main] INFO experimental.OnnxTest - 模型数据准备耗时: 2ms -2025-10-16 19:28:50 [main] INFO experimental.OnnxTest - 模型计算耗时: 11ms -2025-10-16 21:35:57 [main] INFO ai.djl.util.Platform - Found matching platform from: jar:file:/home/slhaf/.m2/repository/ai/djl/huggingface/tokenizers/0.34.0/tokenizers-0.34.0.jar!/native/lib/tokenizers.properties -2025-10-16 21:35:57 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Using cache dir: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 -2025-10-16 21:35:57 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading huggingface library from: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 -2025-10-16 21:35:57 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading native library: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64/libtokenizers.so -2025-10-16 21:35:57 [main] WARN a.d.h.t.HuggingFaceTokenizer - maxLength is not explicitly specified, use modelMaxLength: 512 -2025-10-16 21:35:57 [main] INFO experimental.OnnxTest - [101, 3231, 1024, 7592, 2088, 102] -2025-10-16 21:35:57 [main] INFO experimental.OnnxTest - ----------------------------- -2025-10-16 21:35:57 [main] INFO experimental.OnnxTest - [1, 1, 1, 1, 1, 1] -2025-10-16 21:35:57 [main] INFO experimental.OnnxTest - ----------------------------- -2025-10-16 21:35:57 [main] INFO experimental.OnnxTest - 加载耗时: 4105ms -2025-10-16 21:35:57 [main] INFO experimental.OnnxTest - 计算耗时: 1ms -2025-10-16 21:36:08 [main] INFO ai.djl.util.Platform - Found matching platform from: jar:file:/home/slhaf/.m2/repository/ai/djl/huggingface/tokenizers/0.34.0/tokenizers-0.34.0.jar!/native/lib/tokenizers.properties -2025-10-16 21:36:08 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Using cache dir: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 -2025-10-16 21:36:08 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading huggingface library from: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64 -2025-10-16 21:36:08 [main] DEBUG a.d.h.tokenizers.jni.LibUtils - Loading native library: /home/slhaf/.djl.ai/tokenizers/0.21.0-0.34.0-cpu-linux-x86_64/libtokenizers.so -2025-10-16 21:36:08 [main] WARN a.d.h.t.HuggingFaceTokenizer - maxLength is not explicitly specified, use modelMaxLength: 512 -2025-10-16 21:36:09 [main] INFO experimental.OnnxTest - [0.008940695, 0.50210774, -5.0510945, -0.8937678, 0.8091147, 1.2654096, 1.2879646, -0.72453403, 0.46069813, -1.1958805, -0.038145, 1.8672976, 0.6281317, 1.7732, -0.52271223, -1.4445113, 1.5514337, -2.508686, -0.6864384, -0.6301254, -0.29560322, -1.0180707, -0.83187616, 0.46920234, 1.9916652, -0.35749114, -0.11190428, 2.2374659, -0.6664558, 0.1793392, 0.64779544, -0.111028045, 0.67277247, -0.9106091, 0.2552021, -0.21566938, 0.5772215, 1.3539819, 0.45714578, 0.17660096, 0.49979687, 1.1208547, 0.19748983, -0.71146816, 1.9074292, -0.11441079, -0.24318233, 0.61392385, 1.8441632, -1.3443937, -1.0027645, -0.9185232, 0.19459805, 0.22545397, 1.7715352, 1.353761, 0.21172398, -0.5133596, 0.8219211, 0.9679444, 0.5380537, 1.2222915, 0.1917364, 1.8536644, 0.85374683, -1.6372596, 0.1961565, 0.69616926, -0.24206743, 0.8010477, 1.3424035, -0.050939456, 0.8211133, -0.020956516, 0.26211494, -0.4410275, -1.1032287, 0.115168236, -0.37371528, 0.12982085, 1.0343108, -0.51043314, 0.9773637, 0.52081937, 1.8070213, -1.2970276, -0.36602047, -0.34678212, -1.5465903, 1.0458957, 1.1246372, -0.22684537, -0.33523685, 0.6524532, -0.4258627, 0.8639704, 0.6747687, 1.1801372, -0.18055356, -0.325558, 0.58573216, -0.6885681, -0.008652464, -0.35967788, 1.4759315, 0.79462963, -1.0071485, -0.13985354, -1.7917951, -1.302046, -0.9551339, 0.72700655, -0.82785696, -0.016509667, 0.2450114, -0.14989577, 0.66587335, -1.6692137, -0.10025135, 0.5849763, -0.0066149235, 0.15871382, -1.0094404, 0.57655615, 0.31472182, 0.98309034, -1.8285725, 0.3632993, 0.13209791, 0.5869235, 0.21235198, -0.17361814, -0.32928634, -0.4548379, -0.6051484, 0.4909709, 0.51352304, -0.25750488, 0.21058336, 0.23544005, -1.0283852, 0.61832947, 0.012845237, -0.0017602667, -0.11332193, -0.64147717, 1.3873081, -0.82721007, -0.48795754, 0.04623498, -0.32260513, -0.40278208, 1.4807189, 0.6844304, 0.5813694, -0.7781652, 0.504094, 0.51536506, 0.47406924, 0.9439167, 1.0232425, -0.6551769, -1.3913715, 0.56962323, -0.25564027, -2.001826, 1.0167072, 1.6333333, 0.9226843, 0.23638949, -1.0627227, -1.5849673, 0.53583235, -0.32994375, -1.4948924, -0.54732955, -0.6555769, -0.56513834, 0.56638885, 0.71271247, 1.1922938, -1.5763108, 0.5924969, 1.7915413, -0.6964754, -1.0084081, -0.08877027, -0.28982282, -0.020199053, -0.7514959, -0.24143167, -0.20266221, -2.3080733, -0.34911162, 0.002499245, -0.9315997, 0.14224178, 0.26388752, 0.55929285, -1.9308436, -0.7808089, 0.20109546, -0.50900704, -0.06720903, -0.57660383, -0.12015574, 0.8564407, -0.19855615, 0.5351314, 0.7831901, 2.2334285, -0.07724279, -0.8556066, -1.1182219, -0.10898359, -0.43939131, 0.18218377, -1.0329244, -0.28819674, 0.6573483, 0.94202, -0.5684383, 0.39345515, -0.2149513, 1.1943405, 0.2175886, -1.4272945, -0.15624487, -2.1790175, -0.31830606, -0.074882746, -2.1189816, 1.3915615, 0.53846455, -0.6594929, 1.1428193, 0.14244053, 1.4449791, -0.33742362, 0.1302906, -1.0304217, 1.0046071, -0.14830303, -0.2878356, -0.833144, 0.7353544, -0.047339574, -0.50411963, -0.14792854, 1.2162826, -0.87097895, 0.5479907, -0.61530846, 0.91772366, 0.39351106, -1.1159807, -0.6962802, 0.6177609, 0.28574178, -0.933717, 0.6656517, -2.550455, 0.28417572, -0.81885386, -0.57173115, -0.47732124, -0.83434474, 0.6218224, -0.23378877, -0.16290052, -0.33495492, 0.9589823, -0.13438444, 0.87317586, -0.7977557, -0.8751001, 0.121376105, 0.0016995966, 0.119280726, 0.8511828, -0.80091643, 0.21969834, -0.52506125, 0.21649529, 0.20917195, 0.53206205, -0.060215697, -0.92501277, -0.43172908, 0.1354983, 0.77811605, 0.6264411, 0.11004971, 1.4162332, 0.3008895, 0.6369807, 0.8966343, -0.46057636, -0.4627554, -0.99630976, 0.8575164, 0.45908165, 1.4463993, 0.24505532, -1.313617, -0.26200497, 1.4678717, -0.78108716, 1.5716724, 0.04318331, -1.4950266, 0.87165, -1.2442464, 0.40303344, -0.8583747, 1.123798, -0.27928567, 1.4853265, 0.8615038, -0.22005291, -0.19541085, -0.8011397, 0.6476904, -0.092515044, -0.34317318, -0.16905296, 1.1762776, 0.5573735, -0.59209, -0.3909012, 0.19253278, 1.5935065, -0.7802029, -0.72745705, -0.15390143, 0.9641196, -0.7650623, -0.5825169, -0.42223948, 1.2938359, 0.32511997, -0.48691022, 1.3244666, -0.9317738, 0.0053078495, -0.2814655, -0.010061342, 0.5678287, 0.53736544, 0.84125555, -1.6721346, 0.6866992, -1.039913, -0.55957854, 0.9752761, -0.10916731, 0.81267405, 0.3757345, 0.31622255, -0.070370235, -0.28069317, 0.7060322, -0.30573946, -1.1120561, 0.087441884, 2.1169686, 0.3793122, 0.7199018, 0.7972706, 0.6312716, -0.28640646, -0.24372002, -0.39927763, 1.3067431, 1.3677809, 0.17182645, -1.5993283, -1.0617065, -0.9970951, 0.3591527, -0.2642659, -0.92191654, 0.09367664, -0.8568419, 0.24673605, -0.01075469, 0.53148615, -0.8131387, 0.16646563, 0.4456662, 0.42658246, -0.2286683, -1.240861, 1.2182664, 0.31972283, -0.52042526, 1.0313315, -0.74151134, -1.9206606, 0.67172974, -0.76771915, -0.11668143, -0.16317451, -1.1896999, -0.14067993, -0.5754039, -1.178021, -0.19320671, 1.0556533, -0.13083985, 0.8500223, 0.7322127, 0.47325015, -1.1170738, -0.46539554, 0.60346323, 1.1163684, -0.6468576, -0.6749016, 0.32706273, 0.5102571, 1.538664, 0.2564993, 0.12480027, -0.5115198, -0.22911404, 1.2661121, 2.2754738, 0.054497525, -1.8307894, -0.70205, 0.2732521, 0.3695401, 0.8007306, -0.28857967, 0.38666317, -0.7592721, -0.5713192, 1.1246057, 0.593709, 0.35631394, -0.3205832, -1.4436417, -0.6496872, 0.37343976, 3.2232847, 1.9115183, -1.0618794, -0.96111053, -0.10857664, -1.103422, 0.9816166, 0.60177815, 0.8528089, 1.4430338, -1.370729, 1.3978995, -0.69921416, 0.23256098, 0.4660253, -0.06287591, 0.6654809, -0.69219005, 0.24058081, 0.93626904, -0.7160164, 0.42666763, -0.38045081, -0.17772737, 0.95297396, -0.7321556, -0.82016414, 1.6348257, 0.098678365, -1.8395785, 1.0368643, -0.04200262, 0.7008558, -0.6598028, 1.1169665, 0.59610337, 0.42644075, -0.70989525, -1.1907579, 0.4301988, 0.24375978, 0.12559327, -0.086863026, 0.6391059, 0.3239115, 0.18681988, -0.9638547, 0.6950969, -1.0718625, -0.35861596, 0.007594481, -0.50218886, -0.07959162, 0.3074152, -1.0058187, -0.5779988, -0.21252635, 0.16711673, 0.2945148, -0.9580504, -0.44329655, -0.080028936, -1.9545618, -0.7434137, 0.42564327, -1.1064954, -0.02137646, 0.33320808, 0.87851465, 1.3674957, -0.18974975, 0.30143118, 0.09378138, -2.184264, 1.4090663, 0.42376116, -0.6386673, 0.23209023, 0.93278, -0.9901231, 1.2871186, -0.55473083, -1.0378529, 1.2385598, 0.6200016, -0.19011533, 1.2526734, -0.29594705, -1.159091, 0.12753622, -1.3564175, 0.39733884, 0.35340226, 0.47517172, 0.5938189, -0.97271687, 0.72243273, -0.3874474, -0.8634288, 1.4369297, 0.76829016, -1.5096359, 0.67411625, -0.5942944, -0.68440664, -0.6967539, -1.3790333, -1.0722706, -0.26939258, -0.51274854, -1.6252055, -0.042074203, -0.2941991, -0.9963352, -1.6290406, 0.5964556, 0.61665666, 0.107714295, 0.638748, 0.4289012, -0.8213354, -0.18691581, 0.260664, 0.1988615, -0.67643714, -0.4602536, -1.04408, 0.47709525, -1.5441273, -1.09128, -0.2589167, 0.5129835, 0.35384816, -0.69535726, -0.5024993, 0.17009991, -0.9128699, 0.35023412, 1.5284145, 0.38180998, -0.36242324, 0.7157388, -0.5221178, -0.07077499, -0.80303806, -1.0217718, 0.014210036, 1.1169853, -0.84779525, 0.07265417, 1.5137844, -0.43872315, -3.6163976, -0.71127445, 0.030030718, -0.54634804, 0.6007818, 1.0862793, -1.4570272, 0.29859456, 1.6187196, -0.5408837, 0.7542678, -0.043661788, -0.627822, 0.9626751, -0.18183072, -0.40761006, 0.92285067, 0.4483496, -0.20151655, 2.1187465, -0.5030096, 0.042685598, -1.0087817, -0.27128118, -0.6693532, 0.90893507, -0.5863207, 1.1904533, -0.6463561, -0.9224859, -0.5095885, -0.6562933, 1.7482289, -1.0871308, 0.6194082, -2.2877498, -0.0012813509, -1.1376673, 0.87655807, 0.663956, 0.24306166, 0.22504678, 1.0432729, 0.7316973, -0.20957288, 0.21609576, -0.054103754, 1.2539151, -0.3260904, 1.4898258, 0.71351856, 1.469297, -0.25216702, 2.0916111, 1.6792994, 0.834613, -0.19511522, 0.97750825, -0.1270805, 0.66032535, -0.15046631, -0.99626607, -0.5324382, -0.228696, 0.26502895, -0.7099257, -0.24755025, 0.5434749, -0.4053922, -0.8309872, -0.2989617, -0.86280966, -0.9859461, 0.97572213, 1.3376713, -0.3430115, -0.43402225, -0.1924202, 0.6710346, 0.74688536, 0.68394524, -0.29258135, -0.63783354, -0.25838947, -0.7412832, -0.13756852, 0.29825956, 0.38041145, -1.1111758, 0.5355625, -1.0727328, -0.37962234, -0.90463316, -0.2698317, -0.1467724, 0.13004409, -1.0194534, 0.11609152, 0.4127395, 0.28521538, -0.6652327, -0.7038725, 0.7316348, -0.48964947, 0.87470716, 0.8198417, 0.8121711, -0.55107266, -1.7259613, -0.27550706, -0.29355648, -1.0490227, -0.021362338, 0.19700499, 2.365385, 0.531291, 1.4412646, 0.8194168, 1.334413, -0.21749905, -0.3275181, 0.5781112, 1.150555, 1.4283984, 0.10826522, -1.1658969, -0.45134637, 0.04636837, -0.83447146, 0.81878465, -0.20615144, 0.5333617, -0.60880643, -0.042713113, 0.42055398, -0.5879446, 1.5446286, -0.3906217, -0.014214683, -0.9320095, -1.0041155, -0.77032924, -0.8490772, -0.3068128, -0.3138222, 0.8429545, 0.7392214, 0.059413563, -0.84115446, -0.1827325, 1.2329874, 0.20420718, -0.7757152, -0.4077565, -1.1934249, -0.8312496, 0.06622116, 0.36520314, 1.3569491, 0.27295056, 0.3010164, 1.8382473, -0.42277017, 0.23495656, -0.21165037, 0.37068194, 0.53597724, -0.15588544, -1.2607875, -0.40104312, -0.50267667, -0.13610771, 0.08203963, -4.3039837, -0.082001, 0.4916641, 0.7460458, 1.3272368, -0.5917864, 0.93342024, -1.0633006, -0.22604129, 2.1822553, 0.77348, 1.2415451, -0.92593575, -1.6016923, 1.9382031, -2.2590072, -0.72137606, 0.14148775, 0.13457671, -0.7451491, -0.41633192, 0.572699, 0.20894296, -0.665532, 0.1557113, 1.8900913, -0.17060457, 0.14676529, 0.9459177, 0.1988962, 0.6571039, -1.2214427, 0.48302603, 0.07323967, 0.6089274, 1.5770257, 0.06876827, -0.2896797, 0.6952437, 1.5110533, 0.32220465, -0.6618951, 2.1899383, 0.23477301, -0.41625032, 0.94061273, 1.5684785, -1.8303659, -1.2356102, -0.8779911, 0.89357895, 0.91234356, 1.0632848, 0.9623276, 0.73280936, -0.81256485, 0.62779176, 1.1951995, 0.18735348, 0.48628578, 0.20784137, 1.6061101, 0.6428331, -1.8172319, 0.07742017, 0.76475334, -0.28695786, 0.69205785, 1.3851129, -0.3151007, 0.5124455, -0.4670857, 0.42660737, -0.27413413, -0.79418296, 0.38474238, 0.44336423, -0.70331454, 1.6133739, -0.79705983, 0.58497494, 0.7683212, 0.95143867, -1.2097393, -0.5542208, -1.401292, -1.7129737, 0.32851774, 1.7300217, -0.13283907, 0.7207998, 0.79250276, -0.5060547, 0.838996, 0.33558664, 1.3048035, -0.6595723, 0.01165621, 0.40351102, -0.29559255, -0.3484041, -0.40840417, 0.95276344, 1.3805048, -0.28706077, -0.14665662, -1.5373006, -1.6770992, -0.9637392, 1.0667742, -0.8824096, -0.10521127, -0.33972454, -0.15037933, 0.29304558, -0.7167169, -0.026037984, 0.45332485, -0.30548358, 0.67668605, -0.70388466, 0.9721674, 0.022312656, 0.67783666, -2.221327, 1.0432537, 0.10468251, 0.50377524, 0.5216907, -0.26383665, -0.5668552, -1.0790802, -0.66269624, 0.53420395, -0.056507684, -0.030799769, -0.38935354, -0.26135808, -0.51806945, 0.6764826, 0.21997608, -0.2842363, 0.4153023, -0.7909994, 1.2961726, -0.32138214, -0.21153454, -0.23352191, -0.78287107, -0.47774607, 1.6039003, 0.5824032, 0.2871944, -0.77046245, -0.3201174, 0.4231739, 0.8662363, 0.8589964, 0.5837137, -0.5550777, -0.73803765, 0.7114582, -0.15480545, -2.4421003, 1.2693365, 1.5083162, 0.57656115, 0.5589083, -1.294058, -0.7516413, 0.68240094, -0.6442521, -1.8912579, -0.76375854, -0.18127736, -0.8704367, 0.78815466, 0.58496165, 1.2333207, -0.67811775, 0.7778747, 1.180586, -0.52837384, -1.6866188, 0.43942052, -0.5797858, -0.12091714, -1.5169264, 0.05719204, -0.26951146, -2.684711, -1.0172228, -0.30936632, -1.1998694, 0.13886273, 0.036559507, 0.3245873, -1.6026664, -1.3267136, 0.5069053, -0.36913142, -0.5306911, -0.070908874, -0.18541811, 0.69640446, -0.30087128, 1.0078833, 0.610926, 1.7221036, -0.5379479, -1.326377, -0.52609026, -0.46600527, 0.06604308, 0.2197823, -0.9372009, -0.3256157, 0.14768064, 0.699552, -0.72368884, 0.4794218, 0.026545957, 1.3436007, 0.23628801, -1.5402796, 0.19139451, -1.8511007, -0.44703215, -0.08679469, -1.6827856, 0.8235698, 0.16579445, -0.074705936, 1.0817068, -0.01459034, 0.8199119, -0.80417913, 0.53254235, -1.08217, 0.9492825, 0.24019396, -0.44084668, -0.73341775, 0.9208635, 0.37783542, 0.29370502, 0.27790993, 0.90694183, -0.68210644, 0.35099593, -0.50210375, 0.40147668, 0.56336397, -0.8843219, 0.1813156, 0.60259986, 0.4996659, -1.2195214, -0.06456041, -2.0830536, 0.79561657, -0.33496487, -0.41333812, -0.60755616, -1.3942319, -0.023980334, -0.31574172, -0.47269264, -0.45879, 0.37798846, 0.464371, 1.1505239, -0.35299638, -0.66388196, -0.46442628, -0.0014668554, 0.4657766, 0.3824118, -1.0646446, 0.47359174, -0.5501442, 0.54858595, 0.3592662, 0.41308272, 0.45073894, -0.7594449, -0.33872837, 0.31371093, 0.55662763, -0.20230436, 0.4447407, 1.6444561, 0.22029482, 0.0872115, 0.6798017, -0.32205412, -0.2614859, -0.6706727, 0.35378987, 0.38164073, 1.367708, 0.43917412, -1.6509491, -0.29672295, 1.7558253, -1.3782254, 1.0295317, 0.6083522, -1.7402619, 0.5930131, -1.4394379, -0.3491493, -1.1771997, 0.78438175, 0.0027834475, 1.0757275, 1.8362582, -0.6623099, -0.061427217, -1.429398, 1.0720371, -0.023497377, -0.41509795, 0.07872723, 1.5710311, 0.3394337, -0.86737263, -0.8013209, 1.0093807, 1.9009106, -0.78051865, -0.23401639, 0.073471576, 1.342778, -0.8758744, -0.05092702, -1.0604082, 0.88840294, 0.4845464, -0.31408712, 0.7285716, -0.6598388, 0.26622984, -0.15347672, 0.34162325, 0.5272665, 0.15939362, 1.0359404, -1.3569661, 0.8223073, -0.82353425, -0.851304, 1.2659918, -0.31349543, 0.9090855, 0.25253433, 0.61904687, -0.13841742, -0.67474073, 1.0259502, -0.051506877, -1.1969513, 0.16987415, 0.073220626, 0.37979242, 0.7651893, 0.58660114, 0.7042103, -0.5287451, 0.29557738, 0.17244934, 1.4235036, 1.7157453, 0.37425035, -1.8584217, -1.2582158, -0.6299258, 0.17255291, -0.12686756, -0.49752375, -0.22709069, -0.6200077, 0.42430815, 0.463663, 0.68685627, -0.71040833, -0.17139806, 0.38501126, 0.5601121, 0.50367576, -1.6438738, 0.077835165, -0.36538386, -0.23477188, 1.2270359, -0.61405075, -1.7066628, 0.81988287, -0.7482188, 0.035242945, -0.14084256, -0.65183985, -0.019776158, 0.12996586, -0.9195582, -0.41340956, 0.90673864, -0.6422904, 1.2120672, 0.06385599, 0.63100183, -1.30815, -0.9428998, -0.41631383, 1.965007, -0.86749756, -0.5259007, 0.13663939, 0.3468347, 1.7422681, 0.7007072, -0.020115245, -0.31306064, -0.031459868, 1.0573552, 1.8225657, 0.11774525, -1.5830071, -0.79576176, 0.05965937, 0.6052492, 0.62318075, -0.096916795, 0.31733304, -0.96026015, -0.27850336, 1.4682877, 0.6666615, 0.24167539, -0.5812353, -0.90307945, -0.55028933, 0.5831116, 2.5405624, 2.0145776, -0.960979, -0.4206924, -0.7996599, -1.7888918, 0.5773138, 0.44929433, 0.79602045, 1.2793171, -1.1028179, 1.5785166, -0.6605679, 0.123961315, 1.0325454, -0.030368492, 0.14277515, -0.24839605, 0.22407623, 1.2428747, -0.8223916, 0.7238152, 0.5589315, -1.2599404, 0.36306778, -1.1173778, -0.8732166, 1.4703016, -0.23819679, -1.6242712, 0.7218292, 0.118932486, 0.7071069, 0.53992164, 0.44476104, 0.6507463, 0.5524653, -0.6212482, -0.8308021, 1.7792088, -0.4863599, 0.24588388, 0.48519036, 0.45862278, -0.23362559, 0.6741241, 0.8668838, 0.12244135, -0.6257747, -0.67283255, 0.028253525, -0.6896872, 1.181849, -0.4711876, -0.5782417, 1.0118928, -0.05969412, 0.14305171, -0.4259127, -0.61529285, 0.077514656, 0.85673195, -1.3015722, -0.7207134, -0.27778414, -1.125479, -0.49426728, 0.3936475, 0.8884816, 1.7654979, -0.45583653, -0.11059831, 0.2442121, -2.1273844, 1.4961429, 0.641687, -0.45369974, -0.54703337, 0.6895549, -0.6619705, 1.1465002, -1.1790969, -0.45576596, 1.6416053, 0.6164581, -0.15951222, 0.7921248, -0.032377556, -0.80429655, 0.08237736, -1.4837114, 0.1985715, 0.15340376, 0.801544, 0.078613624, -1.9629599, 0.88010734, -0.46030182, -0.64362615, 1.1952101, 0.32887614, -1.7267823, 0.93907595, 0.094770044, -0.9705627, -0.27643013, -2.292801, -1.2397184, -0.41275358, -0.80883455, -1.7987494, 0.2907484, -0.20178545, -0.87403935, -1.7124034, 0.85280275, 0.042721435, -0.78331816, 0.25862864, -0.045897268, -1.3428419, -0.41759884, 0.6986912, 0.29880998, -0.74742967, -0.5181912, -1.019665, 0.3793689, -1.7902851, -1.4508095, -0.32118288, 0.5071308, 0.7328687, -0.60655284, -0.15128464, 0.6374675, -1.0154953, 0.03218935, 1.279699, 0.28615817, -0.07616529, 0.6687399, -0.7565428, -0.27557972, -0.23855832, -0.93483484, -0.087293684, 1.1687524, -1.3584801, 0.21150073, 1.2037069, -0.6048212, 0.30108434, -0.5661793, -0.27420956, -0.022391453, 0.33260012, 0.85373664, -1.4766654, 0.5845996, 1.4180158, -0.22024389, 0.667976, 0.6244385, -0.3168699, 1.1868767, 0.34774554, -0.64997494, 1.2400774, 0.19068903, -0.13514502, 2.0202057, -0.9182257, 0.199046, -2.1286008, -0.16045126, -0.15270948, 1.3005338, -0.5548139, 1.2173984, -0.29274017, -0.30937454, -0.7711906, -1.2893053, 2.3575566, -0.72209096, 0.7947462, -2.0041177, -0.39761025, -1.015814, 0.6978156, 0.868944, 0.13364673, 0.18352914, 0.8586364, 0.66782385, 0.610228, -0.34375954, 0.13003342, 1.2151164, -0.2166828, 1.1116873, 0.71258795, 1.1434194, -0.47186866, 2.1353364, 1.447041, 0.085622765, -0.5998132, 0.89812726, -0.08066484, 0.8420984, -0.32581723, -0.71437097, -0.17589144, -0.41022748, 0.60955167, -0.6410985, -0.7388026, 0.36736083, 0.039181054, -0.6307165, -0.5466139, -0.7783671, -1.5159419, 0.7252672, 1.2741427, -0.13147596, -0.40053046, -0.028620407, 0.7103258, 0.57227916, 0.87115306, 0.13265681, -0.7893819, -0.73650587, -0.9073851, 0.5145203, 0.11678757, 0.34510773, -0.93830043, 0.11222476, -0.8524616, -0.061620682, -0.55093145, -0.47949544, -0.09997742, 0.09835012, -1.0597764, 0.14261375, 0.1746223, 0.28936136, -1.0353326, -0.19909178, 0.47905058, -1.252357, 0.7624163, 1.2160978, 0.7688873, -0.6454922, -1.0831699, 0.02088613, -0.38204393, -0.907776, -0.9166499, 0.18642414, 2.432432, 0.10058874, 0.8733756, 0.27784142, 1.0831978, -0.60613316, -1.3419845, 0.7750269, 0.8635206, 1.8219028, 0.54030687, -0.87049514, -0.8088964, -0.6807017, -0.89217746, 0.53863055, 0.103357926, 0.29255334, -1.2158495, 0.18755785, -0.41067183, -0.61871785, 2.0842297, -0.6564288, 0.1175787, -0.25890535, -0.7177374, -0.6349298, -0.65529674, -0.26780748, -0.8083765, 0.51767904, 0.6745196, 0.36527988, -0.585937, -0.20295776, 1.7653798, -0.33259234, -0.96098894, -0.07512732, -1.5987782, -0.5730393, 0.25935447, -0.11502524, 0.7548667, 0.6395263, 0.45042387, 2.8521442, -0.95156074, 0.47897643, 0.17717683, 0.36947063, 0.72072726, 0.05572194, -0.8413897, -0.46243054, -1.2105479, 0.13334659, -0.032581076, -4.2375526, -0.59686345, 0.4538272, 1.0885404, 0.6702778, -0.48081216, 0.44729152, -1.140004, -0.010168858, 1.9525921, 0.832294, 1.7936808, -0.048765276, -1.6751267, 1.5497643, -2.353122, -0.4451682, 0.17112952, -0.1890958, -1.3813912, -0.39053974, 0.62938404, 2.082432, -0.7175064, -0.24595845, 2.3162117, -0.3158726, -0.12359636, 0.40302536, 0.18462911, 0.7844205, -0.0015291646, 0.6743531, 0.075157195, 0.11210073, 1.2258631, -0.05680778, -0.24221358, 0.27545154, 0.8361591, 0.5928248, -0.2545021, 1.8165491, -0.04416865, -0.26884404, 0.64862126, 2.21904, -1.7403183, -0.75271726, -0.7202007, 0.16653919, 1.0871801, 1.3364254, 1.4694904, 0.9652211, -0.80510324, 0.5183391, 1.7491461, 0.511918, 1.3462274, 0.7024353, 1.4506098, -0.04295113, -1.2183081, 9.816363E-4, 0.8816808, 0.1508924, 1.1356016, 1.6477102, -0.11800997, 0.30756932, 0.26012784, 0.7386577, 0.29488558, -0.47505602, 0.19272491, 0.51341426, -0.6810482, 0.8993299, -0.60003865, 0.86971986, -0.15220067, 1.1147594, -1.1383475, -0.33894932, -0.26593307, -1.6458954, 0.18725836, 0.94011426, 0.11729905, 0.105840944, 0.3609804, -0.9327989, 0.3713091, 0.060831085, 0.9854874, -0.34511298, -0.2879524, 0.5795063, -0.5236333, 0.065186724, 0.18788286, 1.3223159, 1.1334118, -1.0533829, -0.39967948, -1.9732791, -1.1970584, -1.0549864, 0.43055233, -0.34520608, 0.42950767, -0.003649138, -0.07939597, 0.6475297, -1.3730345, 0.062667415, 1.6147989, -0.1476839, 0.04871749, -0.91856533, 0.56362367, 0.55767614, 1.1749725, -2.0295792, 0.43310302, 0.09634046, 0.20091093, 0.26272556, 0.046745386, -0.21969129, -0.6707004, -0.7647821, -0.063160166, 0.51600844, -0.3087896, 0.41689703, 0.4392679, -0.8582071, 0.79339665, 0.28519478, -0.26558462, -0.6659972, -0.7188982, 1.3808789, -0.89023215, 0.41144633, 0.16805208, -0.75122094, -0.11867887, 1.543643, 0.61344016, -0.19704866, -1.0062346, 0.44627762, 0.4860831, 0.3939407, 0.36183584, 0.7851459, -0.8682549, -1.1847831, 0.5358516, 0.26103783, -2.2152636, 1.103417, 1.4953772, 0.1992315, 0.07908572, -0.8492448, -1.2705877, 0.29931432, -0.9461487, -1.4458283, -1.0470415, -0.41218147, -1.0918698, 0.6166757, 0.18749386, 1.2787181, -0.92622375, 0.6054672, 0.870527, -1.0691093, -1.7123365, 0.0495075, -0.738194, 0.34881157, -0.44842792, -0.4201811, -0.05393745, -2.1925974, 0.09545113, 0.06688569, -0.8977198, -0.085284755, 0.102158695, 0.20149165, -1.7651014, -1.0870925, 0.24054264, -0.74779993, -0.44569153, -0.42099476, 0.8351224, 0.97377527, 0.7060151, 1.0186949, 1.0475934, 2.3733313, -1.1107163, -1.101293, -0.85240287, 0.021774217, -0.03084986, 0.31226873, -0.8944292, -0.6745035, 0.8306402, 0.63163084, -0.88356215, 0.6354829, 0.5462163, 1.6622038, 0.22387153, -1.3001823, -0.0757204, -2.4847255, -0.22084947, -0.7999485, -1.89805, 1.0499556, 0.44911587, -0.5646096, 0.8053865, 1.3021152, 1.8230816, -0.56671524, 0.11187309, -1.3048412, 0.9349616, 0.2546708, -0.36234832, -0.6659309, 0.90868163, 0.04853189, 0.09261486, 0.015527621, 0.7454172, -0.9419852, -0.047329552, 0.08699082, 0.42673504, 0.780743, -0.94500506, -0.73876095, 0.16158783, -0.070774965, -0.5767895, 1.137128, -3.186622, 1.1911851, -1.0656859, -0.392686, -0.03938763, -0.9039558, 0.75739443, 0.5312309, -0.7341834, -0.38595462, 0.2647596, -0.07928561, 0.75340587, -1.3045008, -0.8802977, 0.30121127, 0.2543338, -0.34264043, 0.45520693, -0.9154624, -0.10101467, -0.02641562, -0.12726673, 0.010956101, 0.9258601, 0.1098481, -0.16978537, -0.3670274, -0.07359931, 0.5837086, 0.69936067, -0.28604972, 1.59343, -0.1453458, 0.32370114, 0.6298896, 0.46533775, 0.14416869, -0.39564282, 0.88691527, 0.6066644, 1.3613597, -0.37090945, -1.7808118, -0.1720133, 1.0270717, -0.54187065, 1.6680968, 0.11771559, -1.8401663, 1.1491469, -1.9306219, 0.5856592, -1.1250175, 0.9635127, -0.86805916, 0.9950776, 1.5667278, -0.108083725, -0.8249335, -0.9405231, 1.1947067, -0.35845593, -0.48510844, -0.25952032, 1.5655563, 0.8452434, -0.55366373, -0.842601, 0.14117181, 1.1900853, -0.88801455, -0.8419519, 0.009560674, 0.7411447, -0.11118782, -0.46682933, 0.17498611, 1.4330704, 0.49638534, 0.19230416, 1.2091411, -0.34786895, 0.2274889, -0.37641925, 0.10583784, 0.29251122, 0.26727018, 1.0795634, -1.1727878, 0.7986189, -0.75620455, -0.14081307, 0.70355874, -0.17094393, 0.8434166, 0.0870233, 0.005512327, -0.67821467, -0.5855471, 0.16779336, -0.15551087, -0.58186996, 0.0809322, 0.25340253, 0.4838119, 0.6051569, 0.72161484, 0.24405366, -0.3099302, -0.19053733, -0.33977276, 0.6870599, 1.2345992, 0.3064082, -2.0492685, -0.80029774, -0.73350406, 0.047823828, -0.2212841, -0.53130865, -0.39911112, -0.81050694, 0.19141236, 0.39204028, -0.041854225, -0.41634703, 0.5479881, 0.9199982, 0.37612298, 0.46730843, -0.844545, 0.7269514, -0.54978836, -0.22469144, 0.5518924, -0.21882303, -1.7599337, 0.19333343, -0.6137202, 0.35599604, 0.4681678, -0.93530613, 0.3675471, -0.5560331, -0.93811864, -0.05328221, 0.30546796, -0.06468683, 1.1055162, 0.31039363, 0.79712665, -0.8880656, -0.41150033, 0.62709105, 1.0567634, -1.3500221, -0.58200276, 0.3762134, 0.47680095, 1.6633757, 0.3248726, 0.3021961, -0.65517944, -0.109807625, 1.2432631, 1.7977482, -0.18578239, -2.0532904, -0.619208, 0.14947218, 0.9085295, 1.0551935, 0.011069931, -0.37766242, -0.689911, -0.43453133, 1.6019069, 0.3811674, 0.7572155, -0.40539703, -1.2555295, -0.69455326, 0.49768996, 2.6146052, 2.6659274, -0.9112146, -1.1077894, -0.23498018, -1.2007558, 0.8432704, 1.4062907, 0.53809303, 1.529563, -1.5362505, 1.6111442, -0.5297894, -0.11808497, 0.20472874, 0.31043276, 0.1835281, -0.5836088, -0.02861229, 1.4592621, -0.9100425, 0.61336476, -0.19170228, -0.83800125, 0.8228804, -1.1628532, -0.7328894, 0.84273213, -0.11957289, -1.5090224, 1.0768483, -0.104951106, 0.24791405, -0.366059, 0.96841574, 0.42228532, 0.50324833, -0.5371943, -0.5149842, 1.1027789, 0.19120961, 0.15430793, 0.2757321, -0.36539328, 0.28428805, -0.08055519, -0.3374042, 0.7996474, -0.3285212, -0.14873916, -0.41024688, -0.88183016, 0.2243497, -0.20743272, -0.39711243, -0.20242156, 0.066387035, 0.123112775, 0.469679, -0.39338633, 0.16844624, -0.053532504, -1.3422933, -0.66371524, -0.10573699, -0.2580982, 0.008790031, -0.29559684, 0.8452203, 1.7971001, -0.36888883, 0.58605707, -0.17919783, -1.3992865, 1.8432058, 0.6336147, -0.53755534, 0.05347249, 0.70169985, -1.0162297, 1.4821874, -0.40619004, -1.5554171, 1.3304783, 0.7642607, 0.06273963, 1.190404, 0.050506398, -1.0424638, 0.46894956, -1.1349477, -0.0035732836, 0.47234288, 0.52248424, -0.31404004, -1.919094, 0.51133317, -0.2986818, -0.36438683, 1.6392047, 1.1344445, -1.5788847, 0.9403384, -0.12823837, -0.4158857, -1.3239692, -1.9897468, -0.89076465, -0.47164863, -0.5873591, -1.5080955, -0.4241918, -0.34073642, -0.8595737, -2.1563668, 0.5392478, 1.1566588, -0.48543102, 0.26236895, 0.47868973, -1.1099099, -0.02641529, 0.24095038, 0.05020159, -0.749434, -0.5565289, -1.1763871, 0.7146039, -1.4472867, -0.594348, -0.46612006, 0.7443287, 0.17006834, -1.274579, -0.35685042, -0.07105823, -1.6138446, 0.06209471, 1.7139359, 0.22178563, -0.35350642, 0.543285, -1.3267688, -0.0037474781, -0.6415884, -0.6476863, -0.0051679052, 0.8534037, -1.1693122, 0.010954498, 1.6279119, -0.6788517, -2.533438, -0.8678859, -0.5320176, -0.4124887, 0.9793085, 1.4319218, -1.6222152, 0.5541427, 1.929475, -0.44764268, 0.57726157, 0.30474505, -0.08566475, 1.6472805, 0.15703492, -0.24655053, 0.7776795, 0.49221545, -0.042755544, 1.8118613, -0.33484954, 0.9483563, -1.1041298, -0.34732231, -0.5435285, 0.63029665, -0.29857004, 1.038833, -0.41452676, -0.762923, -0.19454634, -1.763375, 1.6416986, -0.14207828, 0.43010616, -2.5701048, -0.4156133, -0.3095801, 0.7914582, 0.83072764, -0.33544338, 0.03689442, 0.91521347, 0.7419453, 0.4195006, 0.29579616, 0.1270438, 1.1525235, -0.34384894, 1.3438214, 0.7089049, 1.4401239, 0.8427912, 1.9773139, 1.280215, 0.8321328, -0.11056949, 0.541568, -0.37214747, 0.7184359, -0.4635601, -1.0396259, -0.1376052, 0.08048542, 0.2302494, -0.8580882, -0.54565936, 0.0654906, -0.75482774, -0.9244739, 0.06187714, -1.1852716, -0.6424487, 0.25576863, 0.78124565, -0.06435682, -0.70427924, -0.55639213, 0.93429047, 0.69335544, 0.5599617, 0.17459932, -0.41115555, -0.16953023, -0.5571107, -0.6561706, 0.3354718, 0.9480737, -0.94258595, 0.90569663, -1.1170458, -1.9504805, -1.196713, -0.3679911, 0.015131488, 0.18721208, -1.1809741, -0.26950598, 0.6782336, -0.34831914, -0.42956293, -0.62750363, 0.41887188, -0.8657223, 0.2825969, 0.8393127, 0.56417716, -0.05883214, -1.5311673, 0.01864133, -0.1042253, -1.3455918, -0.55855167, -0.24753773, 2.4837918, 0.57509506, 1.0181949, -0.12295708, 0.8753308, -0.5293411, -0.36454523, 0.5012073, 1.1117135, 1.3556263, 0.42402056, -0.93515843, -0.5668046, -0.7429016, -0.49684244, 0.18577796, -0.1632435, 0.12502918, -0.8384259, -0.38961706, -0.20223175, -0.75471324, 2.1295795, -0.3969314, 0.22128996, -0.74520034, -0.675958, -0.56324315, -0.42674473, -0.63405246, -1.2011486, 0.52042735, 0.9495089, 0.020391192, -0.90801936, 0.4682513, 1.7587634, -0.3028639, -1.1834548, -0.31927472, -0.6695488, -0.52235776, -0.7186115, 0.7899222, 1.0014939, 0.27173263, 0.42071947, 1.7468405, -0.78924674, 0.36825815, 0.31606954, 0.11986427, 0.63423735, 0.51299596, -1.373041, -1.069034, -0.57540166, -0.045445397, -0.34945235, -3.3275523, 0.22731975, 0.36902305, 1.2367005, 0.39194432, -0.4746917, -0.24819094, -1.2438312, 0.08193148, 1.8569534, 0.098598346, 1.8004669, 0.097691424, -1.7224234, 0.88370246, -1.9531832, -0.9167318, 0.5780656, 0.05229275, -1.3191699, -0.34447095, 0.68812364, 0.5720577, -0.8811223, -0.11898157, 2.3788629, -0.02985695, -0.5108037, -0.054584697, 0.73180276, 0.4270401, 0.33755153, 1.1565756, 0.23356235, 0.1625686, 0.88033533, -0.2092922, 0.06942951, 0.23726052, -0.23033059, 0.68557966, 0.08532261, 0.99904776, 0.57505476, -0.39024824, -0.13172224, 1.9205338, -1.5390093, -0.08105607, -0.5932407, -0.16045141, 1.7443988, 1.2447889, 1.1255945, 1.2813084, -0.330172, 0.76995254, 1.8966867, 0.1743443, 1.3014711, 1.7853279, 1.1622835, -0.31911337, -0.6598214, 0.7157046, 0.89193434, 0.5118476, 0.65639853, 1.424856, 0.5915188, 0.13096291, 0.022042617, 0.8315848, 0.6827663, 0.07303734, 0.054391682, 0.1589834, -0.9787285, 1.0332872, -0.008612797, 0.8126753, -0.97286534, -0.5721441, -1.9303764, -0.29299396, -0.21202728, -1.1703851, -0.22406223, 1.4962769, 0.11641924, 0.23256451, -0.0811607, -0.8660191, 0.24334851, -0.008027129, 0.9900221, -1.0267837, 0.16684823, 0.57861924, -0.09820887, -0.06444654, 0.79702586, 1.5110456, 1.18736, -1.2774931, -0.78421193, -1.9064893, -1.2888294, -1.0921284, 0.08533788, -0.26716572, 1.0318695, 0.16370623, -0.07553395, 0.5450891, -1.4996822, 0.5724112, 1.5733267, -0.8450707, -0.043714702, -0.6893503, 0.51687837, 1.2746414, 0.7146934, -2.1531124, 0.20818664, -0.10973995, 0.18675843, 0.16448702, -0.7166813, -0.12982129, -0.63502383, 0.031319126, -0.18294649, 0.49100095, -0.36713195, 0.66632205, 0.6834382, -0.35128006, 1.0835311, 0.2283787, -0.66630197, -1.1066312, -0.89536554, 1.5596511, -1.0005987, 0.765801, -0.5909458, -0.85717076, 0.30332184, 1.67724, 1.0395846, -0.028179117, -0.26196128, -0.20154642, -0.15438686, 0.7855068, -0.19717416, 0.5493648, -0.75587803, -0.455737, 0.3237022, 0.42722195, -2.0473754, 0.56801397, 1.3903089, 0.12004324, 0.7005229, -0.3407321, -0.5261313, -0.1538756, -0.7910628, -0.9309482, -0.16353002, -0.58801615, -1.1426258, 0.76081985, -0.53621614, 0.84474635, -0.72333145, 0.24581629, 0.66596776, -0.70429707, -1.6138331, -0.7180623, 0.043840438, 0.84993523, -0.5890736, -0.24500962, -0.20937885, -2.2674901, -0.03398995, -0.078055896, -0.49442667, 0.075571254, 0.09625011, 0.35759744, -0.99303055, -1.5036392, -0.05741927, -0.5990357, -0.56783354, 0.03719426, 2.5208445, 1.2792852, 0.8199502, 0.93128866, 0.9208104, 1.6470743, -1.5426618, -1.3811654, -0.7987242, -0.8944512, 0.4178534, 0.38932425, -0.75248533, -0.06557035, 0.7185067, 0.9333569, -1.0048586, 1.0705352, 0.9695664, 1.353385, 0.09010321, -1.1382583, 0.55308497, -2.6025121, 0.15243526, -1.4278551, -1.6607153, 0.860541, 0.5684724, -0.7798525, 0.9574742, 1.8088274, 1.4807726, -0.1732581, -0.49971592, -1.2938926, 0.6186871, 0.37323606, -0.5336785, -0.98147213, 1.0458283, 0.25446412, 0.36312097, 0.07027008, 0.11262571, -0.42707434, -0.220013, -0.5875742, 0.4669395, 0.6798075, -0.63334805, -0.5783406, 0.1251126, -0.38114056, -0.68132406, 1.0469259, -3.5155873, 1.9671042, -0.9190454, -0.55197716, 0.83801544, -0.5714603, 0.44932735, 0.5354219, -0.5702951, 0.16947825, 0.24018587, 0.48090443, 1.0678362, -1.1853591, 0.079099774, 0.16553098, 0.7293623, -0.71074075, 0.5235574, -0.90503824, -0.88592046, -0.13836983, -1.052803, 0.2526356, 0.34508625, 0.20159572, -0.5355421, -0.43164968, -0.26517433, 0.8913823, 0.39937818, 0.30155915, 2.2124255, 0.0603099, 0.23342517, 0.49676266, 0.75205475, 0.20550296, -0.62654245, 0.28884768, 0.46931282, 1.577348, -0.5057512, -0.8608184, 0.44936067, 1.383238, -0.03490097, 1.2874973, 0.29172882, -1.3608899, 2.2177153, -2.2990627, 0.15486032, -0.94746184, 0.72527826, -0.74821305, 0.5642979, 1.6237416, 0.35510045, -1.371967, -1.4305518, 0.5656934, -1.2487237, 0.4213405, -0.36367983, 0.76374024, 0.93968344, 0.36534926, -0.7551423, -0.0038674623, 0.63060087, -0.6101065, -0.38811347, -0.4785545, 0.5892981, 0.2723823, -0.80994344, -0.7184911, 1.58496, -0.74103945, 0.14645888, 0.8801471, -0.0349124, -0.17808646, -0.8373291, -0.5489321, 0.6399772, -0.56448287, 0.45920986, -0.32797137, 0.48876214, -0.7722936, 0.7110514, 0.5914641, -0.023131683, 0.46343315, 0.4108361, -0.10862967, -0.80872583, -0.56265444, -0.2195296, 0.07072757, -0.32874253, -0.2331534, 0.221698, 0.73738515, 0.7718544, 0.6031042, -0.27522433, -0.8341945, -0.7196441, -0.17732127, 0.5561446, 0.6526755, 0.36112553, -1.6164314, -0.6448827, -0.2615705, 0.37312427, -0.42878437, -0.50876844, 0.01557447, -0.9423974, 0.14062455, 0.6049541, 0.67849314, -0.34584293, 0.4975931, 0.025627308, 0.8797541, 0.4259451, -0.22281408, 0.24196546, -0.11239098, -0.01917174, 0.25028148, -0.34636748, -2.0611026, -0.06447427, -0.62459165, 0.858958, 0.36105034, -1.1696876, 0.056905136, -0.4261216, -0.94341487, -0.30531296, -0.47526762, -0.42512742, 1.4714365, 0.083199374, 1.0179315, -0.9701613, -1.1648011, 0.42087835, 1.1566582, -1.1164685, -0.39050156, 0.4177849, 0.54503053, 1.0581168, 0.122496866, 0.64877594, -0.3731066, 0.8710224, 1.0467112, 1.4225514, -0.1536279, -1.5523295, -0.52426374, -0.2779017, 0.8133898, 0.85683167, -0.36897337, -0.35123062, 0.120082036, -0.54450643, 1.0384865, 0.27679268, 1.8568588, 0.03938148, -1.1608962, -0.41695762, 0.39431348, 3.1264772, 2.3877347, -0.15257652, -0.7320024, 0.12419622, -1.287175, 0.39385453, 0.974821, 0.049994696, 1.0091165, -1.7531127, 1.6948011, -0.366085, -0.4567839, -0.29971364, 0.16656825, 0.08037225, -1.1328343, -0.36554125, 0.40561542, -0.63396376, 0.57928526, -0.40685052, -0.5381798, 0.8005147, -1.3192124, -0.904293, 0.008866582, -0.44051528, -1.3872772, 0.43811536, -0.014631502, -0.022128046, -0.13452059, 1.015941, 0.53356636, 0.39078796, -0.75855446, -0.047520082, 1.2373616, 1.0721242, 0.12809762, 0.1334298, -0.89095044, 0.004328221, -0.24677542, -0.5256807, 0.41210282, 0.35521665, -0.3742752, -0.5365181, -0.40289578, 1.0373986, -0.62946624, 0.09559971, 0.16945997, 0.16011313, 0.15484661, 0.7171279, 0.2228621, 0.62859035, 0.56555617, -1.0822077, 0.104222655, -0.3825818, -0.7731678, -0.34897146, -0.45309782, 0.80402774, 2.3230875, -0.30913597, 0.6176475, -0.15234187, -0.9130463, 1.9025639, 0.86815125, -0.83166724, -0.21401684, 0.78785205, -1.739686, 2.2668343, -0.345401, -1.0512193, 0.91875213, 0.5199171, 0.58468884, 0.73392284, 0.041696012, -0.6166961, 0.84339494, -0.77854466, -0.24405773, 0.67765325, 0.55435055, -0.8057577, -1.5064452, 0.16376469, 0.14463758, 0.19168483, 1.114181, 0.55640376, -1.3145398, 0.98460054, 0.9113636, 0.8381783, -1.8150179, -1.5715137, -0.4935258, -0.49357474, -1.229667, -1.7216921, 0.4676819, -0.11519488, -1.0244559, -2.2180781, 1.4384127, 0.9492223, -0.69357115, 0.1867604, 1.0693477, 0.27487653, 0.121413276, -0.042237528, 0.12876141, -1.2549193, -0.77649903, -1.20677, 0.9945025, -1.718436, -0.3108896, -0.3544942, 0.9586106, 0.12614103, -1.4019394, 0.06979652, -0.51264375, -0.7824047, -0.14419945, 0.78628355, 0.07944815, -0.37333307, 0.540624, -1.2557046, 0.07462505, -0.41541994, -0.62134737, -0.28327915, 1.3320854, -1.043966, -0.12159033, 1.3173989, -0.81243837, -1.0274365, -0.49187303, -0.7640168, -0.7643263, 0.33342665, 1.655695, -1.7654641, 0.35340893, 1.9987454, -0.78443074, 0.79294956, 0.6738753, 0.023859248, 1.9800975, 0.47687012, -0.7451932, 0.1652671, 0.6715458, 0.29612985, 0.89887625, 0.14210236, 0.73136324, -1.5946822, -1.0582726, -0.038778365, 0.16555099, 0.524512, 1.2363143, -0.49336198, -1.3413302, -0.7077877, -1.6578598, 1.5656521, 0.8138503, -0.36629808, -2.1896977, 0.0034853667, 0.9763886, 0.8405733, 0.8849647, -0.17390905, -0.6129, 0.6286722, 1.2564892, 0.2851164, 0.13694803, 9.93222E-4, 0.4676696, -0.48247516, 1.1001453, 0.5705339, 0.94548523, 1.187321, 1.783094, 0.8113491, 1.2139865, -0.016164929, 0.06480987, -0.4149706, 0.23398118, -0.37877452, -1.9220417, -0.050598614, -0.043078206, 0.16855747, -1.6443363, -1.1252139, 0.29613024, -0.672517, -0.5698791, 0.9530813, -1.0694199, -0.46017033, 0.24601588, -0.092323065, -0.44932622, -1.0141845, -1.1348956, 0.61431545, 1.1054189, 0.6349839, 0.7187088, -0.17796, -0.62297076, -0.031074379, -0.79158825, 0.9304359, 1.0766014, -0.76064134, 1.7666234, -0.80129695, -0.74121195, -1.0616574, -0.47188386, -0.36682612, 0.056807466, -0.8654932, -1.0248501, 0.546155, -0.5306963, 0.13037133, -0.6111008, 0.6068614, -0.91773814, -0.44095993, 0.5009603, 0.23484223, -0.17028934, -0.99245024, -0.65067893, 0.5472163, -0.3604442, -0.090568155, -0.4291102, 2.0521805, 0.1021027, 0.6916592, -0.023792937, 1.0715119, -0.83712643, -0.262352, 0.49454427, 0.8390617, 1.3250201, 0.46689984, -1.3506244, -0.99871457, -0.41264826, -0.49381423, 0.26062092, -0.0091345385, -0.02672518, -0.83447754, -0.5903585, -0.39882338, -1.0657839, 1.609232, -0.8066679, 0.4368572, -0.27918258, -2.0761468, -0.09133339, -0.9619137, -1.0781144, -1.9522108, 0.26916057, 1.4185976, -0.2584761, -0.8973954, 1.2409537, 1.2401322, -0.5636558, -0.85113424, 0.65403336, -0.060163096, -0.25691256, -2.1591415, 0.51948744, 0.88662255, 0.1598527, 0.44388902, 0.83538866, -0.6544175, 0.7489537, 0.3759879, -0.30538988, 0.76651734, 0.8989458, -1.1572857, -1.8967073, -0.8011603, 0.20302266, -0.10743599, -3.762876, -0.24564815, -0.6410657, 1.6019788, 1.327007, -1.260699, 0.17235702, -0.99035263, 0.1482996, 2.056026, -0.44028974, 1.9759376, -0.12924966, -1.6157428, 0.03122072, -1.1889125, -0.908909, 0.54299027, -0.8005189, -2.12892, -0.791977, 0.74162257, -0.1204547, -0.6256237, -0.26259482, 1.8753844, -0.3260839, 0.080399685, -0.026118852, 0.8907727, 0.4319697, 0.08642858, 0.8313999, 0.17721243, 1.0065078, 0.6526892, 0.7172497, -0.8695093, 0.6089649, 0.27802703, 0.71105754, 0.31578606, 0.9712795, 0.16790774, -0.038687415, -0.13922635, 1.5738863, -1.0589528, -0.4771744, -0.22979447, 0.21364734, 1.2524059, 1.6702797, 0.20834085, 1.1059339, -1.6936125, 0.6711643, 1.6396366, 0.57020766, 1.045982, 1.2803408, 1.4934437, -0.41918638, -1.1421211, 0.030070513, 0.7253566, 0.31505457, 0.63685656, 1.8019769, 0.54031014, 0.11650577, 0.2846742, 1.5046045, 0.5767608, 0.36930075, 0.32829267, 0.052114997, 0.578656, 1.4265828, 0.3710441, 1.0938163, -0.5008584, -0.5134587, -1.9278206, 0.30874428, 0.15796334, -1.2401778, 0.17576662, 2.0004287, -0.02314052, -0.055543534, -0.50468975, -0.11305372, 0.54043645, -0.5756428, 0.49722683, -0.5297424, 0.13753265, 0.25518733, -0.23544669, -0.5141269, 0.75673586, 1.3438044, 0.9461643, -0.39285365, -0.5860044, -1.787984, -0.8788467, -0.40555692, 0.3285657, -0.38691264, 1.3708282, 0.36385515, -0.7747672, 1.2061442, -1.6046813, -0.23393211, 1.293443, -0.31235135, 0.28134233, -1.1506547, -0.0991762, 1.4272449, 0.6899714, -1.3709666, -0.30998096, 0.7646165, 0.52666295, 0.6161754, -0.32877484, -0.054364443, -0.44929767, -0.8694531, 0.94425637, 0.3422884, 0.6323704, 0.34922627, 0.9050418, -1.5845101, 0.45886135, -0.29504868, -0.5662195, -1.5704926, -0.54826355, 2.2663965, -0.96759653, 0.07684225, -0.68078613, -0.49419355, 0.5082733, 1.7261288, 1.2518026, -0.02031415, -0.90473115, 0.35896915, 0.49848247, 0.5520185, -0.7405191, 0.3500682, -0.262386, -0.3942172, 0.29561684, 1.021035, -1.4068037, 2.2699223, 1.4257491, -0.10412434, 0.17128283, -1.0413268, -0.86806285, 0.37422425, -1.391298, -0.995613, -0.81997967, -1.0913445, -0.43824428, 0.7557612, 0.7228685, 1.022525, -0.8960229, -0.5878514, 0.29143187, -0.24042165, -1.5417792, -0.8847957, -0.16454956, -0.108894505, -0.8830671, 0.30506596, -0.047977895, -1.5889373, 0.0026431233, 0.1652314, -0.084799856, -0.14659284, 0.7213514, -0.25080308, -2.7894351, 0.05464632, 0.20575038, -1.2875743, -0.5489224, -0.23698223, 0.62773806, 1.4328256, 0.87418485, 0.29029268, 0.72027886, 1.5169219, -0.93750125, -0.6640493, -0.8408683, -0.69088763, 0.071907505, -0.33705214, -0.37655997, -1.1414671, -0.3436033, 0.6703798, -0.34200937, 0.76734024, 0.48768342, 2.0672226, 0.3513915, -2.6420221, 0.79512703, -1.9421546, -0.39919388, -0.3103354, -1.3154385, 0.5201629, -0.039092638, -1.0361304, 1.2638918, 1.6469301, 1.4541465, -0.12338864, -0.20437062, -1.3766631, 0.20336919, 0.3032297, -1.1453805, -0.63037485, 0.86080396, 0.057820674, -0.17105912, -0.66717327, 0.8759303, -1.5944928, -0.34394643, -0.81281877, -0.10437061, 0.51413935, -0.6940095, 0.09568102, 0.4002368, 0.3984665, -0.4812769, 1.0038961, -2.2231097, 1.4474787, -0.57229334, -0.20271471, 0.8423536, -0.3723959, 1.499843, 0.74556774, -0.2668783, -0.17127366, -0.26935872, 0.04133615, 0.5453585, -0.8243729, -0.39952496, 0.4004973, 0.41419125, -0.5219258, 0.78898853, -1.1944782, -0.069127515, -0.50455236, -0.72714645, -0.020746175, 0.5059885, 0.04399816, -0.7894044, -0.4625147, -1.1342267, 1.1750203, 1.0542814, 0.54491824, 1.1081833, 0.9187785, 0.35971174, 1.2452533, 0.34259045, 0.21274799, -0.3588566, 0.4610651, -0.04601556, 1.4945889, -0.5564384, -1.0967007, 0.7066467, 3.3626142, -0.45100608, 0.94582105, 0.5915438, -1.2985345, 1.8414979, -1.8253032, 0.14959589, -0.77038383, 1.4642384, -0.4388054, 1.288484, 1.3210498, -0.80942005, -0.9672099, -0.65774846, 1.1029816, 0.46842724, -0.6264829, 0.4077455, 0.81473553, -0.42250708, 0.32202694, -0.22059433, -0.7988756, 0.708937, -0.9522668, -0.7775771, 0.059927836, 0.74642587, -0.19692329, -1.2440609, -1.098552, 1.0545642, -1.0772063, 0.74647504, 1.470575, -0.5858193, -0.0924616, -0.17740022, -0.66750735, 1.1928539, -0.23574628, 0.81189126, 0.09582798, 0.4183188, -1.1813284, -0.026065111, 0.31969306, 0.43597493, 0.66805744, 0.62070143, -0.0034784377, -0.8889909, -0.80639535, 0.3112222, 3.1803548E-4, -0.6416318, 0.33191863, 1.1382916, 1.3028858, -0.10085269, 0.3195763, -0.31446657, -0.35984194, -0.38577667, 0.53107315, 0.40813607, 0.7133298, 0.25367644, -1.0670294, -0.6008749, 0.2553314, 0.80797035, -0.35269725, -0.6880298, 0.24852966, -1.1319366, -0.8757431, -0.21580404, -0.18601301, -0.6906879, 0.014807865, 1.1912467, 1.04509, -0.10085851, -0.45177278, -0.072870165, 0.329378, -0.49100843, -0.43467385, -1.2889651, -0.70850945, 0.26771125, 0.18572438, -0.2720942, 0.43180743, -0.81432074, -0.16396782, -0.6017848, -1.1050781, -0.1555152, -0.23216394, 0.037618868, 0.7290777, 0.9550213, 0.5936872, -1.586561, -0.6771395, 0.56206936, 1.130935, -1.2366065, -0.1617217, 0.51420254, 0.971334, 1.78033, -0.1060246, 0.21716677, -0.27206194, 0.54947907, 0.94673073, 0.73379856, -0.8343029, -1.4676459, -0.46819842, 0.48852733, 0.37889057, 0.23780534, 0.38874793, -0.5406712, 1.3277413, 0.15832564, 1.6661067, 1.2097427, 1.4635663, -0.12328875, -0.67774004, -0.28292066, 0.320097, 2.5623178, 1.3031111, -0.603192, -0.89567465, 0.30138868, -1.5841885, 0.53296447, 0.6786059, 0.40331912, 2.0684633, -1.8140808, 1.4070704, -0.3449422, 0.042878196, 0.015341766, -0.5814527, 0.40312484, -1.6848412, 0.3573785, 0.58632135, -1.2993916, 0.4050647, 0.09386148, -0.9597645, 0.24521033, -1.296575, -0.8788979, -0.07583651, -0.19651726, -1.3198664, 0.91247207, -0.23491615, -0.69126385, -0.36646947, 0.6679405, 0.6521822, 1.2520598, -1.2030113, -0.05532061, 1.2752007, 0.65868104, 0.13310033, -0.38185915, -0.36582285, 0.6203386, -0.44607306, -1.0542217, 0.69973034, -0.21898067, -0.90345484, 0.3432177, -1.1876707, -0.61998874, -0.17062163, 0.03154456, 0.9546824, -1.1999363, 0.35003653, 0.3774589, -0.69688475, 0.5394852, -0.4178684, -0.5743325, 0.44549868, 0.23013777, 0.48078102, -1.2584909, 0.17692174, 0.77223897, 2.3418598, -0.60895723, 0.47246987, 0.0635868, -1.6709051, 0.9226307, 0.87492394, -0.26498368, -0.62524897, 0.4892697, -1.2254604, 1.4037976, -0.2848704, -1.2092291, 0.07173258, 0.9759337, 0.28825217, 1.1190293, 0.36933511, -0.86020666, 0.46288306, -0.8207261, 0.7977053, 0.3890648, 1.1675832, 0.0275044, -0.39459595, -0.13455182, 0.07498321, -1.271422, 1.2770928, 0.049766738, -1.4789736, 0.9204863, 0.70714617, 0.70985067, -2.331192, -0.61922467, -0.2763989, -0.5571157, -0.67623353, -1.1761963, -0.21970682, 0.27037323, -0.8994191, -2.381745, 0.6371306, 1.2865686, -0.18902478, 0.50391877, 0.059875734, 0.060568426, -0.29835868, 0.04036907, 0.22656354, -0.50994015, -0.37293923, -1.2668151, 0.49166775, -0.8428958, -0.19374083, -0.60098785, 1.1365696, 0.27369553, -0.7550793, -0.1837983, -0.28003544, -1.5021, 0.017706933, 1.007257, 0.5001768, -0.76717174, 0.81601655, -1.4830563, -0.06647308, -0.8637145, -0.8227021, 0.45729873, 0.8057303, -0.9028343, -0.6716624, 1.3764576, -0.049274106, 1.3423727, -0.92215544, -1.1009762, -0.32981873, 0.7333975, 1.4434083, -2.4913514, 1.482163, 1.5521965, -0.81519526, 0.5059769, 0.44045776, 0.5900404, 1.4250352, 0.49720865, 0.41570318, 0.15930353, -0.13293587, -0.64938587, 1.6937196, -0.1525658, -0.090940125, -1.6866062, -1.2692227, -0.82893753, 0.8964745, 0.75051117, 1.5867168, 0.096937, -0.74163896, -1.2800126, -1.4941839, 1.6449912, 0.4826567, 0.5664867, -1.7497717, -0.06550709, -0.08505991, 0.4821029, 0.54030067, -0.082249105, -0.99253076, 0.2034322, 0.25167018, 0.32151845, 0.032924175, 0.16754732, 0.11660733, -0.69654804, 1.8220257, 0.28798974, 1.8381176, 1.1841091, 1.6198701, 1.8414903, 1.23679, 0.043849654, 0.1534152, 0.18300694, -0.21019913, -0.8895652, -1.1764803, 0.6239901, -0.26321217, 0.06479309, -0.55182844, 0.040147334, 0.2995581, -0.5331417, -1.0413771, 0.60910714, -1.2584362, -0.28730014, 0.12595543, 0.12742367, -1.0103757, -0.8232557, -0.49357045, 0.70783716, 0.30833355, 0.48050115, 0.29242313, -0.7269964, 0.22016521, 0.14010502, -0.7454974, 0.6690863, 0.8573559, -0.17470227, 1.4966593, -1.2781067, -0.77586764, -0.7272115, -0.45727804, 0.17809007, -0.449621, -0.93235147, -0.45838866, 0.7588631, -0.5219085, 0.1722843, -0.51468235, 0.4696321, -0.7007964, -0.6519156, 0.652754, -0.419362, 0.13925533, -1.5399723, -0.36031464, 0.07082115, -0.5639774, -0.2888695, -0.56151384, 2.0554755, 0.14657974, 0.87772167, -0.4596722, 1.6220878, -0.30062535, -0.63579226, 0.23556773, 1.7248702, 0.17956474, 0.51734966, -1.474717, -0.72370553, 0.016837284, -0.6655267, -0.108507134, 0.09206803, 0.23756504, -0.75349075, -0.7275167, 0.3287605, -0.20825714, 0.540179, -0.563493, 0.18271421, -0.93017954, -1.3007112, -0.36480477, -0.9600047, -0.803205, -1.6867162, 0.55379134, 0.6960957, -0.47614285, -0.7246411, 0.5093761, 1.6628364, -0.5569885, -0.6545775, -0.80253917, -0.8271408, -0.9183827, -1.5228175, -0.09946534, 0.99671286, 0.6209274, 0.12665525, 1.159173, -0.30778784, 0.2912266, 0.12909448, 0.579844, 0.14042296, 0.57635796, -1.6015556, -1.344032, -0.08781851, -0.10264405, 0.1350973, -4.4351306, -0.18748549, 0.11809458, 1.3453304, 0.9689776, -0.86725503, 0.02527731, -0.9093106, -0.039363153, 1.8000926, 0.37629968, 1.5821699, -0.11818232, -1.6388477, 0.70786685, -1.7642478, -0.34004864, 0.05239167, -0.45685053, -1.4894409, -0.6160852, 0.8691628, 8.518949, -0.44275343, -0.15159568, 1.7194852, -0.32879514, 0.503711, 0.32538795, -0.047598664, 0.4116954, -0.37143373, 0.8617377, -0.0024800003, 0.68594164, 0.8106313, 0.5021601, -0.65510845, 0.2947012, 0.4580874, 0.8429514, -0.029524736, 1.244981, 0.056723148, -0.11515126, 0.2904784, 1.5083828, -0.90244603, -0.89504975, -0.5929145, -0.13560995, 1.2172327, 1.2993513, 0.5471312, 0.9823583, -0.53089905, 0.6470476, 1.3706353, 0.07710672, 0.66170347, 0.8522321, 3.7581966, 0.18205029, -1.5388376, 0.14968619, 0.7957213, 0.5417012, 0.57052195, 1.7262292, 0.3853963, 0.05573173, 0.019531325, 0.889642, 0.14051607, -0.10019319, 0.52222127, -0.045800984, -0.1372413, 1.3182182, 0.06720713, 0.65188503, -0.49704686, 0.15328996, -1.4841757, 0.07393673, -0.10667658, -1.741219, 0.15979664, 1.0401752, 0.20498934, -0.09760857, 0.26027164, -0.4799143, 0.66915995, 0.0971428, 0.50639033, -0.5895407, -0.2591088, -0.12500899, -0.44097197, -0.018114433, 0.07570505, 1.8875248, 0.72134954, -0.6835846, -0.43611696, -1.5730146, -0.47251692, -0.967706, 0.67281497, -0.3970288, 0.23531409, 0.31934413, -0.4834523, 0.85528296, -1.4495584, -0.17761847, 1.0605572, -0.33328635, 0.09331871, -1.6740737, 0.32838723, 1.2812709, 0.7532023, -1.6620958, -0.06949543, 0.22357371, 0.5511003, 0.44403845, -0.088602625, 0.086290106, -0.29867518, -0.59133786, 0.47898614, -0.16206141, -0.3974132, 0.020216722, 0.9978839, -0.88115966, 0.43280727, -0.027793905, -0.67816794, -0.6834847, -0.310411, 1.4877534, -0.9325847, 0.08318488, -0.056899868, -0.3264665, 0.18626533, 1.311764, 0.52422476, 0.27261677, -0.9771914, -0.07349676, 0.23518278, 0.6440802, -0.38859436, 0.7356058, -0.87186205, -0.79511106, 0.6331253, 0.51360786, -1.8998158, 1.2421445, 1.6992611, 0.3416561, 0.08102964, -1.1458695, -1.3352224, 0.4332353, -0.82750726, -0.68687415, -1.0607231, -0.45399368, -0.65770257, 0.5407971, 0.36140308, 0.78880286, -0.87017035, 0.11368229, 0.9742579, -0.836373, -1.4891531, -0.39808506, -0.12711097, 0.2665581, -0.94508183, 0.3168681, 0.18193309, -2.0642102, -0.42695135, -0.01493331, -0.8744083, 0.136745, 0.33562094, 0.35592413, -1.9299185, -0.9336301, 0.21273266, -1.1257002, -0.46698323, -0.44841182, 0.4095448, 0.9316055, 0.42856336, 0.7239482, 0.5807358, 1.7736349, -0.8905484, -0.98154503, -0.8812651, -0.591294, 0.114608765, 0.074452646, -0.7906054, -0.48456904, 0.58756906, 0.72785217, -0.45900884, 0.80664396, 0.20831603, 1.404514, 0.10135339, -1.7207683, 0.121471085, -1.4293977, -0.25176442, -0.88530314, -1.932973, 0.75488913, 0.053633798, -0.5996313, 1.1192294, 0.7987387, 1.0803125, -0.20899309, -0.3250925, -1.0392616, 0.60894144, 0.24588943, -0.64634514, -0.6554399, 0.8959745, 0.44019213, -0.045357216, -0.38841888, 0.79150975, -0.70056456, -0.10906712, -0.35132694, 0.38104087, 0.83124346, -0.9196306, 0.101093374, 0.3173144, 0.35568184, -0.72773474, 1.0110441, -2.1881406, 0.90069056, -1.2138778, -0.49465472, 0.29515645, -0.42973396, 0.86696035, 0.462676, -0.2891507, 0.48092514, 0.14870986, 0.2362285, 0.94265085, -0.95444787, -0.7235914, 0.15523535, 0.8009351, -0.57308763, 0.8169279, -0.66213703, -0.03514193, -0.06134875, -0.7540824, -0.20499344, 0.5033528, 0.6832062, -1.0438838, 0.0013836473, -0.5009912, 0.93052953, 0.57491046, 0.42732602, 1.4600122, 0.7491548, 0.1275791, 0.9447524, 0.14973052, 0.5151727, -0.4853087, 0.71405834, 0.5183598, 1.313502, -0.21636684, -0.77506334, -0.12591712, 1.486607, -0.7264576, 0.99942267, 0.3202754, -1.502707, 1.4193612, -1.40818, 0.27752662, -0.80451846, 1.1607374, -0.20769496, 0.61043406, 1.315206, 0.0568088, -0.40790638, -0.5757813, 1.0029505, -0.25614408, -0.60398436, 0.2829705, 0.90209776, 0.19745542, -0.3516592, -0.55319506, -0.1090347, 0.9403592, -0.28909415, -0.61357373, -0.28233677, 0.8260039, -0.211104, -1.1662388, -0.7386189, 1.4462554, -0.34844738, 0.37773976, 0.7810842, -0.5882355, -0.059488796, -0.19547813, -0.24606134, 0.6835963, 0.2511679, 0.856332, -1.0636065, 0.3394099, -0.96563685, -0.005031675, 0.50627327, -0.5008203, 0.90881467, 0.3842252, 0.11551586, -0.83781016, -0.77075464, -0.2338815, -0.035362475, -1.0022215, 0.20489949, 1.1973978, 0.6405313, 0.22105882, 0.759547, -0.15372802, -0.9853528, -0.055215254, -0.11200724, 0.93392026, 0.92165124, 0.56908315, -1.6037151, -0.63075554, -0.3626079, 0.42245942, -0.37033117, -0.899393, 0.3136378, -0.38658756, -0.045805737, -0.12737003, -0.62156856, -0.77010757, 0.3646657, 0.30881408, 0.81467205, -0.35185418, -1.2174497, -0.124289915, 0.21588212, -0.5912653, 0.5155864, -0.55197835, -0.74786615, 0.32146156, -0.54999655, -0.3350795, -0.074797854, -1.4570993, 0.23734923, -0.6517045, -0.39027223, -0.0027831644, -0.07549344, -0.12575209, 1.3137401, 0.77984715, 0.5054453, -1.1595855, -0.31115592, 0.5981977, 1.5581173, -0.71296954, -0.60147953, 0.23892058, 0.90308523, 1.2783934, 0.4829749, 0.56447566, -0.11322677, 0.4671607, 0.7727588, 0.7172333, -0.1574448, -1.2798158, -0.3061784, 0.6185353, 0.9465671, 0.679906, -0.2793042, -0.46887103, -0.016957872, -0.17706259, 0.90864146, 0.5860386, 0.78973603, -0.2444247, -1.0041484, -0.34054106, 0.3139922, 5.928577, 1.9771936, -0.54047304, -0.6981526, 0.18960235, -0.8373701, 0.44040245, 0.92274296, 0.32851875, 2.1369495, -1.9185268, 1.7090166, -0.22396593, -0.0027257204, 0.2886428, -0.14268377, 0.30027795, -1.1787082, 0.29569986, 0.44846383, -1.0683426, 0.19287628, -0.061031498, -0.45552272, 0.8514906, -1.1983136, -0.7224097, 0.56610334, -0.43930328, -1.6241871, 0.022371702, 0.056378156, -0.28574908, 0.22669566, 0.6215599, 0.56851315, -0.12263401, -1.1360767, -0.6112565, 0.9653295, 0.23831022, 0.46430987, -0.004769601, 0.007459389, 0.447268, -0.1048284, -0.29818714, 0.39249915, -0.34207064, -0.57210505, -0.4499803, -0.7788103, -0.0464814, -0.31602553, -0.30049258, -0.26680958, -0.12828995, -0.037486445, 0.09821058, -0.24948204, -0.25496805, 0.3345239, -1.4232894, -0.15812662, 0.08070272, -0.36936277, -0.69673073, -0.33060092, 0.73889613, 1.8970333, -0.53052443, 0.9062418, -0.33914202, -1.9018056, 0.61787736, 0.46802747, -0.40738654, -0.24149843, 0.52864766, -1.6946682, 1.5362931, -0.2065873, -1.3585843, 0.3950286, 0.48188406, 0.37551737, 0.4769164, 0.48761457, -1.0027927, 0.14477731, -1.1952885, -0.23367448, 1.2076813, 0.58423406, 0.07876493, -1.041011, 0.13759089, -0.14066333, -0.40304744, 0.8249726, 0.5309512, -1.5140133, 0.6465395, 0.00805977, -0.35565233, -1.0447453, -1.6391871, -0.57476056, -0.60116166, -0.6509856, -1.6507915, -0.24304004, -0.32796037, -0.9862035, -2.3792913, 0.72232765, 0.88596475, 0.05681677, 0.69371164, 0.4067158, -0.32266128, 0.35941786, 0.14268196, 0.008820172, -0.44048947, -0.3807906, -1.2657222, 0.011590555, -1.4166234, -0.5570914, -0.09691977, 0.61406046, 0.85134614, -0.9073981, -0.14514786, -0.19705656, -1.3431568, -0.18641903, 1.1970922, 0.43596244, -0.4643676, 0.23464873, -1.4809799, 0.22952351, -0.79023015, -0.9660293, -0.06106868, 0.91435355, -0.9410994, -0.27363744, 1.1213156, -0.5552039, 0.47450387, -0.67726296, -0.84531724, -0.3695472, 0.32097948, 1.236008, -1.9377409, 0.8715727, 1.7278404, -0.7182699, 0.34749338, 0.055821747, -0.25673252, 1.5338271, 0.5981914, 0.26056722, 0.35266542, 0.34506303, -0.2707516, 1.6680403, -0.26225284, 0.28264982, -0.93208283, -0.7195003, -0.49397373, 1.097455, -0.17251527, 1.2040282, -0.13247448, -0.8344006, -1.3730105, -0.9985511, 1.6127682, 0.102908984, -0.050705314, -2.0138884, -0.26599008, -0.67300093, 0.4828793, 0.8306255, 0.06904271, -0.2150876, 0.71669734, 0.71310204, 0.18367703, 0.3811021, 0.3367172, 0.4790209, -0.52320474, 1.4387411, 0.49768502, 1.6168096, 0.48664856, 2.0569668, 1.767732, 1.2483784, -0.1911243, 0.2164427, -0.41037652, 0.44743055, -0.32683307, -1.4615301, -0.2763298, -0.3156423, 0.28007326, -1.0386963, -0.556035, 0.55629194, -1.0255252, -0.54166985, 0.47017503, -1.3562512, -0.6570422, 0.85600406, 0.42322922, -0.3800823, -0.96864665, -0.39303845, 0.6151631, 0.8127344, 0.40640417, 0.29468858, -0.3595955, -0.26588053, -0.48084825, 0.1381006, 0.6274589, 0.50441945, -0.70409054, 0.6415553, -1.4776558, -0.7265096, -0.56839985, -0.37481079, -0.0556299, -0.07709563, -1.0079755, -0.31482062, 0.5529114, -0.2905458, -0.33441335, -0.7538321, 1.0301089, -0.8336837, 0.014018759, 0.6930184, 0.2822684, -0.59929043, -1.2549504, -0.04152093, -0.15594202, -0.8416114, 0.30521527, 0.085296825, 1.998172, 0.17953297, 0.81972474, -0.12049776, 0.636938, -0.32321817, -0.6623517, 0.4681129, 0.86831105, 1.3369138, 0.3237801, -1.4724734, -0.77724206, -0.13026565, -0.4761805, 0.25618175, -0.5109254, 0.33371875, -0.54170126, -0.25134182, 0.2437961, -0.46777722, 0.7951042, -0.92533684, 0.3077589, -0.67483133, -1.337733, -0.46373364, -0.6056862, -1.1445198, -0.5523313, 0.5446045, 0.69936764, -0.100782454, -0.7716193, 0.18777585, 1.7000009, -0.13324845, -0.04496102, -0.38585514, -0.6497307, -0.9735717, -0.3312297, 0.67569, 0.6791347, 0.1443547, -0.28027967, 1.9505106, -0.31825987, 0.09358952, -0.003940981, 0.060346037, 0.75013196, 0.75749826, -1.0889099, -1.6545596, 0.1618316] -2025-10-16 21:36:09 [main] INFO experimental.OnnxTest - ------------------------ -2025-10-16 21:36:09 [main] INFO experimental.OnnxTest - tokenizer加载耗时: 4082ms -2025-10-16 21:36:09 [main] INFO experimental.OnnxTest - tokenizer计算耗时: 1ms -2025-10-16 21:36:09 [main] INFO experimental.OnnxTest - 模型加载耗时: 441ms -2025-10-16 21:36:09 [main] INFO experimental.OnnxTest - 模型数据准备耗时: 10ms -2025-10-16 21:36:09 [main] INFO experimental.OnnxTest - 模型计算耗时: 5ms From 1947f25ed652dda84d875825b34cbfdbfb694dd4 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Tue, 16 Dec 2025 21:59:53 +0800 Subject: [PATCH 028/182] feat(LocalRunnerClient): support executing origin actions Context: Origin actions are generated by DynamicActionGenerator and may optionally be persistently serialized. This feature adds the basic execution flow for origin actions within LocalRunnerClient. Notes: The current mapping between action files and their extensions is hardcoded. This should later be replaced with a configurable registry or loaded dynamically during application startup. --- .../core/action/runner/LocalRunnerClient.java | 37 +++++++++++++++-- .../java/resources/action/tmp/hello_world.py | 24 +++++++++++ .../action/runner/LocalRunnerClientTest.java | 40 +++++++++++++++++++ 3 files changed, 98 insertions(+), 3 deletions(-) create mode 100644 Partner-Main/src/test/java/resources/action/tmp/hello_world.py create mode 100644 Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 95370f3f..6e30a456 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -1,5 +1,6 @@ package work.slhaf.partner.core.action.runner; +import cn.hutool.core.io.FileUtil; import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; import lombok.Data; @@ -57,10 +58,40 @@ public class LocalRunnerClient extends RunnerClient { private RunnerResponse doRunWithOrigin(MetaAction metaAction) { RunnerResponse response = new RunnerResponse(); - + File file = metaAction.getPath().toFile(); + String ext = FileUtil.getSuffix(file); + if (ext == null || ext.isEmpty()) { + response.setOk(false); + response.setData("未知文件类型"); + return response; + } + String[] commands = buildCommands(ext, metaAction.getParams(), file.getAbsolutePath()); + SystemExecResult execResult = exec(commands); + response.setOk(execResult.isOk()); + response.setData(execResult.getTotal()); return response; } + //TODO 后续需在加载时、或者通过配置文件获取可用命令并注册匹配 + private String[] buildCommands(String ext, Map params, String absolutePath) { + String command = switch (ext) { + case "py" -> "python"; + case "sh" -> "bash"; + default -> null; + }; + if (command == null) { + return null; + } + String[] commands = new String[params.size() + 2]; + commands[0] = command; + commands[1] = absolutePath; + AtomicInteger paramCount = new AtomicInteger(2); + params.forEach((param, value) -> { + commands[paramCount.getAndIncrement()] = "--" + param + "=" + value; + }); + return commands; + } + private RunnerResponse doRunWithMcp(MetaAction metaAction) { RunnerResponse response = new RunnerResponse(); @@ -95,7 +126,7 @@ public class LocalRunnerClient extends RunnerClient { JSONObject sysDependencies = new JSONObject(); sysDependencies.put("language", "Python"); JSONArray dependencies = sysDependencies.putArray("dependencies"); - SystemExecResult pyResult = exec("pip", "li", "--format=feeze"); + SystemExecResult pyResult = exec("pip", "list", "--format=freeze"); System.out.println(pyResult); if (pyResult.isOk()) { List resultList = pyResult.getResultList(); @@ -283,7 +314,7 @@ public class LocalRunnerClient extends RunnerClient { } private void handleParentDirEvent(WatchEvent.Kind kind, Path thisDir, Path context, - WatchService watchService) { + WatchService watchService) { Path path = Path.of(thisDir.toString(), context.toString()); // MODIFY 事件不进行处理 if (kind == StandardWatchEventKinds.ENTRY_CREATE) { diff --git a/Partner-Main/src/test/java/resources/action/tmp/hello_world.py b/Partner-Main/src/test/java/resources/action/tmp/hello_world.py new file mode 100644 index 00000000..d477459e --- /dev/null +++ b/Partner-Main/src/test/java/resources/action/tmp/hello_world.py @@ -0,0 +1,24 @@ +import sys + + +def parse_args(argv): + """ + 将 --key=value 解析成 dict + """ + params = {} + for arg in argv: + if arg.startswith("--") and "=" in arg: + key, value = arg[2:].split("=", 1) + params[key] = value + return params + + +def main(): + params = parse_args(sys.argv[1:]) + + name = params.get("name", "World") + print(f"Hello {name}!") + + +if __name__ == "__main__": + main() diff --git a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java new file mode 100644 index 00000000..77637a34 --- /dev/null +++ b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java @@ -0,0 +1,40 @@ +package work.slhaf.partner.core.action.runner; + +import org.jetbrains.annotations.NotNull; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import work.slhaf.partner.core.action.entity.MetaAction; +import work.slhaf.partner.core.action.entity.MetaActionType; + +import java.nio.file.Path; +import java.util.Map; +import java.util.concurrent.Executors; + +public class LocalRunnerClientTest { + + static LocalRunnerClient runnerClient; + + @BeforeAll + static void beforeAll() { + runnerClient = new LocalRunnerClient(Map.of(), Executors.newVirtualThreadPerTaskExecutor(), "/home/slhaf/Projects/IdeaProjects/Projects/Partner/Partner-Main/src/test/java/resources/action/data"); + } + + @Test + void runOrigin() { + MetaAction metaAction = buildTmpMetaAction(); + + RunnerClient.RunnerResponse runnerResponse = runnerClient.doRun(metaAction); + System.out.println(runnerResponse.getData()); + } + + private static @NotNull MetaAction buildTmpMetaAction() { + MetaAction metaAction = new MetaAction(); + metaAction.setIo(false); + metaAction.setKey("hello_world"); + metaAction.setParams(Map.of("name", "origin_run")); + metaAction.setOrder(-1); + metaAction.setType(MetaActionType.ORIGIN); + metaAction.setPath(Path.of("/home/slhaf/Projects/IdeaProjects/Projects/Partner/Partner-Main/src/test/java/resources/action/tmp/hello_world.py")); + return metaAction; + } +} From 8a7681ae31db0a2e7bef55b468b1307c85670067 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Wed, 17 Dec 2025 20:02:28 +0800 Subject: [PATCH 029/182] chore(LocalRunnerClient): remove a redundant comment --- .../work/slhaf/partner/core/action/runner/LocalRunnerClient.java | 1 - 1 file changed, 1 deletion(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 6e30a456..fcb96e8d 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -43,7 +43,6 @@ public class LocalRunnerClient extends RunnerClient { protected RunnerResponse doRun(MetaAction metaAction) { RunnerResponse response; try { - // 由于三种方式返回的内容结构变化太大,所以选择油具体执行逻辑返回真正的 Response 对象 response = switch (metaAction.getType()) { case MetaActionType.MCP -> doRunWithMcp(metaAction); case MetaActionType.ORIGIN -> doRunWithOrigin(metaAction); From 0413fc281de1d56c654b0d69b6e75aee39f44c42 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Wed, 17 Dec 2025 22:18:43 +0800 Subject: [PATCH 030/182] chore(MetaAction): update outdated comment --- .../java/work/slhaf/partner/core/action/entity/MetaAction.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java index d4545eb6..a9e61a61 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java @@ -35,8 +35,7 @@ public class MetaAction implements Comparable { */ private boolean io; /** - * 行动程序类型,可分为PLUGIN(jar文件)、SCRIPT(Python程序)、MCP(MCP服务) - * . + * 行动程序类型,可分为 MCP、ORIGIN 两种,前者对应读取到的 MCP Tool、后者对应生成的临时行动程序 */ private MetaActionType type; From 1e6ff1b30c738ff2ce539eb5a2d9eb3bb8a731dd Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Thu, 18 Dec 2025 15:42:02 +0800 Subject: [PATCH 031/182] chore(ActionCore): update outdated comment --- .../main/java/work/slhaf/partner/core/action/ActionCore.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java index 0dde618a..5373b147 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java @@ -55,7 +55,7 @@ public class ActionCore extends PartnerCore { private final ExecutorService virtualExecutor = Executors.newVirtualThreadPerTaskExecutor(); /** - * 已存在的行动程序,键为目录名,值为从目录加载的行动程序元信息 + * 已存在的行动程序,键格式为‘::’,值为 MCP Server 通过 Resources 相关渠道传递的行动程序元信息 */ private final Map existedMetaActions = new HashMap<>(); private final List phaserRecords = new ArrayList<>(); From 0eee12d6854ade5620c696eda2620e9916256186 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Thu, 18 Dec 2025 16:24:04 +0800 Subject: [PATCH 032/182] refactor(MetaActionInfo): remove outdated constructor Context: Previously, MetaActionInfo comes from the local filesystem changes. But now MCP Servers already provide a method to get information of MetaActions. The pre- or post-dependencies are still required, for some MCP Tools cannot just be executed without additional context. --- .../core/action/entity/MetaActionInfo.java | 35 ------------------- .../core/action/runner/LocalRunnerClient.java | 4 +-- 2 files changed, 2 insertions(+), 37 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaActionInfo.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaActionInfo.java index c9bbd04d..bd8dbc6c 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaActionInfo.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaActionInfo.java @@ -1,16 +1,8 @@ package work.slhaf.partner.core.action.entity; -import cn.hutool.core.bean.BeanUtil; import com.alibaba.fastjson2.JSONObject; import lombok.Data; -import org.apache.commons.io.FileUtils; -import work.slhaf.partner.core.action.exception.ActionLoadFailedException; -import java.io.File; -import java.nio.charset.StandardCharsets; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import java.util.Map; @@ -32,31 +24,4 @@ public class MetaActionInfo { private boolean strictDependencies; private JSONObject responseSchema; - - public MetaActionInfo(File actionDir) { - if (actionDir.isFile()) { - throw new ActionLoadFailedException("Action directory expected, but file found: " + actionDir.getAbsolutePath()); - } - File[] files = actionDir.listFiles(); - if (files == null || files.length == 0) { - throw new ActionLoadFailedException("Action directory is empty: " + actionDir.getAbsolutePath()); - } - //加载desc.json - File desc = Path.of(actionDir.getPath(), "desc.json").toFile(); - if (!desc.exists() || desc.isDirectory()) { - throw new ActionLoadFailedException("Action desc.json not found: " + desc.getAbsolutePath()); - } - try { - String s = FileUtils.readFileToString(desc, StandardCharsets.UTF_8); - MetaActionInfo temp = JSONObject.parseObject(s, MetaActionInfo.class); - BeanUtil.copyProperties(temp, this); - } catch (Exception e) { - throw new ActionLoadFailedException("Failed to load action desc.json: " + desc.getAbsolutePath(), e); - } - //进行必要的字段校验和初始化 - if (type == null) throw new ActionLoadFailedException("Action type missing in desc.json"); - if (params == null) params = new HashMap<>(); - if (preActions == null) preActions = new ArrayList<>(); - if (postActions == null) postActions = new ArrayList<>(); - } } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index fcb96e8d..725da9a1 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -282,7 +282,7 @@ public class LocalRunnerClient extends RunnerClient { if (!complete) return; try { - MetaActionInfo newActionInfo = new MetaActionInfo(thisDir.toFile()); + MetaActionInfo newActionInfo = new MetaActionInfo(); existedMetaActions.put(thisDir.toString(), newActionInfo); } catch (ActionLoadFailedException e) { log.warn("行动信息重新加载失败,触发行为: {}", kind.name()); @@ -366,7 +366,7 @@ public class LocalRunnerClient extends RunnerClient { } for (File f : files) { try { - MetaActionInfo actionInfo = new MetaActionInfo(f); + MetaActionInfo actionInfo = new MetaActionInfo(); existedMetaActions.put(f.getName(), actionInfo); log.info("行动程序[{}]已加载", actionInfo.getKey()); } catch (ActionLoadFailedException e) { From ad58567ada0b08a737e692f744d1a9bdd1cfe534 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Thu, 18 Dec 2025 17:52:15 +0800 Subject: [PATCH 033/182] chore(deps): introduce mcp dependencies --- Partner-Main/pom.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Partner-Main/pom.xml b/Partner-Main/pom.xml index e4211334..f05dea7b 100644 --- a/Partner-Main/pom.xml +++ b/Partner-Main/pom.xml @@ -44,6 +44,12 @@ tokenizers 0.34.0 + + + io.modelcontextprotocol.sdk + mcp + 0.17.0 + From cb28a5b0680309cfdd2d7d8fe98037b28e732d0f Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Thu, 18 Dec 2025 21:48:35 +0800 Subject: [PATCH 034/182] feat(RunnerClient): add InProcessMcpTransport to support in-process MCP communication Context: This allows RunnerClient implementations to host local MCP servers without spawning another process. --- .../core/action/runner/RunnerClient.java | 163 ++++++++++++++++++ .../core/action/runner/RunnerClientTest.java | 42 +++++ 2 files changed, 205 insertions(+) create mode 100644 Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/RunnerClientTest.java diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java index da80db13..fd2b22be 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java @@ -1,8 +1,25 @@ package work.slhaf.partner.core.action.runner; import com.alibaba.fastjson2.JSONObject; +import io.modelcontextprotocol.client.McpClient; +import io.modelcontextprotocol.client.McpSyncClient; +import io.modelcontextprotocol.client.transport.HttpClientSseClientTransport; +import io.modelcontextprotocol.client.transport.ServerParameters; +import io.modelcontextprotocol.client.transport.StdioClientTransport; +import io.modelcontextprotocol.client.transport.customizer.McpSyncHttpClientRequestCustomizer; +import io.modelcontextprotocol.common.McpTransportContext; +import io.modelcontextprotocol.json.McpJsonMapper; +import io.modelcontextprotocol.json.TypeRef; +import io.modelcontextprotocol.server.McpServer; +import io.modelcontextprotocol.server.McpStatelessAsyncServer; +import io.modelcontextprotocol.server.McpStatelessServerHandler; +import io.modelcontextprotocol.spec.McpClientTransport; +import io.modelcontextprotocol.spec.McpSchema; +import io.modelcontextprotocol.spec.McpStatelessServerTransport; import lombok.Data; import lombok.extern.slf4j.Slf4j; +import reactor.core.publisher.Mono; +import reactor.core.publisher.Sinks; import work.slhaf.partner.core.action.entity.McpData; import work.slhaf.partner.core.action.entity.MetaAction; import work.slhaf.partner.core.action.entity.MetaAction.Result; @@ -11,8 +28,14 @@ import work.slhaf.partner.core.action.entity.MetaActionInfo; import java.io.IOException; import java.nio.file.Path; +import java.time.Duration; +import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.concurrent.ExecutorService; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.function.Consumer; +import java.util.function.Function; @Slf4j public abstract class RunnerClient { @@ -60,4 +83,144 @@ public abstract class RunnerClient { private boolean ok; private String data; } + + public static final class InProcessMcpTransport implements McpClientTransport, McpStatelessServerTransport { + + // 每个 transport 只处理一条 inbound 流 + private final Sinks.Many inbound = + Sinks.many().unicast().onBackpressureBuffer(); + + private final AtomicBoolean clientConnected = new AtomicBoolean(false); + private final AtomicBoolean serverConnected = new AtomicBoolean(false); + + /** + * 对端 + */ + private volatile InProcessMcpTransport peer; + + private volatile McpStatelessServerHandler serverHandler; + + public record Pair(InProcessMcpTransport clientSide, InProcessMcpTransport serverSide) { + } + + public static Pair pair() { + InProcessMcpTransport client = new InProcessMcpTransport(); + InProcessMcpTransport server = new InProcessMcpTransport(); + + client.peer = server; + server.peer = client; + + return new Pair(client, server); + } + + /* ====================================================== + * Internal receive: peer.sendMessage -> this.receive + * ====================================================== */ + private void receive(McpSchema.JSONRPCMessage message) { + if (inbound.tryEmitNext(message).isFailure()) { + throw new RuntimeException("Failed to receive message: " + message); + } + } + + /* ====================================================== + * Client → Server sendMessage + * ====================================================== */ + @Override + public Mono sendMessage(McpSchema.JSONRPCMessage message) { + InProcessMcpTransport p = this.peer; + if (p == null) { + return Mono.error(new IllegalStateException("Transport is not linked")); + } + return Mono.fromRunnable(() -> p.receive(message)); + } + + /* ====================================================== + * Client connect(handler) 处理 server → client 消息 + * ====================================================== */ + @Override + public Mono connect(Function, Mono> handler) { + if (!clientConnected.compareAndSet(false, true)) { + return Mono.error(new IllegalStateException("Client already connected")); + } + + return inbound.asFlux() + .concatMap(msg -> + handler.apply(Mono.just(msg)) + // handler may emit response message → send back to server + .flatMap(resp -> resp != null ? sendMessage(resp) : Mono.empty()) + ) + .doFinally(sig -> clientConnected.set(false)) + .then(); + } + + @Override + public void setExceptionHandler(Consumer handler) { + McpClientTransport.super.setExceptionHandler(handler); + } + + /* ====================================================== + * Server: bind stateless handler = process client → server inbound + * ====================================================== */ + @Override + public void setMcpHandler(McpStatelessServerHandler handler) { + this.serverHandler = handler; + + if (!serverConnected.compareAndSet(false, true)) { + throw new IllegalStateException("Server already connected"); + } + + // 订阅 client → server 消息 + inbound.asFlux() + .concatMap(this::handleServerMessage) + .doFinally(sig -> serverConnected.set(false)) + .subscribe(); + } + + /** + * Server 端处理 JSONRPCMessage + */ + private Mono handleServerMessage(McpSchema.JSONRPCMessage msg) { + // 创建 transport context(简单实现即可) + McpTransportContext ctx = key -> null; + + if (msg instanceof McpSchema.JSONRPCRequest req) { + return serverHandler.handleRequest(ctx, req) + .flatMap(this::sendMessage); + } + + if (msg instanceof McpSchema.JSONRPCNotification noti) { + return serverHandler.handleNotification(ctx, noti); + } + + return Mono.empty(); + } + + /* ====================================================== + * other boilerplate + * ====================================================== */ + + @Override + public void close() { + McpClientTransport.super.close(); + } + + @Override + public Mono closeGracefully() { + inbound.tryEmitComplete(); + clientConnected.set(false); + serverConnected.set(false); + return Mono.empty(); + } + + @Override + public T unmarshalFrom(Object data, TypeRef typeRef) { + return McpJsonMapper.getDefault().convertValue(data, typeRef); + } + + @Override + public List protocolVersions() { + return McpClientTransport.super.protocolVersions(); + } + } + } diff --git a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/RunnerClientTest.java b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/RunnerClientTest.java new file mode 100644 index 00000000..29bf2d51 --- /dev/null +++ b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/RunnerClientTest.java @@ -0,0 +1,42 @@ +package work.slhaf.partner.core.action.runner; + +import io.modelcontextprotocol.client.McpClient; +import io.modelcontextprotocol.client.McpSyncClient; +import io.modelcontextprotocol.server.McpServer; +import io.modelcontextprotocol.server.McpStatelessServerFeatures; +import io.modelcontextprotocol.server.McpStatelessSyncServer; +import io.modelcontextprotocol.spec.McpSchema; +import org.junit.jupiter.api.Test; + +import java.util.List; + +public class RunnerClientTest { + + @Test + void inProcessMcpTransportTest() { + RunnerClient.InProcessMcpTransport.Pair pair = RunnerClient.InProcessMcpTransport.pair(); + RunnerClient.InProcessMcpTransport clientSide = pair.clientSide(); + RunnerClient.InProcessMcpTransport serverSide = pair.serverSide(); + McpStatelessSyncServer server = McpServer.sync(serverSide) + .capabilities(McpSchema.ServerCapabilities.builder().tools(true).build()) + .build(); + server.addTool(McpStatelessServerFeatures.SyncToolSpecification.builder() + .tool(McpSchema.Tool.builder().name("111").build()).callHandler((mcpTransportContext, callToolRequest) -> { + System.out.println(111); + return McpSchema.CallToolResult.builder().addContent(new McpSchema.TextContent("111")).build(); + }).build()); + McpSyncClient client = McpClient.sync(clientSide) + .build(); + + List tools = client.listTools().tools(); + McpSchema.Tool tool = tools.getFirst(); + System.out.println(tool.toString()); + + McpSchema.CallToolResult callToolResult = client.callTool(McpSchema.CallToolRequest.builder().name(tool.name()).build()); + System.out.println(callToolResult.content().toString()); + + client.close(); + server.close(); + } + +} From e851e33b2ec2992c4a51235b8528e33281fde764 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Thu, 18 Dec 2025 22:25:32 +0800 Subject: [PATCH 035/182] feat(RunnerClient): support MCP type-based dynamic client/server registration This allows implementations of RunnerClient to dynamically register different types of MCP service, and also provides a shutdown hook to close client/server properly. --- .../core/action/runner/RunnerClient.java | 137 ++++++++++++++++++ .../core/action/runner/RunnerClientTest.java | 66 +++++++++ 2 files changed, 203 insertions(+) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java index fd2b22be..4ac0f326 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java @@ -42,6 +42,8 @@ public abstract class RunnerClient { protected final Map existedMetaActions; protected final ExecutorService executor; + protected final Map mcpClients = new HashMap<>(); + protected final Map localMcpServers = new HashMap<>(); /** * ActionCore 将注入虚拟线程池 @@ -49,6 +51,18 @@ public abstract class RunnerClient { public RunnerClient(Map existedMetaActions, ExecutorService executor) { this.existedMetaActions = existedMetaActions; this.executor = executor; + setupShutdownHook(); + } + + protected void setupShutdownHook() { + this.mcpClients.forEach((id, client) -> { + client.close(); + log.info("[{}] MCP-Client 已关闭", id); + }); + this.localMcpServers.forEach((id, server) -> { + server.close(); + log.info("[{}] MCP-Server 已关闭", id); + }); } /** @@ -65,6 +79,77 @@ public abstract class RunnerClient { result.setStatus(response.isOk() ? ResultStatus.SUCCESS : ResultStatus.FAILED); } + protected void registerMcpClient(String id, McpServerParams mcpServerParams) { + McpClientTransport clientTransport = createTransport(mcpServerParams); + McpSyncClient client = McpClient.sync(clientTransport) + .requestTimeout(Duration.ofSeconds(mcpServerParams.timeout)) + .clientInfo(new McpSchema.Implementation(id, "PARTNER")) + // 行动程序(现 MCP Tool)的描述文本将直接由resources返回 + // 原因: ToolChange 发送的内容侧重调用,缺少可承担描述文本的字段 + // ResourcesChange 事件传递的 Resource 可以由 Client 读取内容 + // 预计在 Server 侧,收到客户端发送的新的行动程序信息,该信息由客户端处补充后,将其放置在指定位置 + // 并写入描述文件、发起 ResourcesChange 事件 + .resourcesChangeConsumer(resources -> updateExistedMetaActions(id, resources)) + .build(); + mcpClients.put(id, client); + } + + private void updateExistedMetaActions(String id, List resources) { + synchronized (existedMetaActions) { + McpSyncClient client = mcpClients.get(id); + for (McpSchema.Resource resource : resources) { + McpSchema.ReadResourceResult resourceResult = client.readResource(resource); + for (McpSchema.ResourceContents resourceContent : resourceResult.contents()) { + // 忽略非文本类型,行动描述信息只会以文本形式存在 + if (resourceContent instanceof McpSchema.TextResourceContents content) { + MetaActionInfo metaActionInfo = JSONObject.parseObject(content.text(), MetaActionInfo.class); + existedMetaActions.put(id + "::" + metaActionInfo.getKey(), metaActionInfo); + } + } + } + } + } + + private McpClientTransport createTransport(McpServerParams mcpServerParams) { + return switch (mcpServerParams) { + case InProcessMcpServerParams params -> { + InProcessMcpTransport.Pair pair = InProcessMcpTransport.pair(); + createInProcessMcpServer(params.id, pair.serverSide); + yield pair.clientSide; + } + case StdioMcpServerParams params -> { + ServerParameters serverParameters = ServerParameters.builder(params.command) + .env(params.env) + .args(params.args) + .build(); + yield new StdioClientTransport(serverParameters, McpJsonMapper.getDefault()); + } + case HttpMcpServerParams params -> { + McpSyncHttpClientRequestCustomizer customizer = (builder, method, endpoint, body, context) -> { + params.headers.forEach(builder::setHeader); + }; + yield HttpClientSseClientTransport.builder(params.baseUri) + .httpRequestCustomizer(customizer) + .sseEndpoint(params.endpoint) + .build(); + } + }; + } + + private void createInProcessMcpServer(String id, InProcessMcpTransport serverSide) { + McpSchema.ServerCapabilities serverCapabilities = McpSchema.ServerCapabilities.builder() + .tools(true) + .resources(true, true) + .build(); + + McpStatelessAsyncServer server = McpServer.async(serverSide) + .capabilities(serverCapabilities) + .serverInfo(id, "PARTNER") + .build(); + + localMcpServers.put(id, server); + } + protected abstract RunnerResponse doRun(MetaAction metaAction); public abstract Path buildTmpPath(MetaAction tempAction, String codeType); @@ -84,6 +169,58 @@ public abstract class RunnerClient { private String data; } + protected sealed abstract static class McpServerParams permits HttpMcpServerParams, InProcessMcpServerParams, StdioMcpServerParams { + private final int timeout; + + private McpServerParams(int timeout) { + this.timeout = timeout; + } + } + + protected final static class HttpMcpServerParams extends McpServerParams { + private final String baseUri; + private final String endpoint; + private final Map headers; + + protected HttpMcpServerParams(int timeout, String baseUri, String endpoint, Map header) { + super(timeout); + this.baseUri = baseUri; + this.endpoint = endpoint; + this.headers = header; + } + } + + protected final static class StdioMcpServerParams extends McpServerParams { + private final String command; + private final Map env; + private final List args; + + protected StdioMcpServerParams(int timeout, String command, Map env, List args) { + super(timeout); + this.command = command; + this.env = env; + this.args = args; + } + } + + protected final static class InProcessMcpServerParams extends McpServerParams { + private final String id; + + protected InProcessMcpServerParams(int timeout, String id) { + super(timeout); + this.id = id; + } + } + + protected enum McpServerType { + HTTP, + STDIO, + /** + * 对应 Partner 内部的 Server 创建方式 + */ + SELF + } + public static final class InProcessMcpTransport implements McpClientTransport, McpStatelessServerTransport { // 每个 transport 只处理一条 inbound 流 diff --git a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/RunnerClientTest.java b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/RunnerClientTest.java index 29bf2d51..6f463270 100644 --- a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/RunnerClientTest.java +++ b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/RunnerClientTest.java @@ -1,5 +1,6 @@ package work.slhaf.partner.core.action.runner; +import com.alibaba.fastjson2.JSONObject; import io.modelcontextprotocol.client.McpClient; import io.modelcontextprotocol.client.McpSyncClient; import io.modelcontextprotocol.server.McpServer; @@ -7,11 +8,45 @@ import io.modelcontextprotocol.server.McpStatelessServerFeatures; import io.modelcontextprotocol.server.McpStatelessSyncServer; import io.modelcontextprotocol.spec.McpSchema; import org.junit.jupiter.api.Test; +import work.slhaf.partner.core.action.entity.McpData; +import work.slhaf.partner.core.action.entity.MetaAction; +import work.slhaf.partner.core.action.entity.MetaActionInfo; +import java.io.IOException; +import java.nio.file.Path; import java.util.List; +import java.util.Map; +import java.util.concurrent.Executors; public class RunnerClientTest { + @Test + void httpMcpClientTest() { + TestRunnerClient testClient = new TestRunnerClient(); + RunnerClient.HttpMcpServerParams params = new RunnerClient.HttpMcpServerParams(20, "https://dashscope.aliyuncs.com", "/api/v1/mcps/WebSearch/sse", Map.of("Authorization", "Bearer sk-xxx")); + testClient.registerMcpClient("test", params); + McpSyncClient client = testClient.mcpClients.values().stream().toList().getFirst(); + List tools = client.listTools().tools(); + System.out.println(tools); + McpSchema.CallToolResult query = client.callTool(McpSchema.CallToolRequest.builder().name(tools.getFirst().name()).arguments(Map.of("query", "123")).build()); + for (McpSchema.Content content : query.content()) { + System.out.println("\r\n---\r\n"); + System.out.println(content); + } + } + + @Test + void stdioMcpClientTest() { + TestRunnerClient testClient = new TestRunnerClient(); + RunnerClient.StdioMcpServerParams params = new RunnerClient.StdioMcpServerParams(20, "uvx", Map.of("http_proxy", "http://127.0.0.1:7897", "https_proxy", "http://127.0.0.1:7897"), List.of("mcp-server-fetch")); + testClient.registerMcpClient("test", params); + McpSyncClient client = testClient.mcpClients.values().stream().toList().getFirst(); + List tools = client.listTools().tools(); + System.out.println(tools); + McpSchema.CallToolResult query = client.callTool(McpSchema.CallToolRequest.builder().name(tools.getFirst().name()).arguments(Map.of("url", "https://gitea.slhaf.work")).build()); + System.out.println(query.toString()); + } + @Test void inProcessMcpTransportTest() { RunnerClient.InProcessMcpTransport.Pair pair = RunnerClient.InProcessMcpTransport.pair(); @@ -39,4 +74,35 @@ public class RunnerClientTest { server.close(); } + private static class TestRunnerClient extends RunnerClient { + + public TestRunnerClient() { + super(Map.of(), Executors.newVirtualThreadPerTaskExecutor()); + } + + @Override + protected RunnerResponse doRun(MetaAction metaAction) { + return null; + } + + @Override + public Path buildTmpPath(MetaAction tempAction, String codeType) { + return null; + } + + @Override + public void tmpSerialize(MetaAction tempAction, String code, String codeType) throws IOException { + + } + + @Override + public void persistSerialize(MetaActionInfo metaActionInfo, McpData mcpData) { + + } + + @Override + public JSONObject listSysDependencies() { + return null; + } + } } From 225802c1a8ebeab2bae85d543fc2e24af210b8b0 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 19 Dec 2025 20:41:07 +0800 Subject: [PATCH 036/182] refactor(MetaActionInfo): remove key attribute and update related logic Context: MetaActionInfo was previously located via its own key attribute. This is now redundant, as ActionCore already uses the key of existedMetaActions as the single source of truth. --- .../partner/core/action/ActionCapability.java | 3 ++- .../slhaf/partner/core/action/ActionCore.java | 20 +++++++++---------- .../core/action/entity/MetaActionInfo.java | 1 - .../core/action/runner/RunnerClient.java | 2 +- .../planner/evaluator/ActionEvaluator.java | 5 +---- 5 files changed, 14 insertions(+), 17 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java index 27b55d4c..743baea0 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java @@ -10,6 +10,7 @@ import work.slhaf.partner.core.action.entity.cache.CacheAdjustData; import work.slhaf.partner.core.action.runner.SandboxRunnerClient; import java.util.List; +import java.util.Map; import java.util.concurrent.ExecutorService; import java.util.concurrent.Phaser; @@ -43,7 +44,7 @@ public interface ActionCapability { MetaActionInfo loadMetaActionInfo(@NonNull String actionKey); - List listAvailableActions(); + Map listAvailableActions(); boolean checkExists(String... actionKeys); diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java index 5373b147..29b147f1 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java @@ -1,6 +1,5 @@ package work.slhaf.partner.core.action; -import cn.hutool.core.bean.BeanUtil; import lombok.NonNull; import lombok.extern.slf4j.Slf4j; import work.slhaf.partner.api.agent.factory.capability.annotation.CapabilityCore; @@ -183,8 +182,8 @@ public class ActionCore extends PartnerCore { } @CapabilityMethod - public List listAvailableActions() { - return existedMetaActions.values().stream().toList(); + public Map listAvailableActions() { + return existedMetaActions; } @CapabilityMethod @@ -221,14 +220,15 @@ public class ActionCore extends PartnerCore { @CapabilityMethod public MetaAction loadMetaAction(@NonNull String actionKey) { - for (MetaActionInfo actionInfo : existedMetaActions.values()) { - if (actionInfo.getKey().equals(actionKey)) { - MetaAction metaAction = new MetaAction(); - BeanUtil.copyProperties(actionInfo, metaAction); - return metaAction; - } + MetaActionInfo metaActionInfo = existedMetaActions.get(actionKey); + if (metaActionInfo == null) { + throw new MetaActionNotFoundException("未找到对应的行动程序信息" + actionKey); } - throw new MetaActionNotFoundException("未找到对应的行动程序信息" + actionKey); + MetaAction metaAction = new MetaAction(); + metaAction.setParams(metaActionInfo.getParams()); + metaAction.setType(metaActionInfo.getType()); + metaAction.setIo(metaActionInfo.isIo()); + return metaAction; } @CapabilityMethod diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaActionInfo.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaActionInfo.java index bd8dbc6c..5f957b24 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaActionInfo.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaActionInfo.java @@ -8,7 +8,6 @@ import java.util.Map; @Data public class MetaActionInfo { - private String key; private boolean io; private MetaActionType type; diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java index 4ac0f326..79661bfa 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java @@ -103,7 +103,7 @@ public abstract class RunnerClient { // 忽略非文本类型,行动描述信息只会以文本形式存在 if (resourceContent instanceof McpSchema.TextResourceContents content) { MetaActionInfo metaActionInfo = JSONObject.parseObject(content.text(), MetaActionInfo.class); - existedMetaActions.put(id + "::" + metaActionInfo.getKey(), metaActionInfo); + existedMetaActions.put(id + "::" + resource.name(), metaActionInfo); } } } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/evaluator/ActionEvaluator.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/evaluator/ActionEvaluator.java index 0ca828aa..323ef5b8 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/evaluator/ActionEvaluator.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/evaluator/ActionEvaluator.java @@ -11,7 +11,6 @@ import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.AgentRunn import work.slhaf.partner.api.chat.pojo.ChatResponse; import work.slhaf.partner.common.thread.InteractionThreadPoolExecutor; import work.slhaf.partner.core.action.ActionCapability; -import work.slhaf.partner.core.action.entity.MetaActionInfo; import work.slhaf.partner.core.memory.pojo.EvaluatedSlice; import work.slhaf.partner.module.modules.action.planner.evaluator.entity.EvaluatorBatchInput; import work.slhaf.partner.module.modules.action.planner.evaluator.entity.EvaluatorInput; @@ -69,9 +68,7 @@ public class ActionEvaluator extends AgentRunningSubModule availableActions = new HashMap<>(); - for (MetaActionInfo metaActionInfo : actionCapability.listAvailableActions()) { - availableActions.put(metaActionInfo.getKey(), metaActionInfo.getDescription()); - } + actionCapability.listAvailableActions().forEach((key, info) -> availableActions.put(key, info.getDescription())); temp.setAvailableActions(availableActions); list.add(temp); } From dc4074715e3c167c531a067faa837222b5456f97 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 19 Dec 2025 20:53:01 +0800 Subject: [PATCH 037/182] chore(MetaAction): remove unused order attribute --- .../slhaf/partner/core/action/entity/MetaAction.java | 12 +----------- .../dispatcher/executor/DynamicActionGenerator.java | 1 - .../core/action/runner/LocalRunnerClientTest.java | 1 - 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java index a9e61a61..f0ddda65 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java @@ -1,7 +1,6 @@ package work.slhaf.partner.core.action.entity; import lombok.Data; -import org.jetbrains.annotations.NotNull; import java.nio.file.Path; import java.util.Map; @@ -12,7 +11,7 @@ import static work.slhaf.partner.common.Constant.Path.ACTION_PROGRAM; * 行动链中的单一元素,封装了调用外部行动程序的必要信息与结果容器,可被{@link work.slhaf.partner.core.action.ActionCapability}执行 */ @Data -public class MetaAction implements Comparable { +public class MetaAction { /** * 行动key,用于标识与定位行动程序 @@ -26,10 +25,6 @@ public class MetaAction implements Comparable { * 行动结果,包括执行状态和相应内容(执行结果或者错误信息) */ private Result result = new Result(); - /** - * 执行顺序,升序排列 - */ - private int order; /** * 是否IO密集,用于决定使用何种线程池 */ @@ -48,11 +43,6 @@ public class MetaAction implements Comparable { }; } - @Override - public int compareTo(@NotNull MetaAction metaAction) { - return this.order - metaAction.order; - } - @Data public static class Result { private ResultStatus status = ResultStatus.WAITING; diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/DynamicActionGenerator.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/DynamicActionGenerator.java index 763ebe7f..c7e1d72f 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/DynamicActionGenerator.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/DynamicActionGenerator.java @@ -69,7 +69,6 @@ public class DynamicActionGenerator extends AgentRunningSubModule Date: Fri, 19 Dec 2025 21:35:39 +0800 Subject: [PATCH 038/182] refactor(MetaAction): separate key attribute into name and location Context: This change adapts MetaAction locating to support different MetaAction types, including loading from the local filesystem and from MCP tools. --- .../slhaf/partner/core/action/ActionCore.java | 6 +++++ .../core/action/entity/MetaAction.java | 25 +++++++++++-------- .../core/action/runner/LocalRunnerClient.java | 8 +++--- .../core/action/runner/RunnerClient.java | 3 +-- .../action/runner/SandboxRunnerClient.java | 4 +-- .../executor/DynamicActionGenerator.java | 4 +-- .../executor/entity/GeneratorInput.java | 2 +- .../action/runner/LocalRunnerClientTest.java | 5 ++-- .../core/action/runner/RunnerClientTest.java | 3 +-- 9 files changed, 32 insertions(+), 28 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java index 29b147f1..7297589a 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java @@ -228,6 +228,12 @@ public class ActionCore extends PartnerCore { metaAction.setParams(metaActionInfo.getParams()); metaAction.setType(metaActionInfo.getType()); metaAction.setIo(metaActionInfo.isIo()); + String[] split = actionKey.split("::"); + if (split.length < 2) { + throw new MetaActionNotFoundException("未找到对应的行动程序,原因: 传入的 actionKey(" + actionKey + ") 存在异常"); + } + metaAction.setLocation(split[0]); + metaAction.setName(split[1]); return metaAction; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java index f0ddda65..515737b0 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java @@ -2,11 +2,8 @@ package work.slhaf.partner.core.action.entity; import lombok.Data; -import java.nio.file.Path; import java.util.Map; -import static work.slhaf.partner.common.Constant.Path.ACTION_PROGRAM; - /** * 行动链中的单一元素,封装了调用外部行动程序的必要信息与结果容器,可被{@link work.slhaf.partner.core.action.ActionCapability}执行 */ @@ -14,9 +11,9 @@ import static work.slhaf.partner.common.Constant.Path.ACTION_PROGRAM; public class MetaAction { /** - * 行动key,用于标识与定位行动程序 + * 行动name,用于标识行动程序 */ - private String key; + private String name; /** * 行动程序可接受的参数,由调用处设置 */ @@ -34,13 +31,19 @@ public class MetaAction { */ private MetaActionType type; - private Path path; + /** + * 当类型为 MCP 时,该字段对应相应 MCP Client 注册时生成的 id; + * 当类型为 ORIGIN 时,该字段对应相应的磁盘路径字符串 + */ + private String location; - public void resetPath() { - path = switch (type) { - case ORIGIN -> path; - case MCP -> Path.of(ACTION_PROGRAM, key, "action.json"); - }; + /** + * actionKey 将由 location+name 共同定位 + * + * @return actionKey + */ + public String getKey() { + return location + "::" + name; } @Data diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 725da9a1..66bd93d8 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -57,7 +57,7 @@ public class LocalRunnerClient extends RunnerClient { private RunnerResponse doRunWithOrigin(MetaAction metaAction) { RunnerResponse response = new RunnerResponse(); - File file = metaAction.getPath().toFile(); + File file = new File(metaAction.getLocation()); String ext = FileUtil.getSuffix(file); if (ext == null || ext.isEmpty()) { response.setOk(false); @@ -98,13 +98,13 @@ public class LocalRunnerClient extends RunnerClient { } @Override - public Path buildTmpPath(MetaAction tempAction, String codeType) { - return Path.of(TMP_ACTION_DIR_LOCAL, System.currentTimeMillis() + "-" + tempAction.getKey() + codeType); + public String buildTmpPath(MetaAction tempAction, String codeType) { + return Path.of(TMP_ACTION_DIR_LOCAL, System.currentTimeMillis() + "-" + tempAction.getKey() + codeType).toString(); } @Override public void tmpSerialize(MetaAction tempAction, String code, String codeType) throws IOException { - Path path = tempAction.getPath(); + Path path = Path.of(tempAction.getLocation()); File file = path.toFile(); file.createNewFile(); Files.writeString(path, code); diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java index 79661bfa..65382ba1 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java @@ -27,7 +27,6 @@ import work.slhaf.partner.core.action.entity.MetaAction.ResultStatus; import work.slhaf.partner.core.action.entity.MetaActionInfo; import java.io.IOException; -import java.nio.file.Path; import java.time.Duration; import java.util.HashMap; import java.util.List; @@ -152,7 +151,7 @@ public abstract class RunnerClient { protected abstract RunnerResponse doRun(MetaAction metaAction); - public abstract Path buildTmpPath(MetaAction tempAction, String codeType); + public abstract String buildTmpPath(MetaAction tempAction, String codeType); public abstract void tmpSerialize(MetaAction tempAction, String code, String codeType) throws IOException; diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/SandboxRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/SandboxRunnerClient.java index 86bdd6b5..de1e7715 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/SandboxRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/SandboxRunnerClient.java @@ -1,13 +1,11 @@ package work.slhaf.partner.core.action.runner; import com.alibaba.fastjson2.JSONObject; - import work.slhaf.partner.core.action.entity.McpData; import work.slhaf.partner.core.action.entity.MetaAction; import work.slhaf.partner.core.action.entity.MetaActionInfo; import java.io.IOException; -import java.nio.file.Path; import java.util.Map; import java.util.concurrent.ExecutorService; @@ -42,7 +40,7 @@ public class SandboxRunnerClient extends RunnerClient { } @Override - public Path buildTmpPath(MetaAction tempAction, String codeType) { + public String buildTmpPath(MetaAction tempAction, String codeType) { throw new UnsupportedOperationException("Unimplemented method 'buildTmpPath'"); } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/DynamicActionGenerator.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/DynamicActionGenerator.java index c7e1d72f..45ac8e90 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/DynamicActionGenerator.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/DynamicActionGenerator.java @@ -48,7 +48,7 @@ public class DynamicActionGenerator extends AgentRunningSubModule params; private String description; private Map paramsDescription; diff --git a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java index 903fda79..ddf76f54 100644 --- a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java +++ b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java @@ -6,7 +6,6 @@ import org.junit.jupiter.api.Test; import work.slhaf.partner.core.action.entity.MetaAction; import work.slhaf.partner.core.action.entity.MetaActionType; -import java.nio.file.Path; import java.util.Map; import java.util.concurrent.Executors; @@ -30,10 +29,10 @@ public class LocalRunnerClientTest { private static @NotNull MetaAction buildTmpMetaAction() { MetaAction metaAction = new MetaAction(); metaAction.setIo(false); - metaAction.setKey("hello_world"); + metaAction.setName("hello_world"); metaAction.setParams(Map.of("name", "origin_run")); metaAction.setType(MetaActionType.ORIGIN); - metaAction.setPath(Path.of("/home/slhaf/Projects/IdeaProjects/Projects/Partner/Partner-Main/src/test/java/resources/action/tmp/hello_world.py")); + metaAction.setLocation("/home/slhaf/Projects/IdeaProjects/Projects/Partner/Partner-Main/src/test/java/resources/action/tmp/hello_world.py"); return metaAction; } } diff --git a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/RunnerClientTest.java b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/RunnerClientTest.java index 6f463270..56400410 100644 --- a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/RunnerClientTest.java +++ b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/RunnerClientTest.java @@ -13,7 +13,6 @@ import work.slhaf.partner.core.action.entity.MetaAction; import work.slhaf.partner.core.action.entity.MetaActionInfo; import java.io.IOException; -import java.nio.file.Path; import java.util.List; import java.util.Map; import java.util.concurrent.Executors; @@ -86,7 +85,7 @@ public class RunnerClientTest { } @Override - public Path buildTmpPath(MetaAction tempAction, String codeType) { + public String buildTmpPath(MetaAction tempAction, String codeType) { return null; } From 5ba36ed3e8e24fcb9d3cf2c43f72511e6f1c2604 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 19 Dec 2025 22:29:03 +0800 Subject: [PATCH 039/182] feat(LocalRunnerClient): support executing MetaActions via MCP type --- .../partner/core/action/entity/MetaAction.java | 2 +- .../core/action/entity/MetaActionInfo.java | 2 +- .../core/action/runner/LocalRunnerClient.java | 15 ++++++++++++--- .../executor/entity/GeneratorInput.java | 2 +- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java index 515737b0..379a790a 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java @@ -17,7 +17,7 @@ public class MetaAction { /** * 行动程序可接受的参数,由调用处设置 */ - private Map params; + private Map params; /** * 行动结果,包括执行状态和相应内容(执行结果或者错误信息) */ diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaActionInfo.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaActionInfo.java index 5f957b24..45a6db44 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaActionInfo.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaActionInfo.java @@ -11,7 +11,7 @@ public class MetaActionInfo { private boolean io; private MetaActionType type; - private Map params; + private Map params; private String description; private List tags; diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 66bd93d8..64dc6936 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -3,6 +3,8 @@ package work.slhaf.partner.core.action.runner; import cn.hutool.core.io.FileUtil; import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; +import io.modelcontextprotocol.client.McpSyncClient; +import io.modelcontextprotocol.spec.McpSchema; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.jetbrains.annotations.NotNull; @@ -72,7 +74,7 @@ public class LocalRunnerClient extends RunnerClient { } //TODO 后续需在加载时、或者通过配置文件获取可用命令并注册匹配 - private String[] buildCommands(String ext, Map params, String absolutePath) { + private String[] buildCommands(String ext, Map params, String absolutePath) { String command = switch (ext) { case "py" -> "python"; case "sh" -> "bash"; @@ -86,14 +88,21 @@ public class LocalRunnerClient extends RunnerClient { commands[1] = absolutePath; AtomicInteger paramCount = new AtomicInteger(2); params.forEach((param, value) -> { - commands[paramCount.getAndIncrement()] = "--" + param + "=" + value; + commands[paramCount.getAndIncrement()] = "--" + param + "=" + value.toString(); }); return commands; } private RunnerResponse doRunWithMcp(MetaAction metaAction) { RunnerResponse response = new RunnerResponse(); - + McpSyncClient mcpClient = mcpClients.get(metaAction.getLocation()); + McpSchema.CallToolRequest callToolRequest = McpSchema.CallToolRequest.builder() + .name(metaAction.getName()) + .arguments(metaAction.getParams()) + .build(); + McpSchema.CallToolResult callToolResult = mcpClient.callTool(callToolRequest); + response.setOk(callToolResult.isError()); + response.setData(callToolResult.structuredContent().toString()); return response; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/GeneratorInput.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/GeneratorInput.java index ed601ec8..67c9094a 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/GeneratorInput.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/GeneratorInput.java @@ -7,7 +7,7 @@ import java.util.Map; @Data public class GeneratorInput { private String actionName; - private Map params; + private Map params; private String description; private Map paramsDescription; } From 128592e23c78f0f35b82a3c57c0f844a1b547d75 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 19 Dec 2025 22:47:06 +0800 Subject: [PATCH 040/182] chore(MetaActionInfo): remove unused type attribute --- .../java/work/slhaf/partner/core/action/ActionCore.java | 7 ++----- .../slhaf/partner/core/action/entity/MetaActionInfo.java | 1 - 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java index 7297589a..ae348e24 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java @@ -6,10 +6,7 @@ import work.slhaf.partner.api.agent.factory.capability.annotation.CapabilityCore import work.slhaf.partner.api.agent.factory.capability.annotation.CapabilityMethod; import work.slhaf.partner.common.vector.VectorClient; import work.slhaf.partner.core.PartnerCore; -import work.slhaf.partner.core.action.entity.ActionData; -import work.slhaf.partner.core.action.entity.MetaAction; -import work.slhaf.partner.core.action.entity.MetaActionInfo; -import work.slhaf.partner.core.action.entity.PhaserRecord; +import work.slhaf.partner.core.action.entity.*; import work.slhaf.partner.core.action.entity.cache.ActionCacheData; import work.slhaf.partner.core.action.entity.cache.CacheAdjustData; import work.slhaf.partner.core.action.entity.cache.CacheAdjustMetaData; @@ -226,7 +223,7 @@ public class ActionCore extends PartnerCore { } MetaAction metaAction = new MetaAction(); metaAction.setParams(metaActionInfo.getParams()); - metaAction.setType(metaActionInfo.getType()); + metaAction.setType(MetaActionType.MCP); metaAction.setIo(metaActionInfo.isIo()); String[] split = actionKey.split("::"); if (split.length < 2) { diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaActionInfo.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaActionInfo.java index 45a6db44..c0b4a8af 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaActionInfo.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaActionInfo.java @@ -9,7 +9,6 @@ import java.util.Map; @Data public class MetaActionInfo { private boolean io; - private MetaActionType type; private Map params; private String description; From ed042cfffab34b5f8f4f4d371c2e7f7fd6477575 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 19 Dec 2025 22:57:34 +0800 Subject: [PATCH 041/182] fix(action): correct params type in related DTOs --- .../action/dispatcher/executor/entity/ExtractorResult.java | 2 +- .../action/dispatcher/executor/entity/RepairerInput.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ExtractorResult.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ExtractorResult.java index f36bf561..aefb5ba1 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ExtractorResult.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ExtractorResult.java @@ -7,5 +7,5 @@ import java.util.Map; @Data public class ExtractorResult { private boolean ok; - private Map params; + private Map params; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/RepairerInput.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/RepairerInput.java index 02e59433..fa08264f 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/RepairerInput.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/RepairerInput.java @@ -12,7 +12,7 @@ public class RepairerInput { private String userId; private List recentMessages; - private Map params; + private Map params; private String actionDescription; private List historyActionResults; private PhaserRecord phaserRecord; From 1f5509c17d073960e27ff53de998eeece540b165 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 19 Dec 2025 23:22:36 +0800 Subject: [PATCH 042/182] refactor(RunnerClient): redesign existedMetaActions update strategy Context: Resource-change events cannot reliably represent tool changes. The previous approach attempted to externalize descriptive content into files, but the meta attribute of McpSchema.Tool can provide this information. --- .../core/action/runner/RunnerClient.java | 38 ++++++++++++------- .../core/action/runner/RunnerClientTest.java | 16 ++++++++ 2 files changed, 41 insertions(+), 13 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java index 65382ba1..942e12aa 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java @@ -18,6 +18,8 @@ import io.modelcontextprotocol.spec.McpSchema; import io.modelcontextprotocol.spec.McpStatelessServerTransport; import lombok.Data; import lombok.extern.slf4j.Slf4j; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.UnknownNullability; import reactor.core.publisher.Mono; import reactor.core.publisher.Sinks; import work.slhaf.partner.core.action.entity.McpData; @@ -88,27 +90,37 @@ public abstract class RunnerClient { // ResourcesChange 事件传递的 Resource 可以由 Client 读取内容 // 预计在 Server 侧,收到客户端发送的新的行动程序信息,该信息由客户端处补充后,将其放置在指定位置 // 并写入描述文件、发起 ResourcesChange 事件 - .resourcesChangeConsumer(resources -> updateExistedMetaActions(id, resources)) + .toolsChangeConsumer(tools -> updateExistedMetaActions(id, tools)) .build(); mcpClients.put(id, client); } - private void updateExistedMetaActions(String id, List resources) { - synchronized (existedMetaActions) { - McpSyncClient client = mcpClients.get(id); - for (McpSchema.Resource resource : resources) { - McpSchema.ReadResourceResult resourceResult = client.readResource(resource); - for (McpSchema.ResourceContents resourceContent : resourceResult.contents()) { - // 忽略非文本类型,行动描述信息只会以文本形式存在 - if (resourceContent instanceof McpSchema.TextResourceContents content) { - MetaActionInfo metaActionInfo = JSONObject.parseObject(content.text(), MetaActionInfo.class); - existedMetaActions.put(id + "::" + resource.name(), metaActionInfo); - } - } + private void updateExistedMetaActions(String id, @UnknownNullability List tools) { + for (McpSchema.Tool tool : tools) { + MetaActionInfo info = buildMetaActionInfo(tool); + String actionKey = id + "::" + tool.name(); + synchronized (existedMetaActions) { + existedMetaActions.put(actionKey, info); } } } + private static @NotNull MetaActionInfo buildMetaActionInfo(McpSchema.Tool tool) { + MetaActionInfo info = new MetaActionInfo(); + info.setDescription(tool.description()); + Map outputSchema = tool.outputSchema(); + info.setResponseSchema(outputSchema == null ? JSONObject.of() : JSONObject.from(outputSchema)); + info.setParams(tool.inputSchema().properties()); + + JSONObject meta = JSONObject.from(tool.meta()); + info.setIo(meta.getBoolean("io")); + info.setPreActions(meta.getList("pre", String.class)); + info.setPostActions(meta.getList("post", String.class)); + info.setStrictDependencies(meta.getBoolean("strict")); + info.setTags(meta.getList("tag", String.class)); + return info; + } + private McpClientTransport createTransport(McpServerParams mcpServerParams) { return switch (mcpServerParams) { case InProcessMcpServerParams params -> { diff --git a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/RunnerClientTest.java b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/RunnerClientTest.java index 56400410..5eef9f03 100644 --- a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/RunnerClientTest.java +++ b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/RunnerClientTest.java @@ -46,6 +46,22 @@ public class RunnerClientTest { System.out.println(query.toString()); } + @Test + void schemaTest() { + TestRunnerClient testClient = new TestRunnerClient(); + RunnerClient.StdioMcpServerParams params = new RunnerClient.StdioMcpServerParams(20, "uvx", Map.of("http_proxy", "http://127.0.0.1:7897", "https_proxy", "http://127.0.0.1:7897"), List.of("mcp-server-fetch")); + testClient.registerMcpClient("test", params); + McpSyncClient client = testClient.mcpClients.values().stream().toList().getFirst(); + List tools = client.listTools().tools(); + System.out.println("\r\n ------ \r\n"); + McpSchema.Tool first = tools.getFirst(); + Map paramsSchema = first.inputSchema().properties(); + System.out.println(paramsSchema.toString()); + System.out.println("\r\n ------ \r\n"); + Map outputSchema = first.outputSchema(); + System.out.println(outputSchema); + } + @Test void inProcessMcpTransportTest() { RunnerClient.InProcessMcpTransport.Pair pair = RunnerClient.InProcessMcpTransport.pair(); From 97627391380141521f6fd061151684ed49474433 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 19 Dec 2025 23:30:27 +0800 Subject: [PATCH 043/182] refactor(action): replace HashMap with ConcurrentHashMap for thread-safe MetaAction storage --- .../java/work/slhaf/partner/core/action/ActionCore.java | 3 ++- .../partner/core/action/runner/LocalRunnerClient.java | 3 ++- .../slhaf/partner/core/action/runner/RunnerClient.java | 9 ++++----- .../partner/core/action/runner/SandboxRunnerClient.java | 4 ++-- Partner-Main/src/test/java/experimental/SystemTest.java | 5 ++--- .../core/action/runner/LocalRunnerClientTest.java | 3 ++- .../partner/core/action/runner/RunnerClientTest.java | 3 ++- 7 files changed, 16 insertions(+), 14 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java index ae348e24..9b6397db 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java @@ -17,6 +17,7 @@ import work.slhaf.partner.core.action.runner.SandboxRunnerClient; import java.io.IOException; import java.util.*; +import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Phaser; @@ -53,7 +54,7 @@ public class ActionCore extends PartnerCore { /** * 已存在的行动程序,键格式为‘::’,值为 MCP Server 通过 Resources 相关渠道传递的行动程序元信息 */ - private final Map existedMetaActions = new HashMap<>(); + private final ConcurrentHashMap existedMetaActions = new ConcurrentHashMap<>(); private final List phaserRecords = new ArrayList<>(); private RunnerClient runnerClient; diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 64dc6936..669d5aa1 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -26,6 +26,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.atomic.AtomicInteger; @@ -35,7 +36,7 @@ import static work.slhaf.partner.common.Constant.Path.TMP_ACTION_DIR_LOCAL; @Slf4j public class LocalRunnerClient extends RunnerClient { - public LocalRunnerClient(Map existedMetaActions, ExecutorService executor, @Nullable String actionWatchPath) { + public LocalRunnerClient(ConcurrentHashMap existedMetaActions, ExecutorService executor, @Nullable String actionWatchPath) { super(existedMetaActions, executor); ActionWatchService watchService = new ActionWatchService(actionWatchPath); watchService.launch(); diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java index 942e12aa..019c104c 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java @@ -33,6 +33,7 @@ import java.time.Duration; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Consumer; @@ -41,7 +42,7 @@ import java.util.function.Function; @Slf4j public abstract class RunnerClient { - protected final Map existedMetaActions; + protected final ConcurrentHashMap existedMetaActions; protected final ExecutorService executor; protected final Map mcpClients = new HashMap<>(); protected final Map localMcpServers = new HashMap<>(); @@ -49,7 +50,7 @@ public abstract class RunnerClient { /** * ActionCore 将注入虚拟线程池 */ - public RunnerClient(Map existedMetaActions, ExecutorService executor) { + public RunnerClient(ConcurrentHashMap existedMetaActions, ExecutorService executor) { this.existedMetaActions = existedMetaActions; this.executor = executor; setupShutdownHook(); @@ -99,9 +100,7 @@ public abstract class RunnerClient { for (McpSchema.Tool tool : tools) { MetaActionInfo info = buildMetaActionInfo(tool); String actionKey = id + "::" + tool.name(); - synchronized (existedMetaActions) { - existedMetaActions.put(actionKey, info); - } + existedMetaActions.put(actionKey, info); } } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/SandboxRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/SandboxRunnerClient.java index de1e7715..f7233749 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/SandboxRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/SandboxRunnerClient.java @@ -6,7 +6,7 @@ import work.slhaf.partner.core.action.entity.MetaAction; import work.slhaf.partner.core.action.entity.MetaActionInfo; import java.io.IOException; -import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; /** @@ -25,7 +25,7 @@ import java.util.concurrent.ExecutorService; */ public class SandboxRunnerClient extends RunnerClient { - public SandboxRunnerClient(Map existedMetaActions, ExecutorService executor) { // 连接沙盒执行器(websocket) + public SandboxRunnerClient(ConcurrentHashMap existedMetaActions, ExecutorService executor) { // 连接沙盒执行器(websocket) super(existedMetaActions, executor); } diff --git a/Partner-Main/src/test/java/experimental/SystemTest.java b/Partner-Main/src/test/java/experimental/SystemTest.java index 86982bd2..8306b481 100644 --- a/Partner-Main/src/test/java/experimental/SystemTest.java +++ b/Partner-Main/src/test/java/experimental/SystemTest.java @@ -7,8 +7,7 @@ import work.slhaf.partner.core.action.runner.LocalRunnerClient; import work.slhaf.partner.core.action.runner.RunnerClient; import java.io.IOException; -import java.util.HashMap; -import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -39,7 +38,7 @@ public class SystemTest { @Test void localRunnerClientTest() { - Map existedMetaActions = new HashMap<>(); + ConcurrentHashMap existedMetaActions = new ConcurrentHashMap<>(); ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor(); RunnerClient client = new LocalRunnerClient(existedMetaActions, executor, null); JSONObject res = client.listSysDependencies(); diff --git a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java index ddf76f54..2fca8a02 100644 --- a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java +++ b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java @@ -7,6 +7,7 @@ import work.slhaf.partner.core.action.entity.MetaAction; import work.slhaf.partner.core.action.entity.MetaActionType; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executors; public class LocalRunnerClientTest { @@ -15,7 +16,7 @@ public class LocalRunnerClientTest { @BeforeAll static void beforeAll() { - runnerClient = new LocalRunnerClient(Map.of(), Executors.newVirtualThreadPerTaskExecutor(), "/home/slhaf/Projects/IdeaProjects/Projects/Partner/Partner-Main/src/test/java/resources/action/data"); + runnerClient = new LocalRunnerClient(new ConcurrentHashMap<>(), Executors.newVirtualThreadPerTaskExecutor(), "/home/slhaf/Projects/IdeaProjects/Projects/Partner/Partner-Main/src/test/java/resources/action/data"); } @Test diff --git a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/RunnerClientTest.java b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/RunnerClientTest.java index 5eef9f03..8605d547 100644 --- a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/RunnerClientTest.java +++ b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/RunnerClientTest.java @@ -15,6 +15,7 @@ import work.slhaf.partner.core.action.entity.MetaActionInfo; import java.io.IOException; import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executors; public class RunnerClientTest { @@ -92,7 +93,7 @@ public class RunnerClientTest { private static class TestRunnerClient extends RunnerClient { public TestRunnerClient() { - super(Map.of(), Executors.newVirtualThreadPerTaskExecutor()); + super(new ConcurrentHashMap<>(), Executors.newVirtualThreadPerTaskExecutor()); } @Override From 9e76c3e7ada86c396f40b236128c7f0848bd28a1 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 19 Dec 2025 23:34:17 +0800 Subject: [PATCH 044/182] refactor(SandboxRunnerClient): align doRun visibility with superclass --- .../slhaf/partner/core/action/runner/SandboxRunnerClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/SandboxRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/SandboxRunnerClient.java index f7233749..9823780d 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/SandboxRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/SandboxRunnerClient.java @@ -29,7 +29,7 @@ public class SandboxRunnerClient extends RunnerClient { super(existedMetaActions, executor); } - public RunnerResponse doRun(MetaAction metaAction) { + protected RunnerResponse doRun(MetaAction metaAction) { // 调用沙盒执行器 return null; } From 49a4c9eb01192dbd999dc24d750f9c0425cf9654 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sun, 21 Dec 2025 22:05:46 +0800 Subject: [PATCH 045/182] docs(RunnerClient): add architecture-location comment on RunnerClient --- .../core/action/runner/RunnerClient.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java index 019c104c..3798cf78 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java @@ -39,6 +39,23 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Consumer; import java.util.function.Function; +/** + * 执行客户端抽象类 + *
+ * 只负责暴露序列化、执行等相应接口,具体逻辑交给下游实现 + *
+ * 默认存在两类实现,{@link LocalRunnerClient} 和 {@link SandboxRunnerClient} + *
    + * LocalRunnerClient: + *
  1. + * 对应本地运行环境,可在本地启动 MCP 客户端将 RunnerClient 暴露的能力接口转发至本地 MCP Client 并执行 + *
  2. + * SandboxRunnerClient: + *
  3. + * 对应沙盒运行环境,该 Client 仅作为沙盒环境的客户端,不持有额外能力,仅保持远端连接已存在行动的内容更新 + *
  4. + *
+ */ @Slf4j public abstract class RunnerClient { From 05d1fff1258fd6826dab674c33a10c6b1f8bda04 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sun, 21 Dec 2025 23:03:25 +0800 Subject: [PATCH 046/182] refactor(RunnerClient): remove unused MCP type enum class --- .../slhaf/partner/core/action/runner/RunnerClient.java | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java index 3798cf78..aa66df8f 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java @@ -239,15 +239,6 @@ public abstract class RunnerClient { } } - protected enum McpServerType { - HTTP, - STDIO, - /** - * 对应 Partner 内部的 Server 创建方式 - */ - SELF - } - public static final class InProcessMcpTransport implements McpClientTransport, McpStatelessServerTransport { // 每个 transport 只处理一条 inbound 流 From 88a14f36b2f5c6cf7522ed737be1dbc544775664 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 22 Dec 2025 14:56:23 +0800 Subject: [PATCH 047/182] refactor(runner): relocate InProcessMcpTransport to experimental and move local MCP client logic into LocalRunnerClient MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Context: Recent changes blurred the responsibility boundary between RunnerClient and LocalRunnerClient. This refactor moves local MCP client–specific logic into LocalRunnerClient and isolates InProcessMcpTransport and related code under the experimental package. RunnerClient only defines indispensable methods and attributes. --- .../core/action/runner/LocalRunnerClient.java | 123 ++++++- .../core/action/runner/RunnerClient.java | 301 ------------------ .../experimental/InProcessMcpTransport.java | 190 +++++++++++ .../core/action/runner/RunnerClientTest.java | 79 ----- 4 files changed, 311 insertions(+), 382 deletions(-) create mode 100644 Partner-Main/src/test/java/experimental/InProcessMcpTransport.java diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 669d5aa1..5907e274 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -3,12 +3,20 @@ package work.slhaf.partner.core.action.runner; import cn.hutool.core.io.FileUtil; import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; +import io.modelcontextprotocol.client.McpClient; import io.modelcontextprotocol.client.McpSyncClient; +import io.modelcontextprotocol.client.transport.HttpClientSseClientTransport; +import io.modelcontextprotocol.client.transport.ServerParameters; +import io.modelcontextprotocol.client.transport.StdioClientTransport; +import io.modelcontextprotocol.client.transport.customizer.McpSyncHttpClientRequestCustomizer; +import io.modelcontextprotocol.json.McpJsonMapper; +import io.modelcontextprotocol.spec.McpClientTransport; import io.modelcontextprotocol.spec.McpSchema; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.UnknownNullability; import work.slhaf.partner.core.action.entity.McpData; import work.slhaf.partner.core.action.entity.MetaAction; import work.slhaf.partner.core.action.entity.MetaActionInfo; @@ -22,6 +30,7 @@ import java.io.IOException; import java.io.InputStreamReader; import java.nio.file.*; import java.nio.file.attribute.BasicFileAttributes; +import java.time.Duration; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -36,10 +45,13 @@ import static work.slhaf.partner.common.Constant.Path.TMP_ACTION_DIR_LOCAL; @Slf4j public class LocalRunnerClient extends RunnerClient { + private final Map mcpClients = new HashMap<>(); + public LocalRunnerClient(ConcurrentHashMap existedMetaActions, ExecutorService executor, @Nullable String actionWatchPath) { super(existedMetaActions, executor); ActionWatchService watchService = new ActionWatchService(actionWatchPath); watchService.launch(); + setupShutdownHook(); } @Override @@ -204,6 +216,113 @@ public class LocalRunnerClient extends RunnerClient { return result; } + /** + * 该部分主要发生在扫描到新的MCP Server描述文件时出现的注册逻辑 + * + * @param id MCP Client 的 id + * @param mcpServerParams MCP Server 的参数 + */ + private void registerMcpClient(String id, McpServerParams mcpServerParams) { + McpClientTransport clientTransport = createTransport(mcpServerParams); + McpSyncClient client = McpClient.sync(clientTransport) + .requestTimeout(Duration.ofSeconds(mcpServerParams.timeout)) + .clientInfo(new McpSchema.Implementation(id, "PARTNER")) + // 行动程序(现 MCP Tool)的描述文本将直接由resources返回 + // 原因: ToolChange 发送的内容侧重调用,缺少可承担描述文本的字段 + // ResourcesChange 事件传递的 Resource 可以由 Client 读取内容 + // 预计在 Server 侧,收到客户端发送的新的行动程序信息,该信息由客户端处补充后,将其放置在指定位置 + // 并写入描述文件、发起 ResourcesChange 事件 + .toolsChangeConsumer(tools -> updateExistedMetaActions(id, tools)) + .build(); + mcpClients.put(id, client); + } + + private void updateExistedMetaActions(String id, @UnknownNullability List tools) { + for (McpSchema.Tool tool : tools) { + MetaActionInfo info = buildMetaActionInfo(tool); + String actionKey = id + "::" + tool.name(); + existedMetaActions.put(actionKey, info); + } + } + + private static @NotNull MetaActionInfo buildMetaActionInfo(McpSchema.Tool tool) { + MetaActionInfo info = new MetaActionInfo(); + info.setDescription(tool.description()); + Map outputSchema = tool.outputSchema(); + info.setResponseSchema(outputSchema == null ? JSONObject.of() : JSONObject.from(outputSchema)); + info.setParams(tool.inputSchema().properties()); + + JSONObject meta = JSONObject.from(tool.meta()); + info.setIo(meta.getBoolean("io")); + info.setPreActions(meta.getList("pre", String.class)); + info.setPostActions(meta.getList("post", String.class)); + info.setStrictDependencies(meta.getBoolean("strict")); + info.setTags(meta.getList("tag", String.class)); + return info; + } + + private McpClientTransport createTransport(McpServerParams mcpServerParams) { + return switch (mcpServerParams) { + case StdioMcpServerParams params -> { + ServerParameters serverParameters = ServerParameters.builder(params.command) + .env(params.env) + .args(params.args) + .build(); + yield new StdioClientTransport(serverParameters, McpJsonMapper.getDefault()); + } + case HttpMcpServerParams params -> { + McpSyncHttpClientRequestCustomizer customizer = (builder, method, endpoint, body, context) -> { + params.headers.forEach(builder::setHeader); + }; + yield HttpClientSseClientTransport.builder(params.baseUri) + .httpRequestCustomizer(customizer) + .sseEndpoint(params.endpoint) + .build(); + } + }; + } + + private void setupShutdownHook() { + this.mcpClients.forEach((id, client) -> { + client.close(); + log.info("[{}] MCP-Client 已关闭", id); + }); + } + + private sealed abstract static class McpServerParams permits HttpMcpServerParams, StdioMcpServerParams { + private final int timeout; + + private McpServerParams(int timeout) { + this.timeout = timeout; + } + } + + private final static class HttpMcpServerParams extends McpServerParams { + private final String baseUri; + private final String endpoint; + private final Map headers; + + private HttpMcpServerParams(int timeout, String baseUri, String endpoint, Map header) { + super(timeout); + this.baseUri = baseUri; + this.endpoint = endpoint; + this.headers = header; + } + } + + private final static class StdioMcpServerParams extends McpServerParams { + private final String command; + private final Map env; + private final List args; + + private StdioMcpServerParams(int timeout, String command, Map env, List args) { + super(timeout); + this.command = command; + this.env = env; + this.args = args; + } + } + @Data private static class SystemExecResult { private boolean ok; @@ -211,6 +330,7 @@ public class LocalRunnerClient extends RunnerClient { private List resultList; } + //TODO 逻辑待更新,用以适配 MCP 服务的及时发现与注册 private class ActionWatchService { private final HashMap registeredPaths = new HashMap<>(); @@ -378,14 +498,13 @@ public class LocalRunnerClient extends RunnerClient { try { MetaActionInfo actionInfo = new MetaActionInfo(); existedMetaActions.put(f.getName(), actionInfo); - log.info("行动程序[{}]已加载", actionInfo.getKey()); +// log.info("行动程序[{}]已加载", actionInfo.getKey()); } catch (ActionLoadFailedException e) { log.warn("行动程序加载失败", e); } } } - } } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java index aa66df8f..f410083d 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java @@ -1,27 +1,8 @@ package work.slhaf.partner.core.action.runner; import com.alibaba.fastjson2.JSONObject; -import io.modelcontextprotocol.client.McpClient; -import io.modelcontextprotocol.client.McpSyncClient; -import io.modelcontextprotocol.client.transport.HttpClientSseClientTransport; -import io.modelcontextprotocol.client.transport.ServerParameters; -import io.modelcontextprotocol.client.transport.StdioClientTransport; -import io.modelcontextprotocol.client.transport.customizer.McpSyncHttpClientRequestCustomizer; -import io.modelcontextprotocol.common.McpTransportContext; -import io.modelcontextprotocol.json.McpJsonMapper; -import io.modelcontextprotocol.json.TypeRef; -import io.modelcontextprotocol.server.McpServer; -import io.modelcontextprotocol.server.McpStatelessAsyncServer; -import io.modelcontextprotocol.server.McpStatelessServerHandler; -import io.modelcontextprotocol.spec.McpClientTransport; -import io.modelcontextprotocol.spec.McpSchema; -import io.modelcontextprotocol.spec.McpStatelessServerTransport; import lombok.Data; import lombok.extern.slf4j.Slf4j; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.UnknownNullability; -import reactor.core.publisher.Mono; -import reactor.core.publisher.Sinks; import work.slhaf.partner.core.action.entity.McpData; import work.slhaf.partner.core.action.entity.MetaAction; import work.slhaf.partner.core.action.entity.MetaAction.Result; @@ -29,15 +10,8 @@ import work.slhaf.partner.core.action.entity.MetaAction.ResultStatus; import work.slhaf.partner.core.action.entity.MetaActionInfo; import java.io.IOException; -import java.time.Duration; -import java.util.HashMap; -import java.util.List; -import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.function.Consumer; -import java.util.function.Function; /** * 执行客户端抽象类 @@ -61,8 +35,6 @@ public abstract class RunnerClient { protected final ConcurrentHashMap existedMetaActions; protected final ExecutorService executor; - protected final Map mcpClients = new HashMap<>(); - protected final Map localMcpServers = new HashMap<>(); /** * ActionCore 将注入虚拟线程池 @@ -70,18 +42,6 @@ public abstract class RunnerClient { public RunnerClient(ConcurrentHashMap existedMetaActions, ExecutorService executor) { this.existedMetaActions = existedMetaActions; this.executor = executor; - setupShutdownHook(); - } - - protected void setupShutdownHook() { - this.mcpClients.forEach((id, client) -> { - client.close(); - log.info("[{}] MCP-Client 已关闭", id); - }); - this.localMcpServers.forEach((id, server) -> { - server.close(); - log.info("[{}] MCP-Server 已关闭", id); - }); } /** @@ -98,85 +58,6 @@ public abstract class RunnerClient { result.setStatus(response.isOk() ? ResultStatus.SUCCESS : ResultStatus.FAILED); } - protected void registerMcpClient(String id, McpServerParams mcpServerParams) { - McpClientTransport clientTransport = createTransport(mcpServerParams); - McpSyncClient client = McpClient.sync(clientTransport) - .requestTimeout(Duration.ofSeconds(mcpServerParams.timeout)) - .clientInfo(new McpSchema.Implementation(id, "PARTNER")) - // 行动程序(现 MCP Tool)的描述文本将直接由resources返回 - // 原因: ToolChange 发送的内容侧重调用,缺少可承担描述文本的字段 - // ResourcesChange 事件传递的 Resource 可以由 Client 读取内容 - // 预计在 Server 侧,收到客户端发送的新的行动程序信息,该信息由客户端处补充后,将其放置在指定位置 - // 并写入描述文件、发起 ResourcesChange 事件 - .toolsChangeConsumer(tools -> updateExistedMetaActions(id, tools)) - .build(); - mcpClients.put(id, client); - } - - private void updateExistedMetaActions(String id, @UnknownNullability List tools) { - for (McpSchema.Tool tool : tools) { - MetaActionInfo info = buildMetaActionInfo(tool); - String actionKey = id + "::" + tool.name(); - existedMetaActions.put(actionKey, info); - } - } - - private static @NotNull MetaActionInfo buildMetaActionInfo(McpSchema.Tool tool) { - MetaActionInfo info = new MetaActionInfo(); - info.setDescription(tool.description()); - Map outputSchema = tool.outputSchema(); - info.setResponseSchema(outputSchema == null ? JSONObject.of() : JSONObject.from(outputSchema)); - info.setParams(tool.inputSchema().properties()); - - JSONObject meta = JSONObject.from(tool.meta()); - info.setIo(meta.getBoolean("io")); - info.setPreActions(meta.getList("pre", String.class)); - info.setPostActions(meta.getList("post", String.class)); - info.setStrictDependencies(meta.getBoolean("strict")); - info.setTags(meta.getList("tag", String.class)); - return info; - } - - private McpClientTransport createTransport(McpServerParams mcpServerParams) { - return switch (mcpServerParams) { - case InProcessMcpServerParams params -> { - InProcessMcpTransport.Pair pair = InProcessMcpTransport.pair(); - createInProcessMcpServer(params.id, pair.serverSide); - yield pair.clientSide; - } - case StdioMcpServerParams params -> { - ServerParameters serverParameters = ServerParameters.builder(params.command) - .env(params.env) - .args(params.args) - .build(); - yield new StdioClientTransport(serverParameters, McpJsonMapper.getDefault()); - } - case HttpMcpServerParams params -> { - McpSyncHttpClientRequestCustomizer customizer = (builder, method, endpoint, body, context) -> { - params.headers.forEach(builder::setHeader); - }; - yield HttpClientSseClientTransport.builder(params.baseUri) - .httpRequestCustomizer(customizer) - .sseEndpoint(params.endpoint) - .build(); - } - }; - } - - private void createInProcessMcpServer(String id, InProcessMcpTransport serverSide) { - McpSchema.ServerCapabilities serverCapabilities = McpSchema.ServerCapabilities.builder() - .tools(true) - .resources(true, true) - .build(); - - McpStatelessAsyncServer server = McpServer.async(serverSide) - .capabilities(serverCapabilities) - .serverInfo(id, "PARTNER") - .build(); - - localMcpServers.put(id, server); - } - protected abstract RunnerResponse doRun(MetaAction metaAction); public abstract String buildTmpPath(MetaAction tempAction, String codeType); @@ -196,186 +77,4 @@ public abstract class RunnerClient { private String data; } - protected sealed abstract static class McpServerParams permits HttpMcpServerParams, InProcessMcpServerParams, StdioMcpServerParams { - private final int timeout; - - private McpServerParams(int timeout) { - this.timeout = timeout; - } - } - - protected final static class HttpMcpServerParams extends McpServerParams { - private final String baseUri; - private final String endpoint; - private final Map headers; - - protected HttpMcpServerParams(int timeout, String baseUri, String endpoint, Map header) { - super(timeout); - this.baseUri = baseUri; - this.endpoint = endpoint; - this.headers = header; - } - } - - protected final static class StdioMcpServerParams extends McpServerParams { - private final String command; - private final Map env; - private final List args; - - protected StdioMcpServerParams(int timeout, String command, Map env, List args) { - super(timeout); - this.command = command; - this.env = env; - this.args = args; - } - } - - protected final static class InProcessMcpServerParams extends McpServerParams { - private final String id; - - protected InProcessMcpServerParams(int timeout, String id) { - super(timeout); - this.id = id; - } - } - - public static final class InProcessMcpTransport implements McpClientTransport, McpStatelessServerTransport { - - // 每个 transport 只处理一条 inbound 流 - private final Sinks.Many inbound = - Sinks.many().unicast().onBackpressureBuffer(); - - private final AtomicBoolean clientConnected = new AtomicBoolean(false); - private final AtomicBoolean serverConnected = new AtomicBoolean(false); - - /** - * 对端 - */ - private volatile InProcessMcpTransport peer; - - private volatile McpStatelessServerHandler serverHandler; - - public record Pair(InProcessMcpTransport clientSide, InProcessMcpTransport serverSide) { - } - - public static Pair pair() { - InProcessMcpTransport client = new InProcessMcpTransport(); - InProcessMcpTransport server = new InProcessMcpTransport(); - - client.peer = server; - server.peer = client; - - return new Pair(client, server); - } - - /* ====================================================== - * Internal receive: peer.sendMessage -> this.receive - * ====================================================== */ - private void receive(McpSchema.JSONRPCMessage message) { - if (inbound.tryEmitNext(message).isFailure()) { - throw new RuntimeException("Failed to receive message: " + message); - } - } - - /* ====================================================== - * Client → Server sendMessage - * ====================================================== */ - @Override - public Mono sendMessage(McpSchema.JSONRPCMessage message) { - InProcessMcpTransport p = this.peer; - if (p == null) { - return Mono.error(new IllegalStateException("Transport is not linked")); - } - return Mono.fromRunnable(() -> p.receive(message)); - } - - /* ====================================================== - * Client connect(handler) 处理 server → client 消息 - * ====================================================== */ - @Override - public Mono connect(Function, Mono> handler) { - if (!clientConnected.compareAndSet(false, true)) { - return Mono.error(new IllegalStateException("Client already connected")); - } - - return inbound.asFlux() - .concatMap(msg -> - handler.apply(Mono.just(msg)) - // handler may emit response message → send back to server - .flatMap(resp -> resp != null ? sendMessage(resp) : Mono.empty()) - ) - .doFinally(sig -> clientConnected.set(false)) - .then(); - } - - @Override - public void setExceptionHandler(Consumer handler) { - McpClientTransport.super.setExceptionHandler(handler); - } - - /* ====================================================== - * Server: bind stateless handler = process client → server inbound - * ====================================================== */ - @Override - public void setMcpHandler(McpStatelessServerHandler handler) { - this.serverHandler = handler; - - if (!serverConnected.compareAndSet(false, true)) { - throw new IllegalStateException("Server already connected"); - } - - // 订阅 client → server 消息 - inbound.asFlux() - .concatMap(this::handleServerMessage) - .doFinally(sig -> serverConnected.set(false)) - .subscribe(); - } - - /** - * Server 端处理 JSONRPCMessage - */ - private Mono handleServerMessage(McpSchema.JSONRPCMessage msg) { - // 创建 transport context(简单实现即可) - McpTransportContext ctx = key -> null; - - if (msg instanceof McpSchema.JSONRPCRequest req) { - return serverHandler.handleRequest(ctx, req) - .flatMap(this::sendMessage); - } - - if (msg instanceof McpSchema.JSONRPCNotification noti) { - return serverHandler.handleNotification(ctx, noti); - } - - return Mono.empty(); - } - - /* ====================================================== - * other boilerplate - * ====================================================== */ - - @Override - public void close() { - McpClientTransport.super.close(); - } - - @Override - public Mono closeGracefully() { - inbound.tryEmitComplete(); - clientConnected.set(false); - serverConnected.set(false); - return Mono.empty(); - } - - @Override - public T unmarshalFrom(Object data, TypeRef typeRef) { - return McpJsonMapper.getDefault().convertValue(data, typeRef); - } - - @Override - public List protocolVersions() { - return McpClientTransport.super.protocolVersions(); - } - } - } diff --git a/Partner-Main/src/test/java/experimental/InProcessMcpTransport.java b/Partner-Main/src/test/java/experimental/InProcessMcpTransport.java new file mode 100644 index 00000000..8ca56f69 --- /dev/null +++ b/Partner-Main/src/test/java/experimental/InProcessMcpTransport.java @@ -0,0 +1,190 @@ +package experimental; + +import io.modelcontextprotocol.client.McpClient; +import io.modelcontextprotocol.client.McpSyncClient; +import io.modelcontextprotocol.common.McpTransportContext; +import io.modelcontextprotocol.json.McpJsonMapper; +import io.modelcontextprotocol.json.TypeRef; +import io.modelcontextprotocol.server.McpServer; +import io.modelcontextprotocol.server.McpStatelessServerFeatures; +import io.modelcontextprotocol.server.McpStatelessServerHandler; +import io.modelcontextprotocol.server.McpStatelessSyncServer; +import io.modelcontextprotocol.spec.McpClientTransport; +import io.modelcontextprotocol.spec.McpSchema; +import io.modelcontextprotocol.spec.McpStatelessServerTransport; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; +import reactor.core.publisher.Sinks; + +import java.util.List; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.function.Consumer; +import java.util.function.Function; + +public final class InProcessMcpTransport implements McpClientTransport, McpStatelessServerTransport { + + // 每个 transport 只处理一条 inbound 流 + private final Sinks.Many inbound = + Sinks.many().unicast().onBackpressureBuffer(); + + private final AtomicBoolean clientConnected = new AtomicBoolean(false); + private final AtomicBoolean serverConnected = new AtomicBoolean(false); + + /** + * 对端 + */ + private volatile InProcessMcpTransport peer; + + private volatile McpStatelessServerHandler serverHandler; + + public record Pair(InProcessMcpTransport clientSide, InProcessMcpTransport serverSide) { + } + + public static Pair pair() { + InProcessMcpTransport client = new InProcessMcpTransport(); + InProcessMcpTransport server = new InProcessMcpTransport(); + + client.peer = server; + server.peer = client; + + return new Pair(client, server); + } + + /* ====================================================== + * Internal receive: peer.sendMessage -> this.receive + * ====================================================== */ + private void receive(McpSchema.JSONRPCMessage message) { + if (inbound.tryEmitNext(message).isFailure()) { + throw new RuntimeException("Failed to receive message: " + message); + } + } + + /* ====================================================== + * Client → Server sendMessage + * ====================================================== */ + @Override + public Mono sendMessage(McpSchema.JSONRPCMessage message) { + InProcessMcpTransport p = this.peer; + if (p == null) { + return Mono.error(new IllegalStateException("Transport is not linked")); + } + return Mono.fromRunnable(() -> p.receive(message)); + } + + /* ====================================================== + * Client connect(handler) 处理 server → client 消息 + * ====================================================== */ + @Override + public Mono connect(Function, Mono> handler) { + if (!clientConnected.compareAndSet(false, true)) { + return Mono.error(new IllegalStateException("Client already connected")); + } + + return inbound.asFlux() + .concatMap(msg -> + handler.apply(Mono.just(msg)) + // handler may emit response message → send back to server + .flatMap(resp -> resp != null ? sendMessage(resp) : Mono.empty()) + ) + .doFinally(sig -> clientConnected.set(false)) + .then(); + } + + @Override + public void setExceptionHandler(Consumer handler) { + McpClientTransport.super.setExceptionHandler(handler); + } + + /* ====================================================== + * Server: bind stateless handler = process client → server inbound + * ====================================================== */ + @Override + public void setMcpHandler(McpStatelessServerHandler handler) { + this.serverHandler = handler; + + if (!serverConnected.compareAndSet(false, true)) { + throw new IllegalStateException("Server already connected"); + } + + // 订阅 client → server 消息 + inbound.asFlux() + .concatMap(this::handleServerMessage) + .doFinally(sig -> serverConnected.set(false)) + .subscribe(); + } + + /** + * Server 端处理 JSONRPCMessage + */ + private Mono handleServerMessage(McpSchema.JSONRPCMessage msg) { + // 创建 transport context(简单实现即可) + McpTransportContext ctx = key -> null; + + if (msg instanceof McpSchema.JSONRPCRequest req) { + return serverHandler.handleRequest(ctx, req) + .flatMap(this::sendMessage); + } + + if (msg instanceof McpSchema.JSONRPCNotification noti) { + return serverHandler.handleNotification(ctx, noti); + } + + return Mono.empty(); + } + + /* ====================================================== + * other boilerplate + * ====================================================== */ + + @Override + public void close() { + McpClientTransport.super.close(); + } + + @Override + public Mono closeGracefully() { + inbound.tryEmitComplete(); + clientConnected.set(false); + serverConnected.set(false); + return Mono.empty(); + } + + @Override + public T unmarshalFrom(Object data, TypeRef typeRef) { + return McpJsonMapper.getDefault().convertValue(data, typeRef); + } + + @Override + public List protocolVersions() { + return McpClientTransport.super.protocolVersions(); + } +} + +class InProcessMcpTransportTest { + @Test + void inProcessMcpTransportTest() { + InProcessMcpTransport.Pair pair = InProcessMcpTransport.pair(); + InProcessMcpTransport clientSide = pair.clientSide(); + InProcessMcpTransport serverSide = pair.serverSide(); + McpStatelessSyncServer server = McpServer.sync(serverSide) + .capabilities(McpSchema.ServerCapabilities.builder().tools(true).build()) + .build(); + server.addTool(McpStatelessServerFeatures.SyncToolSpecification.builder() + .tool(McpSchema.Tool.builder().name("111").build()).callHandler((mcpTransportContext, callToolRequest) -> { + System.out.println(111); + return McpSchema.CallToolResult.builder().addContent(new McpSchema.TextContent("111")).build(); + }).build()); + McpSyncClient client = McpClient.sync(clientSide) + .build(); + + List tools = client.listTools().tools(); + McpSchema.Tool tool = tools.getFirst(); + System.out.println(tool.toString()); + + McpSchema.CallToolResult callToolResult = client.callTool(McpSchema.CallToolRequest.builder().name(tool.name()).build()); + System.out.println(callToolResult.content().toString()); + + client.close(); + server.close(); + } +} diff --git a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/RunnerClientTest.java b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/RunnerClientTest.java index 8605d547..040069a4 100644 --- a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/RunnerClientTest.java +++ b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/RunnerClientTest.java @@ -1,95 +1,16 @@ package work.slhaf.partner.core.action.runner; import com.alibaba.fastjson2.JSONObject; -import io.modelcontextprotocol.client.McpClient; -import io.modelcontextprotocol.client.McpSyncClient; -import io.modelcontextprotocol.server.McpServer; -import io.modelcontextprotocol.server.McpStatelessServerFeatures; -import io.modelcontextprotocol.server.McpStatelessSyncServer; -import io.modelcontextprotocol.spec.McpSchema; -import org.junit.jupiter.api.Test; import work.slhaf.partner.core.action.entity.McpData; import work.slhaf.partner.core.action.entity.MetaAction; import work.slhaf.partner.core.action.entity.MetaActionInfo; import java.io.IOException; -import java.util.List; -import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executors; public class RunnerClientTest { - @Test - void httpMcpClientTest() { - TestRunnerClient testClient = new TestRunnerClient(); - RunnerClient.HttpMcpServerParams params = new RunnerClient.HttpMcpServerParams(20, "https://dashscope.aliyuncs.com", "/api/v1/mcps/WebSearch/sse", Map.of("Authorization", "Bearer sk-xxx")); - testClient.registerMcpClient("test", params); - McpSyncClient client = testClient.mcpClients.values().stream().toList().getFirst(); - List tools = client.listTools().tools(); - System.out.println(tools); - McpSchema.CallToolResult query = client.callTool(McpSchema.CallToolRequest.builder().name(tools.getFirst().name()).arguments(Map.of("query", "123")).build()); - for (McpSchema.Content content : query.content()) { - System.out.println("\r\n---\r\n"); - System.out.println(content); - } - } - - @Test - void stdioMcpClientTest() { - TestRunnerClient testClient = new TestRunnerClient(); - RunnerClient.StdioMcpServerParams params = new RunnerClient.StdioMcpServerParams(20, "uvx", Map.of("http_proxy", "http://127.0.0.1:7897", "https_proxy", "http://127.0.0.1:7897"), List.of("mcp-server-fetch")); - testClient.registerMcpClient("test", params); - McpSyncClient client = testClient.mcpClients.values().stream().toList().getFirst(); - List tools = client.listTools().tools(); - System.out.println(tools); - McpSchema.CallToolResult query = client.callTool(McpSchema.CallToolRequest.builder().name(tools.getFirst().name()).arguments(Map.of("url", "https://gitea.slhaf.work")).build()); - System.out.println(query.toString()); - } - - @Test - void schemaTest() { - TestRunnerClient testClient = new TestRunnerClient(); - RunnerClient.StdioMcpServerParams params = new RunnerClient.StdioMcpServerParams(20, "uvx", Map.of("http_proxy", "http://127.0.0.1:7897", "https_proxy", "http://127.0.0.1:7897"), List.of("mcp-server-fetch")); - testClient.registerMcpClient("test", params); - McpSyncClient client = testClient.mcpClients.values().stream().toList().getFirst(); - List tools = client.listTools().tools(); - System.out.println("\r\n ------ \r\n"); - McpSchema.Tool first = tools.getFirst(); - Map paramsSchema = first.inputSchema().properties(); - System.out.println(paramsSchema.toString()); - System.out.println("\r\n ------ \r\n"); - Map outputSchema = first.outputSchema(); - System.out.println(outputSchema); - } - - @Test - void inProcessMcpTransportTest() { - RunnerClient.InProcessMcpTransport.Pair pair = RunnerClient.InProcessMcpTransport.pair(); - RunnerClient.InProcessMcpTransport clientSide = pair.clientSide(); - RunnerClient.InProcessMcpTransport serverSide = pair.serverSide(); - McpStatelessSyncServer server = McpServer.sync(serverSide) - .capabilities(McpSchema.ServerCapabilities.builder().tools(true).build()) - .build(); - server.addTool(McpStatelessServerFeatures.SyncToolSpecification.builder() - .tool(McpSchema.Tool.builder().name("111").build()).callHandler((mcpTransportContext, callToolRequest) -> { - System.out.println(111); - return McpSchema.CallToolResult.builder().addContent(new McpSchema.TextContent("111")).build(); - }).build()); - McpSyncClient client = McpClient.sync(clientSide) - .build(); - - List tools = client.listTools().tools(); - McpSchema.Tool tool = tools.getFirst(); - System.out.println(tool.toString()); - - McpSchema.CallToolResult callToolResult = client.callTool(McpSchema.CallToolRequest.builder().name(tool.name()).build()); - System.out.println(callToolResult.content().toString()); - - client.close(); - server.close(); - } - private static class TestRunnerClient extends RunnerClient { public TestRunnerClient() { From 476acb0641d4c1689eecc1396dcbd3cd4cbc77fe Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 22 Dec 2025 15:02:07 +0800 Subject: [PATCH 048/182] refactor(LocalRunnerClient): rename McpServerParams into McpClientTrasnportParams --- .../core/action/runner/LocalRunnerClient.java | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 5907e274..29afdbec 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -220,12 +220,12 @@ public class LocalRunnerClient extends RunnerClient { * 该部分主要发生在扫描到新的MCP Server描述文件时出现的注册逻辑 * * @param id MCP Client 的 id - * @param mcpServerParams MCP Server 的参数 + * @param mcpClientTransportParams MCP Server 的参数 */ - private void registerMcpClient(String id, McpServerParams mcpServerParams) { - McpClientTransport clientTransport = createTransport(mcpServerParams); + private void registerMcpClient(String id, McpClientTransportParams mcpClientTransportParams) { + McpClientTransport clientTransport = createTransport(mcpClientTransportParams); McpSyncClient client = McpClient.sync(clientTransport) - .requestTimeout(Duration.ofSeconds(mcpServerParams.timeout)) + .requestTimeout(Duration.ofSeconds(mcpClientTransportParams.timeout)) .clientInfo(new McpSchema.Implementation(id, "PARTNER")) // 行动程序(现 MCP Tool)的描述文本将直接由resources返回 // 原因: ToolChange 发送的内容侧重调用,缺少可承担描述文本的字段 @@ -261,16 +261,16 @@ public class LocalRunnerClient extends RunnerClient { return info; } - private McpClientTransport createTransport(McpServerParams mcpServerParams) { - return switch (mcpServerParams) { - case StdioMcpServerParams params -> { + private McpClientTransport createTransport(McpClientTransportParams mcpClientTransportParams) { + return switch (mcpClientTransportParams) { + case StdioMcpClientTransportParams params -> { ServerParameters serverParameters = ServerParameters.builder(params.command) .env(params.env) .args(params.args) .build(); yield new StdioClientTransport(serverParameters, McpJsonMapper.getDefault()); } - case HttpMcpServerParams params -> { + case HttpMcpClientTransportParams params -> { McpSyncHttpClientRequestCustomizer customizer = (builder, method, endpoint, body, context) -> { params.headers.forEach(builder::setHeader); }; @@ -289,20 +289,20 @@ public class LocalRunnerClient extends RunnerClient { }); } - private sealed abstract static class McpServerParams permits HttpMcpServerParams, StdioMcpServerParams { + private sealed abstract static class McpClientTransportParams permits HttpMcpClientTransportParams, StdioMcpClientTransportParams { private final int timeout; - private McpServerParams(int timeout) { + private McpClientTransportParams(int timeout) { this.timeout = timeout; } } - private final static class HttpMcpServerParams extends McpServerParams { + private final static class HttpMcpClientTransportParams extends McpClientTransportParams { private final String baseUri; private final String endpoint; private final Map headers; - private HttpMcpServerParams(int timeout, String baseUri, String endpoint, Map header) { + private HttpMcpClientTransportParams(int timeout, String baseUri, String endpoint, Map header) { super(timeout); this.baseUri = baseUri; this.endpoint = endpoint; @@ -310,12 +310,12 @@ public class LocalRunnerClient extends RunnerClient { } } - private final static class StdioMcpServerParams extends McpServerParams { + private final static class StdioMcpClientTransportParams extends McpClientTransportParams { private final String command; private final Map env; private final List args; - private StdioMcpServerParams(int timeout, String command, Map env, List args) { + private StdioMcpClientTransportParams(int timeout, String command, Map env, List args) { super(timeout); this.command = command; this.env = env; From dcbd2c6569b9d71394d7620f2c23f584d9cfa505 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Wed, 24 Dec 2025 19:21:53 +0800 Subject: [PATCH 049/182] build(maven): introduce common module --- .idea/encodings.xml | 2 ++ Partner-Common/pom.xml | 20 ++++++++++++++++++++ pom.xml | 1 + 3 files changed, 23 insertions(+) create mode 100644 Partner-Common/pom.xml diff --git a/.idea/encodings.xml b/.idea/encodings.xml index d920afab..154a876a 100644 --- a/.idea/encodings.xml +++ b/.idea/encodings.xml @@ -3,6 +3,8 @@ + + diff --git a/Partner-Common/pom.xml b/Partner-Common/pom.xml new file mode 100644 index 00000000..5840c2cb --- /dev/null +++ b/Partner-Common/pom.xml @@ -0,0 +1,20 @@ + + + 4.0.0 + + work.slhaf + Partner + 0.5.0 + + + Partner-Common + + + 21 + 21 + UTF-8 + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index ff6ea8a9..d2dc3f61 100644 --- a/pom.xml +++ b/pom.xml @@ -13,6 +13,7 @@ Partner-Main Partner-Api Partner-SandboxRunner + Partner-Common From 592e2604d92cbef1bcddd80185e1cc30cfc8f7cf Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Wed, 24 Dec 2025 19:34:04 +0800 Subject: [PATCH 050/182] refactor(mcp): move InProcessMcpTransport into Partner-Common module Context: Action modules in Partner-Main and SandboxRunner module rely on in-process MCP transport to support dynamically action generating. --- Partner-Common/pom.xml | 8 ++++ .../common/mcp}/InProcessMcpTransport.java | 37 +---------------- Partner-Main/pom.xml | 6 +++ .../InProcessMcpTransportTest.java | 41 +++++++++++++++++++ 4 files changed, 56 insertions(+), 36 deletions(-) rename {Partner-Main/src/test/java/experimental => Partner-Common/src/main/java/work/slhaf/partner/common/mcp}/InProcessMcpTransport.java (76%) create mode 100644 Partner-Main/src/test/java/experimental/InProcessMcpTransportTest.java diff --git a/Partner-Common/pom.xml b/Partner-Common/pom.xml index 5840c2cb..1639ab13 100644 --- a/Partner-Common/pom.xml +++ b/Partner-Common/pom.xml @@ -11,6 +11,14 @@ Partner-Common + + + + io.modelcontextprotocol.sdk + mcp + 0.17.0 + + 21 21 diff --git a/Partner-Main/src/test/java/experimental/InProcessMcpTransport.java b/Partner-Common/src/main/java/work/slhaf/partner/common/mcp/InProcessMcpTransport.java similarity index 76% rename from Partner-Main/src/test/java/experimental/InProcessMcpTransport.java rename to Partner-Common/src/main/java/work/slhaf/partner/common/mcp/InProcessMcpTransport.java index 8ca56f69..fd37dc53 100644 --- a/Partner-Main/src/test/java/experimental/InProcessMcpTransport.java +++ b/Partner-Common/src/main/java/work/slhaf/partner/common/mcp/InProcessMcpTransport.java @@ -1,18 +1,12 @@ -package experimental; +package work.slhaf.partner.common.mcp; -import io.modelcontextprotocol.client.McpClient; -import io.modelcontextprotocol.client.McpSyncClient; import io.modelcontextprotocol.common.McpTransportContext; import io.modelcontextprotocol.json.McpJsonMapper; import io.modelcontextprotocol.json.TypeRef; -import io.modelcontextprotocol.server.McpServer; -import io.modelcontextprotocol.server.McpStatelessServerFeatures; import io.modelcontextprotocol.server.McpStatelessServerHandler; -import io.modelcontextprotocol.server.McpStatelessSyncServer; import io.modelcontextprotocol.spec.McpClientTransport; import io.modelcontextprotocol.spec.McpSchema; import io.modelcontextprotocol.spec.McpStatelessServerTransport; -import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; import reactor.core.publisher.Sinks; @@ -159,32 +153,3 @@ public final class InProcessMcpTransport implements McpClientTransport, McpState return McpClientTransport.super.protocolVersions(); } } - -class InProcessMcpTransportTest { - @Test - void inProcessMcpTransportTest() { - InProcessMcpTransport.Pair pair = InProcessMcpTransport.pair(); - InProcessMcpTransport clientSide = pair.clientSide(); - InProcessMcpTransport serverSide = pair.serverSide(); - McpStatelessSyncServer server = McpServer.sync(serverSide) - .capabilities(McpSchema.ServerCapabilities.builder().tools(true).build()) - .build(); - server.addTool(McpStatelessServerFeatures.SyncToolSpecification.builder() - .tool(McpSchema.Tool.builder().name("111").build()).callHandler((mcpTransportContext, callToolRequest) -> { - System.out.println(111); - return McpSchema.CallToolResult.builder().addContent(new McpSchema.TextContent("111")).build(); - }).build()); - McpSyncClient client = McpClient.sync(clientSide) - .build(); - - List tools = client.listTools().tools(); - McpSchema.Tool tool = tools.getFirst(); - System.out.println(tool.toString()); - - McpSchema.CallToolResult callToolResult = client.callTool(McpSchema.CallToolRequest.builder().name(tool.name()).build()); - System.out.println(callToolResult.content().toString()); - - client.close(); - server.close(); - } -} diff --git a/Partner-Main/pom.xml b/Partner-Main/pom.xml index f05dea7b..ec937cf1 100644 --- a/Partner-Main/pom.xml +++ b/Partner-Main/pom.xml @@ -50,6 +50,12 @@ mcp 0.17.0 + + work.slhaf + Partner-Common + 0.5.0 + test + diff --git a/Partner-Main/src/test/java/experimental/InProcessMcpTransportTest.java b/Partner-Main/src/test/java/experimental/InProcessMcpTransportTest.java new file mode 100644 index 00000000..c3115f8b --- /dev/null +++ b/Partner-Main/src/test/java/experimental/InProcessMcpTransportTest.java @@ -0,0 +1,41 @@ +package experimental; + +import io.modelcontextprotocol.client.McpClient; +import io.modelcontextprotocol.client.McpSyncClient; +import io.modelcontextprotocol.server.McpServer; +import io.modelcontextprotocol.server.McpStatelessServerFeatures; +import io.modelcontextprotocol.server.McpStatelessSyncServer; +import io.modelcontextprotocol.spec.McpSchema; +import org.junit.jupiter.api.Test; +import work.slhaf.partner.common.mcp.InProcessMcpTransport; + +import java.util.List; + +public class InProcessMcpTransportTest { + @Test + void inProcessMcpTransportTest() { + InProcessMcpTransport.Pair pair = InProcessMcpTransport.pair(); + InProcessMcpTransport clientSide = pair.clientSide(); + InProcessMcpTransport serverSide = pair.serverSide(); + McpStatelessSyncServer server = McpServer.sync(serverSide) + .capabilities(McpSchema.ServerCapabilities.builder().tools(true).build()) + .build(); + server.addTool(McpStatelessServerFeatures.SyncToolSpecification.builder() + .tool(McpSchema.Tool.builder().name("111").build()).callHandler((mcpTransportContext, callToolRequest) -> { + System.out.println(111); + return McpSchema.CallToolResult.builder().addContent(new McpSchema.TextContent("111")).build(); + }).build()); + McpSyncClient client = McpClient.sync(clientSide) + .build(); + + List tools = client.listTools().tools(); + McpSchema.Tool tool = tools.getFirst(); + System.out.println(tool.toString()); + + McpSchema.CallToolResult callToolResult = client.callTool(McpSchema.CallToolRequest.builder().name(tool.name()).build()); + System.out.println(callToolResult.content().toString()); + + client.close(); + server.close(); + } +} From d614ac0b159ee09b4f96b66eab57164fffd63133 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Wed, 24 Dec 2025 21:36:39 +0800 Subject: [PATCH 051/182] feat(LocalRunnerClient): support initializing in-process dynamic action MCP Server --- Partner-Main/pom.xml | 6 ++++ .../core/action/runner/LocalRunnerClient.java | 31 +++++++++++++++++-- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/Partner-Main/pom.xml b/Partner-Main/pom.xml index ec937cf1..f9e3db57 100644 --- a/Partner-Main/pom.xml +++ b/Partner-Main/pom.xml @@ -56,6 +56,12 @@ 0.5.0 test + + work.slhaf + Partner-Common + 0.5.0 + compile + diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 29afdbec..b158fa92 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -10,6 +10,8 @@ import io.modelcontextprotocol.client.transport.ServerParameters; import io.modelcontextprotocol.client.transport.StdioClientTransport; import io.modelcontextprotocol.client.transport.customizer.McpSyncHttpClientRequestCustomizer; import io.modelcontextprotocol.json.McpJsonMapper; +import io.modelcontextprotocol.server.McpServer; +import io.modelcontextprotocol.server.McpStatelessAsyncServer; import io.modelcontextprotocol.spec.McpClientTransport; import io.modelcontextprotocol.spec.McpSchema; import lombok.Data; @@ -17,6 +19,7 @@ import lombok.extern.slf4j.Slf4j; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.UnknownNullability; +import work.slhaf.partner.common.mcp.InProcessMcpTransport; import work.slhaf.partner.core.action.entity.McpData; import work.slhaf.partner.core.action.entity.MetaAction; import work.slhaf.partner.core.action.entity.MetaActionInfo; @@ -29,7 +32,6 @@ import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.nio.file.*; -import java.nio.file.attribute.BasicFileAttributes; import java.time.Duration; import java.util.ArrayList; import java.util.HashMap; @@ -46,14 +48,32 @@ import static work.slhaf.partner.common.Constant.Path.TMP_ACTION_DIR_LOCAL; public class LocalRunnerClient extends RunnerClient { private final Map mcpClients = new HashMap<>(); + /** + * 动态生成的行动程序都将挂载至该 McpServer + */ + private McpStatelessAsyncServer dynamicActionMcpServer; public LocalRunnerClient(ConcurrentHashMap existedMetaActions, ExecutorService executor, @Nullable String actionWatchPath) { super(existedMetaActions, executor); ActionWatchService watchService = new ActionWatchService(actionWatchPath); watchService.launch(); + registerDynamicActionMcp(); setupShutdownHook(); } + private void registerDynamicActionMcp() { + InProcessMcpTransport.Pair pair = InProcessMcpTransport.pair(); + McpSchema.ServerCapabilities serverCapabilities = McpSchema.ServerCapabilities.builder() + .tools(true) + .resources(true, true) + .build(); + dynamicActionMcpServer = McpServer.async(pair.serverSide()) + .capabilities(serverCapabilities) + .jsonMapper(McpJsonMapper.getDefault()) + .build(); + registerMcpClient("dynamic-action", pair.clientSide(), 10); + } + @Override protected RunnerResponse doRun(MetaAction metaAction) { RunnerResponse response; @@ -219,13 +239,18 @@ public class LocalRunnerClient extends RunnerClient { /** * 该部分主要发生在扫描到新的MCP Server描述文件时出现的注册逻辑 * - * @param id MCP Client 的 id + * @param id MCP Client 的 id * @param mcpClientTransportParams MCP Server 的参数 */ private void registerMcpClient(String id, McpClientTransportParams mcpClientTransportParams) { McpClientTransport clientTransport = createTransport(mcpClientTransportParams); + int timeout = mcpClientTransportParams.timeout; + registerMcpClient(id, clientTransport, timeout); + } + + private void registerMcpClient(String id, McpClientTransport clientTransport, int timeout) { McpSyncClient client = McpClient.sync(clientTransport) - .requestTimeout(Duration.ofSeconds(mcpClientTransportParams.timeout)) + .requestTimeout(Duration.ofSeconds(timeout)) .clientInfo(new McpSchema.Implementation(id, "PARTNER")) // 行动程序(现 MCP Tool)的描述文本将直接由resources返回 // 原因: ToolChange 发送的内容侧重调用,缺少可承担描述文本的字段 From e00d77f07691ed1b2ced34bd36f5c9352c176bb0 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Thu, 25 Dec 2025 10:12:38 +0800 Subject: [PATCH 052/182] feat(LocalRunnerClient): add shutdown logic for dynamicActionMcpServer --- .../work/slhaf/partner/core/action/runner/LocalRunnerClient.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index b158fa92..0a64e48b 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -308,6 +308,7 @@ public class LocalRunnerClient extends RunnerClient { } private void setupShutdownHook() { + dynamicActionMcpServer.close(); this.mcpClients.forEach((id, client) -> { client.close(); log.info("[{}] MCP-Client 已关闭", id); From 621441601aefd1cf860a67407f5ea5e3bbfaf825 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Thu, 25 Dec 2025 10:20:55 +0800 Subject: [PATCH 053/182] feat(LocalRunnerClient): correct method signature --- .../slhaf/partner/core/action/runner/LocalRunnerClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 0a64e48b..00343e35 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -270,7 +270,7 @@ public class LocalRunnerClient extends RunnerClient { } } - private static @NotNull MetaActionInfo buildMetaActionInfo(McpSchema.Tool tool) { + private @NotNull MetaActionInfo buildMetaActionInfo(McpSchema.Tool tool) { MetaActionInfo info = new MetaActionInfo(); info.setDescription(tool.description()); Map outputSchema = tool.outputSchema(); From d41074c814febb0e0ca396e6b5a0d990ae78d4ab Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Thu, 25 Dec 2025 15:41:49 +0800 Subject: [PATCH 054/182] refactor(LocalRunnerClient): replace ActionWatchService with unified watch service builder. Context: ActionWatchService was used to support SCRIPT and PLUGIN type actions loading from local FileSystem, this refactor allows register different paths to watch. --- .../core/action/runner/LocalRunnerClient.java | 314 +++++++----------- 1 file changed, 127 insertions(+), 187 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 00343e35..5929bf25 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -25,7 +25,6 @@ import work.slhaf.partner.core.action.entity.MetaAction; import work.slhaf.partner.core.action.entity.MetaActionInfo; import work.slhaf.partner.core.action.entity.MetaActionType; import work.slhaf.partner.core.action.exception.ActionInitFailedException; -import work.slhaf.partner.core.action.exception.ActionLoadFailedException; import java.io.BufferedReader; import java.io.File; @@ -41,7 +40,6 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.atomic.AtomicInteger; -import static work.slhaf.partner.common.Constant.Path.ACTION_PROGRAM; import static work.slhaf.partner.common.Constant.Path.TMP_ACTION_DIR_LOCAL; @Slf4j @@ -52,11 +50,15 @@ public class LocalRunnerClient extends RunnerClient { * 动态生成的行动程序都将挂载至该 McpServer */ private McpStatelessAsyncServer dynamicActionMcpServer; + private final WatchService watchService; public LocalRunnerClient(ConcurrentHashMap existedMetaActions, ExecutorService executor, @Nullable String actionWatchPath) { super(existedMetaActions, executor); - ActionWatchService watchService = new ActionWatchService(actionWatchPath); - watchService.launch(); + try { + watchService = FileSystems.getDefault().newWatchService(); + } catch (IOException e) { + throw new ActionInitFailedException("目录监听器启动失败", e); + } registerDynamicActionMcp(); setupShutdownHook(); } @@ -308,11 +310,127 @@ public class LocalRunnerClient extends RunnerClient { } private void setupShutdownHook() { - dynamicActionMcpServer.close(); - this.mcpClients.forEach((id, client) -> { - client.close(); - log.info("[{}] MCP-Client 已关闭", id); - }); + Runtime.getRuntime().addShutdownHook(new Thread(() -> { + dynamicActionMcpServer.close(); + this.mcpClients.forEach((id, client) -> { + client.close(); + log.info("[{}] MCP-Client 已关闭", id); + }); + })); + } + + private WatchServiceBuild registerWatchService(Path path) { + return new LocalWatchServiceHelper(path, watchService, executor); + } + + private interface WatchServiceBuild { + WatchServiceBuild registerCreate(WatchEventHandler handler); + + WatchServiceBuild registerModify(WatchEventHandler handler); + + WatchServiceBuild registerDelete(WatchEventHandler handler); + + WatchServiceBuild registerOverflow(WatchEventHandler handler); + + WatchServiceBuild initialLoad(WatchInitLoader loader); + + void commit(); + } + + private interface WatchEventHandler { + void handle(Path thisDir, Path context); + } + + private interface WatchInitLoader { + void load(Path path); + } + + private static class LocalWatchServiceHelper implements WatchServiceBuild { + + private final Map, WatchEventHandler> handlers = new HashMap<>(); + private final Path path; + private final WatchService watchService; + private final ExecutorService executor; + private WatchInitLoader initLoader; + + private LocalWatchServiceHelper(Path path, WatchService watchService, ExecutorService executor) { + this.path = path; + this.watchService = watchService; + this.executor = executor; + } + + @Override + public WatchServiceBuild registerCreate(WatchEventHandler handler) { + handlers.put(StandardWatchEventKinds.ENTRY_CREATE, handler); + return this; + } + + @Override + public WatchServiceBuild registerModify(WatchEventHandler handler) { + handlers.put(StandardWatchEventKinds.ENTRY_MODIFY, handler); + return this; + } + + @Override + public WatchServiceBuild registerDelete(WatchEventHandler handler) { + handlers.put(StandardWatchEventKinds.ENTRY_DELETE, handler); + return this; + } + + @Override + public WatchServiceBuild registerOverflow(WatchEventHandler handler) { + handlers.put(StandardWatchEventKinds.OVERFLOW, handler); + return this; + } + + @Override + public WatchServiceBuild initialLoad(WatchInitLoader loader) { + initLoader = loader; + return this; + } + + @Override + public void commit() { + if (initLoader != null) initLoader.load(path); + executor.execute(buildWatchTask()); + } + + private Runnable buildWatchTask() { + return () -> { + String pathStr = path.toString(); + log.info("行动程序目录监听器已启动,监听目录: {}", pathStr); + while (true) { + WatchKey key; + try { + key = watchService.take(); + List> events = key.pollEvents(); + for (WatchEvent e : events) { + WatchEvent.Kind kind = e.kind(); + Object context = e.context(); + log.info("行动程序目录变更事件: {} - {} - {}", pathStr, kind.name(), context); + Path thisDir = (Path) key.watchable(); + if (!thisDir.equals(path)) { + // 若事件所在目录不为为 path,忽略并步入下一轮循环 + continue; + } + WatchEventHandler handler = handlers.get(kind); + if (handler == null) { + continue; + } + handler.handle(thisDir, context instanceof Path ? (Path) context : null); + } + } catch (InterruptedException e) { + log.info("监听线程被中断,准备退出..."); + Thread.currentThread().interrupt(); // 恢复中断标志 + break; + } catch (ClosedWatchServiceException e) { + log.info("WatchService 已关闭,监听线程退出。"); + break; + } + } + }; + } + } private sealed abstract static class McpClientTransportParams permits HttpMcpClientTransportParams, StdioMcpClientTransportParams { @@ -355,182 +473,4 @@ public class LocalRunnerClient extends RunnerClient { private String total; private List resultList; } - - //TODO 逻辑待更新,用以适配 MCP 服务的及时发现与注册 - private class ActionWatchService { - - private final HashMap registeredPaths = new HashMap<>(); - private final String actionWatchPath; - - private ActionWatchService(String actionWatchPath) { - this.actionWatchPath = actionWatchPath; - } - - private void launch() { - Path path = Path.of(actionWatchPath != null ? actionWatchPath : ACTION_PROGRAM); - scanActions(path.toFile()); - launchActionDirectoryWatcher(path); - } - - private void launchActionDirectoryWatcher(Path path) { - WatchService watchService; - try { - watchService = FileSystems.getDefault().newWatchService(); - setupShutdownHook(watchService); - registerParentToWatch(path, watchService); - registerSubToWatch(path, watchService); - executor.execute(registerWatchTask(path, watchService)); - } catch (IOException e) { - throw new ActionInitFailedException("行动程序目录监听器启动失败", e); - } - } - - private void setupShutdownHook(WatchService watchService) { - Runtime.getRuntime().addShutdownHook(new Thread(() -> { - try { - watchService.close(); - } catch (IOException e) { - throw new RuntimeException(e); - } - })); - } - - private Runnable registerWatchTask(Path path, WatchService watchService) { - return () -> { - log.info("行动程序目录监听器已启动"); - while (true) { - WatchKey key; - try { - key = watchService.take(); - List> events = key.pollEvents(); - for (WatchEvent e : events) { - @SuppressWarnings("unchecked") - WatchEvent event = (WatchEvent) e; - WatchEvent.Kind kind = event.kind(); - Path context = event.context(); - log.info("行动程序目录变更事件: {} - {}", kind.name(), context.toString()); - Path thisDir = (Path) key.watchable(); - // 根据事件发生的目录进行分流,分为父目录事件和子程序事件 - if (thisDir.equals(path)) { - handleParentDirEvent(kind, thisDir, context, watchService); - } else { - handleSubDirEvent(kind, thisDir); - } - } - } catch (InterruptedException e) { - log.info("监听线程被中断,准备退出..."); - Thread.currentThread().interrupt(); // 恢复中断标志 - break; - } catch (ClosedWatchServiceException e) { - log.info("WatchService 已关闭,监听线程退出。"); - break; - } - } - }; - } - - private void handleSubDirEvent(WatchEvent.Kind kind, Path thisDir) { - // path为触发本次行动的文件的路径(当前位于某个action目录下) - // 先判定发生的目录前缀是否匹配(action、desc),否则忽略 - if (kind == StandardWatchEventKinds.ENTRY_CREATE || kind == StandardWatchEventKinds.ENTRY_MODIFY) { - // CREATE、MODIFY 事件将触发一次检测,看当前thisDir中action和desc是否都具备,如果通过则尝试加载(put)。 - boolean complete = checkComplete(thisDir); - if (!complete) - return; - try { - MetaActionInfo newActionInfo = new MetaActionInfo(); - existedMetaActions.put(thisDir.toString(), newActionInfo); - } catch (ActionLoadFailedException e) { - log.warn("行动信息重新加载失败,触发行为: {}", kind.name()); - } - } else if (kind == StandardWatchEventKinds.ENTRY_DELETE) { - // DELETE 事件将会把该 MetaActionInfo 从记录中移除 - existedMetaActions.remove(thisDir.toString()); - } - } - - private boolean checkComplete(Path thisDir) { - File[] files = thisDir.toFile().listFiles(); - if (files == null) { - log.error("当前目录无法访问: [{}]", thisDir); - return false; - } - boolean existedAction = false; - boolean existedDesc = false; - for (File file : files) { - String fileName = file.getName(); - String nameWithoutExt = fileName.substring(0, fileName.lastIndexOf('.')); - if (nameWithoutExt.equals("action")) - existedAction = true; - else if (nameWithoutExt.equals("desc")) - existedDesc = true; - } - return existedAction && existedDesc; - } - - private void handleParentDirEvent(WatchEvent.Kind kind, Path thisDir, Path context, - WatchService watchService) { - Path path = Path.of(thisDir.toString(), context.toString()); - // MODIFY 事件不进行处理 - if (kind == StandardWatchEventKinds.ENTRY_CREATE) { - try { - path.register(watchService, - StandardWatchEventKinds.ENTRY_CREATE, - StandardWatchEventKinds.ENTRY_DELETE, - StandardWatchEventKinds.ENTRY_MODIFY); - } catch (IOException e) { - log.error("新增行动程序目录监听失败: {}", path, e); - } - } else if (kind == StandardWatchEventKinds.ENTRY_DELETE) { - WatchKey remove = registeredPaths.remove(path); - remove.cancel(); - } - } - - private void registerSubToWatch(Path path, WatchService watchService) throws IOException { - Files.walkFileTree(path, new SimpleFileVisitor<>() { - @Override - public @NotNull FileVisitResult preVisitDirectory(@NotNull Path dir, @NotNull BasicFileAttributes attrs) - throws IOException { - if (dir.getFileName().startsWith(".")) - return FileVisitResult.CONTINUE; - WatchKey key = dir.register(watchService, - StandardWatchEventKinds.ENTRY_CREATE, - StandardWatchEventKinds.ENTRY_DELETE, - StandardWatchEventKinds.ENTRY_MODIFY); - registeredPaths.put(dir, key); - return FileVisitResult.CONTINUE; - } - }); - } - - private void registerParentToWatch(Path path, WatchService watchService) throws IOException { - WatchKey key = path.register(watchService, - StandardWatchEventKinds.ENTRY_CREATE, - StandardWatchEventKinds.ENTRY_DELETE, - StandardWatchEventKinds.ENTRY_MODIFY); - registeredPaths.put(path, key); - } - - private void scanActions(File file) { - if (!file.exists() || file.isFile()) { - throw new ActionInitFailedException("未找到行动程序目录: " + file.getAbsolutePath()); - } - File[] files = file.listFiles(); - if (files == null) { - throw new ActionInitFailedException("目录无法访问: " + file.getAbsolutePath()); - } - for (File f : files) { - try { - MetaActionInfo actionInfo = new MetaActionInfo(); - existedMetaActions.put(f.getName(), actionInfo); -// log.info("行动程序[{}]已加载", actionInfo.getKey()); - } catch (ActionLoadFailedException e) { - log.warn("行动程序加载失败", e); - } - } - - } - } - } From 1f737c0e2964c4027e62af69d7dd51c7524a9a21 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 26 Dec 2025 21:28:02 +0800 Subject: [PATCH 055/182] refactor(action): reorganize constants in action module --- .../java/work/slhaf/partner/common/Constant.java | 2 -- .../work/slhaf/partner/common/util/PathUtil.java | 14 ++++++++++++++ .../core/action/runner/LocalRunnerClient.java | 13 +++++++++---- .../partner/core/action/runner/RunnerClient.java | 11 ++++++++++- 4 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/common/util/PathUtil.java diff --git a/Partner-Main/src/main/java/work/slhaf/partner/common/Constant.java b/Partner-Main/src/main/java/work/slhaf/partner/common/Constant.java index 36d0ab3a..5cecd24a 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/common/Constant.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/common/Constant.java @@ -5,8 +5,6 @@ public final class Constant { public static final class Path { public static final String DATA = "data"; public static final String MEMORY_DATA = DATA + "/memory"; - public static final String ACTION_PROGRAM = DATA + "/action"; - public static final String TMP_ACTION_DIR_LOCAL = ACTION_PROGRAM + "/tmp"; } } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/common/util/PathUtil.java b/Partner-Main/src/main/java/work/slhaf/partner/common/util/PathUtil.java new file mode 100644 index 00000000..3266de53 --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/common/util/PathUtil.java @@ -0,0 +1,14 @@ +package work.slhaf.partner.common.util; + +public class PathUtil { + public static String buildPathStr(String... path) { + StringBuilder str = new StringBuilder(); + for (int i = 0; i < path.length; i++) { + str.append(path[i]); + if (i < path.length - 1) { + str.append("/"); + } + } + return str.toString(); + } +} \ No newline at end of file diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 5929bf25..81c204e6 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -40,11 +40,16 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.atomic.AtomicInteger; -import static work.slhaf.partner.common.Constant.Path.TMP_ACTION_DIR_LOCAL; +import static work.slhaf.partner.common.util.PathUtil.buildPathStr; @Slf4j public class LocalRunnerClient extends RunnerClient { + private final String TMP_ACTION_PATH = buildPathStr(ACTION_PATH, "tmp"); + private final String DYNAMIC_ACTION_PATH = buildPathStr(ACTION_PATH, "dynamic"); + private final String MCP_SERVER_PATH = buildPathStr(ACTION_PATH, "mcp"); + private final String MCP_DESC_PATH = buildPathStr(MCP_SERVER_PATH, "desc"); + private final Map mcpClients = new HashMap<>(); /** * 动态生成的行动程序都将挂载至该 McpServer @@ -52,8 +57,8 @@ public class LocalRunnerClient extends RunnerClient { private McpStatelessAsyncServer dynamicActionMcpServer; private final WatchService watchService; - public LocalRunnerClient(ConcurrentHashMap existedMetaActions, ExecutorService executor, @Nullable String actionWatchPath) { - super(existedMetaActions, executor); + public LocalRunnerClient(ConcurrentHashMap existedMetaActions, ExecutorService executor, @Nullable String baseActionPath) { + super(existedMetaActions, executor, baseActionPath); try { watchService = FileSystems.getDefault().newWatchService(); } catch (IOException e) { @@ -143,7 +148,7 @@ public class LocalRunnerClient extends RunnerClient { @Override public String buildTmpPath(MetaAction tempAction, String codeType) { - return Path.of(TMP_ACTION_DIR_LOCAL, System.currentTimeMillis() + "-" + tempAction.getKey() + codeType).toString(); + return Path.of(TMP_ACTION_PATH, System.currentTimeMillis() + "-" + tempAction.getKey() + codeType).toString(); } @Override diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java index f410083d..b7c32f18 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java @@ -1,8 +1,10 @@ package work.slhaf.partner.core.action.runner; import com.alibaba.fastjson2.JSONObject; +import io.modelcontextprotocol.server.McpStatelessAsyncServer; import lombok.Data; import lombok.extern.slf4j.Slf4j; +import org.jetbrains.annotations.Nullable; import work.slhaf.partner.core.action.entity.McpData; import work.slhaf.partner.core.action.entity.MetaAction; import work.slhaf.partner.core.action.entity.MetaAction.Result; @@ -13,6 +15,9 @@ import java.io.IOException; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; +import static work.slhaf.partner.common.Constant.Path.DATA; +import static work.slhaf.partner.common.util.PathUtil.buildPathStr; + /** * 执行客户端抽象类 *
@@ -33,15 +38,19 @@ import java.util.concurrent.ExecutorService; @Slf4j public abstract class RunnerClient { + protected final String ACTION_PATH; + protected final ConcurrentHashMap existedMetaActions; protected final ExecutorService executor; /** * ActionCore 将注入虚拟线程池 */ - public RunnerClient(ConcurrentHashMap existedMetaActions, ExecutorService executor) { + public RunnerClient(ConcurrentHashMap existedMetaActions, ExecutorService executor, @Nullable String baseActionPath) { this.existedMetaActions = existedMetaActions; this.executor = executor; + baseActionPath = baseActionPath == null ? DATA : baseActionPath; + this.ACTION_PATH = buildPathStr(baseActionPath, "action"); } /** From abe5dd52511720448067d1a79c9d94ecfa3ccac2 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 26 Dec 2025 21:28:10 +0800 Subject: [PATCH 056/182] chore(idea): update misc.xml --- .idea/misc.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index ff5d8541..3a7b2ead 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,3 @@ - From 442dd55686c109da716bf63c0b0dfe2849531125 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 29 Dec 2025 14:27:00 +0800 Subject: [PATCH 057/182] refactor(LocalRunnerClient): rename LocalWatchServiceRegistry --- .../slhaf/partner/core/action/runner/LocalRunnerClient.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 81c204e6..e29573d6 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -325,7 +325,7 @@ public class LocalRunnerClient extends RunnerClient { } private WatchServiceBuild registerWatchService(Path path) { - return new LocalWatchServiceHelper(path, watchService, executor); + return new LocalWatchServiceRegistry(path, watchService, executor); } private interface WatchServiceBuild { @@ -350,7 +350,7 @@ public class LocalRunnerClient extends RunnerClient { void load(Path path); } - private static class LocalWatchServiceHelper implements WatchServiceBuild { + private static class LocalWatchServiceRegistry implements WatchServiceBuild { private final Map, WatchEventHandler> handlers = new HashMap<>(); private final Path path; @@ -358,7 +358,7 @@ public class LocalRunnerClient extends RunnerClient { private final ExecutorService executor; private WatchInitLoader initLoader; - private LocalWatchServiceHelper(Path path, WatchService watchService, ExecutorService executor) { + private LocalWatchServiceRegistry(Path path, WatchService watchService, ExecutorService executor) { this.path = path; this.watchService = watchService; this.executor = executor; From 1bd23b20c4de05dcd19b07f6616702cd3a3886b1 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 29 Dec 2025 17:35:03 +0800 Subject: [PATCH 058/182] refactor(LocalRunnerClient): introduce DescMcpServer Context: This refactor supports creating descriptional files for common MCP Tools. --- .../core/action/runner/LocalRunnerClient.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index e29573d6..6f29c7fc 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -55,6 +55,10 @@ public class LocalRunnerClient extends RunnerClient { * 动态生成的行动程序都将挂载至该 McpServer */ private McpStatelessAsyncServer dynamicActionMcpServer; + /** + * 负责监听常规 MCP Server 的描述文件(描述文件主要用于添加原本 MCP Tools 不携带的信息,如前置依赖、后置依赖、是否 IO 密集等 + */ + private McpStatelessAsyncServer mcpDescServer; private final WatchService watchService; public LocalRunnerClient(ConcurrentHashMap existedMetaActions, ExecutorService executor, @Nullable String baseActionPath) { @@ -64,10 +68,25 @@ public class LocalRunnerClient extends RunnerClient { } catch (IOException e) { throw new ActionInitFailedException("目录监听器启动失败", e); } + registerDescMcp(); registerDynamicActionMcp(); setupShutdownHook(); } + private void registerDescMcp() { + InProcessMcpTransport.Pair pair = InProcessMcpTransport.pair(); + McpSchema.ServerCapabilities serverCapabilities = McpSchema.ServerCapabilities.builder() + .resources(true, true) + .build(); + mcpDescServer = McpServer.async(pair.serverSide()) + .capabilities(serverCapabilities) + .jsonMapper(McpJsonMapper.getDefault()) + .build(); + + // TODO 完善加载与监听逻辑 + registerMcpClient("mcp-desc", pair.clientSide(), 10); + } + private void registerDynamicActionMcp() { InProcessMcpTransport.Pair pair = InProcessMcpTransport.pair(); McpSchema.ServerCapabilities serverCapabilities = McpSchema.ServerCapabilities.builder() @@ -317,6 +336,7 @@ public class LocalRunnerClient extends RunnerClient { private void setupShutdownHook() { Runtime.getRuntime().addShutdownHook(new Thread(() -> { dynamicActionMcpServer.close(); + mcpDescServer.close(); this.mcpClients.forEach((id, client) -> { client.close(); log.info("[{}] MCP-Client 已关闭", id); From bf99e01b51fe763083cb310ade633b4d3f096dc8 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 29 Dec 2025 17:45:39 +0800 Subject: [PATCH 059/182] feat(LocalRunnerClient): introduce LocalWatchServiceHelper and internal implementations Context: This change introduces an internal scaffold to organize WatchEventHandler building logic. --- .../core/action/runner/LocalRunnerClient.java | 139 ++++++++++++++++++ 1 file changed, 139 insertions(+) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 6f29c7fc..93682706 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -458,6 +458,145 @@ public class LocalRunnerClient extends RunnerClient { } + private sealed static abstract class LocalWatchServiceHelper permits LocalWatchServiceHelper.Dynamic, LocalWatchServiceHelper.Desc, LocalWatchServiceHelper.Common { + + protected final ConcurrentHashMap existedMetaActions; + + private LocalWatchServiceHelper(ConcurrentHashMap existedMetaActions) { + this.existedMetaActions = existedMetaActions; + } + + protected abstract @NotNull WatchInitLoader buildLoad(); + + protected abstract @NotNull WatchEventHandler buildModify(); + + protected abstract @NotNull WatchEventHandler buildCreate(); + + protected abstract @NotNull WatchEventHandler buildDelete(); + + protected abstract @NotNull WatchEventHandler buildOverflow(); + + private static final class Dynamic extends LocalWatchServiceHelper { + + private final McpStatelessAsyncServer dynamicActionMcpServer; + + private Dynamic(ConcurrentHashMap existedMetaActions, McpStatelessAsyncServer dynamicActionMcpServer) { + super(existedMetaActions); + this.dynamicActionMcpServer = dynamicActionMcpServer; + } + + @Override + @NotNull + protected WatchInitLoader buildLoad() { + return null; + } + + @Override + @NotNull + protected WatchEventHandler buildModify() { + return null; + } + + @Override + @NotNull + protected WatchEventHandler buildCreate() { + return null; + } + + @Override + @NotNull + protected WatchEventHandler buildDelete() { + return null; + } + + @Override + @NotNull + protected WatchEventHandler buildOverflow() { + return null; + } + } + + private static final class Desc extends LocalWatchServiceHelper { + + private final McpStatelessAsyncServer mcpDescServer; + + private Desc(ConcurrentHashMap existedMetaActions, McpStatelessAsyncServer mcpDescServer) { + super(existedMetaActions); + this.mcpDescServer = mcpDescServer; + } + + @Override + @NotNull + protected WatchInitLoader buildLoad() { + return null; + } + + @Override + @NotNull + protected WatchEventHandler buildModify() { + return null; + } + + @Override + @NotNull + protected WatchEventHandler buildCreate() { + return null; + } + + @Override + @NotNull + protected WatchEventHandler buildDelete() { + return null; + } + + @Override + @NotNull + protected WatchEventHandler buildOverflow() { + return null; + } + } + + private static final class Common extends LocalWatchServiceHelper { + + private final Map mcpClients; + + private Common(ConcurrentHashMap existedMetaActions, Map mcpClients) { + super(existedMetaActions); + this.mcpClients = mcpClients; + } + + @Override + @NotNull + protected WatchInitLoader buildLoad() { + return null; + } + + @Override + @NotNull + protected WatchEventHandler buildModify() { + return null; + } + + @Override + @NotNull + protected WatchEventHandler buildCreate() { + return null; + } + + @Override + @NotNull + protected WatchEventHandler buildDelete() { + return null; + } + + @Override + @NotNull + protected WatchEventHandler buildOverflow() { + return null; + } + } + } + private sealed abstract static class McpClientTransportParams permits HttpMcpClientTransportParams, StdioMcpClientTransportParams { private final int timeout; From e3294ec3022a53277c3e1b4e6e6db186751066a2 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 29 Dec 2025 18:26:30 +0800 Subject: [PATCH 060/182] refactor(LocalRunnerClient): move system execution methods into SystemExecHelper --- .../core/action/runner/LocalRunnerClient.java | 154 +++++++++--------- 1 file changed, 79 insertions(+), 75 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 93682706..b7457a69 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -125,33 +125,13 @@ public class LocalRunnerClient extends RunnerClient { response.setData("未知文件类型"); return response; } - String[] commands = buildCommands(ext, metaAction.getParams(), file.getAbsolutePath()); - SystemExecResult execResult = exec(commands); + String[] commands = SystemExecHelper.buildCommands(ext, metaAction.getParams(), file.getAbsolutePath()); + SystemExecResult execResult = SystemExecHelper.exec(commands); response.setOk(execResult.isOk()); response.setData(execResult.getTotal()); return response; } - //TODO 后续需在加载时、或者通过配置文件获取可用命令并注册匹配 - private String[] buildCommands(String ext, Map params, String absolutePath) { - String command = switch (ext) { - case "py" -> "python"; - case "sh" -> "bash"; - default -> null; - }; - if (command == null) { - return null; - } - String[] commands = new String[params.size() + 2]; - commands[0] = command; - commands[1] = absolutePath; - AtomicInteger paramCount = new AtomicInteger(2); - params.forEach((param, value) -> { - commands[paramCount.getAndIncrement()] = "--" + param + "=" + value.toString(); - }); - return commands; - } - private RunnerResponse doRunWithMcp(MetaAction metaAction) { RunnerResponse response = new RunnerResponse(); McpSyncClient mcpClient = mcpClients.get(metaAction.getLocation()); @@ -193,7 +173,7 @@ public class LocalRunnerClient extends RunnerClient { JSONObject sysDependencies = new JSONObject(); sysDependencies.put("language", "Python"); JSONArray dependencies = sysDependencies.putArray("dependencies"); - SystemExecResult pyResult = exec("pip", "list", "--format=freeze"); + SystemExecResult pyResult = SystemExecHelper.exec("pip", "list", "--format=freeze"); System.out.println(pyResult); if (pyResult.isOk()) { List resultList = pyResult.getResultList(); @@ -210,58 +190,6 @@ public class LocalRunnerClient extends RunnerClient { return sysDependencies; } - private SystemExecResult exec(String... command) { - SystemExecResult result = new SystemExecResult(); - List output = new ArrayList<>(); - List error = new ArrayList<>(); - - try { - Process process = new ProcessBuilder(command) - .redirectErrorStream(false) // 分开读 - .start(); - - Thread stdoutThread = new Thread(() -> { - try (BufferedReader r = new BufferedReader( - new InputStreamReader(process.getInputStream()))) { - String line; - while ((line = r.readLine()) != null) { - output.add(line); - } - } catch (Exception ignored) { - } - }); - - Thread stderrThread = new Thread(() -> { - try (BufferedReader r = new BufferedReader( - new InputStreamReader(process.getErrorStream()))) { - String line; - while ((line = r.readLine()) != null) { - error.add(line); - } - } catch (Exception ignored) { - } - }); - - stdoutThread.start(); - stderrThread.start(); - - int exitCode = process.waitFor(); - stdoutThread.join(); - stderrThread.join(); - - result.setOk(exitCode == 0); - result.setResultList(output.isEmpty() ? error : output); - result.setTotal(String.join("\n", - output.isEmpty() ? error : output)); - - } catch (Exception e) { - result.setOk(false); - result.setTotal(e.getMessage()); - } - - return result; - } - /** * 该部分主要发生在扫描到新的MCP Server描述文件时出现的注册逻辑 * @@ -631,6 +559,82 @@ public class LocalRunnerClient extends RunnerClient { } } + private static class SystemExecHelper { + + //TODO 后续需在加载时、或者通过配置文件获取可用命令并注册匹配 + private static String[] buildCommands(String ext, Map params, String absolutePath) { + String command = switch (ext) { + case "py" -> "python"; + case "sh" -> "bash"; + default -> null; + }; + if (command == null) { + return null; + } + int paramSize = params == null ? 0 : params.size(); + String[] commands = new String[paramSize + 2]; + commands[0] = command; + commands[1] = absolutePath; + AtomicInteger paramCount = new AtomicInteger(2); + if (params != null) { + params.forEach((param, value) -> commands[paramCount.getAndIncrement()] = "--" + param + "=" + value); + } + return commands; + } + + private static SystemExecResult exec(String... command) { + SystemExecResult result = new SystemExecResult(); + List output = new ArrayList<>(); + List error = new ArrayList<>(); + + try { + Process process = new ProcessBuilder(command) + .redirectErrorStream(false) // 分开读 + .start(); + + Thread stdoutThread = new Thread(() -> { + try (BufferedReader r = new BufferedReader( + new InputStreamReader(process.getInputStream()))) { + String line; + while ((line = r.readLine()) != null) { + output.add(line); + } + } catch (Exception ignored) { + } + }); + + Thread stderrThread = new Thread(() -> { + try (BufferedReader r = new BufferedReader( + new InputStreamReader(process.getErrorStream()))) { + String line; + while ((line = r.readLine()) != null) { + error.add(line); + } + } catch (Exception ignored) { + } + }); + + stdoutThread.start(); + stderrThread.start(); + + int exitCode = process.waitFor(); + stdoutThread.join(); + stderrThread.join(); + + result.setOk(exitCode == 0); + result.setResultList(output.isEmpty() ? error : output); + result.setTotal(String.join("\n", + output.isEmpty() ? error : output)); + + } catch (Exception e) { + result.setOk(false); + result.setTotal(e.getMessage()); + } + + return result; + } + } + @Data private static class SystemExecResult { private boolean ok; From db3435fccf89bfd5f53b5791935369012329328b Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 29 Dec 2025 18:40:20 +0800 Subject: [PATCH 061/182] refactor(LocalRunnerClient): co-locate watch service builder internals Context: Group WatchService build interfaces and registry implementation into a single internal structure for better cohesion. --- .../core/action/runner/LocalRunnerClient.java | 228 +++++++++--------- 1 file changed, 115 insertions(+), 113 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index b7457a69..5a62c685 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -272,118 +272,118 @@ public class LocalRunnerClient extends RunnerClient { })); } - private WatchServiceBuild registerWatchService(Path path) { - return new LocalWatchServiceRegistry(path, watchService, executor); + private LocalWatchServiceBuild registerWatchService(Path path) { + return new LocalWatchServiceBuild.BuildRegistry(path, watchService, executor); } - private interface WatchServiceBuild { - WatchServiceBuild registerCreate(WatchEventHandler handler); + private interface LocalWatchServiceBuild { + LocalWatchServiceBuild registerCreate(EventHandler handler); - WatchServiceBuild registerModify(WatchEventHandler handler); + LocalWatchServiceBuild registerModify(EventHandler handler); - WatchServiceBuild registerDelete(WatchEventHandler handler); + LocalWatchServiceBuild registerDelete(EventHandler handler); - WatchServiceBuild registerOverflow(WatchEventHandler handler); + LocalWatchServiceBuild registerOverflow(EventHandler handler); - WatchServiceBuild initialLoad(WatchInitLoader loader); + LocalWatchServiceBuild initialLoad(InitLoader loader); void commit(); - } - private interface WatchEventHandler { - void handle(Path thisDir, Path context); - } - - private interface WatchInitLoader { - void load(Path path); - } - - private static class LocalWatchServiceRegistry implements WatchServiceBuild { - - private final Map, WatchEventHandler> handlers = new HashMap<>(); - private final Path path; - private final WatchService watchService; - private final ExecutorService executor; - private WatchInitLoader initLoader; - - private LocalWatchServiceRegistry(Path path, WatchService watchService, ExecutorService executor) { - this.path = path; - this.watchService = watchService; - this.executor = executor; + interface EventHandler { + void handle(Path thisDir, Path context); } - @Override - public WatchServiceBuild registerCreate(WatchEventHandler handler) { - handlers.put(StandardWatchEventKinds.ENTRY_CREATE, handler); - return this; + interface InitLoader { + void load(Path path); } - @Override - public WatchServiceBuild registerModify(WatchEventHandler handler) { - handlers.put(StandardWatchEventKinds.ENTRY_MODIFY, handler); - return this; - } + class BuildRegistry implements LocalWatchServiceBuild { - @Override - public WatchServiceBuild registerDelete(WatchEventHandler handler) { - handlers.put(StandardWatchEventKinds.ENTRY_DELETE, handler); - return this; - } + private final Map, EventHandler> handlers = new HashMap<>(); + private final Path path; + private final WatchService watchService; + private final ExecutorService executor; + private InitLoader initLoader; - @Override - public WatchServiceBuild registerOverflow(WatchEventHandler handler) { - handlers.put(StandardWatchEventKinds.OVERFLOW, handler); - return this; - } + private BuildRegistry(Path path, WatchService watchService, ExecutorService executor) { + this.path = path; + this.watchService = watchService; + this.executor = executor; + } - @Override - public WatchServiceBuild initialLoad(WatchInitLoader loader) { - initLoader = loader; - return this; - } + @Override + public LocalWatchServiceBuild registerCreate(EventHandler handler) { + handlers.put(StandardWatchEventKinds.ENTRY_CREATE, handler); + return this; + } - @Override - public void commit() { - if (initLoader != null) initLoader.load(path); - executor.execute(buildWatchTask()); - } + @Override + public LocalWatchServiceBuild registerModify(EventHandler handler) { + handlers.put(StandardWatchEventKinds.ENTRY_MODIFY, handler); + return this; + } - private Runnable buildWatchTask() { - return () -> { - String pathStr = path.toString(); - log.info("行动程序目录监听器已启动,监听目录: {}", pathStr); - while (true) { - WatchKey key; - try { - key = watchService.take(); - List> events = key.pollEvents(); - for (WatchEvent e : events) { - WatchEvent.Kind kind = e.kind(); - Object context = e.context(); - log.info("行动程序目录变更事件: {} - {} - {}", pathStr, kind.name(), context); - Path thisDir = (Path) key.watchable(); - if (!thisDir.equals(path)) { - // 若事件所在目录不为为 path,忽略并步入下一轮循环 - continue; + @Override + public LocalWatchServiceBuild registerDelete(EventHandler handler) { + handlers.put(StandardWatchEventKinds.ENTRY_DELETE, handler); + return this; + } + + @Override + public LocalWatchServiceBuild registerOverflow(EventHandler handler) { + handlers.put(StandardWatchEventKinds.OVERFLOW, handler); + return this; + } + + @Override + public LocalWatchServiceBuild initialLoad(InitLoader loader) { + initLoader = loader; + return this; + } + + @Override + public void commit() { + if (initLoader != null) initLoader.load(path); + executor.execute(buildWatchTask()); + } + + private Runnable buildWatchTask() { + return () -> { + String pathStr = path.toString(); + log.info("行动程序目录监听器已启动,监听目录: {}", pathStr); + while (true) { + WatchKey key; + try { + key = watchService.take(); + List> events = key.pollEvents(); + for (WatchEvent e : events) { + WatchEvent.Kind kind = e.kind(); + Object context = e.context(); + log.info("行动程序目录变更事件: {} - {} - {}", pathStr, kind.name(), context); + Path thisDir = (Path) key.watchable(); + if (!thisDir.equals(path)) { + // 若事件所在目录不为为 path,忽略并步入下一轮循环 + continue; + } + EventHandler handler = handlers.get(kind); + if (handler == null) { + continue; + } + handler.handle(thisDir, context instanceof Path ? (Path) context : null); } - WatchEventHandler handler = handlers.get(kind); - if (handler == null) { - continue; - } - handler.handle(thisDir, context instanceof Path ? (Path) context : null); + } catch (InterruptedException e) { + log.info("监听线程被中断,准备退出..."); + Thread.currentThread().interrupt(); // 恢复中断标志 + break; + } catch (ClosedWatchServiceException e) { + log.info("WatchService 已关闭,监听线程退出。"); + break; } - } catch (InterruptedException e) { - log.info("监听线程被中断,准备退出..."); - Thread.currentThread().interrupt(); // 恢复中断标志 - break; - } catch (ClosedWatchServiceException e) { - log.info("WatchService 已关闭,监听线程退出。"); - break; } - } - }; - } + }; + } + } } private sealed static abstract class LocalWatchServiceHelper permits LocalWatchServiceHelper.Dynamic, LocalWatchServiceHelper.Desc, LocalWatchServiceHelper.Common { @@ -394,15 +394,15 @@ public class LocalRunnerClient extends RunnerClient { this.existedMetaActions = existedMetaActions; } - protected abstract @NotNull WatchInitLoader buildLoad(); + protected abstract @NotNull LocalWatchServiceBuild.InitLoader buildLoad(); - protected abstract @NotNull WatchEventHandler buildModify(); + protected abstract @NotNull LocalWatchServiceBuild.EventHandler buildModify(); - protected abstract @NotNull WatchEventHandler buildCreate(); + protected abstract @NotNull LocalWatchServiceBuild.EventHandler buildCreate(); - protected abstract @NotNull WatchEventHandler buildDelete(); + protected abstract @NotNull LocalWatchServiceBuild.EventHandler buildDelete(); - protected abstract @NotNull WatchEventHandler buildOverflow(); + protected abstract @NotNull LocalWatchServiceBuild.EventHandler buildOverflow(); private static final class Dynamic extends LocalWatchServiceHelper { @@ -417,29 +417,31 @@ public class LocalRunnerClient extends RunnerClient { @NotNull protected WatchInitLoader buildLoad() { return null; + protected LocalWatchServiceBuild.InitLoader buildLoad() { } @Override @NotNull protected WatchEventHandler buildModify() { return null; + protected LocalWatchServiceBuild.EventHandler buildModify() { } @Override @NotNull - protected WatchEventHandler buildCreate() { + protected LocalWatchServiceBuild.EventHandler buildCreate() { + return buildModify(); + } + + @Override + @NotNull + protected LocalWatchServiceBuild.EventHandler buildDelete() { return null; } @Override @NotNull - protected WatchEventHandler buildDelete() { - return null; - } - - @Override - @NotNull - protected WatchEventHandler buildOverflow() { + protected LocalWatchServiceBuild.EventHandler buildOverflow() { return null; } } @@ -455,31 +457,31 @@ public class LocalRunnerClient extends RunnerClient { @Override @NotNull - protected WatchInitLoader buildLoad() { + protected LocalWatchServiceBuild.InitLoader buildLoad() { return null; } @Override @NotNull - protected WatchEventHandler buildModify() { + protected LocalWatchServiceBuild.EventHandler buildModify() { return null; } @Override @NotNull - protected WatchEventHandler buildCreate() { + protected LocalWatchServiceBuild.EventHandler buildCreate() { return null; } @Override @NotNull - protected WatchEventHandler buildDelete() { + protected LocalWatchServiceBuild.EventHandler buildDelete() { return null; } @Override @NotNull - protected WatchEventHandler buildOverflow() { + protected LocalWatchServiceBuild.EventHandler buildOverflow() { return null; } } @@ -495,31 +497,31 @@ public class LocalRunnerClient extends RunnerClient { @Override @NotNull - protected WatchInitLoader buildLoad() { + protected LocalWatchServiceBuild.InitLoader buildLoad() { return null; } @Override @NotNull - protected WatchEventHandler buildModify() { + protected LocalWatchServiceBuild.EventHandler buildModify() { return null; } @Override @NotNull - protected WatchEventHandler buildCreate() { + protected LocalWatchServiceBuild.EventHandler buildCreate() { return null; } @Override @NotNull - protected WatchEventHandler buildDelete() { + protected LocalWatchServiceBuild.EventHandler buildDelete() { return null; } @Override @NotNull - protected WatchEventHandler buildOverflow() { + protected LocalWatchServiceBuild.EventHandler buildOverflow() { return null; } } From 0e741802d1d6b947e64b9a59e2d956e73579e2a0 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 29 Dec 2025 18:48:53 +0800 Subject: [PATCH 062/182] refactor(LocalRunnerClient): consolidate MCP client transport params Context: Group HTTP and STDIO transport parameter variants under a sealed internal transport parameter hierarchy. --- .../core/action/runner/LocalRunnerClient.java | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 5a62c685..58dfa606 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -242,14 +242,14 @@ public class LocalRunnerClient extends RunnerClient { private McpClientTransport createTransport(McpClientTransportParams mcpClientTransportParams) { return switch (mcpClientTransportParams) { - case StdioMcpClientTransportParams params -> { + case McpClientTransportParams.Stdio params -> { ServerParameters serverParameters = ServerParameters.builder(params.command) .env(params.env) .args(params.args) .build(); yield new StdioClientTransport(serverParameters, McpJsonMapper.getDefault()); } - case HttpMcpClientTransportParams params -> { + case McpClientTransportParams.Http params -> { McpSyncHttpClientRequestCustomizer customizer = (builder, method, endpoint, body, context) -> { params.headers.forEach(builder::setHeader); }; @@ -527,37 +527,37 @@ public class LocalRunnerClient extends RunnerClient { } } - private sealed abstract static class McpClientTransportParams permits HttpMcpClientTransportParams, StdioMcpClientTransportParams { + private sealed abstract static class McpClientTransportParams permits McpClientTransportParams.Http, McpClientTransportParams.Stdio { private final int timeout; private McpClientTransportParams(int timeout) { this.timeout = timeout; } - } - private final static class HttpMcpClientTransportParams extends McpClientTransportParams { - private final String baseUri; - private final String endpoint; - private final Map headers; + private final static class Http extends McpClientTransportParams { + private final String baseUri; + private final String endpoint; + private final Map headers; - private HttpMcpClientTransportParams(int timeout, String baseUri, String endpoint, Map header) { - super(timeout); - this.baseUri = baseUri; - this.endpoint = endpoint; - this.headers = header; + private Http(int timeout, String baseUri, String endpoint, Map header) { + super(timeout); + this.baseUri = baseUri; + this.endpoint = endpoint; + this.headers = header; + } } - } - private final static class StdioMcpClientTransportParams extends McpClientTransportParams { - private final String command; - private final Map env; - private final List args; + private final static class Stdio extends McpClientTransportParams { + private final String command; + private final Map env; + private final List args; - private StdioMcpClientTransportParams(int timeout, String command, Map env, List args) { - super(timeout); - this.command = command; - this.env = env; - this.args = args; + private Stdio(int timeout, String command, Map env, List args) { + super(timeout); + this.command = command; + this.env = env; + this.args = args; + } } } From 6e90bc8d670602538b1da22d8b51587af041da4d Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 29 Dec 2025 18:53:41 +0800 Subject: [PATCH 063/182] refactor(LocalRunnerClient): co-locate system execution result --- .../core/action/runner/LocalRunnerClient.java | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 58dfa606..cde39ab3 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -126,7 +126,7 @@ public class LocalRunnerClient extends RunnerClient { return response; } String[] commands = SystemExecHelper.buildCommands(ext, metaAction.getParams(), file.getAbsolutePath()); - SystemExecResult execResult = SystemExecHelper.exec(commands); + SystemExecHelper.Result execResult = SystemExecHelper.exec(commands); response.setOk(execResult.isOk()); response.setData(execResult.getTotal()); return response; @@ -173,7 +173,7 @@ public class LocalRunnerClient extends RunnerClient { JSONObject sysDependencies = new JSONObject(); sysDependencies.put("language", "Python"); JSONArray dependencies = sysDependencies.putArray("dependencies"); - SystemExecResult pyResult = SystemExecHelper.exec("pip", "list", "--format=freeze"); + SystemExecHelper.Result pyResult = SystemExecHelper.exec("pip", "list", "--format=freeze"); System.out.println(pyResult); if (pyResult.isOk()) { List resultList = pyResult.getResultList(); @@ -584,8 +584,8 @@ public class LocalRunnerClient extends RunnerClient { return commands; } - private static SystemExecResult exec(String... command) { - SystemExecResult result = new SystemExecResult(); + private static Result exec(String... command) { + Result result = new Result(); List output = new ArrayList<>(); List error = new ArrayList<>(); @@ -635,12 +635,13 @@ public class LocalRunnerClient extends RunnerClient { return result; } + + @Data + private static class Result { + private boolean ok; + private String total; + private List resultList; + } } - @Data - private static class SystemExecResult { - private boolean ok; - private String total; - private List resultList; - } } From 89535a6b1c32a8a1122096c5b9d5461089ba0ca9 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 29 Dec 2025 20:46:26 +0800 Subject: [PATCH 064/182] feat(LocalRunnerClient): add initial support for loading local action tools from filesystem Context: This feature supports DynamicActionMcpServer. During initialization, directories containing a program file and a .meta.json description are scanned and registered as MCP tools. Tool execution is handled asynchronously via boundedElastic to avoid blocking server threads. --- .../core/action/runner/LocalRunnerClient.java | 93 ++++++++++++++++++- 1 file changed, 91 insertions(+), 2 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index cde39ab3..79d86ace 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -1,6 +1,7 @@ package work.slhaf.partner.core.action.runner; import cn.hutool.core.io.FileUtil; +import cn.hutool.json.JSONUtil; import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; import io.modelcontextprotocol.client.McpClient; @@ -9,9 +10,11 @@ import io.modelcontextprotocol.client.transport.HttpClientSseClientTransport; import io.modelcontextprotocol.client.transport.ServerParameters; import io.modelcontextprotocol.client.transport.StdioClientTransport; import io.modelcontextprotocol.client.transport.customizer.McpSyncHttpClientRequestCustomizer; +import io.modelcontextprotocol.common.McpTransportContext; import io.modelcontextprotocol.json.McpJsonMapper; import io.modelcontextprotocol.server.McpServer; import io.modelcontextprotocol.server.McpStatelessAsyncServer; +import io.modelcontextprotocol.server.McpStatelessServerFeatures; import io.modelcontextprotocol.spec.McpClientTransport; import io.modelcontextprotocol.spec.McpSchema; import lombok.Data; @@ -19,6 +22,8 @@ import lombok.extern.slf4j.Slf4j; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.UnknownNullability; +import reactor.core.publisher.Mono; +import reactor.core.scheduler.Schedulers; import work.slhaf.partner.common.mcp.InProcessMcpTransport; import work.slhaf.partner.core.action.entity.McpData; import work.slhaf.partner.core.action.entity.MetaAction; @@ -30,6 +35,7 @@ import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; import java.nio.file.*; import java.time.Duration; import java.util.ArrayList; @@ -39,6 +45,7 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.BiFunction; import static work.slhaf.partner.common.util.PathUtil.buildPathStr; @@ -413,11 +420,93 @@ public class LocalRunnerClient extends RunnerClient { this.dynamicActionMcpServer = dynamicActionMcpServer; } + private BiFunction> buildToolHandler(File finalProgram) { + return (mcpTransportContext, callToolRequest) -> { + Map arguments = callToolRequest.arguments(); + if (arguments == null) { + arguments = Map.of(); + } + String ext = FileUtil.getSuffix(finalProgram); + String[] commands = SystemExecHelper.buildCommands(ext, arguments, finalProgram.getAbsolutePath()); + if (commands == null) { + return Mono.just(McpSchema.CallToolResult.builder() + .addTextContent("未知文件类型: " + finalProgram.getName()) + .isError(true) + .build()); + } + + return Mono.fromCallable(() -> { + SystemExecHelper.Result execResult = SystemExecHelper.exec(commands); + McpSchema.CallToolResult.Builder builder = McpSchema.CallToolResult.builder() + .isError(!execResult.isOk()); + List resultList = execResult.getResultList(); + if (resultList != null && !resultList.isEmpty()) { + builder.textContent(resultList); + builder.structuredContent(resultList); + } else { + builder.addTextContent(execResult.getTotal()); + builder.structuredContent(execResult.getTotal()); + } + return builder.build(); + }).subscribeOn(Schedulers.boundedElastic()); + }; + } + @Override @NotNull - protected WatchInitLoader buildLoad() { - return null; protected LocalWatchServiceBuild.InitLoader buildLoad() { + return path -> { + // 从该路径列出已存在的目录,每个目录对应不同的行动程序及描述文件,从描述文件加载程序信息 + File file = path.toFile(); + if (file.isFile()) { + throw new ActionInitFailedException("未找到目录: " + path); + } + File[] files = file.listFiles(); + if (files == null) { + throw new ActionInitFailedException("未正常读取目录: " + path); + } + for (File dir : files) { + if (!dir.isDirectory()) + continue; + + File[] fs = dir.listFiles(); + if (fs == null || fs.length != 2) + continue; + + File meta = null; + File program = null; + for (File f : fs) { + if (f.getName().endsWith(".meta.json")) + meta = f; + else + program = f; + } + if (meta == null || program == null) + continue; + + MetaActionInfo info = JSONUtil.readJSONObject(meta, StandardCharsets.UTF_8).toBean(MetaActionInfo.class); + existedMetaActions.put("local::" + program.getName(), info); + + Map additional = Map.of("pre", info.getPreActions(), + "post", info.getPostActions(), + "strict_pre", info.isStrictDependencies(), + "io", info.isIo()); + McpSchema.Tool tool = McpSchema.Tool.builder() + .name(program.getName()) + .description(info.getDescription()) + .inputSchema(McpJsonMapper.getDefault(), JSONObject.toJSONString(info.getParams())) + .outputSchema(info.getResponseSchema()) + .title("local::" + program.getName()) + .meta(additional) + .build(); + File finalProgram = program; + McpStatelessServerFeatures.AsyncToolSpecification specification = McpStatelessServerFeatures.AsyncToolSpecification.builder() + .tool(tool) + .callHandler(buildToolHandler(finalProgram)) + .build(); + dynamicActionMcpServer.addTool(specification).subscribe(); + } + }; } @Override From 1c562f0e7b8aac52128185de2e33b5126087fb87 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Tue, 30 Dec 2025 16:43:39 +0800 Subject: [PATCH 065/182] refactor(LocalRunnerClient): update action keys building source in DynamicActionMcp Context: Building action keys by subdirector's name keeps unique identity for each local action. --- .../slhaf/partner/core/action/runner/LocalRunnerClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 79d86ace..b553bf3e 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -485,7 +485,7 @@ public class LocalRunnerClient extends RunnerClient { continue; MetaActionInfo info = JSONUtil.readJSONObject(meta, StandardCharsets.UTF_8).toBean(MetaActionInfo.class); - existedMetaActions.put("local::" + program.getName(), info); + existedMetaActions.put("local::" + dir.getName(), info); Map additional = Map.of("pre", info.getPreActions(), "post", info.getPostActions(), From a222015abb0471a01b024b0e150139cb86f9e06e Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Tue, 30 Dec 2025 20:52:32 +0800 Subject: [PATCH 066/182] feat(LocalRunnerClient): support program modify and unify action load protocol Context: The method buildModify reuses AsyncToolSpecification building logic in buildLoad. This feature unifies local action directory protocol, and refactors related logic in buildLoad. New action directory protocol defines the file names of program and description files. --- .../core/action/runner/LocalRunnerClient.java | 137 +++++++++++++----- 1 file changed, 102 insertions(+), 35 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index b553bf3e..7ff65a54 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -1,6 +1,7 @@ package work.slhaf.partner.core.action.runner; import cn.hutool.core.io.FileUtil; +import cn.hutool.core.io.IORuntimeException; import cn.hutool.json.JSONUtil; import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; @@ -420,6 +421,33 @@ public class LocalRunnerClient extends RunnerClient { this.dynamicActionMcpServer = dynamicActionMcpServer; } + @SuppressWarnings("BooleanMethodIsAlwaysInverted") + private boolean normalPath(Path path) { + File file = path.toFile(); + if (file.isFile()) { + return false; + } + File[] files = file.listFiles(); + if (files == null) { + return false; + } + if (files.length < 2) { + return false; + } + boolean desc = false; + int run = 0; + for (File f : files) { + String fileName = f.getName(); + if (fileName.equals("desc.json")) { + desc = true; + } + if (fileName.startsWith("run.")) { + run++; + } + } + return run == 1 && desc; + } + private BiFunction> buildToolHandler(File finalProgram) { return (mcpTransportContext, callToolRequest) -> { Map arguments = callToolRequest.arguments(); @@ -466,54 +494,93 @@ public class LocalRunnerClient extends RunnerClient { throw new ActionInitFailedException("未正常读取目录: " + path); } for (File dir : files) { - if (!dir.isDirectory()) + if (!normalPath(dir.toPath())) { continue; - - File[] fs = dir.listFiles(); - if (fs == null || fs.length != 2) - continue; - - File meta = null; - File program = null; - for (File f : fs) { - if (f.getName().endsWith(".meta.json")) - meta = f; - else - program = f; } - if (meta == null || program == null) - continue; + File meta = new File(dir, "desc.json"); + File program = null; + //noinspection DataFlowIssue + for (File f : dir.listFiles()) { + if (f.getName().startsWith("run.")) { + program = f; + } + } MetaActionInfo info = JSONUtil.readJSONObject(meta, StandardCharsets.UTF_8).toBean(MetaActionInfo.class); - existedMetaActions.put("local::" + dir.getName(), info); + String actionKey = "local::" + dir.getName(); + existedMetaActions.put(actionKey, info); - Map additional = Map.of("pre", info.getPreActions(), - "post", info.getPostActions(), - "strict_pre", info.isStrictDependencies(), - "io", info.isIo()); - McpSchema.Tool tool = McpSchema.Tool.builder() - .name(program.getName()) - .description(info.getDescription()) - .inputSchema(McpJsonMapper.getDefault(), JSONObject.toJSONString(info.getParams())) - .outputSchema(info.getResponseSchema()) - .title("local::" + program.getName()) - .meta(additional) - .build(); - File finalProgram = program; - McpStatelessServerFeatures.AsyncToolSpecification specification = McpStatelessServerFeatures.AsyncToolSpecification.builder() - .tool(tool) - .callHandler(buildToolHandler(finalProgram)) - .build(); + McpStatelessServerFeatures.AsyncToolSpecification specification = buildAsyncToolSpecification(info, program, actionKey, dir.getName()); dynamicActionMcpServer.addTool(specification).subscribe(); } }; } + private McpStatelessServerFeatures.AsyncToolSpecification buildAsyncToolSpecification(MetaActionInfo info, File program, String actionKey, String name) { + Map additional = Map.of("pre", info.getPreActions(), + "post", info.getPostActions(), + "strict_pre", info.isStrictDependencies(), + "io", info.isIo()); + McpSchema.Tool tool = McpSchema.Tool.builder() + .name(name) + .description(info.getDescription()) + .inputSchema(McpJsonMapper.getDefault(), JSONObject.toJSONString(info.getParams())) + .outputSchema(info.getResponseSchema()) + .title(actionKey) + .meta(additional) + .build(); + return McpStatelessServerFeatures.AsyncToolSpecification.builder() + .tool(tool) + .callHandler(buildToolHandler(program)) + .build(); + } + @Override @NotNull - protected WatchEventHandler buildModify() { - return null; protected LocalWatchServiceBuild.EventHandler buildModify() { + return (thisDir, context) -> { + // 查看当前目录是否为空或者能否正常读取 + if (!normalPath(thisDir)) { + return; + } + // 对应本地程序或者描述文件的修改行为 + String fileName = context.getFileName().toString(); + if (fileName.equals("desc.json")) { + handleMetaModify(thisDir, context); + } + if (fileName.startsWith("run.")) { + handleProgramModify(thisDir, context); + } + }; + } + + private void handleProgramModify(Path thisDir, Path context) { + String name = thisDir.getFileName().toString(); + String actionKey = "local::" + name; + // 检查是否存在当前 program 对应的 Tool + if (existedMetaActions.containsKey(actionKey)) { + return; + } + // 检查描述文件是否可读取,如果可以正常读取,则新增 Tool + File meta = Path.of(thisDir.toString(), "desc.json").toFile(); + try { + MetaActionInfo info = JSONUtil.readJSONObject(meta, StandardCharsets.UTF_8).toBean(MetaActionInfo.class); + dynamicActionMcpServer.addTool(buildAsyncToolSpecification(info, context.toFile(), actionKey, name)).subscribe(); + existedMetaActions.put(actionKey, info); + } catch (IORuntimeException e) { + log.warn("读取 desc.json 失败,请检查字段", e); + } + } + + private void handleMetaModify(Path thisDir, Path context) { + // 检查是否除了描述文件外还存在别的可执行文件 + File meta = Path.of(thisDir.toString(), context.toString()).toFile(); + try { + MetaActionInfo info = JSONUtil.readJSONObject(meta, StandardCharsets.UTF_8).toBean(MetaActionInfo.class); + existedMetaActions.put("local::" + thisDir.getFileName().toString(), info); + } catch (Exception e) { + log.warn("读取 desc 失败,可能处于写入中: {}", meta.getAbsolutePath(), e); + } } @Override From 94ef79c67db5db6db67e59938d7da773858955fe Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Wed, 31 Dec 2025 13:41:35 +0800 Subject: [PATCH 067/182] feat(LocalRunnerClient): support program deletion for DynamicActionMcp --- .../partner/core/action/runner/LocalRunnerClient.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 7ff65a54..267a856f 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -592,7 +592,16 @@ public class LocalRunnerClient extends RunnerClient { @Override @NotNull protected LocalWatchServiceBuild.EventHandler buildDelete() { - return null; + return (thisDir, context) -> { + // 如果删除行为涉及 program 或者 desc.json,则移除对应的 action + // 可直接使用 normalPath 校验 + if (normalPath(thisDir)) { + return; + } + // 未通过校验则删除对应的 action + String name = thisDir.getFileName().toString(); + existedMetaActions.remove("local::" + name); + }; } @Override From a6e33edc7aa1663ca675a95084e7306b7c3f449a Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Wed, 31 Dec 2025 16:27:34 +0800 Subject: [PATCH 068/182] refactor(LocalRunnerClient): support remove action temporarily while action is not usable --- .../core/action/runner/LocalRunnerClient.java | 35 +++++++++++++------ 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 267a856f..0f65160e 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -448,6 +448,17 @@ public class LocalRunnerClient extends RunnerClient { return run == 1 && desc; } + private void addAction(String name, MetaActionInfo info, File program) { + String actionKey = "local::" + name; + existedMetaActions.put(actionKey, info); + dynamicActionMcpServer.addTool(buildAsyncToolSpecification(info, program, actionKey, name)).subscribe(); + } + + private void removeAction(String name) { + existedMetaActions.remove("local::" + name); + dynamicActionMcpServer.removeTool(name).subscribe(); + } + private BiFunction> buildToolHandler(File finalProgram) { return (mcpTransportContext, callToolRequest) -> { Map arguments = callToolRequest.arguments(); @@ -507,11 +518,7 @@ public class LocalRunnerClient extends RunnerClient { } MetaActionInfo info = JSONUtil.readJSONObject(meta, StandardCharsets.UTF_8).toBean(MetaActionInfo.class); - String actionKey = "local::" + dir.getName(); - existedMetaActions.put(actionKey, info); - - McpStatelessServerFeatures.AsyncToolSpecification specification = buildAsyncToolSpecification(info, program, actionKey, dir.getName()); - dynamicActionMcpServer.addTool(specification).subscribe(); + addAction(dir.getName(), info, program); } }; } @@ -565,9 +572,9 @@ public class LocalRunnerClient extends RunnerClient { File meta = Path.of(thisDir.toString(), "desc.json").toFile(); try { MetaActionInfo info = JSONUtil.readJSONObject(meta, StandardCharsets.UTF_8).toBean(MetaActionInfo.class); - dynamicActionMcpServer.addTool(buildAsyncToolSpecification(info, context.toFile(), actionKey, name)).subscribe(); - existedMetaActions.put(actionKey, info); + addAction(name, info, context.toFile()); } catch (IORuntimeException e) { + removeAction(name); log.warn("读取 desc.json 失败,请检查字段", e); } } @@ -575,10 +582,18 @@ public class LocalRunnerClient extends RunnerClient { private void handleMetaModify(Path thisDir, Path context) { // 检查是否除了描述文件外还存在别的可执行文件 File meta = Path.of(thisDir.toString(), context.toString()).toFile(); + String name = thisDir.getFileName().toString(); try { MetaActionInfo info = JSONUtil.readJSONObject(meta, StandardCharsets.UTF_8).toBean(MetaActionInfo.class); - existedMetaActions.put("local::" + thisDir.getFileName().toString(), info); + File program = null; + //noinspection DataFlowIssue + for (File f : thisDir.toFile().listFiles()) { + program = f; + } + addAction(name, info, program); } catch (Exception e) { + // 如果程序已经存在,此时针对 desc.json 的调整可能来自程序的调整,所以此时的失败读取最好将 tool 及对应的 action 移除 + removeAction(name); log.warn("读取 desc 失败,可能处于写入中: {}", meta.getAbsolutePath(), e); } } @@ -598,9 +613,9 @@ public class LocalRunnerClient extends RunnerClient { if (normalPath(thisDir)) { return; } - // 未通过校验则删除对应的 action + // 未通过校验则删除对应的 action,并在 DynamicActonMcpServer 中删除对应的工具 String name = thisDir.getFileName().toString(); - existedMetaActions.remove("local::" + name); + removeAction(name); }; } From 64b907707a4aa295382295c57e19db6893a69ef1 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Wed, 31 Dec 2025 23:11:15 +0800 Subject: [PATCH 069/182] refactor(LocalRunnerClient): introduce WatchContext and decouple build/processor state --- .../core/action/runner/LocalRunnerClient.java | 107 +++++++++--------- 1 file changed, 56 insertions(+), 51 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 0f65160e..20caec3b 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -47,6 +47,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.BiFunction; +import java.util.stream.Stream; import static work.slhaf.partner.common.util.PathUtil.buildPathStr; @@ -280,10 +281,6 @@ public class LocalRunnerClient extends RunnerClient { })); } - private LocalWatchServiceBuild registerWatchService(Path path) { - return new LocalWatchServiceBuild.BuildRegistry(path, watchService, executor); - } - private interface LocalWatchServiceBuild { LocalWatchServiceBuild registerCreate(EventHandler handler); @@ -295,28 +292,25 @@ public class LocalRunnerClient extends RunnerClient { LocalWatchServiceBuild initialLoad(InitLoader loader); - void commit(); + LocalWatchServiceBuild watchAll(boolean watchAll); + + void commit(ExecutorService executor); interface EventHandler { void handle(Path thisDir, Path context); } interface InitLoader { - void load(Path path); + void load(); } class BuildRegistry implements LocalWatchServiceBuild { private final Map, EventHandler> handlers = new HashMap<>(); - private final Path path; - private final WatchService watchService; - private final ExecutorService executor; private InitLoader initLoader; - private BuildRegistry(Path path, WatchService watchService, ExecutorService executor) { - this.path = path; - this.watchService = watchService; - this.executor = executor; + private BuildRegistry(WatchContext ctx) { + this.ctx = ctx; } @Override @@ -357,12 +351,12 @@ public class LocalRunnerClient extends RunnerClient { private Runnable buildWatchTask() { return () -> { - String pathStr = path.toString(); + String pathStr = ctx.path.toString(); log.info("行动程序目录监听器已启动,监听目录: {}", pathStr); while (true) { WatchKey key; try { - key = watchService.take(); + key = ctx.watchService.take(); List> events = key.pollEvents(); for (WatchEvent e : events) { WatchEvent.Kind kind = e.kind(); @@ -394,12 +388,20 @@ public class LocalRunnerClient extends RunnerClient { } } - private sealed static abstract class LocalWatchServiceHelper permits LocalWatchServiceHelper.Dynamic, LocalWatchServiceHelper.Desc, LocalWatchServiceHelper.Common { + private record WatchContext(Path path, WatchService watchService, Map watchKeys) { + private WatchContext(Path path, WatchService watchService) { + this(path, watchService, new HashMap<>()); + } + } + + private sealed static abstract class LocalWatchEventProcessor permits LocalWatchEventProcessor.Dynamic, LocalWatchEventProcessor.Desc, LocalWatchEventProcessor.Common { protected final ConcurrentHashMap existedMetaActions; + protected final WatchContext ctx; - private LocalWatchServiceHelper(ConcurrentHashMap existedMetaActions) { + private LocalWatchEventProcessor(ConcurrentHashMap existedMetaActions, WatchContext ctx) { this.existedMetaActions = existedMetaActions; + this.ctx = ctx; } protected abstract @NotNull LocalWatchServiceBuild.InitLoader buildLoad(); @@ -412,12 +414,12 @@ public class LocalRunnerClient extends RunnerClient { protected abstract @NotNull LocalWatchServiceBuild.EventHandler buildOverflow(); - private static final class Dynamic extends LocalWatchServiceHelper { + private static final class Dynamic extends LocalWatchEventProcessor { private final McpStatelessAsyncServer dynamicActionMcpServer; - private Dynamic(ConcurrentHashMap existedMetaActions, McpStatelessAsyncServer dynamicActionMcpServer) { - super(existedMetaActions); + private Dynamic(ConcurrentHashMap existedMetaActions, McpStatelessAsyncServer dynamicActionMcpServer, WatchContext ctx) { + super(existedMetaActions, ctx); this.dynamicActionMcpServer = dynamicActionMcpServer; } @@ -494,33 +496,36 @@ public class LocalRunnerClient extends RunnerClient { @Override @NotNull protected LocalWatchServiceBuild.InitLoader buildLoad() { - return path -> { - // 从该路径列出已存在的目录,每个目录对应不同的行动程序及描述文件,从描述文件加载程序信息 - File file = path.toFile(); - if (file.isFile()) { - throw new ActionInitFailedException("未找到目录: " + path); - } - File[] files = file.listFiles(); - if (files == null) { - throw new ActionInitFailedException("未正常读取目录: " + path); - } - for (File dir : files) { - if (!normalPath(dir.toPath())) { - continue; - } - File meta = new File(dir, "desc.json"); - File program = null; - //noinspection DataFlowIssue - for (File f : dir.listFiles()) { - if (f.getName().startsWith("run.")) { - program = f; - } - } + // 从该路径列出已存在的目录,每个目录对应不同的行动程序及描述文件,从描述文件加载程序信息 + return this::load; + } - MetaActionInfo info = JSONUtil.readJSONObject(meta, StandardCharsets.UTF_8).toBean(MetaActionInfo.class); - addAction(dir.getName(), info, program); + private void load() { + Path path = ctx.path; + File file = path.toFile(); + if (file.isFile()) { + throw new ActionInitFailedException("未找到目录: " + path); + } + File[] files = file.listFiles(); + if (files == null) { + throw new ActionInitFailedException("未正常读取目录: " + path); + } + for (File dir : files) { + if (!normalPath(dir.toPath())) { + continue; } - }; + File meta = new File(dir, "desc.json"); + File program = null; + //noinspection DataFlowIssue + for (File f : dir.listFiles()) { + if (f.getName().startsWith("run.")) { + program = f; + } + } + + MetaActionInfo info = JSONUtil.readJSONObject(meta, StandardCharsets.UTF_8).toBean(MetaActionInfo.class); + addAction(dir.getName(), info, program); + } } private McpStatelessServerFeatures.AsyncToolSpecification buildAsyncToolSpecification(MetaActionInfo info, File program, String actionKey, String name) { @@ -626,12 +631,12 @@ public class LocalRunnerClient extends RunnerClient { } } - private static final class Desc extends LocalWatchServiceHelper { + private static final class Desc extends LocalWatchEventProcessor { private final McpStatelessAsyncServer mcpDescServer; - private Desc(ConcurrentHashMap existedMetaActions, McpStatelessAsyncServer mcpDescServer) { - super(existedMetaActions); + private Desc(ConcurrentHashMap existedMetaActions, McpStatelessAsyncServer mcpDescServer, WatchContext ctx) { + super(existedMetaActions, ctx); this.mcpDescServer = mcpDescServer; } @@ -666,12 +671,12 @@ public class LocalRunnerClient extends RunnerClient { } } - private static final class Common extends LocalWatchServiceHelper { + private static final class Common extends LocalWatchEventProcessor { private final Map mcpClients; - private Common(ConcurrentHashMap existedMetaActions, Map mcpClients) { - super(existedMetaActions); + private Common(ConcurrentHashMap existedMetaActions, Map mcpClients, WatchContext ctx) { + super(existedMetaActions, ctx); this.mcpClients = mcpClients; } From f35a467ebcad788563f9e10f778d986bdaa3f13b Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Wed, 31 Dec 2025 23:15:27 +0800 Subject: [PATCH 070/182] fix(LocalRunnerClient): support registering subdirectories in LocalWatchServiceBuild --- .../core/action/runner/LocalRunnerClient.java | 45 ++++++++++++++++--- 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 20caec3b..620f84b8 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -308,6 +308,9 @@ public class LocalRunnerClient extends RunnerClient { private final Map, EventHandler> handlers = new HashMap<>(); private InitLoader initLoader; + private final WatchContext ctx; + List> kinds = new ArrayList<>(); + private boolean watchAll = false; private BuildRegistry(WatchContext ctx) { this.ctx = ctx; @@ -315,24 +318,28 @@ public class LocalRunnerClient extends RunnerClient { @Override public LocalWatchServiceBuild registerCreate(EventHandler handler) { + kinds.add(StandardWatchEventKinds.ENTRY_CREATE); handlers.put(StandardWatchEventKinds.ENTRY_CREATE, handler); return this; } @Override public LocalWatchServiceBuild registerModify(EventHandler handler) { + kinds.add(StandardWatchEventKinds.ENTRY_MODIFY); handlers.put(StandardWatchEventKinds.ENTRY_MODIFY, handler); return this; } @Override public LocalWatchServiceBuild registerDelete(EventHandler handler) { + kinds.add(StandardWatchEventKinds.ENTRY_DELETE); handlers.put(StandardWatchEventKinds.ENTRY_DELETE, handler); return this; } @Override public LocalWatchServiceBuild registerOverflow(EventHandler handler) { + kinds.add(StandardWatchEventKinds.OVERFLOW); handlers.put(StandardWatchEventKinds.OVERFLOW, handler); return this; } @@ -344,11 +351,41 @@ public class LocalRunnerClient extends RunnerClient { } @Override - public void commit() { - if (initLoader != null) initLoader.load(path); + public LocalWatchServiceBuild watchAll(boolean watchAll) { + this.watchAll = watchAll; + return this; + } + + @Override + public void commit(ExecutorService executor) { + registerPath(); + if (initLoader != null) + initLoader.load(); executor.execute(buildWatchTask()); } + private void registerPath() { + Path path = ctx.path; + WatchService watchService = ctx.watchService; + Map watchKeys = ctx.watchKeys; + try { + WatchEvent.Kind[] kindsArray = kinds.toArray(WatchEvent.Kind[]::new); + WatchKey root = path.register(watchService, kindsArray); + watchKeys.put(root, path); + if (!watchAll) { + return; + } + Stream walk = Files.walk(path).filter(Files::isDirectory); + for (Path dir : walk.toList()) { + WatchKey key = dir.register(watchService, kindsArray); + watchKeys.put(key, dir); + } + walk.close(); + } catch (IOException e) { + log.error("监听目录注册失败: "); + } + } + private Runnable buildWatchTask() { return () -> { String pathStr = ctx.path.toString(); @@ -363,10 +400,6 @@ public class LocalRunnerClient extends RunnerClient { Object context = e.context(); log.info("行动程序目录变更事件: {} - {} - {}", pathStr, kind.name(), context); Path thisDir = (Path) key.watchable(); - if (!thisDir.equals(path)) { - // 若事件所在目录不为为 path,忽略并步入下一轮循环 - continue; - } EventHandler handler = handlers.get(kind); if (handler == null) { continue; From 74f2c6c950088b24058ff2d441939052a28d8d51 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Thu, 1 Jan 2026 00:32:34 +0800 Subject: [PATCH 071/182] fix(LocalRunnerClient): support creating and registering new action in method buildCreate in DynamicActionMcp --- .../core/action/runner/LocalRunnerClient.java | 87 ++++++++++++------- 1 file changed, 56 insertions(+), 31 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 620f84b8..fb815a97 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -309,7 +309,6 @@ public class LocalRunnerClient extends RunnerClient { private final Map, EventHandler> handlers = new HashMap<>(); private InitLoader initLoader; private final WatchContext ctx; - List> kinds = new ArrayList<>(); private boolean watchAll = false; private BuildRegistry(WatchContext ctx) { @@ -318,28 +317,28 @@ public class LocalRunnerClient extends RunnerClient { @Override public LocalWatchServiceBuild registerCreate(EventHandler handler) { - kinds.add(StandardWatchEventKinds.ENTRY_CREATE); + ctx.kinds.add(StandardWatchEventKinds.ENTRY_CREATE); handlers.put(StandardWatchEventKinds.ENTRY_CREATE, handler); return this; } @Override public LocalWatchServiceBuild registerModify(EventHandler handler) { - kinds.add(StandardWatchEventKinds.ENTRY_MODIFY); + ctx.kinds.add(StandardWatchEventKinds.ENTRY_MODIFY); handlers.put(StandardWatchEventKinds.ENTRY_MODIFY, handler); return this; } @Override public LocalWatchServiceBuild registerDelete(EventHandler handler) { - kinds.add(StandardWatchEventKinds.ENTRY_DELETE); + ctx.kinds.add(StandardWatchEventKinds.ENTRY_DELETE); handlers.put(StandardWatchEventKinds.ENTRY_DELETE, handler); return this; } @Override public LocalWatchServiceBuild registerOverflow(EventHandler handler) { - kinds.add(StandardWatchEventKinds.OVERFLOW); + ctx.kinds.add(StandardWatchEventKinds.OVERFLOW); handlers.put(StandardWatchEventKinds.OVERFLOW, handler); return this; } @@ -365,31 +364,31 @@ public class LocalRunnerClient extends RunnerClient { } private void registerPath() { - Path path = ctx.path; + Path root = ctx.root; WatchService watchService = ctx.watchService; Map watchKeys = ctx.watchKeys; try { - WatchEvent.Kind[] kindsArray = kinds.toArray(WatchEvent.Kind[]::new); - WatchKey root = path.register(watchService, kindsArray); - watchKeys.put(root, path); + WatchEvent.Kind[] kindsArray = ctx.kinds.toArray(WatchEvent.Kind[]::new); + WatchKey rootKey = root.register(watchService, kindsArray); + watchKeys.put(rootKey, root); if (!watchAll) { return; } - Stream walk = Files.walk(path).filter(Files::isDirectory); + Stream walk = Files.walk(root).filter(Files::isDirectory); for (Path dir : walk.toList()) { WatchKey key = dir.register(watchService, kindsArray); watchKeys.put(key, dir); } walk.close(); } catch (IOException e) { - log.error("监听目录注册失败: "); + log.error("监听目录注册失败: ", e); } } private Runnable buildWatchTask() { return () -> { - String pathStr = ctx.path.toString(); - log.info("行动程序目录监听器已启动,监听目录: {}", pathStr); + String rootStr = ctx.root.toString(); + log.info("行动程序目录监听器已启动,监听目录: {}", rootStr); while (true) { WatchKey key; try { @@ -398,13 +397,13 @@ public class LocalRunnerClient extends RunnerClient { for (WatchEvent e : events) { WatchEvent.Kind kind = e.kind(); Object context = e.context(); - log.info("行动程序目录变更事件: {} - {} - {}", pathStr, kind.name(), context); + log.info("行动程序目录变更事件: {} - {} - {}", rootStr, kind.name(), context); Path thisDir = (Path) key.watchable(); EventHandler handler = handlers.get(kind); if (handler == null) { continue; } - handler.handle(thisDir, context instanceof Path ? (Path) context : null); + handler.handle(thisDir, context instanceof Path ? thisDir.resolve((Path) context) : null); } } catch (InterruptedException e) { log.info("监听线程被中断,准备退出..."); @@ -421,9 +420,10 @@ public class LocalRunnerClient extends RunnerClient { } } - private record WatchContext(Path path, WatchService watchService, Map watchKeys) { - private WatchContext(Path path, WatchService watchService) { - this(path, watchService, new HashMap<>()); + private record WatchContext(Path root, WatchService watchService, Map watchKeys, + List> kinds) { + private WatchContext(Path root, WatchService watchService) { + this(root, watchService, new HashMap<>(), new ArrayList<>()); } } @@ -534,14 +534,14 @@ public class LocalRunnerClient extends RunnerClient { } private void load() { - Path path = ctx.path; - File file = path.toFile(); + Path root = ctx.root; + File file = root.toFile(); if (file.isFile()) { - throw new ActionInitFailedException("未找到目录: " + path); + throw new ActionInitFailedException("未找到目录: " + root); } File[] files = file.listFiles(); if (files == null) { - throw new ActionInitFailedException("未正常读取目录: " + path); + throw new ActionInitFailedException("未正常读取目录: " + root); } for (File dir : files) { if (!normalPath(dir.toPath())) { @@ -589,16 +589,20 @@ public class LocalRunnerClient extends RunnerClient { return; } // 对应本地程序或者描述文件的修改行为 - String fileName = context.getFileName().toString(); - if (fileName.equals("desc.json")) { - handleMetaModify(thisDir, context); - } - if (fileName.startsWith("run.")) { - handleProgramModify(thisDir, context); - } + modify(thisDir, context); }; } + private void modify(Path thisDir, Path context) { + String fileName = context.getFileName().toString(); + if (fileName.equals("desc.json")) { + handleMetaModify(thisDir, context); + } + if (fileName.startsWith("run.")) { + handleProgramModify(thisDir, context); + } + } + private void handleProgramModify(Path thisDir, Path context) { String name = thisDir.getFileName().toString(); String actionKey = "local::" + name; @@ -619,7 +623,7 @@ public class LocalRunnerClient extends RunnerClient { private void handleMetaModify(Path thisDir, Path context) { // 检查是否除了描述文件外还存在别的可执行文件 - File meta = Path.of(thisDir.toString(), context.toString()).toFile(); + File meta = context.toFile(); String name = thisDir.getFileName().toString(); try { MetaActionInfo info = JSONUtil.readJSONObject(meta, StandardCharsets.UTF_8).toBean(MetaActionInfo.class); @@ -639,7 +643,28 @@ public class LocalRunnerClient extends RunnerClient { @Override @NotNull protected LocalWatchServiceBuild.EventHandler buildCreate() { - return buildModify(); + return (thisDir, context) -> { + if (thisDir.equals(ctx.root) && Files.isDirectory(context)) { + try { + context.register(ctx.watchService, ctx.kinds.toArray(WatchEvent.Kind[]::new)); + } catch (IOException e) { + log.error("监听目录注册失败: {}", context); + } + } + if (normalPath(thisDir)) { + modify(thisDir, context); + } + if (Files.isDirectory(context) && normalPath(context)) { + File[] files = context.toFile().listFiles(); + if (files == null) { + log.warn("目录无法访问: {}", context); + return; + } + for (File f : files) { + modify(context, f.toPath()); + } + } + }; } @Override From 0ecaec05454588a73a0897ff05ca8105e6bf5896 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Thu, 1 Jan 2026 20:28:19 +0800 Subject: [PATCH 072/182] fix(LocalRunnerClient): repair loading logic of action subdirectories --- .../slhaf/partner/core/action/runner/LocalRunnerClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index fb815a97..66577e21 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -374,7 +374,7 @@ public class LocalRunnerClient extends RunnerClient { if (!watchAll) { return; } - Stream walk = Files.walk(root).filter(Files::isDirectory); + Stream walk = Files.list(root).filter(Files::isDirectory); for (Path dir : walk.toList()) { WatchKey key = dir.register(watchService, kindsArray); watchKeys.put(key, dir); From 03a59351072f271aca4feebfa3af507ac8c5e1e2 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Thu, 1 Jan 2026 21:29:30 +0800 Subject: [PATCH 073/182] fix(LocalRunnerClient): support deleting event for action directories in DynamicActionMcp --- .../core/action/runner/LocalRunnerClient.java | 38 ++++++++++++++++--- 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 66577e21..71ae3b10 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -671,14 +671,40 @@ public class LocalRunnerClient extends RunnerClient { @NotNull protected LocalWatchServiceBuild.EventHandler buildDelete() { return (thisDir, context) -> { - // 如果删除行为涉及 program 或者 desc.json,则移除对应的 action - // 可直接使用 normalPath 校验 - if (normalPath(thisDir)) { + // 如果发生在 root,且context为目录,则需要移除对应的 action + if (thisDir.equals(ctx.root)) { + String name = context.getFileName().toString(); + Path candidate = ctx.root.resolve(name); + + // 如果 root 下仍然存在一个同名目录 + if (Files.isDirectory(candidate)) { + // 说明删的是同名文件,不是 action 目录 + return; + } + + removeAction(name); + + AtomicReference toRemove = new AtomicReference<>(); + ctx.watchKeys.forEach((key, path) -> { + if (path.getFileName().toString().equals(name)) { + key.cancel(); + toRemove.set(key); + } + }); + if (toRemove.get() != null) { + ctx.watchKeys.remove(toRemove.get()); + } return; } - // 未通过校验则删除对应的 action,并在 DynamicActonMcpServer 中删除对应的工具 - String name = thisDir.getFileName().toString(); - removeAction(name); + + // 如果发生在非 root 目录内且 context 不符合 action 目录特征 + // 由于只会监听 root 目录与 action 目录 + // 所以此时则证明当前目录对应的行动已不可靠,需要移除 + if (!thisDir.equals(ctx.root) && !normalPath(thisDir)) { + // 未通过校验则删除对应的 action,并在 DynamicActonMcpServer 中删除对应的工具 + String name = thisDir.getFileName().toString(); + removeAction(name); + } }; } From 62cec79005fbb21c4e28ecc51765c2e5abfdd86c Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Thu, 1 Jan 2026 22:39:32 +0800 Subject: [PATCH 074/182] refactor(LocalRunnerClient): extract duplicated action adding logic --- .../core/action/runner/LocalRunnerClient.java | 62 ++++++++----------- 1 file changed, 27 insertions(+), 35 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 71ae3b10..2929dc01 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -1,7 +1,6 @@ package work.slhaf.partner.core.action.runner; import cn.hutool.core.io.FileUtil; -import cn.hutool.core.io.IORuntimeException; import cn.hutool.json.JSONUtil; import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; @@ -46,6 +45,7 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicReference; import java.util.function.BiFunction; import java.util.stream.Stream; @@ -483,10 +483,28 @@ public class LocalRunnerClient extends RunnerClient { return run == 1 && desc; } - private void addAction(String name, MetaActionInfo info, File program) { + private boolean addAction(String name, Path dir) { + File program = null; + try (Stream stream = Files.list(dir)) { + for (Path p : stream.toList()) { + if (p.getFileName().toString().startsWith("run.")) + program = p.toFile(); + } + } catch (Exception e) { + log.error("添加 action 失败", e); + return false; + } + MetaActionInfo info; + try { + info = JSONUtil.readJSONObject(dir.resolve("desc.json").toFile(), StandardCharsets.UTF_8).toBean(MetaActionInfo.class); + } catch (Exception e) { + log.error("desc.json 加载失败: {}", dir); + return false; + } String actionKey = "local::" + name; existedMetaActions.put(actionKey, info); dynamicActionMcpServer.addTool(buildAsyncToolSpecification(info, program, actionKey, name)).subscribe(); + return true; } private void removeAction(String name) { @@ -547,17 +565,8 @@ public class LocalRunnerClient extends RunnerClient { if (!normalPath(dir.toPath())) { continue; } - File meta = new File(dir, "desc.json"); - File program = null; - //noinspection DataFlowIssue - for (File f : dir.listFiles()) { - if (f.getName().startsWith("run.")) { - program = f; - } - } - MetaActionInfo info = JSONUtil.readJSONObject(meta, StandardCharsets.UTF_8).toBean(MetaActionInfo.class); - addAction(dir.getName(), info, program); + addAction(dir.getName(), dir.toPath()); } } @@ -596,47 +605,30 @@ public class LocalRunnerClient extends RunnerClient { private void modify(Path thisDir, Path context) { String fileName = context.getFileName().toString(); if (fileName.equals("desc.json")) { - handleMetaModify(thisDir, context); + handleMetaModify(thisDir); } if (fileName.startsWith("run.")) { - handleProgramModify(thisDir, context); + handleProgramModify(thisDir); } } - private void handleProgramModify(Path thisDir, Path context) { + private void handleProgramModify(Path thisDir) { String name = thisDir.getFileName().toString(); String actionKey = "local::" + name; // 检查是否存在当前 program 对应的 Tool if (existedMetaActions.containsKey(actionKey)) { return; } - // 检查描述文件是否可读取,如果可以正常读取,则新增 Tool - File meta = Path.of(thisDir.toString(), "desc.json").toFile(); - try { - MetaActionInfo info = JSONUtil.readJSONObject(meta, StandardCharsets.UTF_8).toBean(MetaActionInfo.class); - addAction(name, info, context.toFile()); - } catch (IORuntimeException e) { + if (!addAction(name, thisDir)) { removeAction(name); - log.warn("读取 desc.json 失败,请检查字段", e); } } - private void handleMetaModify(Path thisDir, Path context) { + private void handleMetaModify(Path thisDir) { // 检查是否除了描述文件外还存在别的可执行文件 - File meta = context.toFile(); String name = thisDir.getFileName().toString(); - try { - MetaActionInfo info = JSONUtil.readJSONObject(meta, StandardCharsets.UTF_8).toBean(MetaActionInfo.class); - File program = null; - //noinspection DataFlowIssue - for (File f : thisDir.toFile().listFiles()) { - program = f; - } - addAction(name, info, program); - } catch (Exception e) { - // 如果程序已经存在,此时针对 desc.json 的调整可能来自程序的调整,所以此时的失败读取最好将 tool 及对应的 action 移除 + if (!addAction(name, thisDir)) { removeAction(name); - log.warn("读取 desc 失败,可能处于写入中: {}", meta.getAbsolutePath(), e); } } From b58eeffd2f8e9872fc13d31b99fe7e15af1a60d8 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Thu, 1 Jan 2026 23:32:21 +0800 Subject: [PATCH 075/182] feat(LocalRunnerClient): support overflow event in DynamicActionMcpServer --- .../core/action/runner/LocalRunnerClient.java | 92 ++++++++++++++----- 1 file changed, 68 insertions(+), 24 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 2929dc01..51ed8313 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -38,15 +38,13 @@ import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.nio.file.*; import java.time.Duration; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; import java.util.function.BiFunction; +import java.util.stream.Collectors; import java.util.stream.Stream; import static work.slhaf.partner.common.util.PathUtil.buildPathStr; @@ -548,26 +546,23 @@ public class LocalRunnerClient extends RunnerClient { @NotNull protected LocalWatchServiceBuild.InitLoader buildLoad() { // 从该路径列出已存在的目录,每个目录对应不同的行动程序及描述文件,从描述文件加载程序信息 - return this::load; - } - - private void load() { - Path root = ctx.root; - File file = root.toFile(); - if (file.isFile()) { - throw new ActionInitFailedException("未找到目录: " + root); - } - File[] files = file.listFiles(); - if (files == null) { - throw new ActionInitFailedException("未正常读取目录: " + root); - } - for (File dir : files) { - if (!normalPath(dir.toPath())) { - continue; + return () -> { + Path root = ctx.root; + File file = root.toFile(); + if (file.isFile()) { + throw new ActionInitFailedException("未找到目录: " + root); } - - addAction(dir.getName(), dir.toPath()); - } + File[] files = file.listFiles(); + if (files == null) { + throw new ActionInitFailedException("未正常读取目录: " + root); + } + for (File dir : files) { + if (!normalPath(dir.toPath())) { + continue; + } + addAction(dir.getName(), dir.toPath()); + } + }; } private McpStatelessServerFeatures.AsyncToolSpecification buildAsyncToolSpecification(MetaActionInfo info, File program, String actionKey, String name) { @@ -703,7 +698,56 @@ public class LocalRunnerClient extends RunnerClient { @Override @NotNull protected LocalWatchServiceBuild.EventHandler buildOverflow() { - return null; + return (thisDir, context) -> { + // 直接从 existedMetaActions 中拿取现有的 key,上游也从这里发现可用工具 + Set existed = existedMetaActions.keySet().stream().map(actionKey -> actionKey.split("::")[1]).collect(Collectors.toSet()); + Set currentDirs = new HashSet<>(); + // 按照预期 root 目录下有效 path 只包括各个 action 目录 + // 排除非目录 path + try (Stream stream = Files.list(ctx.root).filter(Files::isDirectory)) { + stream.forEach(path -> { + String name = path.getFileName().toString(); + currentDirs.add(name); + + boolean contains = existed.contains(name); + boolean normal = normalPath(path); + + // 如果该目录对应 action 已被记录,且符合 action 目录要求,则无处理 + // 如果已被记录,但不符合,则移除行动 + // 此时必定被监听 + if (contains && !normal) { + removeAction(name); + } + + // 如果 action 没有记录,但符合要求,由于此时必定尚未被监听,则注册监听且添加新 action + // 如果未被记录,且不符合要求,则只注册监听 + if (!contains) { + boolean alreadyWatching = ctx.watchKeys.values().stream() + .anyMatch(p -> p.equals(path)); + if (!alreadyWatching) { + try { + WatchKey watchKey = path.register(ctx.watchService, ctx.kinds.toArray(WatchEvent.Kind[]::new)); + ctx.watchKeys.put(watchKey, path); + } catch (IOException e) { + log.error("监听目录注册失败: {}", path); + } + } + + if (normal) { + addAction(name, path); + } + } + }); + } catch (IOException e) { + log.error("目录无法读取: {}", ctx.root); + return; + } + for (String existedName : existed) { + if (!currentDirs.contains(existedName)) { + removeAction(existedName); + } + } + }; } } From 3097efe453bb485f9093c8f8df010c195962abd7 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 2 Jan 2026 13:29:00 +0800 Subject: [PATCH 076/182] feat(LocalRunnerClient): support register DynamicActionMcp watch service --- .../core/action/runner/LocalRunnerClient.java | 33 +++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 51ed8313..741cf648 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -94,19 +94,45 @@ public class LocalRunnerClient extends RunnerClient { registerMcpClient("mcp-desc", pair.clientSide(), 10); } + /** + * 目录按照以下格式进行组织: + *

+ * DYNAMIC_ACTION_PATH/action 名称/ + *

+ * 每个action子目录下,除了相关的程序文件外,将额外提供一个 .meta.json 文件来提供相关描述文件, + * 该描述文件将携带 McpTools、MetaActionInfo 相关的所有信息, + * 故 McpDescServer 将只负责 Common Mcp Servers 的额外描述文件 + */ private void registerDynamicActionMcp() { InProcessMcpTransport.Pair pair = InProcessMcpTransport.pair(); McpSchema.ServerCapabilities serverCapabilities = McpSchema.ServerCapabilities.builder() .tools(true) - .resources(true, true) .build(); dynamicActionMcpServer = McpServer.async(pair.serverSide()) .capabilities(serverCapabilities) .jsonMapper(McpJsonMapper.getDefault()) .build(); + // Tools 的执行逻辑应当高度一致化,但仍需要独立为不同 Tool + // 初始的加载逻辑通过 initialLoad 加载 + // 后续的动态更新通过对应的 event 事件触发 + registerDynamicActionMcpWatch(); registerMcpClient("dynamic-action", pair.clientSide(), 10); } + private void registerDynamicActionMcpWatch() { + // MODIFY、CREATE、DELETE、OVERFLOW 都需要不同的处理方式 + WatchContext ctx = new WatchContext(Path.of(DYNAMIC_ACTION_PATH), watchService); + LocalWatchEventProcessor.Dynamic dynamic = new LocalWatchEventProcessor.Dynamic(existedMetaActions, dynamicActionMcpServer, ctx); + new LocalWatchServiceBuild.BuildRegistry(ctx) + .initialLoad(dynamic.buildLoad()) + .registerCreate(dynamic.buildCreate()) + .registerModify(dynamic.buildModify()) + .registerDelete(dynamic.buildDelete()) + .registerOverflow(dynamic.buildOverflow()) + .watchAll(true) + .commit(executor); + } + @Override protected RunnerResponse doRun(MetaAction metaAction) { RunnerResponse response; @@ -218,6 +244,7 @@ public class LocalRunnerClient extends RunnerClient { // ResourcesChange 事件传递的 Resource 可以由 Client 读取内容 // 预计在 Server 侧,收到客户端发送的新的行动程序信息,该信息由客户端处补充后,将其放置在指定位置 // 并写入描述文件、发起 ResourcesChange 事件 + //TODO 更新触发应当遵循触发逻辑: ToolChange -> client.listResource -> 仅填写 tool 信息 | 根据查找到的 resource 文件修正信息 .toolsChangeConsumer(tools -> updateExistedMetaActions(id, tools)) .build(); mcpClients.put(id, client); @@ -445,6 +472,7 @@ public class LocalRunnerClient extends RunnerClient { protected abstract @NotNull LocalWatchServiceBuild.EventHandler buildOverflow(); + @SuppressWarnings("LoggingSimilarMessage") private static final class Dynamic extends LocalWatchEventProcessor { private final McpStatelessAsyncServer dynamicActionMcpServer; @@ -565,7 +593,8 @@ public class LocalRunnerClient extends RunnerClient { }; } - private McpStatelessServerFeatures.AsyncToolSpecification buildAsyncToolSpecification(MetaActionInfo info, File program, String actionKey, String name) { + private McpStatelessServerFeatures.AsyncToolSpecification buildAsyncToolSpecification(MetaActionInfo + info, File program, String actionKey, String name) { Map additional = Map.of("pre", info.getPreActions(), "post", info.getPostActions(), "strict_pre", info.isStrictDependencies(), From 64f24d3fc3e2a1898db485cf7129d354e3ad95a1 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 2 Jan 2026 13:38:43 +0800 Subject: [PATCH 077/182] chore(LocalRunnerClient): adjust mcp servers' comments location --- .../core/action/runner/LocalRunnerClient.java | 33 ++++++++++++++----- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 741cf648..4f2bfa2c 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -57,13 +57,37 @@ public class LocalRunnerClient extends RunnerClient { private final String MCP_SERVER_PATH = buildPathStr(ACTION_PATH, "mcp"); private final String MCP_DESC_PATH = buildPathStr(MCP_SERVER_PATH, "desc"); + /** + * 存储包括 DescMcp、DynamicActionMcp、CommonMcp 在内的所有 MCP Server 对应的客户端 + *
+ * 自身需要针对 CommonMcp 维护一个存储 McpServers.json 文件的目录 + *
+ * 相关目录按照以下格式组织: + *

+ * MCP_SERVER_PATH/mcp-server.json + *

+ */ private final Map mcpClients = new HashMap<>(); /** * 动态生成的行动程序都将挂载至该 McpServer + *
+ * 相关目录按照以下格式进行组织: + *

+ * DYNAMIC_ACTION_PATH/action 名称/ + *

+ * 每个action子目录下,除了相关的程序文件外,将额外提供一个 .meta.json 文件来提供相关描述文件, + * 该描述文件将携带 McpTools、MetaActionInfo 相关的所有信息, + * 故 McpDescServer 将只负责 Common Mcp Servers 的额外描述文件 + * */ private McpStatelessAsyncServer dynamicActionMcpServer; /** * 负责监听常规 MCP Server 的描述文件(描述文件主要用于添加原本 MCP Tools 不携带的信息,如前置依赖、后置依赖、是否 IO 密集等 + *
+ * 目录按照以下格式组织: + *

+ * MCP_DESC_PATH/server::toolName.desc.json + *

*/ private McpStatelessAsyncServer mcpDescServer; private final WatchService watchService; @@ -94,15 +118,6 @@ public class LocalRunnerClient extends RunnerClient { registerMcpClient("mcp-desc", pair.clientSide(), 10); } - /** - * 目录按照以下格式进行组织: - *

- * DYNAMIC_ACTION_PATH/action 名称/ - *

- * 每个action子目录下,除了相关的程序文件外,将额外提供一个 .meta.json 文件来提供相关描述文件, - * 该描述文件将携带 McpTools、MetaActionInfo 相关的所有信息, - * 故 McpDescServer 将只负责 Common Mcp Servers 的额外描述文件 - */ private void registerDynamicActionMcp() { InProcessMcpTransport.Pair pair = InProcessMcpTransport.pair(); McpSchema.ServerCapabilities serverCapabilities = McpSchema.ServerCapabilities.builder() From 623a86daabab4292a26a65db3bab6b0f56179b90 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 2 Jan 2026 15:52:44 +0800 Subject: [PATCH 078/182] chore(LocalRunnerClient): update mcp servers' comments --- .../slhaf/partner/core/action/runner/LocalRunnerClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 4f2bfa2c..a341e13c 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -78,7 +78,6 @@ public class LocalRunnerClient extends RunnerClient { * 每个action子目录下,除了相关的程序文件外,将额外提供一个 .meta.json 文件来提供相关描述文件, * 该描述文件将携带 McpTools、MetaActionInfo 相关的所有信息, * 故 McpDescServer 将只负责 Common Mcp Servers 的额外描述文件 - * */ private McpStatelessAsyncServer dynamicActionMcpServer; /** @@ -88,6 +87,7 @@ public class LocalRunnerClient extends RunnerClient { *

* MCP_DESC_PATH/server::toolName.desc.json *

+ * 该 MCP Server-Client 的作用为: 与 CommonMcp Clients 配合,补齐第三方 MCP 服务的描述信息 */ private McpStatelessAsyncServer mcpDescServer; private final WatchService watchService; From 5db0b5fad176bb333d6ffca05fc8886b502abada Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 2 Jan 2026 15:55:29 +0800 Subject: [PATCH 079/182] feat(LocalRunnerClient): support load *.desc.json when DescMcpServer launched --- .../core/action/runner/LocalRunnerClient.java | 62 ++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index a341e13c..a279bf3f 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -17,6 +17,7 @@ import io.modelcontextprotocol.server.McpStatelessAsyncServer; import io.modelcontextprotocol.server.McpStatelessServerFeatures; import io.modelcontextprotocol.spec.McpClientTransport; import io.modelcontextprotocol.spec.McpSchema; +import javassist.NotFoundException; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.jetbrains.annotations.NotNull; @@ -44,6 +45,8 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; import java.util.function.BiFunction; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -798,16 +801,73 @@ public class LocalRunnerClient extends RunnerClient { private static final class Desc extends LocalWatchEventProcessor { private final McpStatelessAsyncServer mcpDescServer; + private final HashMap descCache = new HashMap<>(); private Desc(ConcurrentHashMap existedMetaActions, McpStatelessAsyncServer mcpDescServer, WatchContext ctx) { super(existedMetaActions, ctx); this.mcpDescServer = mcpDescServer; } + private McpStatelessServerFeatures.@NotNull AsyncResourceSpecification buildAsyncResourceSpecification(String name, String uri) { + McpSchema.Resource resource = McpSchema.Resource.builder() + .name(name) + .title(name) + .description("Action descriptor for " + name) + .mimeType("application/json") + .uri(uri) + .build(); + BiFunction> readHandler = (context, request) -> { + String requestUri = request.uri(); + String result = descCache.get(requestUri); + if (result == null) { + return Mono.error(new NotFoundException("未找到 Resource: " + requestUri)); + } + return Mono.just(new McpSchema.ReadResourceResult(List.of(new McpSchema.TextResourceContents(requestUri, "application/json", result)))); + }; + return new McpStatelessServerFeatures.AsyncResourceSpecification(resource, readHandler); + } + + @SuppressWarnings("UnusedReturnValue") + private boolean addResource(File file) { + String name = file.getName(); + String pattern = "[a-z][A-Z]+::[a-z][A-Z]+.desk.json"; + Pattern p = Pattern.compile(pattern); + Matcher matcher = p.matcher(name); + if (!matcher.find()) { + log.error("文件名称不符合要求: {}", name); + return false; + } + // 读取并解析为 MetaActionInfo,存入 resources + try { + MetaActionInfo info = JSONUtil.readJSONObject(file, StandardCharsets.UTF_8).toBean(MetaActionInfo.class); + String uri = ctx.root.resolve(name).toUri().toString(); + descCache.put(uri, JSONObject.toJSONString(info)); + mcpDescServer.addResource(buildAsyncResourceSpecification(name, uri)).subscribe(); + } catch (Exception e) { + log.error("desc.json 解析失败: {}", file.getAbsolutePath()); + return false; + } + return true; + } + @Override @NotNull protected LocalWatchServiceBuild.InitLoader buildLoad() { - return null; + return () -> { + // DescMcp 的加载逻辑只负责读取已有的 *.desc.json 并注册为 resources + // 正常来讲 root 直接对应 MCP_DESC_PATH,先检查 root 是否为目录,否则拒绝启动 + Path root = ctx.root; + if (!Files.isDirectory(root)) { + throw new ActionInitFailedException("未找到目录: " + root); + } + File[] files = root.toFile().listFiles(); + if (files == null) { + throw new ActionInitFailedException("目录无法正常读取: " + root); + } + for (File file : files) { + addResource(file); + } + }; } @Override From 5877b9e80d8f4ea2194d0eef857f5f5f7a5074f7 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 2 Jan 2026 16:42:56 +0800 Subject: [PATCH 080/182] feat(LocalRunnerClient): support modify *.desc.json in DescMcpServer --- .../core/action/runner/LocalRunnerClient.java | 53 ++++++++++++++++--- 1 file changed, 47 insertions(+), 6 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index a279bf3f..06897318 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -827,14 +827,30 @@ public class LocalRunnerClient extends RunnerClient { return new McpStatelessServerFeatures.AsyncResourceSpecification(resource, readHandler); } + private boolean normal(String fileName) { + String pattern = "[a-z][A-Z]+::[a-z][A-Z]+.desk.json"; + Pattern p = Pattern.compile(pattern); + Matcher matcher = p.matcher(fileName); + if (!matcher.find()) { + log.error("文件名称不符合要求: {}", fileName); + return false; + } + return true; + } + + private boolean normal(File file) { + String name = file.getName(); + return normal(name); + } + + private boolean normal(Path path) { + return normal(path.toFile()); + } + @SuppressWarnings("UnusedReturnValue") private boolean addResource(File file) { String name = file.getName(); - String pattern = "[a-z][A-Z]+::[a-z][A-Z]+.desk.json"; - Pattern p = Pattern.compile(pattern); - Matcher matcher = p.matcher(name); - if (!matcher.find()) { - log.error("文件名称不符合要求: {}", name); + if (!normal(name)) { return false; } // 读取并解析为 MetaActionInfo,存入 resources @@ -873,7 +889,32 @@ public class LocalRunnerClient extends RunnerClient { @Override @NotNull protected LocalWatchServiceBuild.EventHandler buildModify() { - return null; + return (thisDir, context) -> { + // 排除目录事件、名称不符合要求的文件 + String fileName = context.getFileName().toString(); + if (!Files.isDirectory(context) || !normal(fileName)) { + return; + } + + // 先尝试能否正常读取,再决定是否步入更新逻辑 + MetaActionInfo info; + try { + info = JSONUtil.readJSONObject(context.toFile(), StandardCharsets.UTF_8).toBean(MetaActionInfo.class); + } catch (Exception e) { + log.warn("desc.json 加载失败: {}", context); + return; + } + + // 要处理的 MODIFY 上下文只有一种 + // *.desc.json 发生变更时,检查是否存在于 existedMetaActions 内部 + // 如果存在,则读取并更新对应的 info,同时更新 descCache + // 如果不存在,则只更新 descCache + String actionKey = fileName.replace(".desc.json", ""); + if (existedMetaActions.containsKey(actionKey)) { + existedMetaActions.put(actionKey, info); + } + descCache.put(context.toUri().toString(), JSONObject.toJSONString(info)); + }; } @Override From 19ec93f248b80c464e16cb6c911e6475b6c25acc Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 2 Jan 2026 16:45:01 +0800 Subject: [PATCH 081/182] feat(LocalRunnerClient): create modify *.desc.json in DescMcpServer --- .../slhaf/partner/core/action/runner/LocalRunnerClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 06897318..aac00d5b 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -920,7 +920,7 @@ public class LocalRunnerClient extends RunnerClient { @Override @NotNull protected LocalWatchServiceBuild.EventHandler buildCreate() { - return null; + return buildModify(); } @Override From 07578561873625c381cb3ea845b59df0a97bb178 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 2 Jan 2026 17:20:12 +0800 Subject: [PATCH 082/182] feat(LocalRunnerClient): support deleting *.desc.json in DescMcpServer --- .../core/action/runner/LocalRunnerClient.java | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index aac00d5b..b37e9d79 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -926,7 +926,29 @@ public class LocalRunnerClient extends RunnerClient { @Override @NotNull protected LocalWatchServiceBuild.EventHandler buildDelete() { - return null; + return (thisDir, context) -> { + // 排除被删除文件名称不符合要求的事件 + String fileName = context.getFileName().toString(); + if (!normal(fileName)) { + return; + } + + // DELETE 事件发生后,需要移除对应的 descCache 条目; + // 如果存在对应的 info,也需要将其中的额外信息进行重置,只保留 Tools 自身的信息 + descCache.remove(context.toUri().toString()); + String actionKey = fileName.replace(".desc.json", ""); + if (existedMetaActions.containsKey(actionKey)) { + resetMetaActionInfo(existedMetaActions.get(actionKey)); + } + }; + } + + private void resetMetaActionInfo(MetaActionInfo info) { + info.setIo(false); + info.getTags().clear(); + info.getPreActions().clear(); + info.getPostActions().clear(); + info.setStrictDependencies(false); } @Override From 04c98c785624f7979d33d9fa39807e88587db269 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 2 Jan 2026 18:18:15 +0800 Subject: [PATCH 083/182] fix(LocalRunnerClient): support deleting descCache while *.desc.json is not available in DescMcpServer --- .../slhaf/partner/core/action/runner/LocalRunnerClient.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index b37e9d79..54c2002b 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -901,6 +901,8 @@ public class LocalRunnerClient extends RunnerClient { try { info = JSONUtil.readJSONObject(context.toFile(), StandardCharsets.UTF_8).toBean(MetaActionInfo.class); } catch (Exception e) { + // 加载失败也需要移除对应的 cache + descCache.remove(context.toUri().toString()); log.warn("desc.json 加载失败: {}", context); return; } From 4ea8926363bcd1080905404d0045b24f9998fad9 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 2 Jan 2026 21:29:18 +0800 Subject: [PATCH 084/182] feat(LocalRunnerClient): support repairing description data while OVERFLOW event happened in DescMcpServer --- .../core/action/runner/LocalRunnerClient.java | 113 ++++++++++++------ 1 file changed, 74 insertions(+), 39 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 54c2002b..46a928af 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -36,6 +36,7 @@ import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; +import java.net.URI; import java.nio.charset.StandardCharsets; import java.nio.file.*; import java.time.Duration; @@ -45,8 +46,6 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; import java.util.function.BiFunction; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -801,7 +800,7 @@ public class LocalRunnerClient extends RunnerClient { private static final class Desc extends LocalWatchEventProcessor { private final McpStatelessAsyncServer mcpDescServer; - private final HashMap descCache = new HashMap<>(); + private final ConcurrentHashMap descCache = new ConcurrentHashMap<>(); private Desc(ConcurrentHashMap existedMetaActions, McpStatelessAsyncServer mcpDescServer, WatchContext ctx) { super(existedMetaActions, ctx); @@ -828,14 +827,7 @@ public class LocalRunnerClient extends RunnerClient { } private boolean normal(String fileName) { - String pattern = "[a-z][A-Z]+::[a-z][A-Z]+.desk.json"; - Pattern p = Pattern.compile(pattern); - Matcher matcher = p.matcher(fileName); - if (!matcher.find()) { - log.error("文件名称不符合要求: {}", fileName); - return false; - } - return true; + return fileName.endsWith(".desc.json") && fileName.contains("::"); } private boolean normal(File file) { @@ -847,7 +839,6 @@ public class LocalRunnerClient extends RunnerClient { return normal(path.toFile()); } - @SuppressWarnings("UnusedReturnValue") private boolean addResource(File file) { String name = file.getName(); if (!normal(name)) { @@ -858,7 +849,11 @@ public class LocalRunnerClient extends RunnerClient { MetaActionInfo info = JSONUtil.readJSONObject(file, StandardCharsets.UTF_8).toBean(MetaActionInfo.class); String uri = ctx.root.resolve(name).toUri().toString(); descCache.put(uri, JSONObject.toJSONString(info)); - mcpDescServer.addResource(buildAsyncResourceSpecification(name, uri)).subscribe(); + mcpDescServer.addResource(buildAsyncResourceSpecification(name, uri)).block(); + String actionKey = name.replace(".desc.json", ""); + if (existedMetaActions.containsKey(actionKey)) { + existedMetaActions.put(actionKey, info); + } } catch (Exception e) { log.error("desc.json 解析失败: {}", file.getAbsolutePath()); return false; @@ -866,6 +861,17 @@ public class LocalRunnerClient extends RunnerClient { return true; } + private void removeResource(Path path) { + String uri = path.toUri().toString(); + String actionKey = path.getFileName().toString().replace(".desc.json", ""); + + descCache.remove(uri); + mcpDescServer.removeResource(uri).block(); + if (existedMetaActions.containsKey(actionKey)) { + resetMetaActionInfo(existedMetaActions.get(actionKey)); + } + } + @Override @NotNull protected LocalWatchServiceBuild.InitLoader buildLoad() { @@ -892,30 +898,13 @@ public class LocalRunnerClient extends RunnerClient { return (thisDir, context) -> { // 排除目录事件、名称不符合要求的文件 String fileName = context.getFileName().toString(); - if (!Files.isDirectory(context) || !normal(fileName)) { + if (!Files.isRegularFile(context) || !normal(fileName)) { return; } - // 先尝试能否正常读取,再决定是否步入更新逻辑 - MetaActionInfo info; - try { - info = JSONUtil.readJSONObject(context.toFile(), StandardCharsets.UTF_8).toBean(MetaActionInfo.class); - } catch (Exception e) { - // 加载失败也需要移除对应的 cache - descCache.remove(context.toUri().toString()); - log.warn("desc.json 加载失败: {}", context); - return; + if (!addResource(context.toFile())) { + removeResource(context); } - - // 要处理的 MODIFY 上下文只有一种 - // *.desc.json 发生变更时,检查是否存在于 existedMetaActions 内部 - // 如果存在,则读取并更新对应的 info,同时更新 descCache - // 如果不存在,则只更新 descCache - String actionKey = fileName.replace(".desc.json", ""); - if (existedMetaActions.containsKey(actionKey)) { - existedMetaActions.put(actionKey, info); - } - descCache.put(context.toUri().toString(), JSONObject.toJSONString(info)); }; } @@ -937,11 +926,7 @@ public class LocalRunnerClient extends RunnerClient { // DELETE 事件发生后,需要移除对应的 descCache 条目; // 如果存在对应的 info,也需要将其中的额外信息进行重置,只保留 Tools 自身的信息 - descCache.remove(context.toUri().toString()); - String actionKey = fileName.replace(".desc.json", ""); - if (existedMetaActions.containsKey(actionKey)) { - resetMetaActionInfo(existedMetaActions.get(actionKey)); - } + removeResource(context); }; } @@ -956,7 +941,57 @@ public class LocalRunnerClient extends RunnerClient { @Override @NotNull protected LocalWatchServiceBuild.EventHandler buildOverflow() { - return null; + return (thisDir, context) -> { + // 对于 OVERFLOW 事件,需要依据当前目录下的所有 *.desc.json 针对现有内容进行修复 + List files; + try (Stream stream = Files.list(ctx.root)) { + files = stream.filter(Files::isRegularFile).filter(this::normal).map(Path::toFile).toList(); + } catch (IOException e) { + log.error("目录无法访问: {}", ctx.root); + return; + } + Set currentUriStr = new HashSet<>(); + + for (File file : files) { + MetaActionInfo info = null; + try { + info = JSONUtil.readJSONObject(file, StandardCharsets.UTF_8).toBean(MetaActionInfo.class); + } catch (Exception e) { + log.warn("desc.json 读取失败: {}", file.toPath()); + } + + boolean available = info != null; + + // 如果读取成功,则更新 descCache + // 若在 existedMetaActions 中存在,则更新对应 info + String uriStr = file.toURI().toString(); + currentUriStr.add(uriStr); + + if (available) { + // 由于涉及内容均为 map,所以额外判断没有必要,直接进行 add 行为即可 + addResource(file); + } else { + // 如果读取失败,则移除对应 descCache 条目 + // 若在 existedMetaActions 中存在,则重置对应 info + removeResource(file.toPath()); + } + + } + + List serverUris = mcpDescServer.listResources() + .map(McpSchema.Resource::uri) + .collectList() + .block(); + if (serverUris == null) { + log.error("无法获取 DescMcpServer 持有的资源列表"); + return; + } + for (String uri : serverUris) { + if (!currentUriStr.contains(uri)) { + removeResource(Paths.get(URI.create(uri))); + } + } + }; } } From de462866b2f37d65ee7ac6c34aff040760e141b4 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 2 Jan 2026 21:41:47 +0800 Subject: [PATCH 085/182] feat(LocalRunnerClient): support registering DescMcpServer watch service --- .../core/action/runner/LocalRunnerClient.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 46a928af..c8208c23 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -115,11 +115,22 @@ public class LocalRunnerClient extends RunnerClient { .capabilities(serverCapabilities) .jsonMapper(McpJsonMapper.getDefault()) .build(); - - // TODO 完善加载与监听逻辑 + registerDescMcpWatch(); registerMcpClient("mcp-desc", pair.clientSide(), 10); } + private void registerDescMcpWatch() { + WatchContext ctx = new WatchContext(Path.of(MCP_DESC_PATH), watchService); + LocalWatchEventProcessor.Desc desc = new LocalWatchEventProcessor.Desc(existedMetaActions, mcpDescServer, ctx); + new LocalWatchServiceBuild.BuildRegistry(ctx) + .initialLoad(desc.buildLoad()) + .registerCreate(desc.buildCreate()) + .registerDelete(desc.buildDelete()) + .registerModify(desc.buildModify()) + .registerOverflow(desc.buildOverflow()) + .commit(executor); + } + private void registerDynamicActionMcp() { InProcessMcpTransport.Pair pair = InProcessMcpTransport.pair(); McpSchema.ServerCapabilities serverCapabilities = McpSchema.ServerCapabilities.builder() From 74b6d0c653a6dde559393e52076de2840123fb8b Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sat, 3 Jan 2026 15:49:54 +0800 Subject: [PATCH 086/182] chore(RunnerClient): fix RunnerClient error usages in implementations --- .../slhaf/partner/core/action/runner/SandboxRunnerClient.java | 2 +- .../work/slhaf/partner/core/action/runner/RunnerClientTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/SandboxRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/SandboxRunnerClient.java index 9823780d..6d428bb6 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/SandboxRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/SandboxRunnerClient.java @@ -26,7 +26,7 @@ import java.util.concurrent.ExecutorService; public class SandboxRunnerClient extends RunnerClient { public SandboxRunnerClient(ConcurrentHashMap existedMetaActions, ExecutorService executor) { // 连接沙盒执行器(websocket) - super(existedMetaActions, executor); + super(existedMetaActions, executor, null); } protected RunnerResponse doRun(MetaAction metaAction) { diff --git a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/RunnerClientTest.java b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/RunnerClientTest.java index 040069a4..329e5aff 100644 --- a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/RunnerClientTest.java +++ b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/RunnerClientTest.java @@ -14,7 +14,7 @@ public class RunnerClientTest { private static class TestRunnerClient extends RunnerClient { public TestRunnerClient() { - super(new ConcurrentHashMap<>(), Executors.newVirtualThreadPerTaskExecutor()); + super(new ConcurrentHashMap<>(), Executors.newVirtualThreadPerTaskExecutor(), null); } @Override From ec30ac1922375619716a74efd26bef12464f8b26 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sat, 3 Jan 2026 16:34:04 +0800 Subject: [PATCH 087/182] refactor(LocalRunnerClient): remove tool change consumer in registerMcpClient Context: ExistedMetaActions' updating logic is covered by implementations of LocalWatchEventProcessor. --- .../partner/core/action/runner/LocalRunnerClient.java | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index c8208c23..8c12f53b 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -272,20 +272,10 @@ public class LocalRunnerClient extends RunnerClient { // ResourcesChange 事件传递的 Resource 可以由 Client 读取内容 // 预计在 Server 侧,收到客户端发送的新的行动程序信息,该信息由客户端处补充后,将其放置在指定位置 // 并写入描述文件、发起 ResourcesChange 事件 - //TODO 更新触发应当遵循触发逻辑: ToolChange -> client.listResource -> 仅填写 tool 信息 | 根据查找到的 resource 文件修正信息 - .toolsChangeConsumer(tools -> updateExistedMetaActions(id, tools)) .build(); mcpClients.put(id, client); } - private void updateExistedMetaActions(String id, @UnknownNullability List tools) { - for (McpSchema.Tool tool : tools) { - MetaActionInfo info = buildMetaActionInfo(tool); - String actionKey = id + "::" + tool.name(); - existedMetaActions.put(actionKey, info); - } - } - private @NotNull MetaActionInfo buildMetaActionInfo(McpSchema.Tool tool) { MetaActionInfo info = new MetaActionInfo(); info.setDescription(tool.description()); From 44ab6cfac84ddac90e94a2b12a1fad9ea5dd3f54 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 5 Jan 2026 23:06:17 +0800 Subject: [PATCH 088/182] feat(LocalRunnerClient): support registering MCP clients in CommonMcp --- .../core/action/runner/LocalRunnerClient.java | 197 +++++++++++++----- 1 file changed, 141 insertions(+), 56 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 8c12f53b..c4c331ad 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -1,6 +1,7 @@ package work.slhaf.partner.core.action.runner; import cn.hutool.core.io.FileUtil; +import cn.hutool.core.io.IORuntimeException; import cn.hutool.json.JSONUtil; import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; @@ -20,9 +21,9 @@ import io.modelcontextprotocol.spec.McpSchema; import javassist.NotFoundException; import lombok.Data; import lombok.extern.slf4j.Slf4j; +import lombok.val; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.annotations.UnknownNullability; import reactor.core.publisher.Mono; import reactor.core.scheduler.Schedulers; import work.slhaf.partner.common.mcp.InProcessMcpTransport; @@ -37,6 +38,7 @@ import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.net.URI; +import java.net.http.HttpRequest; import java.nio.charset.StandardCharsets; import java.nio.file.*; import java.time.Duration; @@ -251,18 +253,6 @@ public class LocalRunnerClient extends RunnerClient { return sysDependencies; } - /** - * 该部分主要发生在扫描到新的MCP Server描述文件时出现的注册逻辑 - * - * @param id MCP Client 的 id - * @param mcpClientTransportParams MCP Server 的参数 - */ - private void registerMcpClient(String id, McpClientTransportParams mcpClientTransportParams) { - McpClientTransport clientTransport = createTransport(mcpClientTransportParams); - int timeout = mcpClientTransportParams.timeout; - registerMcpClient(id, clientTransport, timeout); - } - private void registerMcpClient(String id, McpClientTransport clientTransport, int timeout) { McpSyncClient client = McpClient.sync(clientTransport) .requestTimeout(Duration.ofSeconds(timeout)) @@ -292,27 +282,6 @@ public class LocalRunnerClient extends RunnerClient { return info; } - private McpClientTransport createTransport(McpClientTransportParams mcpClientTransportParams) { - return switch (mcpClientTransportParams) { - case McpClientTransportParams.Stdio params -> { - ServerParameters serverParameters = ServerParameters.builder(params.command) - .env(params.env) - .args(params.args) - .build(); - yield new StdioClientTransport(serverParameters, McpJsonMapper.getDefault()); - } - case McpClientTransportParams.Http params -> { - McpSyncHttpClientRequestCustomizer customizer = (builder, method, endpoint, body, context) -> { - params.headers.forEach(builder::setHeader); - }; - yield HttpClientSseClientTransport.builder(params.baseUri) - .httpRequestCustomizer(customizer) - .sseEndpoint(params.endpoint) - .build(); - } - }; - } - private void setupShutdownHook() { Runtime.getRuntime().addShutdownHook(new Thread(() -> { dynamicActionMcpServer.close(); @@ -490,6 +459,18 @@ public class LocalRunnerClient extends RunnerClient { protected abstract @NotNull LocalWatchServiceBuild.EventHandler buildOverflow(); + protected File[] loadFiles() { + val root = ctx.root; + if (!Files.isDirectory(root)) { + throw new ActionInitFailedException("未找到目录: " + root); + } + val files = root.toFile().listFiles(); + if (files == null) { + throw new ActionInitFailedException("目录无法正常读取: " + root); + } + return files; + } + @SuppressWarnings("LoggingSimilarMessage") private static final class Dynamic extends LocalWatchEventProcessor { @@ -502,14 +483,7 @@ public class LocalRunnerClient extends RunnerClient { @SuppressWarnings("BooleanMethodIsAlwaysInverted") private boolean normalPath(Path path) { - File file = path.toFile(); - if (file.isFile()) { - return false; - } - File[] files = file.listFiles(); - if (files == null) { - return false; - } + val files = loadFiles(); if (files.length < 2) { return false; } @@ -879,14 +853,7 @@ public class LocalRunnerClient extends RunnerClient { return () -> { // DescMcp 的加载逻辑只负责读取已有的 *.desc.json 并注册为 resources // 正常来讲 root 直接对应 MCP_DESC_PATH,先检查 root 是否为目录,否则拒绝启动 - Path root = ctx.root; - if (!Files.isDirectory(root)) { - throw new ActionInitFailedException("未找到目录: " + root); - } - File[] files = root.toFile().listFiles(); - if (files == null) { - throw new ActionInitFailedException("目录无法正常读取: " + root); - } + val files = loadFiles(); for (File file : files) { addResource(file); } @@ -1005,9 +972,130 @@ public class LocalRunnerClient extends RunnerClient { this.mcpClients = mcpClients; } + /** + * 该部分主要发生在扫描到新的MCP Server描述文件时出现的注册逻辑 + * + * @param id MCP Client 的 id + * @param mcpClientTransportParams MCP Server 的参数 + */ + private void registerMcpClient(String id, McpClientTransportParams mcpClientTransportParams) { + val clientTransport = createTransport(mcpClientTransportParams); + val timeout = mcpClientTransportParams.timeout; + val client = McpClient.sync(clientTransport) + .requestTimeout(Duration.ofSeconds(timeout)) + .clientInfo(new McpSchema.Implementation(id, "PARTNER")) + .build(); + mcpClients.put(id, client); + } + + private McpClientTransport createTransport(McpClientTransportParams mcpClientTransportParams) { + return switch (mcpClientTransportParams) { + case McpClientTransportParams.Stdio params -> { + val serverParameters = ServerParameters.builder(params.command).env(params.env).args(params.args).build(); + yield new StdioClientTransport(serverParameters, McpJsonMapper.getDefault()); + } + case McpClientTransportParams.Http params -> { + val customizer = new McpSyncHttpClientRequestCustomizer() { + @Override + public void customize(HttpRequest.Builder builder, String method, URI endpoint, String body, McpTransportContext context) { + params.headers.forEach(builder::setHeader); + } + }; + yield HttpClientSseClientTransport.builder(params.baseUri).httpRequestCustomizer(customizer).sseEndpoint(params.endpoint).build(); + } + }; + } + @Override @NotNull protected LocalWatchServiceBuild.InitLoader buildLoad() { + return () -> { + // For CommonMcp, we need to list all files in MCP_SERVER_PATH, + // and search for files with extend name .json, + // and then reading them as JSONObject to get McpClientTransportParams. + val files = loadFiles(); + + for (File file : files) { + if (file.isFile() && file.getName().endsWith(".json")) { + registerMcpClients(file); + } + } + }; + } + + private void registerMcpClients(File file) { + val json = readJson(file); + if (json == null) { + return; + } + + for (String id : json.keySet()) { + val mcp = readMcp(json, id); + if (mcp == null) { + continue; + } + + val params = readParams(mcp); + if (params == null) { + continue; + } + + registerMcpClient(id, params); + } + } + + private cn.hutool.json.JSONObject readJson(File file) { + try { + return JSONUtil.readJSONObject(file, StandardCharsets.UTF_8); + } catch (IORuntimeException ignored) { + return null; + } + } + + private cn.hutool.json.JSONObject readMcp(cn.hutool.json.JSONObject json, String id) { + try { + return json.getJSONObject(id); + } catch (Exception ignored) { + return null; + } + } + + @SuppressWarnings("unchecked") + private McpClientTransportParams readParams(cn.hutool.json.JSONObject mcp) { + val stdioKeys = Set.of("command", "args", "env"); + val httpKeys = Set.of("uri", "endpoint", "headers"); + val httpKey = Set.of("url"); + val keys = mcp.keySet(); + val timeout = mcp.getInt("timeout", 10); + + if (keys.equals(stdioKeys)) { + val command = mcp.getStr("command"); + val env = mcp.getBean("env", Map.class); + val args = mcp.getBeanList("args", String.class); + if (command == null || env == null || args == null) { + return null; + } + return new McpClientTransportParams.Stdio(timeout, command, env, args); + } + + if (keys.equals(httpKeys)) { + val uri = mcp.getStr("uri"); + val endpoint = mcp.getStr("endpoint"); + val headers = mcp.getBean("headers", Map.class); + if (uri == null || endpoint == null || headers == null) { + return null; + } + return new McpClientTransportParams.Http(timeout, uri, endpoint, headers); + } + + if (keys.equals(httpKey)) { + val url = mcp.getStr("url"); + if (url == null) { + return null; + } + return new McpClientTransportParams.Http(timeout, url, "", Map.of()); + } + return null; } @@ -1105,8 +1193,7 @@ public class LocalRunnerClient extends RunnerClient { .start(); Thread stdoutThread = new Thread(() -> { - try (BufferedReader r = new BufferedReader( - new InputStreamReader(process.getInputStream()))) { + try (BufferedReader r = new BufferedReader(new InputStreamReader(process.getInputStream()))) { String line; while ((line = r.readLine()) != null) { output.add(line); @@ -1116,8 +1203,7 @@ public class LocalRunnerClient extends RunnerClient { }); Thread stderrThread = new Thread(() -> { - try (BufferedReader r = new BufferedReader( - new InputStreamReader(process.getErrorStream()))) { + try (BufferedReader r = new BufferedReader(new InputStreamReader(process.getErrorStream()))) { String line; while ((line = r.readLine()) != null) { error.add(line); @@ -1135,8 +1221,7 @@ public class LocalRunnerClient extends RunnerClient { result.setOk(exitCode == 0); result.setResultList(output.isEmpty() ? error : output); - result.setTotal(String.join("\n", - output.isEmpty() ? error : output)); + result.setTotal(String.join("\n", output.isEmpty() ? error : output)); } catch (Exception e) { result.setOk(false); From 872d21170a3e0dbf3e6797066abc81a9347cdb8e Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Thu, 8 Jan 2026 21:16:28 +0800 Subject: [PATCH 089/182] feat(LocalRunnerClient): support modify and overflow events on mcp configurations in CommonMcp Context: Due to single file cannot present all mcp configurations, loading all MCPs at once is required. This is compatible in both modify and overflow events. --- .../core/action/runner/LocalRunnerClient.java | 126 ++++++++++++++++-- 1 file changed, 118 insertions(+), 8 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index c4c331ad..5855eec1 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -966,6 +966,12 @@ public class LocalRunnerClient extends RunnerClient { private static final class Common extends LocalWatchEventProcessor { private final Map mcpClients; + private final Map mcpConfigFileCache = new HashMap<>(); + + @SuppressWarnings("BooleanMethodIsAlwaysInverted") + private boolean normalFile(File file) { + return file.exists() && file.isFile() && file.getName().endsWith(".json"); + } private Common(ConcurrentHashMap existedMetaActions, Map mcpClients, WatchContext ctx) { super(existedMetaActions, ctx); @@ -1016,13 +1022,28 @@ public class LocalRunnerClient extends RunnerClient { val files = loadFiles(); for (File file : files) { - if (file.isFile() && file.getName().endsWith(".json")) { - registerMcpClients(file); + if (!normalFile(file)) { + continue; } + registerMcpClients(file); } }; } + @Override + @NotNull + protected LocalWatchServiceBuild.EventHandler buildModify() { + /* + 发现文件更改事件时,读取该文件中存放的mcp配置,与现有的 MCP 记录对比 + 根据其是否发生配置变动等,针对对应的 client 进行调整 + 如果额外维护一个 文件-clientIds 的映射,可以解决删除某一mcp的情况 + 但如果对于极端场景:从某一文件剪切并粘贴至另一文件,但后者先于前者保存 + 此时就会出现问题,重复client无法被注册 + 建议对于这种‘分布式’的配置存放方式,每个文件变更最好都触发全量加载 + */ + return (thisDir, context) -> checkAndReload(true); + } + private void registerMcpClients(File file) { val json = readJson(file); if (json == null) { @@ -1099,10 +1120,101 @@ public class LocalRunnerClient extends RunnerClient { return null; } + private void checkAndReload(boolean trustCache) { + /* + for each file cannot present all mcp configurations, + we need to load all at once, and then compare them with existed records. + we will record existing mcp paramsCacheMap and id-params map for which is changed. + + recording changedMap only cannot figure out which mcp was deleted, + so existingMcpIdSet attr is required + */ + val changedMap = new HashMap(); + val existingMcpIdSet = new HashSet(); + + val files = loadFiles(); + for (File file : files) { + if (!normalFile(file)) { + continue; + } + + // check if necessary stats changed, null record is seen as file changed + val fileRecord = mcpConfigFileCache.get(file); + boolean fileRecordExists = fileRecord != null; + if (fileRecordExists && !fileChanged(file, fileRecord) && trustCache) { + existingMcpIdSet.addAll(fileRecord.paramsCacheMap().keySet()); + continue; + } + + // if changed, read file and load mcp configurations + val mcpConfigJson = readJson(file); + if (mcpConfigJson == null) { + // uses old records to avoid abnormal deletion + if (fileRecordExists) { + existingMcpIdSet.addAll(fileRecord.paramsCacheMap().keySet()); + } + continue; + } + + val newFileRecord = new McpConfigFileRecord(file.lastModified(), file.length(), new HashMap<>()); + for (String id : mcpConfigJson.keySet()) { + val mcp = readMcp(mcpConfigJson, id); + if (mcp == null) { + continue; + } + + val params = readParams(mcp); + if (params == null) { + continue; + } + + existingMcpIdSet.add(id); + newFileRecord.paramsCacheMap().put(id, params); + + if (fileRecordExists) { + val paramsCache = fileRecord.paramsCacheMap().get(id); + if (paramsCache != null && paramsCache.equals(params)) { + continue; + } + } + + changedMap.put(id, params); + } + mcpConfigFileCache.put(file, newFileRecord); + } + + updateMcpClients(changedMap, existingMcpIdSet); + } + + private void updateMcpClients(HashMap changedMap, HashSet existingMcpIdSet) { + // following attr changedMap, update or insert mcp clients + changedMap.forEach((id, params) -> { + // close outdated clients if exists + val oldClient = mcpClients.get(id); + if (oldClient != null) { + oldClient.close(); + } + // create new clients + registerMcpClient(id, params); + }); + + // following attr existingMcpIdSet, align mcp clients + // new mcp clients and outdated clients has been updated in above logic + // this part focus on removing non-existing mcp + mcpClients.keySet().removeIf(id -> !existingMcpIdSet.contains(id)); + } + + private boolean fileChanged(File file, McpConfigFileRecord fileRecord) { + val lastModified = file.lastModified(); + val length = file.length(); + + return fileRecord.lastModified() != lastModified || fileRecord.length() != length; + } + @Override @NotNull - protected LocalWatchServiceBuild.EventHandler buildModify() { - return null; + protected LocalWatchServiceBuild.EventHandler buildOverflow() { + return (thisDir, context) -> checkAndReload(false); } @Override @@ -1117,10 +1229,8 @@ public class LocalRunnerClient extends RunnerClient { return null; } - @Override - @NotNull - protected LocalWatchServiceBuild.EventHandler buildOverflow() { - return null; + private record McpConfigFileRecord(long lastModified, long length, + Map paramsCacheMap) { } } } From c6118c41b03107660c04e573b797674d599b83a3 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Thu, 8 Jan 2026 21:33:39 +0800 Subject: [PATCH 090/182] refactor(LocalRunnerClient): support loading primary fileMcpCache when CommonMcp launched --- .../core/action/runner/LocalRunnerClient.java | 47 ++++++++++--------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 5855eec1..45149423 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -1025,7 +1025,28 @@ public class LocalRunnerClient extends RunnerClient { if (!normalFile(file)) { continue; } - registerMcpClients(file); + + val json = readJson(file); + if (json == null) { + return; + } + + val newFileRecord = new McpConfigFileRecord(file.lastModified(), file.length()); + for (String id : json.keySet()) { + val mcp = readMcp(json, id); + if (mcp == null) { + continue; + } + + val params = readParams(mcp); + if (params == null) { + continue; + } + + registerMcpClient(id, params); + newFileRecord.paramsCacheMap().put(id, params); + } + mcpConfigFileCache.put(file, newFileRecord); } }; } @@ -1044,27 +1065,6 @@ public class LocalRunnerClient extends RunnerClient { return (thisDir, context) -> checkAndReload(true); } - private void registerMcpClients(File file) { - val json = readJson(file); - if (json == null) { - return; - } - - for (String id : json.keySet()) { - val mcp = readMcp(json, id); - if (mcp == null) { - continue; - } - - val params = readParams(mcp); - if (params == null) { - continue; - } - - registerMcpClient(id, params); - } - } - private cn.hutool.json.JSONObject readJson(File file) { try { return JSONUtil.readJSONObject(file, StandardCharsets.UTF_8); @@ -1231,6 +1231,9 @@ public class LocalRunnerClient extends RunnerClient { private record McpConfigFileRecord(long lastModified, long length, Map paramsCacheMap) { + public McpConfigFileRecord(long lastModified, long length) { + this(lastModified, length, new HashMap<>()); + } } } } From a0bca668cb52c5136f161deba1a72982499d07e4 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Thu, 8 Jan 2026 21:48:30 +0800 Subject: [PATCH 091/182] refactor(LocalRunnerClient): support update existedMetaActions in method registerMcpClient --- .../core/action/runner/LocalRunnerClient.java | 38 +++++++++++-------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 45149423..b6acbc2d 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -266,22 +266,6 @@ public class LocalRunnerClient extends RunnerClient { mcpClients.put(id, client); } - private @NotNull MetaActionInfo buildMetaActionInfo(McpSchema.Tool tool) { - MetaActionInfo info = new MetaActionInfo(); - info.setDescription(tool.description()); - Map outputSchema = tool.outputSchema(); - info.setResponseSchema(outputSchema == null ? JSONObject.of() : JSONObject.from(outputSchema)); - info.setParams(tool.inputSchema().properties()); - - JSONObject meta = JSONObject.from(tool.meta()); - info.setIo(meta.getBoolean("io")); - info.setPreActions(meta.getList("pre", String.class)); - info.setPostActions(meta.getList("post", String.class)); - info.setStrictDependencies(meta.getBoolean("strict")); - info.setTags(meta.getList("tag", String.class)); - return info; - } - private void setupShutdownHook() { Runtime.getRuntime().addShutdownHook(new Thread(() -> { dynamicActionMcpServer.close(); @@ -992,6 +976,28 @@ public class LocalRunnerClient extends RunnerClient { .clientInfo(new McpSchema.Implementation(id, "PARTNER")) .build(); mcpClients.put(id, client); + + for (McpSchema.Tool tool : client.listTools().tools()) { + val metaActionInfo = buildMetaActionInfo(tool); + existedMetaActions.put(id + "::" + tool.name(), metaActionInfo); + } + } + + + private @NotNull MetaActionInfo buildMetaActionInfo(McpSchema.Tool tool) { + MetaActionInfo info = new MetaActionInfo(); + info.setDescription(tool.description()); + Map outputSchema = tool.outputSchema(); + info.setResponseSchema(outputSchema == null ? JSONObject.of() : JSONObject.from(outputSchema)); + info.setParams(tool.inputSchema().properties()); + + JSONObject meta = JSONObject.from(tool.meta()); + info.setIo(meta.getBoolean("io")); + info.setPreActions(meta.getList("pre", String.class)); + info.setPostActions(meta.getList("post", String.class)); + info.setStrictDependencies(meta.getBoolean("strict")); + info.setTags(meta.getList("tag", String.class)); + return info; } private McpClientTransport createTransport(McpClientTransportParams mcpClientTransportParams) { From 00993bd7630fedb1390f1d21e2bf01aab5ef94d5 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Thu, 8 Jan 2026 22:09:14 +0800 Subject: [PATCH 092/182] feat(LocalRunnerClient): support creating MCP configurations in CommonMcp --- .../core/action/runner/LocalRunnerClient.java | 56 +++++++++++-------- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index b6acbc2d..9a7cadcc 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -1031,28 +1031,7 @@ public class LocalRunnerClient extends RunnerClient { if (!normalFile(file)) { continue; } - - val json = readJson(file); - if (json == null) { - return; - } - - val newFileRecord = new McpConfigFileRecord(file.lastModified(), file.length()); - for (String id : json.keySet()) { - val mcp = readMcp(json, id); - if (mcp == null) { - continue; - } - - val params = readParams(mcp); - if (params == null) { - continue; - } - - registerMcpClient(id, params); - newFileRecord.paramsCacheMap().put(id, params); - } - mcpConfigFileCache.put(file, newFileRecord); + loadAndRegisterMcpClientsFromFile(file); } }; } @@ -1226,7 +1205,38 @@ public class LocalRunnerClient extends RunnerClient { @Override @NotNull protected LocalWatchServiceBuild.EventHandler buildCreate() { - return null; + return (thisDir, context) -> { + val file = context.toFile(); + if (!normalFile(file)) { + return; + } + + loadAndRegisterMcpClientsFromFile(file); + }; + } + + private void loadAndRegisterMcpClientsFromFile(File file) { + val mcpConfigJson = readJson(file); + if (mcpConfigJson == null) { + return; + } + + val newFileRecord = new McpConfigFileRecord(file.lastModified(), file.length()); + for (String id : mcpConfigJson.keySet()) { + val mcp = readMcp(mcpConfigJson, id); + if (mcp == null) { + continue; + } + + val params = readParams(mcp); + if (params == null) { + continue; + } + + registerMcpClient(id, params); + newFileRecord.paramsCacheMap().put(id, params); + } + mcpConfigFileCache.put(file, newFileRecord); } @Override From 4f36c0dd2d0f37d21b1df54690e2d89a38246231 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Thu, 8 Jan 2026 22:23:08 +0800 Subject: [PATCH 093/182] feat(LocalRunnerClient): support deleting MCP configurations in CommonMcp --- .../core/action/runner/LocalRunnerClient.java | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 9a7cadcc..fef9578a 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -1242,7 +1242,35 @@ public class LocalRunnerClient extends RunnerClient { @Override @NotNull protected LocalWatchServiceBuild.EventHandler buildDelete() { - return null; + return (thisDir, context) -> { + val file = context.toFile(); + if (file.isFile() && file.getName().endsWith(".json")) { + return; + } + + val fileRecord = mcpConfigFileCache.remove(file); + if (fileRecord == null) { + return; + } + + // clear from existedMetaActions and mcpClients + // client id comes from fileRecord.paramsCache + // actionKey from `id::toolName` + val clientIdSet = fileRecord.paramsCacheMap().keySet(); + for (String clientId : clientIdSet) { + val client = mcpClients.remove(clientId); + if (client == null) { + continue; + } + + val tools = client.listTools().tools(); + for (McpSchema.Tool tool : tools) { + val actionKey = clientId + "::" + tool.name(); + existedMetaActions.remove(actionKey); + } + client.close(); + } + }; } private record McpConfigFileRecord(long lastModified, long length, From 8ca475beeb6f2e4e9ea1ad8932a1f48332fd7869 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Thu, 8 Jan 2026 22:28:12 +0800 Subject: [PATCH 094/182] feat(LocalRunnerClient): support registering CommonMcp --- .../core/action/runner/LocalRunnerClient.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index fef9578a..761f43ed 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -105,9 +105,22 @@ public class LocalRunnerClient extends RunnerClient { } registerDescMcp(); registerDynamicActionMcp(); + registerCommonMcp(); setupShutdownHook(); } + private void registerCommonMcp() { + val ctx = new WatchContext(Path.of(MCP_SERVER_PATH), watchService); + val common = new LocalWatchEventProcessor.Common(existedMetaActions, mcpClients, ctx); + new LocalWatchServiceBuild.BuildRegistry(ctx) + .initialLoad(common.buildLoad()) + .registerCreate(common.buildCreate()) + .registerDelete(common.buildDelete()) + .registerModify(common.buildModify()) + .registerOverflow(common.buildOverflow()) + .commit(executor); + } + private void registerDescMcp() { InProcessMcpTransport.Pair pair = InProcessMcpTransport.pair(); McpSchema.ServerCapabilities serverCapabilities = McpSchema.ServerCapabilities.builder() From 70b8335d49050218c8891397794604ad90ed3fd0 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sun, 11 Jan 2026 14:24:34 +0800 Subject: [PATCH 095/182] feat(LocalRunnerClient): support atomic persist serialization in LocalRunnerClient --- .../action/entity/ActionFileMetaData.java | 10 +++ .../ActionSerializeFailedException.java | 13 ++++ .../core/action/runner/LocalRunnerClient.java | 78 ++++++++++++++++++- .../action/runner/SandboxRunnerClient.java | 4 +- .../core/action/runner/RunnerClientTest.java | 4 +- 5 files changed, 101 insertions(+), 8 deletions(-) create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionFileMetaData.java create mode 100644 Partner-Main/src/main/java/work/slhaf/partner/core/action/exception/ActionSerializeFailedException.java diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionFileMetaData.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionFileMetaData.java new file mode 100644 index 00000000..18094e6b --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionFileMetaData.java @@ -0,0 +1,10 @@ +package work.slhaf.partner.core.action.entity; + +import lombok.Data; + +@Data +public class ActionFileMetaData { + private String content; + private String name; + private String ext; +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/exception/ActionSerializeFailedException.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/exception/ActionSerializeFailedException.java new file mode 100644 index 00000000..1f6d411f --- /dev/null +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/exception/ActionSerializeFailedException.java @@ -0,0 +1,13 @@ +package work.slhaf.partner.core.action.exception; + +import work.slhaf.partner.api.agent.runtime.exception.AgentRuntimeException; + +public class ActionSerializeFailedException extends AgentRuntimeException { + public ActionSerializeFailedException(String message) { + super(message); + } + + public ActionSerializeFailedException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 761f43ed..5578dab3 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -27,11 +27,12 @@ import org.jetbrains.annotations.Nullable; import reactor.core.publisher.Mono; import reactor.core.scheduler.Schedulers; import work.slhaf.partner.common.mcp.InProcessMcpTransport; -import work.slhaf.partner.core.action.entity.McpData; +import work.slhaf.partner.core.action.entity.ActionFileMetaData; import work.slhaf.partner.core.action.entity.MetaAction; import work.slhaf.partner.core.action.entity.MetaActionInfo; import work.slhaf.partner.core.action.entity.MetaActionType; import work.slhaf.partner.core.action.exception.ActionInitFailedException; +import work.slhaf.partner.core.action.exception.ActionSerializeFailedException; import java.io.BufferedReader; import java.io.File; @@ -234,11 +235,80 @@ public class LocalRunnerClient extends RunnerClient { Files.writeString(path, code); } - @Override - public void persistSerialize(MetaActionInfo metaActionInfo, McpData mcpData) { - throw new UnsupportedOperationException("Unimplemented method 'doPersistSerialize'"); + private static @NotNull Path createActionDir(String baseName, Path baseDir) { + Path actionDir = null; + + // 原子地“抢占”目录名 + for (int i = 0; ; i++) { + String dirName = (i == 0) ? baseName : baseName + "(" + i + ")"; + Path candidate = baseDir.resolve(dirName); + + try { + Files.createDirectory(candidate); // 原子操作 + actionDir = candidate; + break; + } catch (FileAlreadyExistsException ignored) { + // 继续尝试下一个名字 + } catch (IOException e) { + throw new ActionSerializeFailedException( + "无法创建行动目录: " + candidate.toAbsolutePath(), e + ); + } + } + return actionDir; } + @Override + public void persistSerialize(MetaActionInfo metaActionInfo, ActionFileMetaData fileMetaData) { + val baseDir = Path.of(DYNAMIC_ACTION_PATH); + + if (!Files.isDirectory(baseDir)) { + throw new ActionSerializeFailedException( + "目录不存在或不可用: " + baseDir.toAbsolutePath() + ); + } + + val baseName = fileMetaData.getName(); + val ext = fileMetaData.getExt(); + + val actionDir = createActionDir(baseName, baseDir); + + // 使用临时文件写入内容 + val runTmp = actionDir.resolve("run." + ext + ".tmp"); + val descTmp = actionDir.resolve("desc.json.tmp"); + + val runFinal = actionDir.resolve("run." + ext); + val descFinal = actionDir.resolve("desc.json"); + + try { + Files.writeString(runTmp, fileMetaData.getContent()); + Files.writeString(descTmp, JSONObject.toJSONString(metaActionInfo)); + + // 原子提交 + Files.move(runTmp, runFinal, StandardCopyOption.ATOMIC_MOVE); + Files.move(descTmp, descFinal, StandardCopyOption.ATOMIC_MOVE); + + } catch (IOException e) { + // 失败清理 + safeDelete(runTmp); + safeDelete(descTmp); + safeDelete(runFinal); + safeDelete(descFinal); + safeDelete(actionDir); + throw new ActionSerializeFailedException("行动文件写入失败", e); + } + } + + private void safeDelete(Path path) { + try { + if (Files.exists(path)) { + Files.delete(path); + } + } catch (IOException ignored) { + } + } + + @Override public JSONObject listSysDependencies() { // 先只列出系统/环境的 Python 依赖 diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/SandboxRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/SandboxRunnerClient.java index 6d428bb6..410c1af9 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/SandboxRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/SandboxRunnerClient.java @@ -1,7 +1,7 @@ package work.slhaf.partner.core.action.runner; import com.alibaba.fastjson2.JSONObject; -import work.slhaf.partner.core.action.entity.McpData; +import work.slhaf.partner.core.action.entity.ActionFileMetaData; import work.slhaf.partner.core.action.entity.MetaAction; import work.slhaf.partner.core.action.entity.MetaActionInfo; @@ -50,7 +50,7 @@ public class SandboxRunnerClient extends RunnerClient { } @Override - public void persistSerialize(MetaActionInfo metaActionInfo, McpData mcpData) { + public void persistSerialize(MetaActionInfo metaActionInfo, ActionFileMetaData fileMetaData) { throw new UnsupportedOperationException("Unimplemented method 'persistSerialize'"); } diff --git a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/RunnerClientTest.java b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/RunnerClientTest.java index 329e5aff..722c41b5 100644 --- a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/RunnerClientTest.java +++ b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/RunnerClientTest.java @@ -1,7 +1,7 @@ package work.slhaf.partner.core.action.runner; import com.alibaba.fastjson2.JSONObject; -import work.slhaf.partner.core.action.entity.McpData; +import work.slhaf.partner.core.action.entity.ActionFileMetaData; import work.slhaf.partner.core.action.entity.MetaAction; import work.slhaf.partner.core.action.entity.MetaActionInfo; @@ -33,7 +33,7 @@ public class RunnerClientTest { } @Override - public void persistSerialize(MetaActionInfo metaActionInfo, McpData mcpData) { + public void persistSerialize(MetaActionInfo metaActionInfo, ActionFileMetaData fileMetaData) { } From 99b42620d05ac81b83de7e022a91c618a5887282 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sun, 11 Jan 2026 15:01:19 +0800 Subject: [PATCH 096/182] refactor(LocalRunnerClient): repair paths registering order and support creating directories automatically --- .../core/action/runner/LocalRunnerClient.java | 26 ++++++++++++++++--- .../core/action/runner/RunnerClient.java | 11 +++++++- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 5578dab3..e7a3dec7 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -57,10 +57,10 @@ import static work.slhaf.partner.common.util.PathUtil.buildPathStr; @Slf4j public class LocalRunnerClient extends RunnerClient { - private final String TMP_ACTION_PATH = buildPathStr(ACTION_PATH, "tmp"); - private final String DYNAMIC_ACTION_PATH = buildPathStr(ACTION_PATH, "dynamic"); - private final String MCP_SERVER_PATH = buildPathStr(ACTION_PATH, "mcp"); - private final String MCP_DESC_PATH = buildPathStr(MCP_SERVER_PATH, "desc"); + private final String TMP_ACTION_PATH; + private final String DYNAMIC_ACTION_PATH; + private final String MCP_SERVER_PATH; + private final String MCP_DESC_PATH; /** * 存储包括 DescMcp、DynamicActionMcp、CommonMcp 在内的所有 MCP Server 对应的客户端 @@ -99,6 +99,13 @@ public class LocalRunnerClient extends RunnerClient { public LocalRunnerClient(ConcurrentHashMap existedMetaActions, ExecutorService executor, @Nullable String baseActionPath) { super(existedMetaActions, executor, baseActionPath); + this.TMP_ACTION_PATH = buildPathStr(ACTION_PATH, "tmp"); + this.DYNAMIC_ACTION_PATH = buildPathStr(ACTION_PATH, "dynamic"); + this.MCP_SERVER_PATH = buildPathStr(ACTION_PATH, "mcp"); + this.MCP_DESC_PATH = buildPathStr(MCP_SERVER_PATH, "desc"); + + createPaths(); + try { watchService = FileSystems.getDefault().newWatchService(); } catch (IOException e) { @@ -110,6 +117,17 @@ public class LocalRunnerClient extends RunnerClient { setupShutdownHook(); } + private void createPaths() { + try { + Files.createDirectory(Path.of(TMP_ACTION_PATH)); + Files.createDirectory(Path.of(DYNAMIC_ACTION_PATH)); + Files.createDirectory(Path.of(MCP_SERVER_PATH)); + Files.createDirectory(Path.of(MCP_DESC_PATH)); + } catch (IOException e) { + throw new ActionInitFailedException("目录创建失败: " + e); + } + } + private void registerCommonMcp() { val ctx = new WatchContext(Path.of(MCP_SERVER_PATH), watchService); val common = new LocalWatchEventProcessor.Common(existedMetaActions, mcpClients, ctx); diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java index b7c32f18..af610ffa 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java @@ -5,13 +5,16 @@ import io.modelcontextprotocol.server.McpStatelessAsyncServer; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.jetbrains.annotations.Nullable; -import work.slhaf.partner.core.action.entity.McpData; +import work.slhaf.partner.core.action.entity.ActionFileMetaData; import work.slhaf.partner.core.action.entity.MetaAction; import work.slhaf.partner.core.action.entity.MetaAction.Result; import work.slhaf.partner.core.action.entity.MetaAction.ResultStatus; import work.slhaf.partner.core.action.entity.MetaActionInfo; +import work.slhaf.partner.core.action.exception.ActionInitFailedException; import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; @@ -51,6 +54,12 @@ public abstract class RunnerClient { this.executor = executor; baseActionPath = baseActionPath == null ? DATA : baseActionPath; this.ACTION_PATH = buildPathStr(baseActionPath, "action"); + + try { + Files.createDirectory(Path.of(ACTION_PATH)); + } catch (IOException e) { + throw new ActionInitFailedException("目录创建失败: " + ACTION_PATH, e); + } } /** From dd8d86d3c41e6f69fcb15d4086aeea9fe347af7e Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sun, 11 Jan 2026 16:27:14 +0800 Subject: [PATCH 097/182] chore(LocalRunnerClient): add logs to LocalRunnerClient --- .../core/action/runner/LocalRunnerClient.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index e7a3dec7..516e50b0 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -138,6 +138,7 @@ public class LocalRunnerClient extends RunnerClient { .registerModify(common.buildModify()) .registerOverflow(common.buildOverflow()) .commit(executor); + log.info("CommonMcp 文件监听注册完毕"); } private void registerDescMcp() { @@ -150,7 +151,10 @@ public class LocalRunnerClient extends RunnerClient { .jsonMapper(McpJsonMapper.getDefault()) .build(); registerDescMcpWatch(); + log.info("DescMcp 文件监听注册完毕"); registerMcpClient("mcp-desc", pair.clientSide(), 10); + log.info("DescMcp 注册完毕"); + } private void registerDescMcpWatch() { @@ -178,7 +182,9 @@ public class LocalRunnerClient extends RunnerClient { // 初始的加载逻辑通过 initialLoad 加载 // 后续的动态更新通过对应的 event 事件触发 registerDynamicActionMcpWatch(); + log.info("DynamicActionMcp 文件监听注册完毕"); registerMcpClient("dynamic-action", pair.clientSide(), 10); + log.info("DynamicActionMcp 注册完毕"); } private void registerDynamicActionMcpWatch() { @@ -197,6 +203,7 @@ public class LocalRunnerClient extends RunnerClient { @Override protected RunnerResponse doRun(MetaAction metaAction) { + log.debug("执行行动: {}", metaAction); RunnerResponse response; try { response = switch (metaAction.getType()) { @@ -208,6 +215,7 @@ public class LocalRunnerClient extends RunnerClient { response.setOk(false); response.setData(e.getLocalizedMessage()); } + log.debug("行动执行结果: {}", response); return response; } @@ -247,10 +255,12 @@ public class LocalRunnerClient extends RunnerClient { @Override public void tmpSerialize(MetaAction tempAction, String code, String codeType) throws IOException { + log.debug("行动程序临时序列化: {}", tempAction); Path path = Path.of(tempAction.getLocation()); File file = path.toFile(); file.createNewFile(); Files.writeString(path, code); + log.debug("临时序列化完毕"); } private static @NotNull Path createActionDir(String baseName, Path baseDir) { @@ -278,6 +288,7 @@ public class LocalRunnerClient extends RunnerClient { @Override public void persistSerialize(MetaActionInfo metaActionInfo, ActionFileMetaData fileMetaData) { + log.debug("行动程序持久序列化: {}", metaActionInfo); val baseDir = Path.of(DYNAMIC_ACTION_PATH); if (!Files.isDirectory(baseDir)) { @@ -305,7 +316,6 @@ public class LocalRunnerClient extends RunnerClient { // 原子提交 Files.move(runTmp, runFinal, StandardCopyOption.ATOMIC_MOVE); Files.move(descTmp, descFinal, StandardCopyOption.ATOMIC_MOVE); - } catch (IOException e) { // 失败清理 safeDelete(runTmp); @@ -315,6 +325,7 @@ public class LocalRunnerClient extends RunnerClient { safeDelete(actionDir); throw new ActionSerializeFailedException("行动文件写入失败", e); } + log.debug("持久序列化结束"); } private void safeDelete(Path path) { @@ -475,6 +486,7 @@ public class LocalRunnerClient extends RunnerClient { for (Path dir : walk.toList()) { WatchKey key = dir.register(watchService, kindsArray); watchKeys.put(key, dir); + log.debug("注册目录监听: {}", dir); } walk.close(); } catch (IOException e) { @@ -494,7 +506,7 @@ public class LocalRunnerClient extends RunnerClient { for (WatchEvent e : events) { WatchEvent.Kind kind = e.kind(); Object context = e.context(); - log.info("行动程序目录变更事件: {} - {} - {}", rootStr, kind.name(), context); + log.debug("文件目录监听事件: {} - {} - {}", rootStr, kind.name(), context); Path thisDir = (Path) key.watchable(); EventHandler handler = handlers.get(kind); if (handler == null) { From cdb6ae9d01c6905b887bb690225e16aef264c17d Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sun, 11 Jan 2026 16:30:44 +0800 Subject: [PATCH 098/182] fix(LocalRunnerClient): correct method loadFiles in LocalWatchEventProcessor --- .../partner/core/action/runner/LocalRunnerClient.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 516e50b0..31292415 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -556,8 +556,7 @@ public class LocalRunnerClient extends RunnerClient { protected abstract @NotNull LocalWatchServiceBuild.EventHandler buildOverflow(); - protected File[] loadFiles() { - val root = ctx.root; + protected File[] loadFiles(Path root) { if (!Files.isDirectory(root)) { throw new ActionInitFailedException("未找到目录: " + root); } @@ -580,7 +579,7 @@ public class LocalRunnerClient extends RunnerClient { @SuppressWarnings("BooleanMethodIsAlwaysInverted") private boolean normalPath(Path path) { - val files = loadFiles(); + val files = loadFiles(path); if (files.length < 2) { return false; } @@ -950,7 +949,7 @@ public class LocalRunnerClient extends RunnerClient { return () -> { // DescMcp 的加载逻辑只负责读取已有的 *.desc.json 并注册为 resources // 正常来讲 root 直接对应 MCP_DESC_PATH,先检查 root 是否为目录,否则拒绝启动 - val files = loadFiles(); + val files = loadFiles(ctx.root); for (File file : files) { addResource(file); } @@ -1138,7 +1137,7 @@ public class LocalRunnerClient extends RunnerClient { // For CommonMcp, we need to list all files in MCP_SERVER_PATH, // and search for files with extend name .json, // and then reading them as JSONObject to get McpClientTransportParams. - val files = loadFiles(); + val files = loadFiles(ctx.root); for (File file : files) { if (!normalFile(file)) { @@ -1230,7 +1229,7 @@ public class LocalRunnerClient extends RunnerClient { val changedMap = new HashMap(); val existingMcpIdSet = new HashSet(); - val files = loadFiles(); + val files = loadFiles(ctx.root); for (File file : files) { if (!normalFile(file)) { continue; From abec141e4e2a77129c78d90598eb4047bd075fc4 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sun, 11 Jan 2026 16:47:14 +0800 Subject: [PATCH 099/182] fix(LocalRunnerClient): correct path creating logic in RunnerClient and its implementations --- .../core/action/runner/LocalRunnerClient.java | 16 ++++----------- .../core/action/runner/RunnerClient.java | 20 +++++++++++++------ .../action/runner/LocalRunnerClientTest.java | 12 +++++++++-- 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 31292415..cafce89a 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -104,7 +104,10 @@ public class LocalRunnerClient extends RunnerClient { this.MCP_SERVER_PATH = buildPathStr(ACTION_PATH, "mcp"); this.MCP_DESC_PATH = buildPathStr(MCP_SERVER_PATH, "desc"); - createPaths(); + createPath(TMP_ACTION_PATH); + createPath(DYNAMIC_ACTION_PATH); + createPath(MCP_SERVER_PATH); + createPath(MCP_DESC_PATH); try { watchService = FileSystems.getDefault().newWatchService(); @@ -117,17 +120,6 @@ public class LocalRunnerClient extends RunnerClient { setupShutdownHook(); } - private void createPaths() { - try { - Files.createDirectory(Path.of(TMP_ACTION_PATH)); - Files.createDirectory(Path.of(DYNAMIC_ACTION_PATH)); - Files.createDirectory(Path.of(MCP_SERVER_PATH)); - Files.createDirectory(Path.of(MCP_DESC_PATH)); - } catch (IOException e) { - throw new ActionInitFailedException("目录创建失败: " + e); - } - } - private void registerCommonMcp() { val ctx = new WatchContext(Path.of(MCP_SERVER_PATH), watchService); val common = new LocalWatchEventProcessor.Common(existedMetaActions, mcpClients, ctx); diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java index af610ffa..f4610772 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSONObject; import io.modelcontextprotocol.server.McpStatelessAsyncServer; import lombok.Data; import lombok.extern.slf4j.Slf4j; +import lombok.val; import org.jetbrains.annotations.Nullable; import work.slhaf.partner.core.action.entity.ActionFileMetaData; import work.slhaf.partner.core.action.entity.MetaAction; @@ -55,11 +56,7 @@ public abstract class RunnerClient { baseActionPath = baseActionPath == null ? DATA : baseActionPath; this.ACTION_PATH = buildPathStr(baseActionPath, "action"); - try { - Files.createDirectory(Path.of(ACTION_PATH)); - } catch (IOException e) { - throw new ActionInitFailedException("目录创建失败: " + ACTION_PATH, e); - } + createPath(ACTION_PATH); } /** @@ -82,7 +79,18 @@ public abstract class RunnerClient { public abstract void tmpSerialize(MetaAction tempAction, String code, String codeType) throws IOException; - public abstract void persistSerialize(MetaActionInfo metaActionInfo, McpData mcpData); + public abstract void persistSerialize(MetaActionInfo metaActionInfo, ActionFileMetaData fileMetaData); + + protected void createPath(String pathStr) { + val path = Path.of(pathStr); + try { + Files.createDirectory(path); + } catch (IOException e) { + if (!Files.exists(path)) { + throw new ActionInitFailedException("目录创建失败: " + pathStr, e); + } + } + } /** * 列出执行环境下的系统依赖情况 diff --git a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java index 2fca8a02..f9e3e462 100644 --- a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java +++ b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java @@ -7,6 +7,7 @@ import work.slhaf.partner.core.action.entity.MetaAction; import work.slhaf.partner.core.action.entity.MetaActionType; import java.util.Map; +import java.util.Scanner; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executors; @@ -16,11 +17,11 @@ public class LocalRunnerClientTest { @BeforeAll static void beforeAll() { - runnerClient = new LocalRunnerClient(new ConcurrentHashMap<>(), Executors.newVirtualThreadPerTaskExecutor(), "/home/slhaf/Projects/IdeaProjects/Projects/Partner/Partner-Main/src/test/java/resources/action/data"); + runnerClient = new LocalRunnerClient(new ConcurrentHashMap<>(), Executors.newVirtualThreadPerTaskExecutor(), "/home/slhaf/Projects/IdeaProjects/Projects/Partner/Partner-Main/src/test/java/resources/action"); } @Test - void runOrigin() { + void testRunOrigin() { MetaAction metaAction = buildTmpMetaAction(); RunnerClient.RunnerResponse runnerResponse = runnerClient.doRun(metaAction); @@ -36,4 +37,11 @@ public class LocalRunnerClientTest { metaAction.setLocation("/home/slhaf/Projects/IdeaProjects/Projects/Partner/Partner-Main/src/test/java/resources/action/tmp/hello_world.py"); return metaAction; } + + @Test + void testWatch() { + // 直接等待输入然后尝试触发各种文件监听事件即可 + Scanner scanner = new Scanner(System.in); + scanner.next(); + } } From 31968c7076af80bbcefd74150df6dd6b89ddc776 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 12 Jan 2026 14:25:20 +0800 Subject: [PATCH 100/182] chore(gitignore): create AGENTS.md for codex, and add it to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index bde338f9..58bbe5cd 100644 --- a/.gitignore +++ b/.gitignore @@ -56,3 +56,4 @@ build/ /generated-classes/ /.idea/copilot.data.migration.ask2agent.xml /Partner-Main/data/ +/AGENTS.md From 9694a022c7fb37fbed72d3f80f0826b5682fe5fc Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 12 Jan 2026 19:35:41 +0800 Subject: [PATCH 101/182] chore(gitignore): update gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 58bbe5cd..92fdc547 100644 --- a/.gitignore +++ b/.gitignore @@ -57,3 +57,4 @@ build/ /.idea/copilot.data.migration.ask2agent.xml /Partner-Main/data/ /AGENTS.md +/.serena/ From ddd999d47b4613aab77d56bca41f9e1b7f9bbfa0 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 12 Jan 2026 19:46:45 +0800 Subject: [PATCH 102/182] fix(LocalRunnerClient): prevent WatchService event loss caused by concurrent consumers Context: Shared WatchService with multiple watch threads caused WatchKey events to be consumed by mismatched processors, leading to missed file events. Use isolated WatchService per WatchContext to restore correct semantics. --- .../core/action/runner/LocalRunnerClient.java | 35 +++--- .../action/runner/LocalRunnerClientTest.java | 109 +++++++++++++++--- 2 files changed, 115 insertions(+), 29 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index cafce89a..c947e2f6 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -95,7 +95,6 @@ public class LocalRunnerClient extends RunnerClient { * 该 MCP Server-Client 的作用为: 与 CommonMcp Clients 配合,补齐第三方 MCP 服务的描述信息 */ private McpStatelessAsyncServer mcpDescServer; - private final WatchService watchService; public LocalRunnerClient(ConcurrentHashMap existedMetaActions, ExecutorService executor, @Nullable String baseActionPath) { super(existedMetaActions, executor, baseActionPath); @@ -110,18 +109,17 @@ public class LocalRunnerClient extends RunnerClient { createPath(MCP_DESC_PATH); try { - watchService = FileSystems.getDefault().newWatchService(); + registerDescMcp(); + registerDynamicActionMcp(); + registerCommonMcp(); } catch (IOException e) { throw new ActionInitFailedException("目录监听器启动失败", e); } - registerDescMcp(); - registerDynamicActionMcp(); - registerCommonMcp(); setupShutdownHook(); } - private void registerCommonMcp() { - val ctx = new WatchContext(Path.of(MCP_SERVER_PATH), watchService); + private void registerCommonMcp() throws IOException { + val ctx = new WatchContext(Path.of(MCP_SERVER_PATH), FileSystems.getDefault().newWatchService()); val common = new LocalWatchEventProcessor.Common(existedMetaActions, mcpClients, ctx); new LocalWatchServiceBuild.BuildRegistry(ctx) .initialLoad(common.buildLoad()) @@ -133,7 +131,7 @@ public class LocalRunnerClient extends RunnerClient { log.info("CommonMcp 文件监听注册完毕"); } - private void registerDescMcp() { + private void registerDescMcp() throws IOException { InProcessMcpTransport.Pair pair = InProcessMcpTransport.pair(); McpSchema.ServerCapabilities serverCapabilities = McpSchema.ServerCapabilities.builder() .resources(true, true) @@ -149,8 +147,8 @@ public class LocalRunnerClient extends RunnerClient { } - private void registerDescMcpWatch() { - WatchContext ctx = new WatchContext(Path.of(MCP_DESC_PATH), watchService); + private void registerDescMcpWatch() throws IOException { + WatchContext ctx = new WatchContext(Path.of(MCP_DESC_PATH), FileSystems.getDefault().newWatchService()); LocalWatchEventProcessor.Desc desc = new LocalWatchEventProcessor.Desc(existedMetaActions, mcpDescServer, ctx); new LocalWatchServiceBuild.BuildRegistry(ctx) .initialLoad(desc.buildLoad()) @@ -158,10 +156,11 @@ public class LocalRunnerClient extends RunnerClient { .registerDelete(desc.buildDelete()) .registerModify(desc.buildModify()) .registerOverflow(desc.buildOverflow()) + .watchAll(true) .commit(executor); } - private void registerDynamicActionMcp() { + private void registerDynamicActionMcp() throws IOException { InProcessMcpTransport.Pair pair = InProcessMcpTransport.pair(); McpSchema.ServerCapabilities serverCapabilities = McpSchema.ServerCapabilities.builder() .tools(true) @@ -179,9 +178,9 @@ public class LocalRunnerClient extends RunnerClient { log.info("DynamicActionMcp 注册完毕"); } - private void registerDynamicActionMcpWatch() { + private void registerDynamicActionMcpWatch() throws IOException { // MODIFY、CREATE、DELETE、OVERFLOW 都需要不同的处理方式 - WatchContext ctx = new WatchContext(Path.of(DYNAMIC_ACTION_PATH), watchService); + WatchContext ctx = new WatchContext(Path.of(DYNAMIC_ACTION_PATH), FileSystems.getDefault().newWatchService()); LocalWatchEventProcessor.Dynamic dynamic = new LocalWatchEventProcessor.Dynamic(existedMetaActions, dynamicActionMcpServer, ctx); new LocalWatchServiceBuild.BuildRegistry(ctx) .initialLoad(dynamic.buildLoad()) @@ -491,7 +490,7 @@ public class LocalRunnerClient extends RunnerClient { String rootStr = ctx.root.toString(); log.info("行动程序目录监听器已启动,监听目录: {}", rootStr); while (true) { - WatchKey key; + WatchKey key = null; try { key = ctx.watchService.take(); List> events = key.pollEvents(); @@ -513,6 +512,14 @@ public class LocalRunnerClient extends RunnerClient { } catch (ClosedWatchServiceException e) { log.info("WatchService 已关闭,监听线程退出。"); break; + } finally { + if (key != null) { + // reset 返回 false 表示该 key 已失效(目录被删、不可访问等) + boolean valid = key.reset(); + if (!valid) { + log.info("WatchKey 已失效,停止监听该目录: {}", key.watchable()); + } + } } } }; diff --git a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java index f9e3e462..2a0dc383 100644 --- a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java +++ b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java @@ -1,31 +1,32 @@ package work.slhaf.partner.core.action.runner; +import lombok.extern.slf4j.Slf4j; import org.jetbrains.annotations.NotNull; -import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; import work.slhaf.partner.core.action.entity.MetaAction; +import work.slhaf.partner.core.action.entity.MetaActionInfo; import work.slhaf.partner.core.action.entity.MetaActionType; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.Map; import java.util.Scanner; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.function.BooleanSupplier; +@SuppressWarnings("LoggingSimilarMessage") +@Slf4j public class LocalRunnerClientTest { - static LocalRunnerClient runnerClient; - - @BeforeAll - static void beforeAll() { - runnerClient = new LocalRunnerClient(new ConcurrentHashMap<>(), Executors.newVirtualThreadPerTaskExecutor(), "/home/slhaf/Projects/IdeaProjects/Projects/Partner/Partner-Main/src/test/java/resources/action"); - } - - @Test - void testRunOrigin() { - MetaAction metaAction = buildTmpMetaAction(); - - RunnerClient.RunnerResponse runnerResponse = runnerClient.doRun(metaAction); - System.out.println(runnerResponse.getData()); + private static void writeRunFile(Path actionDir) throws IOException { + Path runPath = actionDir.resolve("run.py"); + log.debug("写入路径: {}", runPath); + Files.writeString(runPath, "print('ok')\n"); } private static @NotNull MetaAction buildTmpMetaAction() { @@ -38,10 +39,88 @@ public class LocalRunnerClientTest { return metaAction; } + private static void writeDescJson(Path actionDir, String description) throws IOException { + Path descPath = actionDir.resolve("desc.json"); + log.debug("写入路径: {}", descPath); + String json = "{\n" + + " \"io\": false,\n" + + " \"params\": {},\n" + + " \"description\": \"" + description + "\",\n" + + " \"tags\": [],\n" + + " \"preActions\": [],\n" + + " \"postActions\": [],\n" + + " \"strictDependencies\": false,\n" + + " \"responseSchema\": {}\n" + + "}\n"; + Files.writeString(descPath, json); + } + + private static void waitForCondition(BooleanSupplier supplier, long timeoutMs) throws InterruptedException { + long start = System.currentTimeMillis(); + while (!supplier.getAsBoolean()) { + if (System.currentTimeMillis() - start > timeoutMs) { + break; + } + Thread.sleep(50); + } + } + @Test - void testWatch() { + void testRunOrigin(@TempDir Path tempDir) { + LocalRunnerClient runnerClient = + new LocalRunnerClient( + new ConcurrentHashMap<>(), + Executors.newVirtualThreadPerTaskExecutor(), + tempDir.toString() + ); + + MetaAction metaAction = buildTmpMetaAction(); + RunnerClient.RunnerResponse runnerResponse = runnerClient.doRun(metaAction); + System.out.println(runnerResponse.getData()); + } + + @Test + void testWatch(@TempDir Path tempDir) { + LocalRunnerClient runnerClient = + new LocalRunnerClient( + new ConcurrentHashMap<>(), + Executors.newVirtualThreadPerTaskExecutor(), + tempDir.toString() + ); // 直接等待输入然后尝试触发各种文件监听事件即可 + System.out.println("Press any key to continue..."); Scanner scanner = new Scanner(System.in); scanner.next(); } + + @Test + void testDynamicWatchCreateModifyDelete(@TempDir Path tempDir) throws IOException, InterruptedException { + ConcurrentHashMap existedMetaActions = new ConcurrentHashMap<>(); + ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor(); + LocalRunnerClient client = new LocalRunnerClient(existedMetaActions, executor, tempDir.toString()); + + try { + Path dynamicRoot = tempDir.resolve("action").resolve("dynamic"); + Path actionDir = dynamicRoot.resolve("demo_action"); + Files.createDirectories(actionDir); + Thread.sleep(100); + + writeRunFile(actionDir); + writeDescJson(actionDir, "demo action"); + waitForCondition(() -> existedMetaActions.containsKey("local::demo_action"), 2000); + Assertions.assertTrue(existedMetaActions.containsKey("local::demo_action")); + + // 触发一次 modify,确保监听线程能够捕捉到完整的 action 结构 + writeDescJson(actionDir, "demo action updated"); + + waitForCondition(() -> existedMetaActions.containsKey("local::demo_action"), 2000); + Assertions.assertTrue(existedMetaActions.containsKey("local::demo_action")); + + Files.deleteIfExists(actionDir.resolve("run.py")); + waitForCondition(() -> !existedMetaActions.containsKey("local::demo_action"), 2000); + Assertions.assertFalse(existedMetaActions.containsKey("local::demo_action")); + } finally { + executor.shutdownNow(); + } + } } From 837a4c92d10589f07c3b89d844a1b75fd2038ce6 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 12 Jan 2026 21:46:34 +0800 Subject: [PATCH 103/182] fix(LocalRunnerClient): treat missing action dir as invalid path during DELETE in DynamicMcp Context: Action directories may already be removed when DELETE events are handled. Return null from loadFiles to signal invalid paths and lock behavior with DynamicAction watch tests. --- .../core/action/runner/LocalRunnerClient.java | 11 +- .../action/runner/LocalRunnerClientTest.java | 355 +++++++++++++----- 2 files changed, 269 insertions(+), 97 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index c947e2f6..0ae633ff 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -556,14 +556,11 @@ public class LocalRunnerClient extends RunnerClient { protected abstract @NotNull LocalWatchServiceBuild.EventHandler buildOverflow(); protected File[] loadFiles(Path root) { + // 在批量删除场景下,在接收到事件时目录等内容可能已被删除,此时不应该报错,而是返回一个‘异常值’ if (!Files.isDirectory(root)) { - throw new ActionInitFailedException("未找到目录: " + root); + return null; } - val files = root.toFile().listFiles(); - if (files == null) { - throw new ActionInitFailedException("目录无法正常读取: " + root); - } - return files; + return root.toFile().listFiles(); } @SuppressWarnings("LoggingSimilarMessage") @@ -579,7 +576,7 @@ public class LocalRunnerClient extends RunnerClient { @SuppressWarnings("BooleanMethodIsAlwaysInverted") private boolean normalPath(Path path) { val files = loadFiles(path); - if (files.length < 2) { + if (files == null || files.length < 2) { return false; } boolean desc = false; diff --git a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java index 2a0dc383..4a77ff09 100644 --- a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java +++ b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java @@ -1,126 +1,301 @@ package work.slhaf.partner.core.action.runner; import lombok.extern.slf4j.Slf4j; -import org.jetbrains.annotations.NotNull; import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; -import work.slhaf.partner.core.action.entity.MetaAction; import work.slhaf.partner.core.action.entity.MetaActionInfo; -import work.slhaf.partner.core.action.entity.MetaActionType; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; -import java.util.Map; -import java.util.Scanner; +import java.nio.file.StandardCopyOption; +import java.util.Comparator; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.function.BooleanSupplier; -@SuppressWarnings("LoggingSimilarMessage") +import static work.slhaf.partner.core.action.runner.LocalRunnerClientTest.Await.waitForCondition; +import static work.slhaf.partner.core.action.runner.LocalRunnerClientTest.Common.getMetaActionInfo; +import static work.slhaf.partner.core.action.runner.LocalRunnerClientTest.Fs.*; + @Slf4j public class LocalRunnerClientTest { - private static void writeRunFile(Path actionDir) throws IOException { - Path runPath = actionDir.resolve("run.py"); - log.debug("写入路径: {}", runPath); - Files.writeString(runPath, "print('ok')\n"); - } + @SuppressWarnings("LoggingSimilarMessage") + static class Fs { + static void writeRunFile(Path actionDir) throws IOException { + Path runPath = actionDir.resolve("run.py"); + log.debug("写入路径: {}", runPath); + Files.writeString(runPath, "print('ok')\n"); + } - private static @NotNull MetaAction buildTmpMetaAction() { - MetaAction metaAction = new MetaAction(); - metaAction.setIo(false); - metaAction.setName("hello_world"); - metaAction.setParams(Map.of("name", "origin_run")); - metaAction.setType(MetaActionType.ORIGIN); - metaAction.setLocation("/home/slhaf/Projects/IdeaProjects/Projects/Partner/Partner-Main/src/test/java/resources/action/tmp/hello_world.py"); - return metaAction; - } + static void writeInvalidDescJson(Path actionDir) throws IOException { + Path descPath = actionDir.resolve("desc.json"); + log.debug("写入路径: {}", descPath); + Files.writeString(descPath, "{ invalid json"); + } - private static void writeDescJson(Path actionDir, String description) throws IOException { - Path descPath = actionDir.resolve("desc.json"); - log.debug("写入路径: {}", descPath); - String json = "{\n" - + " \"io\": false,\n" - + " \"params\": {},\n" - + " \"description\": \"" + description + "\",\n" - + " \"tags\": [],\n" - + " \"preActions\": [],\n" - + " \"postActions\": [],\n" - + " \"strictDependencies\": false,\n" - + " \"responseSchema\": {}\n" - + "}\n"; - Files.writeString(descPath, json); - } + static void writeDescJson(Path actionDir, String description) throws IOException { + Path descPath = actionDir.resolve("desc.json"); + log.debug("写入路径: {}", descPath); + String json = "{\n" + + " \"io\": false,\n" + + " \"params\": {},\n" + + " \"description\": \"" + description + "\",\n" + + " \"tags\": [],\n" + + " \"preActions\": [],\n" + + " \"postActions\": [],\n" + + " \"strictDependencies\": false,\n" + + " \"responseSchema\": {}\n" + + "}\n"; + Files.writeString(descPath, json); + } - private static void waitForCondition(BooleanSupplier supplier, long timeoutMs) throws InterruptedException { - long start = System.currentTimeMillis(); - while (!supplier.getAsBoolean()) { - if (System.currentTimeMillis() - start > timeoutMs) { - break; + @SuppressWarnings("SameParameterValue") + static void writeDescJsonAtomic(Path actionDir, String description) throws IOException { + Path descPath = actionDir.resolve("desc.json"); + Path tmpPath = actionDir.resolve("desc.json.tmp"); + String json = "{\n" + + " \"io\": false,\n" + + " \"params\": {},\n" + + " \"description\": \"" + description + "\",\n" + + " \"tags\": [],\n" + + " \"preActions\": [],\n" + + " \"postActions\": [],\n" + + " \"strictDependencies\": false,\n" + + " \"responseSchema\": {}\n" + + "}\n"; + Files.writeString(tmpPath, json); + Files.move(tmpPath, descPath, StandardCopyOption.ATOMIC_MOVE, StandardCopyOption.REPLACE_EXISTING); + } + + static void deleteDirectory(Path dir) throws IOException { + if (!Files.exists(dir)) { + return; + } + try (var stream = Files.walk(dir)) { + stream.sorted(Comparator.reverseOrder()).forEach(path -> { + try { + Files.deleteIfExists(path); + } catch (IOException ignored) { + } + }); + } + } + + } + + @SuppressWarnings("BusyWait") + static class Await { + static void waitForCondition(BooleanSupplier supplier, long timeoutMs) throws InterruptedException { + long start = System.currentTimeMillis(); + while (!supplier.getAsBoolean()) { + if (System.currentTimeMillis() - start > timeoutMs) { + break; + } + Thread.sleep(50); } - Thread.sleep(50); } } - @Test - void testRunOrigin(@TempDir Path tempDir) { - LocalRunnerClient runnerClient = - new LocalRunnerClient( - new ConcurrentHashMap<>(), - Executors.newVirtualThreadPerTaskExecutor(), - tempDir.toString() - ); - - MetaAction metaAction = buildTmpMetaAction(); - RunnerClient.RunnerResponse runnerResponse = runnerClient.doRun(metaAction); - System.out.println(runnerResponse.getData()); + static class Common { + static MetaActionInfo getMetaActionInfo(ConcurrentHashMap existedMetaActions, + String actionKey) { + return existedMetaActions.get(actionKey); + } } - @Test - void testWatch(@TempDir Path tempDir) { - LocalRunnerClient runnerClient = - new LocalRunnerClient( - new ConcurrentHashMap<>(), - Executors.newVirtualThreadPerTaskExecutor(), - tempDir.toString() - ); - // 直接等待输入然后尝试触发各种文件监听事件即可 - System.out.println("Press any key to continue..."); - Scanner scanner = new Scanner(System.in); - scanner.next(); - } + @Nested + class DynamicMcpTest { - @Test - void testDynamicWatchCreateModifyDelete(@TempDir Path tempDir) throws IOException, InterruptedException { - ConcurrentHashMap existedMetaActions = new ConcurrentHashMap<>(); - ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor(); - LocalRunnerClient client = new LocalRunnerClient(existedMetaActions, executor, tempDir.toString()); + @Test + void testDynamicWatchCreateModifyDelete(@TempDir Path tempDir) throws IOException, InterruptedException { + ConcurrentHashMap existedMetaActions = new ConcurrentHashMap<>(); + ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor(); + new LocalRunnerClient(existedMetaActions, executor, tempDir.toString()); - try { - Path dynamicRoot = tempDir.resolve("action").resolve("dynamic"); - Path actionDir = dynamicRoot.resolve("demo_action"); - Files.createDirectories(actionDir); + try { + Path dynamicRoot = tempDir.resolve("action").resolve("dynamic"); + Path actionDir = dynamicRoot.resolve("demo_action"); + Files.createDirectories(actionDir); + + Fs.writeRunFile(actionDir); + writeDescJson(actionDir, "demo action"); + waitForCondition(() -> existedMetaActions.containsKey("local::demo_action"), 2000); + Assertions.assertTrue(existedMetaActions.containsKey("local::demo_action")); + + // 触发一次 modify,确保监听线程能够捕捉到完整的 action 结构 + writeDescJson(actionDir, "demo action updated"); + + waitForCondition(() -> existedMetaActions.containsKey("local::demo_action"), 2000); + Assertions.assertTrue(existedMetaActions.containsKey("local::demo_action")); + + Files.deleteIfExists(actionDir.resolve("run.py")); + waitForCondition(() -> !existedMetaActions.containsKey("local::demo_action"), 2000); + Assertions.assertFalse(existedMetaActions.containsKey("local::demo_action")); + } finally { + executor.shutdownNow(); + } + } + + @Test + void testDynamicWatchOutOfOrderEvents(@TempDir Path tempDir) throws IOException, InterruptedException { + ConcurrentHashMap existedMetaActions = new ConcurrentHashMap<>(); + ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor(); + new LocalRunnerClient(existedMetaActions, executor, tempDir.toString()); + + try { + Path dynamicRoot = tempDir.resolve("action").resolve("dynamic"); + + Path actionDir = dynamicRoot.resolve("demo_action_order"); + Files.createDirectories(actionDir); + writeDescJson(actionDir, "desc first"); + waitForCondition(() -> existedMetaActions.containsKey("local::demo_action_order"), 500); + Assertions.assertFalse(existedMetaActions.containsKey("local::demo_action_order")); + + writeRunFile(actionDir); + waitForCondition(() -> existedMetaActions.containsKey("local::demo_action_order"), 2000); + Assertions.assertTrue(existedMetaActions.containsKey("local::demo_action_order")); + + Path descOnlyDir = dynamicRoot.resolve("demo_action_desc_only"); + Files.createDirectories(descOnlyDir); + writeDescJson(descOnlyDir, "desc only"); + waitForCondition(() -> existedMetaActions.containsKey("local::demo_action_desc_only"), 500); + Assertions.assertFalse(existedMetaActions.containsKey("local::demo_action_desc_only")); + + Path runOnlyDir = dynamicRoot.resolve("demo_action_run_only"); + Files.createDirectories(runOnlyDir); + writeRunFile(runOnlyDir); + waitForCondition(() -> existedMetaActions.containsKey("local::demo_action_run_only"), 500); + Assertions.assertFalse(existedMetaActions.containsKey("local::demo_action_run_only")); + } finally { + executor.shutdownNow(); + } + } + + @Test + void testDynamicWatchAtomicDescOverwrite(@TempDir Path tempDir) throws IOException, InterruptedException { + ConcurrentHashMap existedMetaActions = new ConcurrentHashMap<>(); + ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor(); + new LocalRunnerClient(existedMetaActions, executor, tempDir.toString()); + + try { + Path dynamicRoot = tempDir.resolve("action").resolve("dynamic"); + Path actionDir = dynamicRoot.resolve("demo_action_atomic"); + Files.createDirectories(actionDir); + + writeRunFile(actionDir); + writeDescJson(actionDir, "before"); + waitForCondition(() -> existedMetaActions.containsKey("local::demo_action_atomic"), 2000); + Assertions.assertTrue(existedMetaActions.containsKey("local::demo_action_atomic")); + + writeDescJsonAtomic(actionDir, "after"); + waitForCondition(() -> { + MetaActionInfo info = getMetaActionInfo(existedMetaActions, "local::demo_action_atomic"); + return info != null && "after".equals(info.getDescription()); + }, 2000); + + MetaActionInfo info = getMetaActionInfo(existedMetaActions, "local::demo_action_atomic"); + Assertions.assertNotNull(info); + Assertions.assertEquals("after", info.getDescription()); + } finally { + executor.shutdownNow(); + } + } + + @Test + void testDynamicWatchRapidDescModify(@TempDir Path tempDir) throws IOException, InterruptedException { + ConcurrentHashMap existedMetaActions = new ConcurrentHashMap<>(); + ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor(); + new LocalRunnerClient(existedMetaActions, executor, tempDir.toString()); + + try { + Path dynamicRoot = tempDir.resolve("action").resolve("dynamic"); + Path actionDir = dynamicRoot.resolve("demo_action_rapid"); + Files.createDirectories(actionDir); + + writeRunFile(actionDir); + writeDescJson(actionDir, "v0"); + waitForCondition(() -> existedMetaActions.containsKey("local::demo_action_rapid"), 2000); + Assertions.assertTrue(existedMetaActions.containsKey("local::demo_action_rapid")); + + String last = "v5"; + for (int i = 1; i <= 5; i++) { + writeDescJson(actionDir, "v" + i); + } + + waitForCondition(() -> { + MetaActionInfo info = getMetaActionInfo(existedMetaActions, "local::demo_action_rapid"); + return info != null && last.equals(info.getDescription()); + }, 2000); + + MetaActionInfo info = getMetaActionInfo(existedMetaActions, "local::demo_action_rapid"); + Assertions.assertNotNull(info); + Assertions.assertEquals(last, info.getDescription()); + } finally { + executor.shutdownNow(); + } + } + + @Test + void testDynamicWatchDeleteBehavior(@TempDir Path tempDir) throws IOException, InterruptedException { + ConcurrentHashMap existedMetaActions = new ConcurrentHashMap<>(); + ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor(); + new LocalRunnerClient(existedMetaActions, executor, tempDir.toString()); + + try { + Path dynamicRoot = tempDir.resolve("action").resolve("dynamic"); + Path actionDir = dynamicRoot.resolve("demo_action_delete"); + Files.createDirectories(actionDir); + Thread.sleep(100); + writeRunFile(actionDir); + writeDescJson(actionDir, "delete test"); + waitForCondition(() -> existedMetaActions.containsKey("local::demo_action_delete"), 2000); + Assertions.assertTrue(existedMetaActions.containsKey("local::demo_action_delete")); + + Files.deleteIfExists(actionDir.resolve("run.py")); + waitForCondition(() -> !existedMetaActions.containsKey("local::demo_action_delete"), 2000); + Assertions.assertFalse(existedMetaActions.containsKey("local::demo_action_delete")); + + writeRunFile(actionDir); + writeDescJson(actionDir, "delete test restore"); + waitForCondition(() -> existedMetaActions.containsKey("local::demo_action_delete"), 2000); + Assertions.assertTrue(existedMetaActions.containsKey("local::demo_action_delete")); + + deleteDirectory(actionDir); + waitForCondition(() -> !existedMetaActions.containsKey("local::demo_action_delete"), 2000); + Assertions.assertFalse(existedMetaActions.containsKey("local::demo_action_delete")); + } finally { + executor.shutdownNow(); + } + } + + @Test + void testDynamicWatchInvalidDescRecovery(@TempDir Path tempDir) throws IOException, InterruptedException { + ConcurrentHashMap existedMetaActions = new ConcurrentHashMap<>(); + ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor(); + new LocalRunnerClient(existedMetaActions, executor, tempDir.toString()); Thread.sleep(100); + try { + Path dynamicRoot = tempDir.resolve("action").resolve("dynamic"); + Path actionDir = dynamicRoot.resolve("demo_action_invalid"); + Files.createDirectories(actionDir); - writeRunFile(actionDir); - writeDescJson(actionDir, "demo action"); - waitForCondition(() -> existedMetaActions.containsKey("local::demo_action"), 2000); - Assertions.assertTrue(existedMetaActions.containsKey("local::demo_action")); + writeRunFile(actionDir); + writeInvalidDescJson(actionDir); + waitForCondition(() -> existedMetaActions.containsKey("local::demo_action_invalid"), 500); + Assertions.assertFalse(existedMetaActions.containsKey("local::demo_action_invalid")); - // 触发一次 modify,确保监听线程能够捕捉到完整的 action 结构 - writeDescJson(actionDir, "demo action updated"); - - waitForCondition(() -> existedMetaActions.containsKey("local::demo_action"), 2000); - Assertions.assertTrue(existedMetaActions.containsKey("local::demo_action")); - - Files.deleteIfExists(actionDir.resolve("run.py")); - waitForCondition(() -> !existedMetaActions.containsKey("local::demo_action"), 2000); - Assertions.assertFalse(existedMetaActions.containsKey("local::demo_action")); - } finally { - executor.shutdownNow(); + writeDescJson(actionDir, "fixed"); + waitForCondition(() -> existedMetaActions.containsKey("local::demo_action_invalid"), 2000); + Assertions.assertTrue(existedMetaActions.containsKey("local::demo_action_invalid")); + } finally { + executor.shutdownNow(); + } } } + } From 774e2b6cd5c9af266cf2c519a3ac7127ddb47c34 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Tue, 13 Jan 2026 23:13:52 +0800 Subject: [PATCH 104/182] fix(LocalRunnerClient): correct abnormal deleting condition in CommonMcp --- .../slhaf/partner/core/action/runner/LocalRunnerClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 0ae633ff..f8f20041 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -1352,7 +1352,7 @@ public class LocalRunnerClient extends RunnerClient { protected LocalWatchServiceBuild.EventHandler buildDelete() { return (thisDir, context) -> { val file = context.toFile(); - if (file.isFile() && file.getName().endsWith(".json")) { + if (!file.isFile() || !file.getName().endsWith(".json")) { return; } From fdf398b86ec634225bbde96fabf260be9db3d180 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Tue, 13 Jan 2026 23:22:54 +0800 Subject: [PATCH 105/182] fix(LocalRunnerClient): close old MCP client while a new client's name is duplicated with the old one --- .../slhaf/partner/core/action/runner/LocalRunnerClient.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index f8f20041..46396555 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -1077,6 +1077,12 @@ public class LocalRunnerClient extends RunnerClient { * @param mcpClientTransportParams MCP Server 的参数 */ private void registerMcpClient(String id, McpClientTransportParams mcpClientTransportParams) { + // 如果已存在同名 client,则需要先获取并关闭 + val old = mcpClients.get(id); + if (old != null) { + old.close(); + } + val clientTransport = createTransport(mcpClientTransportParams); val timeout = mcpClientTransportParams.timeout; val client = McpClient.sync(clientTransport) From 200c0f3f13afb5948ff080f94b2f338ee154b32a Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Wed, 14 Jan 2026 16:10:33 +0800 Subject: [PATCH 106/182] fix(LocalRunnerClient): guard against null tool meta and ignore non-protocol MCP --- .../core/action/runner/LocalRunnerClient.java | 42 +++--- .../action/runner/LocalRunnerClientTest.java | 124 +++++++++++++++++- 2 files changed, 148 insertions(+), 18 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 46396555..8a26f163 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -1,7 +1,6 @@ package work.slhaf.partner.core.action.runner; import cn.hutool.core.io.FileUtil; -import cn.hutool.core.io.IORuntimeException; import cn.hutool.json.JSONUtil; import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; @@ -1079,22 +1078,28 @@ public class LocalRunnerClient extends RunnerClient { private void registerMcpClient(String id, McpClientTransportParams mcpClientTransportParams) { // 如果已存在同名 client,则需要先获取并关闭 val old = mcpClients.get(id); - if (old != null) { - old.close(); - } - val clientTransport = createTransport(mcpClientTransportParams); val timeout = mcpClientTransportParams.timeout; val client = McpClient.sync(clientTransport) .requestTimeout(Duration.ofSeconds(timeout)) .clientInfo(new McpSchema.Implementation(id, "PARTNER")) .build(); - mcpClients.put(id, client); - for (McpSchema.Tool tool : client.listTools().tools()) { - val metaActionInfo = buildMetaActionInfo(tool); - existedMetaActions.put(id + "::" + tool.name(), metaActionInfo); + try { + for (McpSchema.Tool tool : client.listTools().tools()) { + val metaActionInfo = buildMetaActionInfo(tool); + existedMetaActions.put(id + "::" + tool.name(), metaActionInfo); + } + mcpClients.put(id, client); + + if (old != null) { + old.close(); + } + } catch (Exception e) { + log.warn("[{}] MCP client init failed, skipped (probably non-stdio-safe)", id, e); + client.close(); } + } @@ -1105,12 +1110,15 @@ public class LocalRunnerClient extends RunnerClient { info.setResponseSchema(outputSchema == null ? JSONObject.of() : JSONObject.from(outputSchema)); info.setParams(tool.inputSchema().properties()); - JSONObject meta = JSONObject.from(tool.meta()); - info.setIo(meta.getBoolean("io")); - info.setPreActions(meta.getList("pre", String.class)); - info.setPostActions(meta.getList("post", String.class)); - info.setStrictDependencies(meta.getBoolean("strict")); - info.setTags(meta.getList("tag", String.class)); + val meta = tool.meta(); + if (meta != null) { + JSONObject metaJson = JSONObject.from(meta); + info.setIo(metaJson.getBoolean("io")); + info.setPreActions(metaJson.getList("pre", String.class)); + info.setPostActions(metaJson.getList("post", String.class)); + info.setStrictDependencies(metaJson.getBoolean("strict")); + info.setTags(metaJson.getList("tag", String.class)); + } return info; } @@ -1167,7 +1175,7 @@ public class LocalRunnerClient extends RunnerClient { private cn.hutool.json.JSONObject readJson(File file) { try { return JSONUtil.readJSONObject(file, StandardCharsets.UTF_8); - } catch (IORuntimeException ignored) { + } catch (Exception ignored) { return null; } } @@ -1358,7 +1366,7 @@ public class LocalRunnerClient extends RunnerClient { protected LocalWatchServiceBuild.EventHandler buildDelete() { return (thisDir, context) -> { val file = context.toFile(); - if (!file.isFile() || !file.getName().endsWith(".json")) { + if (!file.getName().endsWith(".json")) { return; } diff --git a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java index 4a77ff09..0353f375 100644 --- a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java +++ b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java @@ -16,9 +16,10 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.function.BooleanSupplier; +import java.util.function.Predicate; import static work.slhaf.partner.core.action.runner.LocalRunnerClientTest.Await.waitForCondition; -import static work.slhaf.partner.core.action.runner.LocalRunnerClientTest.Common.getMetaActionInfo; +import static work.slhaf.partner.core.action.runner.LocalRunnerClientTest.Common.*; import static work.slhaf.partner.core.action.runner.LocalRunnerClientTest.Fs.*; @Slf4j @@ -86,6 +87,10 @@ public class LocalRunnerClientTest { } } + static void writeCommonMcpConfig(Path filePath, String content) throws IOException { + Files.writeString(filePath, content); + } + } @SuppressWarnings("BusyWait") @@ -106,6 +111,35 @@ public class LocalRunnerClientTest { String actionKey) { return existedMetaActions.get(actionKey); } + + static boolean hasActionKey(ConcurrentHashMap existedMetaActions, + Predicate predicate) { + return existedMetaActions.keySet().stream().anyMatch(predicate); + } + + static String buildCommonMcpConfig(String... serverEntries) { + StringBuilder builder = new StringBuilder(); + builder.append("{\n"); + for (int i = 0; i < serverEntries.length; i++) { + builder.append(serverEntries[i]); + if (i < serverEntries.length - 1) { + builder.append(",\n"); + } + } + builder.append("\n}\n"); + return builder.toString(); + } + + static String buildStdioServerEntry(String id, String packageName) { + return " \"" + id + "\": {\n" + + " \"command\": \"npx\",\n" + + " \"args\": [\n" + + " \"-y\",\n" + + " \"" + packageName + "\"\n" + + " ],\n" + + " \"env\": {}\n" + + " }"; + } } @Nested @@ -298,4 +332,92 @@ public class LocalRunnerClientTest { } } + @Nested + class CommonMcpTest { + + @Test + void testCommonMcpInitialLoad(@TempDir Path tempDir) throws IOException, InterruptedException { + ConcurrentHashMap existedMetaActions = new ConcurrentHashMap<>(); + ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor(); + + Path mcpDir = tempDir.resolve("action").resolve("mcp"); + Files.createDirectories(mcpDir); + Path configFile = mcpDir.resolve("servers.json"); + String config = buildCommonMcpConfig( + buildStdioServerEntry("mcp-deepwiki", "mcp-deepwiki@latest") + ); + writeCommonMcpConfig(configFile, config); + + new LocalRunnerClient(existedMetaActions, executor, tempDir.toString()); + + try { + waitForCondition(() -> hasActionKey(existedMetaActions, key -> key.startsWith("mcp-deepwiki::")), 20000); + Assertions.assertTrue(hasActionKey(existedMetaActions, key -> key.startsWith("mcp-deepwiki::"))); + } finally { + executor.shutdownNow(); + } + } + + @Test + void testCommonMcpCreateModifyDelete(@TempDir Path tempDir) throws IOException, InterruptedException { + ConcurrentHashMap existedMetaActions = new ConcurrentHashMap<>(); + ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor(); + new LocalRunnerClient(existedMetaActions, executor, tempDir.toString()); + + try { + Path mcpDir = tempDir.resolve("action").resolve("mcp"); + Files.createDirectories(mcpDir); + Path configFile = mcpDir.resolve("servers.json"); + + String config = buildCommonMcpConfig( + buildStdioServerEntry("mcp-deepwiki", "mcp-deepwiki@latest") + ); + writeCommonMcpConfig(configFile, config); + waitForCondition(() -> hasActionKey(existedMetaActions, key -> key.startsWith("mcp-deepwiki::")), 20000); + Assertions.assertTrue(hasActionKey(existedMetaActions, key -> key.startsWith("mcp-deepwiki::"))); + + String updatedConfig = buildCommonMcpConfig( + buildStdioServerEntry("mcp-deepwiki", "mcp-deepwiki@latest"), + buildStdioServerEntry("playwright", "@playwright/mcp@latest") + ); + writeCommonMcpConfig(configFile, updatedConfig); + waitForCondition(() -> hasActionKey(existedMetaActions, key -> key.startsWith("playwright::")), 20000); + Assertions.assertTrue(hasActionKey(existedMetaActions, key -> key.startsWith("playwright::"))); + + Files.deleteIfExists(configFile); + waitForCondition(() -> !hasActionKey(existedMetaActions, key -> key.startsWith("mcp-deepwiki::")), 20000); + Assertions.assertFalse(hasActionKey(existedMetaActions, key -> key.startsWith("mcp-deepwiki::"))); + Assertions.assertFalse(hasActionKey(existedMetaActions, key -> key.startsWith("playwright::"))); + } finally { + executor.shutdownNow(); + } + } + + @Test + void testCommonMcpInvalidJsonRecovery(@TempDir Path tempDir) throws IOException, InterruptedException { + ConcurrentHashMap existedMetaActions = new ConcurrentHashMap<>(); + ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor(); + new LocalRunnerClient(existedMetaActions, executor, tempDir.toString()); + + try { + Path mcpDir = tempDir.resolve("action").resolve("mcp"); + Files.createDirectories(mcpDir); + Path configFile = mcpDir.resolve("servers.json"); + + writeCommonMcpConfig(configFile, "{ invalid json"); + waitForCondition(() -> hasActionKey(existedMetaActions, key -> key.startsWith("mcp-deepwiki::")), 2000); + Assertions.assertFalse(hasActionKey(existedMetaActions, key -> key.startsWith("mcp-deepwiki::"))); + + String config = buildCommonMcpConfig( + buildStdioServerEntry("mcp-deepwiki", "mcp-deepwiki@latest") + ); + writeCommonMcpConfig(configFile, config); + waitForCondition(() -> hasActionKey(existedMetaActions, key -> key.startsWith("mcp-deepwiki::")), 20000); + Assertions.assertTrue(hasActionKey(existedMetaActions, key -> key.startsWith("mcp-deepwiki::"))); + } finally { + executor.shutdownNow(); + } + } + } + } From c5f6c4e0aecbd81709b715c36e2d131e9443d353 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Wed, 14 Jan 2026 19:57:24 +0800 Subject: [PATCH 107/182] fix(LocalRunnerClient): recover desc watcher after root deletion and expand DescMcp tests --- .../core/action/runner/LocalRunnerClient.java | 11 + .../action/runner/LocalRunnerClientTest.java | 308 ++++++++++++++++++ 2 files changed, 319 insertions(+) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 8a26f163..ab9eead0 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -517,6 +517,17 @@ public class LocalRunnerClient extends RunnerClient { boolean valid = key.reset(); if (!valid) { log.info("WatchKey 已失效,停止监听该目录: {}", key.watchable()); + ctx.watchKeys.remove(key); + if (key.watchable().equals(ctx.root)) { + try { + Files.createDirectories(ctx.root); + registerPath(); + if (initLoader != null) + initLoader.load(); + } catch (IOException e) { + log.error("重建根目录并重新注册监听失败: {}", ctx.root, e); + } + } } } } diff --git a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java index 0353f375..7f12551e 100644 --- a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java +++ b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java @@ -11,7 +11,10 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.StandardCopyOption; +import java.util.ArrayList; import java.util.Comparator; +import java.util.HashMap; +import java.util.List; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -55,6 +58,28 @@ public class LocalRunnerClientTest { Files.writeString(descPath, json); } + static void writeDescMcpJson(Path descDir, String actionKey, String description) throws IOException { + Path descPath = descDir.resolve(actionKey + ".desc.json"); + log.debug("写入路径: {}", descPath); + String json = "{\n" + + " \"io\": true,\n" + + " \"params\": {},\n" + + " \"description\": \"" + description + "\",\n" + + " \"tags\": [\"tag\"],\n" + + " \"preActions\": [\"pre\"],\n" + + " \"postActions\": [\"post\"],\n" + + " \"strictDependencies\": true,\n" + + " \"responseSchema\": {}\n" + + "}\n"; + Files.writeString(descPath, json); + } + + static void writeInvalidDescMcpJson(Path descDir, String actionKey) throws IOException { + Path descPath = descDir.resolve(actionKey + ".desc.json"); + log.debug("写入路径: {}", descPath); + Files.writeString(descPath, "{ invalid json"); + } + @SuppressWarnings("SameParameterValue") static void writeDescJsonAtomic(Path actionDir, String description) throws IOException { Path descPath = actionDir.resolve("desc.json"); @@ -117,6 +142,18 @@ public class LocalRunnerClientTest { return existedMetaActions.keySet().stream().anyMatch(predicate); } + static MetaActionInfo buildMetaActionInfo(String description) { + MetaActionInfo info = new MetaActionInfo(); + info.setIo(true); + info.setParams(new HashMap<>()); + info.setDescription(description); + info.setTags(new ArrayList<>(List.of("tag"))); + info.setPreActions(new ArrayList<>(List.of("pre"))); + info.setPostActions(new ArrayList<>(List.of("post"))); + info.setStrictDependencies(true); + return info; + } + static String buildCommonMcpConfig(String... serverEntries) { StringBuilder builder = new StringBuilder(); builder.append("{\n"); @@ -332,6 +369,277 @@ public class LocalRunnerClientTest { } } + @Nested + class DescMcpTest { + + @Test + void testDescMcpWatchCreateModifyDelete(@TempDir Path tempDir) throws IOException, InterruptedException { + ConcurrentHashMap existedMetaActions = new ConcurrentHashMap<>(); + ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor(); + String actionKey = "local::desc_action"; + existedMetaActions.put(actionKey, buildMetaActionInfo("base")); + new LocalRunnerClient(existedMetaActions, executor, tempDir.toString()); + + try { + Path descDir = tempDir.resolve("action").resolve("mcp").resolve("desc"); + Files.createDirectories(descDir); + + writeDescMcpJson(descDir, actionKey, "v1"); + waitForCondition(() -> { + MetaActionInfo info = getMetaActionInfo(existedMetaActions, actionKey); + return info != null && "v1".equals(info.getDescription()); + }, 2000); + MetaActionInfo info = getMetaActionInfo(existedMetaActions, actionKey); + Assertions.assertNotNull(info); + Assertions.assertEquals("v1", info.getDescription()); + Assertions.assertTrue(info.isIo()); + Assertions.assertTrue(info.isStrictDependencies()); + Assertions.assertFalse(info.getTags().isEmpty()); + + writeDescMcpJson(descDir, actionKey, "v2"); + waitForCondition(() -> { + MetaActionInfo current = getMetaActionInfo(existedMetaActions, actionKey); + return current != null && "v2".equals(current.getDescription()); + }, 2000); + info = getMetaActionInfo(existedMetaActions, actionKey); + Assertions.assertNotNull(info); + Assertions.assertEquals("v2", info.getDescription()); + + Files.deleteIfExists(descDir.resolve(actionKey + ".desc.json")); + waitForCondition(() -> { + MetaActionInfo current = getMetaActionInfo(existedMetaActions, actionKey); + return current != null + && !current.isIo() + && !current.isStrictDependencies() + && current.getTags().isEmpty() + && current.getPreActions().isEmpty() + && current.getPostActions().isEmpty(); + }, 2000); + info = getMetaActionInfo(existedMetaActions, actionKey); + Assertions.assertNotNull(info); + Assertions.assertFalse(info.isIo()); + Assertions.assertFalse(info.isStrictDependencies()); + Assertions.assertTrue(info.getTags().isEmpty()); + Assertions.assertTrue(info.getPreActions().isEmpty()); + Assertions.assertTrue(info.getPostActions().isEmpty()); + } finally { + executor.shutdownNow(); + } + } + + @Test + void testDescMcpInvalidJsonRecovery(@TempDir Path tempDir) throws IOException, InterruptedException { + ConcurrentHashMap existedMetaActions = new ConcurrentHashMap<>(); + ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor(); + String actionKey = "local::desc_invalid"; + existedMetaActions.put(actionKey, buildMetaActionInfo("base")); + new LocalRunnerClient(existedMetaActions, executor, tempDir.toString()); + + try { + Path descDir = tempDir.resolve("action").resolve("mcp").resolve("desc"); + Files.createDirectories(descDir); + + writeInvalidDescMcpJson(descDir, actionKey); + waitForCondition(() -> { + MetaActionInfo info = getMetaActionInfo(existedMetaActions, actionKey); + return info != null + && !info.isIo() + && !info.isStrictDependencies() + && info.getTags().isEmpty() + && info.getPreActions().isEmpty() + && info.getPostActions().isEmpty(); + }, 2000); + MetaActionInfo info = getMetaActionInfo(existedMetaActions, actionKey); + Assertions.assertNotNull(info); + Assertions.assertFalse(info.isIo()); + Assertions.assertFalse(info.isStrictDependencies()); + Assertions.assertTrue(info.getTags().isEmpty()); + Assertions.assertTrue(info.getPreActions().isEmpty()); + Assertions.assertTrue(info.getPostActions().isEmpty()); + + writeDescMcpJson(descDir, actionKey, "fixed"); + waitForCondition(() -> { + MetaActionInfo current = getMetaActionInfo(existedMetaActions, actionKey); + return current != null && "fixed".equals(current.getDescription()); + }, 2000); + info = getMetaActionInfo(existedMetaActions, actionKey); + Assertions.assertNotNull(info); + Assertions.assertEquals("fixed", info.getDescription()); + Assertions.assertTrue(info.isIo()); + Assertions.assertTrue(info.isStrictDependencies()); + } finally { + executor.shutdownNow(); + } + } + + @Test + void testDescMcpIgnoreInvalidFileName(@TempDir Path tempDir) throws IOException, InterruptedException { + ConcurrentHashMap existedMetaActions = new ConcurrentHashMap<>(); + ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor(); + String actionKey = "local::desc_ignore"; + existedMetaActions.put(actionKey, buildMetaActionInfo("base")); + new LocalRunnerClient(existedMetaActions, executor, tempDir.toString()); + + try { + Path descDir = tempDir.resolve("action").resolve("mcp").resolve("desc"); + Files.createDirectories(descDir); + + Files.writeString(descDir.resolve("local-desc.desc.json"), "{ \"description\": \"bad\" }"); + Files.writeString(descDir.resolve(actionKey + ".json"), "{ \"description\": \"bad\" }"); + waitForCondition(() -> existedMetaActions.size() > 1, 500); + + MetaActionInfo info = getMetaActionInfo(existedMetaActions, actionKey); + Assertions.assertNotNull(info); + Assertions.assertEquals("base", info.getDescription()); + Assertions.assertTrue(info.isIo()); + Assertions.assertEquals(1, existedMetaActions.size()); + } finally { + executor.shutdownNow(); + } + } + + @Test + void testDescMcpNoActionKeyPresent(@TempDir Path tempDir) throws IOException, InterruptedException { + ConcurrentHashMap existedMetaActions = new ConcurrentHashMap<>(); + ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor(); + new LocalRunnerClient(existedMetaActions, executor, tempDir.toString()); + + try { + Path descDir = tempDir.resolve("action").resolve("mcp").resolve("desc"); + Files.createDirectories(descDir); + + String actionKey = "local::missing_action"; + writeDescMcpJson(descDir, actionKey, "desc"); + waitForCondition(() -> existedMetaActions.containsKey(actionKey), 500); + Assertions.assertFalse(existedMetaActions.containsKey(actionKey)); + } finally { + executor.shutdownNow(); + } + } + + @Test + void testDescMcpRapidCreateDelete(@TempDir Path tempDir) throws IOException, InterruptedException { + ConcurrentHashMap existedMetaActions = new ConcurrentHashMap<>(); + ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor(); + String actionKey = "local::desc_rapid"; + existedMetaActions.put(actionKey, buildMetaActionInfo("base")); + new LocalRunnerClient(existedMetaActions, executor, tempDir.toString()); + + try { + Path descDir = tempDir.resolve("action").resolve("mcp").resolve("desc"); + Files.createDirectories(descDir); + + writeDescMcpJson(descDir, actionKey, "v1"); + Files.deleteIfExists(descDir.resolve(actionKey + ".desc.json")); + + waitForCondition(() -> { + MetaActionInfo info = getMetaActionInfo(existedMetaActions, actionKey); + return info != null + && !info.isIo() + && !info.isStrictDependencies() + && info.getTags().isEmpty() + && info.getPreActions().isEmpty() + && info.getPostActions().isEmpty(); + }, 2000); + MetaActionInfo info = getMetaActionInfo(existedMetaActions, actionKey); + Assertions.assertNotNull(info); + Assertions.assertFalse(info.isIo()); + Assertions.assertFalse(info.isStrictDependencies()); + Assertions.assertTrue(info.getTags().isEmpty()); + Assertions.assertTrue(info.getPreActions().isEmpty()); + Assertions.assertTrue(info.getPostActions().isEmpty()); + } finally { + executor.shutdownNow(); + } + } + + @Test + void testDescMcpRapidDeleteCreate(@TempDir Path tempDir) throws IOException, InterruptedException { + ConcurrentHashMap existedMetaActions = new ConcurrentHashMap<>(); + ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor(); + String actionKey = "local::desc_rapid_restore"; + existedMetaActions.put(actionKey, buildMetaActionInfo("base")); + new LocalRunnerClient(existedMetaActions, executor, tempDir.toString()); + + try { + Path descDir = tempDir.resolve("action").resolve("mcp").resolve("desc"); + Files.createDirectories(descDir); + + writeDescMcpJson(descDir, actionKey, "v1"); + waitForCondition(() -> { + MetaActionInfo info = getMetaActionInfo(existedMetaActions, actionKey); + return info != null && "v1".equals(info.getDescription()); + }, 2000); + + Files.deleteIfExists(descDir.resolve(actionKey + ".desc.json")); + waitForCondition(() -> { + MetaActionInfo info = getMetaActionInfo(existedMetaActions, actionKey); + return info != null + && !info.isIo() + && !info.isStrictDependencies() + && info.getTags().isEmpty() + && info.getPreActions().isEmpty() + && info.getPostActions().isEmpty(); + }, 2000); + + writeDescMcpJson(descDir, actionKey, "v2"); + waitForCondition(() -> { + MetaActionInfo info = getMetaActionInfo(existedMetaActions, actionKey); + return info != null && "v2".equals(info.getDescription()); + }, 2000); + MetaActionInfo info = getMetaActionInfo(existedMetaActions, actionKey); + Assertions.assertNotNull(info); + Assertions.assertEquals("v2", info.getDescription()); + } finally { + executor.shutdownNow(); + } + } + + @Test + void testDescMcpDirDeleteRecreate(@TempDir Path tempDir) throws IOException, InterruptedException { + ConcurrentHashMap existedMetaActions = new ConcurrentHashMap<>(); + ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor(); + String actionKey = "local::desc_dir_restore"; + existedMetaActions.put(actionKey, buildMetaActionInfo("base")); + new LocalRunnerClient(existedMetaActions, executor, tempDir.toString()); + + try { + Path descDir = tempDir.resolve("action").resolve("mcp").resolve("desc"); + Files.createDirectories(descDir); + + writeDescMcpJson(descDir, actionKey, "v1"); + waitForCondition(() -> { + MetaActionInfo info = getMetaActionInfo(existedMetaActions, actionKey); + return info != null && "v1".equals(info.getDescription()); + }, 2000); + + Files.deleteIfExists(descDir.resolve(actionKey + ".desc.json")); + deleteDirectory(descDir); + waitForCondition(() -> { + MetaActionInfo info = getMetaActionInfo(existedMetaActions, actionKey); + return info != null + && !info.isIo() + && !info.isStrictDependencies() + && info.getTags().isEmpty() + && info.getPreActions().isEmpty() + && info.getPostActions().isEmpty(); + }, 2000); + + Files.createDirectories(descDir); + writeDescMcpJson(descDir, actionKey, "v2"); + waitForCondition(() -> { + MetaActionInfo info = getMetaActionInfo(existedMetaActions, actionKey); + return info != null && "v2".equals(info.getDescription()); + }, 2000); + MetaActionInfo info = getMetaActionInfo(existedMetaActions, actionKey); + Assertions.assertNotNull(info); + Assertions.assertEquals("v2", info.getDescription()); + } finally { + executor.shutdownNow(); + } + } + } + @Nested class CommonMcpTest { From fb5cabc747bedad90c855dd8654b7e43b0689760 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 16 Jan 2026 21:28:45 +0800 Subject: [PATCH 108/182] fix(LocalRunnerClient): support read MetaActionInfo according to desc files when an MCP Client with described tools registered by CommonMcp --- .../core/action/runner/LocalRunnerClient.java | 41 ++++++++++++++++--- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index ab9eead0..99888228 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -61,6 +61,9 @@ public class LocalRunnerClient extends RunnerClient { private final String MCP_SERVER_PATH; private final String MCP_DESC_PATH; + private final String MCP_NAME_DESC = "mcp-desc"; + private final String MCP_NAME_DYNAMIC = "mcp-dynamic"; + /** * 存储包括 DescMcp、DynamicActionMcp、CommonMcp 在内的所有 MCP Server 对应的客户端 *
@@ -119,7 +122,7 @@ public class LocalRunnerClient extends RunnerClient { private void registerCommonMcp() throws IOException { val ctx = new WatchContext(Path.of(MCP_SERVER_PATH), FileSystems.getDefault().newWatchService()); - val common = new LocalWatchEventProcessor.Common(existedMetaActions, mcpClients, ctx); + val common = new LocalWatchEventProcessor.Common(existedMetaActions, mcpClients, mcpClients.get(MCP_NAME_DESC), ctx); new LocalWatchServiceBuild.BuildRegistry(ctx) .initialLoad(common.buildLoad()) .registerCreate(common.buildCreate()) @@ -141,7 +144,7 @@ public class LocalRunnerClient extends RunnerClient { .build(); registerDescMcpWatch(); log.info("DescMcp 文件监听注册完毕"); - registerMcpClient("mcp-desc", pair.clientSide(), 10); + registerMcpClient(MCP_NAME_DESC, pair.clientSide(), 10); log.info("DescMcp 注册完毕"); } @@ -173,7 +176,7 @@ public class LocalRunnerClient extends RunnerClient { // 后续的动态更新通过对应的 event 事件触发 registerDynamicActionMcpWatch(); log.info("DynamicActionMcp 文件监听注册完毕"); - registerMcpClient("dynamic-action", pair.clientSide(), 10); + registerMcpClient(MCP_NAME_DYNAMIC, pair.clientSide(), 10); log.info("DynamicActionMcp 注册完毕"); } @@ -1069,15 +1072,17 @@ public class LocalRunnerClient extends RunnerClient { private final Map mcpClients; private final Map mcpConfigFileCache = new HashMap<>(); + private final McpSyncClient descClient; @SuppressWarnings("BooleanMethodIsAlwaysInverted") private boolean normalFile(File file) { return file.exists() && file.isFile() && file.getName().endsWith(".json"); } - private Common(ConcurrentHashMap existedMetaActions, Map mcpClients, WatchContext ctx) { + private Common(ConcurrentHashMap existedMetaActions, Map mcpClients, McpSyncClient descClient, WatchContext ctx) { super(existedMetaActions, ctx); this.mcpClients = mcpClients; + this.descClient = descClient; } /** @@ -1098,7 +1103,7 @@ public class LocalRunnerClient extends RunnerClient { try { for (McpSchema.Tool tool : client.listTools().tools()) { - val metaActionInfo = buildMetaActionInfo(tool); + val metaActionInfo = buildMetaActionInfo(id, tool); existedMetaActions.put(id + "::" + tool.name(), metaActionInfo); } mcpClients.put(id, client); @@ -1113,8 +1118,32 @@ public class LocalRunnerClient extends RunnerClient { } + /** + * 构建 MetaActionInfo + * + * @param id MCP Client id + * @param tool 待构建 MetaActionInfo 的 MCP Tool + * @return MetaActionInfo 信息 + */ + private @NotNull MetaActionInfo buildMetaActionInfo(String id, McpSchema.Tool tool) { + // 先检查是否存在对应的描述文件 + val toolName = tool.name(); //格式: mcpName::toolName + for (McpSchema.Resource resource : descClient.listResources().resources()) { + val resourceName = resource.name(); + if (resourceName.equals(toolName) && resourceName.split("::")[0].equals(id)) { + val resourceContent = descClient.readResource(resource).contents().getFirst(); + if (resourceContent instanceof McpSchema.TextResourceContents r) { + try { + return JSONObject.parseObject(r.text(), MetaActionInfo.class); + } catch (Exception e) { + log.error("序列化描述文件资源失败", e); + log.error("序列化描述文件资源失败, uri: {}", r.uri()); + log.error("序列化描述文件资源失败, text: {}", r.text()); + } + } + } + } - private @NotNull MetaActionInfo buildMetaActionInfo(McpSchema.Tool tool) { MetaActionInfo info = new MetaActionInfo(); info.setDescription(tool.description()); Map outputSchema = tool.outputSchema(); From c793851107491924452c3f082cdef8a18c162e34 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 16 Jan 2026 21:48:17 +0800 Subject: [PATCH 109/182] fix(LocalRunnerClient): support cleaning non-existing MCP Servers' tools while MCP configuration files changed in CommonMcp --- .../core/action/runner/LocalRunnerClient.java | 14 ++++---- .../action/runner/LocalRunnerClientTest.java | 34 +++++++++++++++++++ 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 99888228..142f90a0 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -1269,13 +1269,13 @@ public class LocalRunnerClient extends RunnerClient { private void checkAndReload(boolean trustCache) { /* - for each file cannot present all mcp configurations, - we need to load all at once, and then compare them with existed records. - we will record existing mcp paramsCacheMap and id-params map for which is changed. + for each file cannot present all mcp configurations, + we need to load all at once, and then compare them with existed records. + we will record existing mcp paramsCacheMap and id-params map for which is changed. - recording changedMap only cannot figure out which mcp was deleted, - so existingMcpIdSet attr is required - */ + recording changedMap only cannot figure out which mcp was deleted, + so existingMcpIdSet attr is required + */ val changedMap = new HashMap(); val existingMcpIdSet = new HashSet(); @@ -1349,6 +1349,8 @@ public class LocalRunnerClient extends RunnerClient { // new mcp clients and outdated clients has been updated in above logic // this part focus on removing non-existing mcp mcpClients.keySet().removeIf(id -> !existingMcpIdSet.contains(id)); + // clear relevant tools' action info + existedMetaActions.keySet().removeIf(id -> !existingMcpIdSet.contains(id.split("::")[0])); } private boolean fileChanged(File file, McpConfigFileRecord fileRecord) { diff --git a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java index 7f12551e..f502f296 100644 --- a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java +++ b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java @@ -701,6 +701,40 @@ public class LocalRunnerClientTest { } } + @Test + void testCommonMcpRemoveEntryFromConfig(@TempDir Path tempDir) throws IOException, InterruptedException { + ConcurrentHashMap existedMetaActions = new ConcurrentHashMap<>(); + ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor(); + new LocalRunnerClient(existedMetaActions, executor, tempDir.toString()); + + try { + Path mcpDir = tempDir.resolve("action").resolve("mcp"); + Files.createDirectories(mcpDir); + Path configFile = mcpDir.resolve("servers.json"); + + String config = buildCommonMcpConfig( + buildStdioServerEntry("mcp-deepwiki", "mcp-deepwiki@latest"), + buildStdioServerEntry("playwright", "@playwright/mcp@latest") + ); + writeCommonMcpConfig(configFile, config); + waitForCondition(() -> hasActionKey(existedMetaActions, key -> key.startsWith("mcp-deepwiki::")), 20000); + waitForCondition(() -> hasActionKey(existedMetaActions, key -> key.startsWith("playwright::")), 20000); + Assertions.assertTrue(hasActionKey(existedMetaActions, key -> key.startsWith("mcp-deepwiki::"))); + Assertions.assertTrue(hasActionKey(existedMetaActions, key -> key.startsWith("playwright::"))); + + String updatedConfig = buildCommonMcpConfig( + buildStdioServerEntry("mcp-deepwiki", "mcp-deepwiki@latest") + ); + writeCommonMcpConfig(configFile, updatedConfig); + + waitForCondition(() -> !hasActionKey(existedMetaActions, key -> key.startsWith("playwright::")), 20000); + Assertions.assertFalse(hasActionKey(existedMetaActions, key -> key.startsWith("playwright::"))); + Assertions.assertTrue(hasActionKey(existedMetaActions, key -> key.startsWith("mcp-deepwiki::"))); + } finally { + executor.shutdownNow(); + } + } + @Test void testCommonMcpInvalidJsonRecovery(@TempDir Path tempDir) throws IOException, InterruptedException { ConcurrentHashMap existedMetaActions = new ConcurrentHashMap<>(); From 8ead306b7bf12c95bbf382ccfb95a03eb265f38c Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 16 Jan 2026 22:17:15 +0800 Subject: [PATCH 110/182] fix(RunnerClient): correct RunnerResponse's visibility --- .../work/slhaf/partner/core/action/runner/RunnerClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java index f4610772..832af9f0 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java @@ -98,7 +98,7 @@ public abstract class RunnerClient { public abstract JSONObject listSysDependencies(); @Data - protected static class RunnerResponse { + public static class RunnerResponse { private boolean ok; private String data; } From 420d51af15d1aa3ad19a888912bcc0cc11d3f1b9 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 16 Jan 2026 23:28:46 +0800 Subject: [PATCH 111/182] fix(LocalRunnerClient): harden doRun branches and add tests --- .../core/action/runner/LocalRunnerClient.java | 13 ++- .../action/runner/LocalRunnerClientTest.java | 101 +++++++++++++++++- 2 files changed, 108 insertions(+), 6 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 142f90a0..21e20f1c 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -222,6 +222,10 @@ public class LocalRunnerClient extends RunnerClient { return response; } String[] commands = SystemExecHelper.buildCommands(ext, metaAction.getParams(), file.getAbsolutePath()); + if (commands == null || commands.length == 0) { + response.setOk(false); + response.setData("不支持的文件类型: " + file.getName()); + } SystemExecHelper.Result execResult = SystemExecHelper.exec(commands); response.setOk(execResult.isOk()); response.setData(execResult.getTotal()); @@ -236,7 +240,12 @@ public class LocalRunnerClient extends RunnerClient { .arguments(metaAction.getParams()) .build(); McpSchema.CallToolResult callToolResult = mcpClient.callTool(callToolRequest); - response.setOk(callToolResult.isError()); + val callToolResultError = callToolResult.isError(); + if (callToolResultError == null) { + response.setOk(false); + } else { + response.setOk(!callToolResultError); + } response.setData(callToolResult.structuredContent().toString()); return response; } @@ -1234,7 +1243,7 @@ public class LocalRunnerClient extends RunnerClient { val httpKeys = Set.of("uri", "endpoint", "headers"); val httpKey = Set.of("url"); val keys = mcp.keySet(); - val timeout = mcp.getInt("timeout", 10); + val timeout = mcp.getInt("timeout", 30); if (keys.equals(stdioKeys)) { val command = mcp.getStr("command"); diff --git a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java index f502f296..c60d8d24 100644 --- a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java +++ b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java @@ -5,16 +5,15 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; +import work.slhaf.partner.core.action.entity.MetaAction; import work.slhaf.partner.core.action.entity.MetaActionInfo; +import work.slhaf.partner.core.action.entity.MetaActionType; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.StandardCopyOption; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; +import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -177,6 +176,15 @@ public class LocalRunnerClientTest { + " \"env\": {}\n" + " }"; } + + static MetaAction buildMetaAction(MetaActionType type, String location, String name, Map params) { + MetaAction metaAction = new MetaAction(); + metaAction.setType(type); + metaAction.setLocation(location); + metaAction.setName(name); + metaAction.setParams(params); + return metaAction; + } } @Nested @@ -762,4 +770,89 @@ public class LocalRunnerClientTest { } } + @Nested + class DoRunTest { + + @Test + void testDoRunWithOriginUnknownExt(@TempDir Path tempDir) throws IOException { + ConcurrentHashMap existedMetaActions = new ConcurrentHashMap<>(); + ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor(); + LocalRunnerClient client = new LocalRunnerClient(existedMetaActions, executor, tempDir.toString()); + + try { + Path script = tempDir.resolve("run"); + Files.writeString(script, "echo ok\n"); + MetaAction metaAction = buildMetaAction(MetaActionType.ORIGIN, script.toString(), "run", Map.of()); + RunnerClient.RunnerResponse response = client.doRun(metaAction); + Assertions.assertNotNull(response); + Assertions.assertFalse(response.isOk()); + Assertions.assertEquals("未知文件类型", response.getData()); + } finally { + executor.shutdownNow(); + } + } + + @Test + void testDoRunWithOriginScriptSuccess(@TempDir Path tempDir) throws IOException { + ConcurrentHashMap existedMetaActions = new ConcurrentHashMap<>(); + ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor(); + LocalRunnerClient client = new LocalRunnerClient(existedMetaActions, executor, tempDir.toString()); + + try { + Path script = tempDir.resolve("run.sh"); + Files.writeString(script, "echo ok\n"); + MetaAction metaAction = buildMetaAction(MetaActionType.ORIGIN, script.toString(), "run", Map.of()); + RunnerClient.RunnerResponse response = client.doRun(metaAction); + Assertions.assertNotNull(response); + Assertions.assertTrue(response.isOk()); + Assertions.assertTrue(response.getData().contains("ok")); + } finally { + executor.shutdownNow(); + } + } + + @Test + void testDoRunWithMcpMissingClient(@TempDir Path tempDir) { + ConcurrentHashMap existedMetaActions = new ConcurrentHashMap<>(); + ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor(); + LocalRunnerClient client = new LocalRunnerClient(existedMetaActions, executor, tempDir.toString()); + + try { + MetaAction metaAction = buildMetaAction(MetaActionType.MCP, "missing-client", "missing-tool", Map.of()); + RunnerClient.RunnerResponse response = client.doRun(metaAction); + Assertions.assertNotNull(response); + Assertions.assertFalse(response.isOk()); + } finally { + executor.shutdownNow(); + } + } + + @Test + void testDoRunWithMcpLoadedFromCommonConfig(@TempDir Path tempDir) throws IOException, InterruptedException { + ConcurrentHashMap existedMetaActions = new ConcurrentHashMap<>(); + ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor(); + + Path mcpDir = tempDir.resolve("action").resolve("mcp"); + Files.createDirectories(mcpDir); + Path configFile = mcpDir.resolve("servers.json"); + String config = buildCommonMcpConfig( + buildStdioServerEntry("playwright", "@playwright/mcp@latest") + ); + writeCommonMcpConfig(configFile, config); + + LocalRunnerClient client = new LocalRunnerClient(existedMetaActions, executor, tempDir.toString()); + + try { + waitForCondition(() -> hasActionKey(existedMetaActions, key -> key.startsWith("playwright::")), 20000); + Assertions.assertTrue(hasActionKey(existedMetaActions, key -> key.startsWith("playwright::"))); + + MetaAction metaAction = buildMetaAction(MetaActionType.MCP, "playwright", "browser_navigate", Map.of("url", "https://deepwiki.com/microsoft/vscode")); + client.run(metaAction); + Assertions.assertNotEquals(MetaAction.ResultStatus.WAITING, metaAction.getResult().getStatus()); + } finally { + executor.shutdownNow(); + } + } + } + } From 96e74ec877c62c6610e01b710be830750053e3cc Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sat, 17 Jan 2026 11:28:21 +0800 Subject: [PATCH 112/182] test(LocalRunnerClient): add test for method run in RunnerClient --- .../core/action/runner/LocalRunnerClientTest.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java index c60d8d24..1c5a86f6 100644 --- a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java +++ b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java @@ -827,6 +827,21 @@ public class LocalRunnerClientTest { } } + @Test + void testDoRunViaRunnerClient(@TempDir Path tempDir) { + ConcurrentHashMap existedMetaActions = new ConcurrentHashMap<>(); + ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor(); + RunnerClient client = new LocalRunnerClient(existedMetaActions, executor, tempDir.toString()); + + try { + MetaAction metaAction = buildMetaAction(MetaActionType.MCP, "missing-client", "missing-tool", Map.of()); + client.run(metaAction); + Assertions.assertNotNull(metaAction.getResult().getData()); + } finally { + executor.shutdownNow(); + } + } + @Test void testDoRunWithMcpLoadedFromCommonConfig(@TempDir Path tempDir) throws IOException, InterruptedException { ConcurrentHashMap existedMetaActions = new ConcurrentHashMap<>(); From 830503eee49380106e1fb2fe9a99ed87ec16c9a5 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 23 Jan 2026 19:23:07 +0800 Subject: [PATCH 113/182] chore(ActionExecutor): update comments --- .../action/dispatcher/executor/ActionExecutor.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java index bd01e0f4..25bfbfe0 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java @@ -55,6 +55,12 @@ public class ActionExecutor extends AgentRunningSubModule immediateActions = input.getImmediateActions(); @@ -82,14 +88,14 @@ public class ActionExecutor extends AgentRunningSubModule metaActions = actionChain.get(order); for (MetaAction metaAction : metaActions) { - // 根据io类型放入合适的列表 + // 根据 io 类型放入合适的列表 if (metaAction.isIo()) { virtual.add(metaAction); } else { platform.add(metaAction); } } - // 使用phaser来承担同组的动态任务新增 + // 使用 phaser 来承担同组的动态任务新增 runGroupAction(virtual, userId, actionData, virtualExecutor, phaserRecord); runGroupAction(platform, userId, actionData, platformExecutor, phaserRecord); phaser.arriveAndAwaitAdvance(); @@ -133,7 +139,7 @@ public class ActionExecutor extends AgentRunningSubModule Date: Sun, 25 Jan 2026 19:38:53 +0800 Subject: [PATCH 114/182] refactor(ActionExecutor): rework staged execution and runner submit Context: This refactor drops unnecessary method abstractions and cleans the action execution flow. Additionally, method 'run' is renamed to 'submit' in RunnerClient, which better reflects that execution results are held in MetaAction. --- .../core/action/runner/RunnerClient.java | 4 +- .../dispatcher/executor/ActionExecutor.java | 220 +++++++----------- .../dispatcher/executor/ActionRepairer.java | 4 +- .../executor/entity/RepairerInput.java | 2 - .../handler/InterventionHandler.java | 2 +- .../action/runner/LocalRunnerClientTest.java | 4 +- 6 files changed, 91 insertions(+), 145 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java index 832af9f0..7b5f045f 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java @@ -46,6 +46,8 @@ public abstract class RunnerClient { protected final ConcurrentHashMap existedMetaActions; protected final ExecutorService executor; + //TODO 仍可提供内部 MCP,但调用方式需要结合 AgentContext来获取,否则生命周期不合 + protected McpStatelessAsyncServer innerMcpServer; /** * ActionCore 将注入虚拟线程池 @@ -62,7 +64,7 @@ public abstract class RunnerClient { /** * 执行行动程序 */ - public void run(MetaAction metaAction) { + public void submit(MetaAction metaAction) { // 获取已存在行动列表 Result result = metaAction.getResult(); if (!result.getStatus().equals(ResultStatus.WAITING)) { diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java index 25bfbfe0..68bc1d91 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java @@ -1,6 +1,7 @@ package work.slhaf.partner.module.modules.action.dispatcher.executor; import lombok.extern.slf4j.Slf4j; +import lombok.val; import work.slhaf.partner.api.agent.factory.capability.annotation.InjectCapability; import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule; import work.slhaf.partner.api.agent.factory.module.annotation.Init; @@ -10,13 +11,10 @@ import work.slhaf.partner.core.action.ActionCapability; import work.slhaf.partner.core.action.ActionCore; import work.slhaf.partner.core.action.entity.*; import work.slhaf.partner.core.action.entity.ActionData.ActionStatus; -import work.slhaf.partner.core.action.entity.MetaAction.ResultStatus; import work.slhaf.partner.core.action.runner.RunnerClient; import work.slhaf.partner.core.cognation.CognationCapability; import work.slhaf.partner.core.memory.MemoryCapability; import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.*; -import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.RepairerResult.RepairerStatus; -import work.slhaf.partner.module.modules.action.dispatcher.executor.exception.ActionExecutingFailedException; import java.util.ArrayList; import java.util.List; @@ -63,54 +61,46 @@ public class ActionExecutor extends AgentRunningSubModule immediateActions = input.getImmediateActions(); - String userId = input.getUserId(); + val immediateActions = input.getImmediateActions(); + val userId = input.getUserId(); + // 异步执行所有行动 for (ImmediateActionData actionData : immediateActions) { - virtualExecutor.execute(() -> { + platformExecutor.execute(() -> { if (actionData.getStatus() != ActionData.ActionStatus.PREPARE) { return; } - actionData.setStatus(ActionData.ActionStatus.EXECUTING); - Map> actionChain = actionData.getActionChain(); - List virtual = new ArrayList<>(); - List platform = new ArrayList<>(); - Phaser phaser = new Phaser(); + // 注册执行中行动 + val phaser = new Phaser(); phaser.register(); - PhaserRecord phaserRecord = actionCapability.putPhaserRecord(phaser, actionData); - List orderList = new ArrayList<>(actionChain.keySet().stream().toList()); - orderList.sort(Integer::compareTo); - try { - for (Integer order : orderList) { - if (actionData.getStatus().equals(ActionStatus.FAILED)) { - // 此时已经在 PhaserRecord 调用的 fail 方法中调整了 ActionData 的状态标记 - // 跳出循环后仍将正常执行 phaserRecord 的移除操作 - break; - } - List metaActions = actionChain.get(order); - for (MetaAction metaAction : metaActions) { - // 根据 io 类型放入合适的列表 - if (metaAction.isIo()) { - virtual.add(metaAction); - } else { - platform.add(metaAction); - } - } - // 使用 phaser 来承担同组的动态任务新增 - runGroupAction(virtual, userId, actionData, virtualExecutor, phaserRecord); - runGroupAction(platform, userId, actionData, platformExecutor, phaserRecord); - phaser.arriveAndAwaitAdvance(); - virtual.clear(); - platform.clear(); - // 进行行动链修正 - CorrectorInput correctorInput = assemblyHelper.buildCorrectorInput(); - actionCorrector.execute(correctorInput); - } - } finally { - phaser.arriveAndDeregister(); - actionCapability.removePhaserRecord(phaser); - if (actionData.getStatus() != ActionData.ActionStatus.FAILED) { - actionData.setStatus(ActionStatus.SUCCESS); + val phaserRecord = actionCapability.putPhaserRecord(phaser, actionData); + actionData.setStatus(ActionData.ActionStatus.EXECUTING); + + // 开始执行 + val actionChain = actionData.getActionChain(); + int stageCount = 0; + do { + val orderList = new ArrayList<>(actionChain.keySet()); + orderList.sort(Integer::compareTo); + val executingStage = orderList.get(stageCount); + actionData.setExecutingStage(executingStage); + + val metaActions = actionChain.get(executingStage); + phaser.bulkRegister(metaActions.size()); + for (MetaAction metaAction : metaActions) { + val executor = metaAction.isIo() ? virtualExecutor : platformExecutor; + executor.execute(buildMataActionTask(metaAction, phaserRecord, userId)); } + + // TODO 进行行动链修正 + val correctorInput = assemblyHelper.buildCorrectorInput(); + actionCorrector.execute(correctorInput); + } while (actionChain.size() > ++stageCount); + + // 结束 + phaser.arriveAndDeregister(); + actionCapability.removePhaserRecord(phaser); + if (actionData.getStatus() != ActionData.ActionStatus.FAILED) { + actionData.setStatus(ActionStatus.SUCCESS); } }); @@ -119,93 +109,51 @@ public class ActionExecutor extends AgentRunningSubModule actions, String userId, ActionData actionData, - ExecutorService executor, - PhaserRecord phaserRecord) { - Phaser phaser = phaserRecord.phaser(); - phaser.bulkRegister(actions.size()); - // 不可替换为增强for,因为单组的行动单元集合数量是可以被外部干预的 - // noinspection ForLoopReplaceableByForEach - for (int i = 0; i < actions.size(); i++) { - MetaAction action = actions.get(i); - executor.execute(() -> { - try { - // 两个循环需考虑最大次数,但为了达到最好融合,次数累计作用于 ActionRepairer 的修复策略选择上更合适 - // 修复的最终结果是 action 的参数补充完整,然后能够继续行动链 - // 如果无法补充,则该行动行动阶段可能确实有误,实际上应当在 actionRepairer 内部进行处理(行动链调整、自对话或请求用户进行干预) - // 所以无法补充时,行动链所属行动数据的状态需要置为 Interrupted ,等待状态变更,同时使用 Phaser 暂停(阻塞)当前行动链执行过程 - // 这个功能应该交给 PhaserRecord 实现,尽量确保功能一致性 - setActionParams(action, phaserRecord, userId); - do { - runnerClient.run(action); - MetaAction.Result result = action.getResult(); - // 该循环对应 LLM 的调整参数后重试 - if (!result.getStatus().equals(ResultStatus.SUCCESS)) { - // LLM决策是重构参数、执行自对话反思、还是选择向用户求助(通过cognationCore暴露方法,可能需要修改其他模块以进行适应),仅重构参数时无需结束当前循环 - // 若使用Phaser作为执行线程与反思、求助等调用流程的同步协调,应当需要额外维护Phaser全局字段,获取到反思结果或者用户反馈后, - // 调用对应的phaser注册任务,在ActionExecutor中动态添加任务至actionChain,同时启动异步执行 - // 而且由于执行与放入的为同一个MetaAction对象,所以执行结果可被当前行动链获取,但virtual、executor两个列表似乎不行,需要重构执行模式,建议将行动链直接重构为LinkedHashMap,order为键 - setActionParams(action, phaserRecord, userId); - } else { - break; + private Runnable buildMataActionTask(MetaAction metaAction, PhaserRecord phaserRecord, String userId) { + return () -> { + try { + val result = metaAction.getResult(); + do { + val actionData = phaserRecord.actionData(); + val historyActionResults = assemblyHelper.getHistoryActionResults(actionData); + val additionalContext = actionData.getAdditionalContext().get(actionData.getExecutingStage()); + val extractorInput = assemblyHelper.buildExtractorInput(metaAction, userId, historyActionResults, additionalContext); + val extractorResult = paramsExtractor.execute(extractorInput); + + if (extractorResult.isOk()) { + metaAction.setParams(extractorResult.getParams()); + runnerClient.submit(metaAction); + } else { + val repairerInput = assemblyHelper.buildRepairerInput(historyActionResults, metaAction, userId); + val repairerResult = actionRepairer.execute(repairerInput); + switch (repairerResult.getStatus()) { + // 如果本次修复被认为成功,则将补充的信息添加至 additionalContext + case RepairerResult.RepairerStatus.OK -> { + additionalContext.addAll(repairerResult.getFixedData()); + result.setStatus(MetaAction.ResultStatus.WAITING); + } + // 此处的修复失败来自系统内部的执行失败:其余方式均不可行时将回退至当前分支 + case RepairerResult.RepairerStatus.FAILED -> { + result.setStatus(MetaAction.ResultStatus.FAILED); + result.setData("行动执行失败"); + } + // 此处对应已在 repairer 内发起外部请求,故在此处进行阻塞 + case RepairerResult.RepairerStatus.ACQUIRE -> { + phaserRecord.interrupt(); + result.setStatus(MetaAction.ResultStatus.WAITING); + } } - runnerClient.run(action); - } while (true); - // TODO 执行结果不再需要写入特定位置,当前的 ActionCapability - // 内部的行动池已经足以承担这个功能,但这也就意味着行动池或许需要考虑特殊的序列化形式避免内存占用过高, - // 同时也需要在某些模块执行时加上行动结果的挑取作为输入内容 - } catch (ActionExecutingFailedException e) { - log.error("Action executing failed: {}", action.getKey(), e); - } finally { - phaser.arriveAndDeregister(); - } - }); - - } - - } - - private void setActionParams(MetaAction action, PhaserRecord phaserRecord, String userId) { - ActionData actionData = phaserRecord.actionData(); - List additionalContext = actionData.getAdditionalContext().get(actionData.getExecutingStage()); - do { - ExtractorInput extractorInput = assemblyHelper.buildExtractorInput(action, userId, actionData, - additionalContext); - ExtractorResult extractorResult = paramsExtractor.execute(extractorInput); - if (extractorResult.isOk()) { - action.setParams(extractorResult.getParams()); - break; + } + } while (result.getStatus().equals(MetaAction.ResultStatus.WAITING)); + // TODO 执行结果不再需要写入特定位置,当前的 ActionCapability + // 内部的行动池已经足以承担这个功能,但这也就意味着行动池或许需要考虑特殊的序列化形式避免内存占用过高, + // 同时也需要在某些模块执行时加上行动结果的挑取作为输入内容 + } catch (Exception e) { + log.error("Action executing failed: {}", metaAction.getKey(), e); + } finally { + phaserRecord.phaser().arriveAndDeregister(); } - RepairerInput repairerInput = assemblyHelper.buildRepairerInput(phaserRecord, action, userId); - RepairerResult repairerResult = actionRepairer.execute(repairerInput); - switch (repairerResult.getStatus()) { - // 修复成功则直接设置参数 - case RepairerStatus.OK -> additionalContext.addAll(repairerResult.getFixedData()); - // 修复失败则证明行动链不可行(外部因素,如果本身即不存在满足可能,则应当通过 ADJUST 或者 ACQUIRE 方式选择取消) - case RepairerStatus.FAILED -> { - // 此处抛出执行异常,runGroupAction 为并发执行同组动作,此时只是中断了一个行动单元的执行 - // 那么对于其他的行动单元,也需要进行中断处理,仅靠 PhaserRecord 无法完成 - // 或许需要再增加一个集合,用于记录开启的执行线程,然后统一停止 - // 由于行动链的并发特性,所以只需要记录单组行动单元的执行线程,但是如果此时其他的行动单元也触发了额外的线程操作 - // (例如自对话,但此时这些触发自对话的线程本身是正常状态,会被正常中断) - // 也需要避免这些内容出现异常(主要是前置行动模块处针对 ActionData 的操作),应该只需要依据 FAILED 状态阻止操作即可 - // 对于修复和动态生成的行动单元执行,都是同步操作,不再需要额外处理 - // 但考虑到同组行动单元的执行过程,也的确用不到那么多线程中断操作,所以只要收到干预时做好拒绝策略即可 - // 此处的话,由于主要依赖 ActionData 持有的状态防止失败行动数据继续执行,所以不再需要 phaserRecord 进行额外处理 - // 只需要重设 ActionData 状态即可 - actionData.setStatus(ActionData.ActionStatus.FAILED); - throw new ActionExecutingFailedException("行动执行失败"); - } - // 通过自对话通道发起了干预,这里需要调用 phaserRecord 进行一次阻塞 - // 如果通过 phaserRecord 进行阻塞,那么在前置模块的 InterventionHandler 需要额外得知当前 ActionData - // 的内容,这点是可以做到的 - // 如果在 ActionRepairer 内部调用阻塞,还是无法免除同样的逻辑,即 RepairerResult 内容需要携带干预信息,但这些内容最终是在 - // ActionData 中放置的,相当于绕了一层,不太合适 - case RepairerStatus.ACQUIRE -> { - phaserRecord.interrupt(); - } - } - } while (true); + }; } @SuppressWarnings("InnerClassMayBeStatic") @@ -214,26 +162,24 @@ public class ActionExecutor extends AgentRunningSubModule historyActionsResults, MetaAction action, String userId) { RepairerInput input = new RepairerInput(); MetaActionInfo metaActionInfo = actionCapability.loadMetaActionInfo(action.getKey()); - ActionData actionData = phaserRecord.actionData(); - input.setHistoryActionResults(getHistoryActionResults(actionData)); + input.setHistoryActionResults(historyActionsResults); input.setParams(metaActionInfo.getParams()); input.setRecentMessages(cognationCapability.getChatMessages()); input.setActionDescription(metaActionInfo.getDescription()); input.setUserId(userId); - input.setPhaserRecord(phaserRecord); return input; } - private ExtractorInput buildExtractorInput(MetaAction action, String userId, ActionData actionData, - List additionalContext) { + private ExtractorInput buildExtractorInput(MetaAction action, String userId, List historyActionResults, + List additionalContext) { ExtractorInput input = new ExtractorInput(); input.setEvaluatedSlices(memoryCapability.getActivatedSlices(userId)); input.setRecentMessages(cognationCapability.getChatMessages()); input.setMetaActionInfo(actionCapability.loadMetaActionInfo(action.getKey())); - input.setHistoryActionResults(getHistoryActionResults(actionData)); + input.setHistoryActionResults(historyActionResults); input.setAdditionalContext(additionalContext); return input; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionRepairer.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionRepairer.java index 76788ba0..01d164db 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionRepairer.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionRepairer.java @@ -109,7 +109,7 @@ public class ActionRepairer extends AgentRunningSubModule { try { - runnerClient.run(action); + runnerClient.submit(action); result.getFixedData().add(action.getResult().getData()); } catch (Exception e) { log.error("行动单元执行失败: {}", key, e); diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/RepairerInput.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/RepairerInput.java index fa08264f..dd470a13 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/RepairerInput.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/RepairerInput.java @@ -2,7 +2,6 @@ package work.slhaf.partner.module.modules.action.dispatcher.executor.entity; import lombok.Data; import work.slhaf.partner.api.chat.pojo.Message; -import work.slhaf.partner.core.action.entity.PhaserRecord; import java.util.List; import java.util.Map; @@ -15,5 +14,4 @@ public class RepairerInput { private Map params; private String actionDescription; private List historyActionResults; - private PhaserRecord phaserRecord; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/InterventionHandler.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/InterventionHandler.java index e30897a1..2973de07 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/InterventionHandler.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/InterventionHandler.java @@ -155,7 +155,7 @@ public class InterventionHandler extends AgentRunningSubModule { try { - runnerClient.run(action); + runnerClient.submit(action); } finally { phaser.arriveAndDeregister(); } diff --git a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java index 1c5a86f6..023fda13 100644 --- a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java +++ b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/LocalRunnerClientTest.java @@ -835,7 +835,7 @@ public class LocalRunnerClientTest { try { MetaAction metaAction = buildMetaAction(MetaActionType.MCP, "missing-client", "missing-tool", Map.of()); - client.run(metaAction); + client.submit(metaAction); Assertions.assertNotNull(metaAction.getResult().getData()); } finally { executor.shutdownNow(); @@ -862,7 +862,7 @@ public class LocalRunnerClientTest { Assertions.assertTrue(hasActionKey(existedMetaActions, key -> key.startsWith("playwright::"))); MetaAction metaAction = buildMetaAction(MetaActionType.MCP, "playwright", "browser_navigate", Map.of("url", "https://deepwiki.com/microsoft/vscode")); - client.run(metaAction); + client.submit(metaAction); Assertions.assertNotEquals(MetaAction.ResultStatus.WAITING, metaAction.getResult().getStatus()); } finally { executor.shutdownNow(); From cd641ac8ddd60d1bca0958afca981fb4e280a6c9 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Wed, 28 Jan 2026 15:38:13 +0800 Subject: [PATCH 115/182] fix(ActionExecutor): correct phaser block logic in method execute --- .../modules/action/dispatcher/executor/ActionExecutor.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java index 68bc1d91..ab83feda 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java @@ -85,11 +85,12 @@ public class ActionExecutor extends AgentRunningSubModule Date: Wed, 28 Jan 2026 21:16:51 +0800 Subject: [PATCH 116/182] refactor(ActionExecutor): update type of history field in ActionData --- .../slhaf/partner/core/action/entity/ActionData.java | 6 +++--- .../action/dispatcher/executor/ActionExecutor.java | 10 +++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java index cecb17ff..5494a14b 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java @@ -1,9 +1,9 @@ package work.slhaf.partner.core.action.entity; -import cn.hutool.json.JSONObject; import lombok.Data; +import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.HistoryAction; -import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -37,7 +37,7 @@ public abstract class ActionData { * 行动结果 */ protected String result; - protected List history = new ArrayList<>(); + protected Map> history = new HashMap<>(); /** * 修复上下文 */ diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java index ab83feda..09741a0a 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java @@ -112,6 +112,7 @@ public class ActionExecutor extends AgentRunningSubModule { + val actionKey = metaAction.getKey(); try { val result = metaAction.getResult(); do { @@ -124,6 +125,13 @@ public class ActionExecutor extends AgentRunningSubModule new ArrayList<>()) + .add(historyAction); } else { val repairerInput = assemblyHelper.buildRepairerInput(historyActionResults, metaAction, userId); val repairerResult = actionRepairer.execute(repairerInput); @@ -150,7 +158,7 @@ public class ActionExecutor extends AgentRunningSubModule Date: Wed, 28 Jan 2026 23:00:53 +0800 Subject: [PATCH 117/182] refactor(ActionExecutor): remove useless method getHistoryActionResults --- .../dispatcher/executor/ActionExecutor.java | 26 +++---------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java index 09741a0a..71ef3e4a 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java @@ -117,8 +117,9 @@ public class ActionExecutor extends AgentRunningSubModule new ArrayList<>()) + .computeIfAbsent(executingStage, integer -> new ArrayList<>()) .add(historyAction); } else { val repairerInput = assemblyHelper.buildRepairerInput(historyActionResults, metaAction, userId); @@ -193,25 +194,6 @@ public class ActionExecutor extends AgentRunningSubModule getHistoryActionResults(ActionData actionData) { - int executingStage = actionData.getExecutingStage(); - if (executingStage <= 0) { - return new ArrayList<>(); - } - Map> actionChain = actionData.getActionChain(); - // executingStage 是当前正在执行的阶段,所以只需要获取到前一阶段的结果 - return actionChain.get(executingStage - 1).stream() - .map(metaAction -> { - HistoryAction historyAction = new HistoryAction(); - historyAction.setActionKey(metaAction.getKey()); - historyAction - .setDescription( - actionCapability.loadMetaActionInfo(metaAction.getKey()).getDescription()); - historyAction.setResult(metaAction.getResult().getData()); - return historyAction; - }).toList(); - } - private CorrectorInput buildCorrectorInput() { return null; } From d1ca1cda7d422f5b2bf3ecf9bf42a15060adaab0 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Wed, 28 Jan 2026 23:11:45 +0800 Subject: [PATCH 118/182] feature(ActionExecutor): complete CorrectorInput --- .../dispatcher/executor/ActionExecutor.java | 18 +++++++++++++----- .../executor/entity/CorrectorInput.java | 17 +++++++++++++++++ 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java index 71ef3e4a..bc24a781 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java @@ -18,7 +18,6 @@ import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.*; import java.util.ArrayList; import java.util.List; -import java.util.Map; import java.util.concurrent.ExecutorService; import java.util.concurrent.Phaser; @@ -92,8 +91,8 @@ public class ActionExecutor extends AgentRunningSubModule ++stageCount); @@ -194,8 +193,17 @@ public class ActionExecutor extends AgentRunningSubModule history; + private ActionData.ActionStatus status; + + private List recentMessages; + private List activatedSlices; } From 75145cc547e134fa279cc45d943dbfeff658519f Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 30 Jan 2026 16:30:10 +0800 Subject: [PATCH 119/182] chore(ActionRepairer): correct name of AssemblyHelper --- .../action/dispatcher/executor/ActionRepairer.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionRepairer.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionRepairer.java index 01d164db..96d3c471 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionRepairer.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionRepairer.java @@ -56,7 +56,7 @@ public class ActionRepairer extends AgentRunningSubModule Date: Fri, 30 Jan 2026 16:50:45 +0800 Subject: [PATCH 120/182] fix(ActivateModel): correct modelSettings --- .../agent/runtime/interaction/flow/abstracts/ActivateModel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Partner-Api/src/main/java/work/slhaf/partner/api/agent/runtime/interaction/flow/abstracts/ActivateModel.java b/Partner-Api/src/main/java/work/slhaf/partner/api/agent/runtime/interaction/flow/abstracts/ActivateModel.java index 2b8a222d..022876f6 100644 --- a/Partner-Api/src/main/java/work/slhaf/partner/api/agent/runtime/interaction/flow/abstracts/ActivateModel.java +++ b/Partner-Api/src/main/java/work/slhaf/partner/api/agent/runtime/interaction/flow/abstracts/ActivateModel.java @@ -23,7 +23,7 @@ public interface ActivateModel { ModelConfig modelConfig = AgentConfigManager.INSTANCE.loadModelConfig(modelKey()); model.setBaseMessages(withBasicPrompt() ? loadSpecificPromptAndBasicPrompt(modelKey()) : loadSpecificPrompt(modelKey())); model.setChatClient(new ChatClient(modelConfig.getBaseUrl(), modelConfig.getApikey(), modelConfig.getModel())); - ((Module) this).setModel(model); + setModel(model); } default void updateModelSettings(ChatClient newChatClient) { From a1b4743eebe4eacb0238972df3ad82469f9a4767 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 30 Jan 2026 19:19:48 +0800 Subject: [PATCH 121/182] feat(ActionCorrector): complete corrector's executing logic --- .../dispatcher/executor/ActionCorrector.java | 28 +++++++++++++++++-- .../dispatcher/executor/ActionExecutor.java | 3 +- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionCorrector.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionCorrector.java index a040d309..481f851b 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionCorrector.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionCorrector.java @@ -1,5 +1,7 @@ package work.slhaf.partner.module.modules.action.dispatcher.executor; +import com.alibaba.fastjson2.JSONObject; +import lombok.val; import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule; import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.ActivateModel; import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.AgentRunningSubModule; @@ -13,13 +15,33 @@ import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.Corre public class ActionCorrector extends AgentRunningSubModule implements ActivateModel { @Override - public CorrectorResult execute(CorrectorInput data) { - return null; + public CorrectorResult execute(CorrectorInput input) { + val prompt = buildPrompt(input); + val chatResponse = singleChat(prompt); + return JSONObject.parseObject(chatResponse.getMessage(), CorrectorResult.class); + } + + private String buildPrompt(CorrectorInput input) { + val prompt = new JSONObject(); + prompt.put("[行动来源]", input.getSource()); + prompt.put("[行动倾向]", input.getTendency()); + prompt.put("[行动描述]", input.getDescription()); + prompt.put("[行动原因]", input.getReason()); + + val messages = prompt.putArray("[近期对话]"); + messages.addAll(input.getRecentMessages()); + + val memory = prompt.putArray("[已激活记忆]"); + memory.addAll(input.getActivatedSlices()); + + val history = prompt.putArray("[已执行情况]"); + history.addAll(input.getHistory()); + return prompt.toJSONString(); } @Override public String modelKey() { - return ""; + return "action_corrector"; } @Override diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java index bc24a781..9bd93691 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java @@ -93,7 +93,8 @@ public class ActionExecutor extends AgentRunningSubModule ++stageCount); // 结束 From 77eb9b92a434ba88da7deab26cb7a452e651c259 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 30 Jan 2026 20:10:01 +0800 Subject: [PATCH 122/182] refactor(ActionCorrector): move intervention logic from InterventionHandler into ActionCapability --- .../partner/core/action/ActionCapability.java | 3 + .../slhaf/partner/core/action/ActionCore.java | 127 +++++++++++++++ .../handler/InterventionHandler.java | 147 +----------------- 3 files changed, 132 insertions(+), 145 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java index 743baea0..f7955c14 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java @@ -8,6 +8,7 @@ import work.slhaf.partner.core.action.entity.MetaActionInfo; import work.slhaf.partner.core.action.entity.PhaserRecord; import work.slhaf.partner.core.action.entity.cache.CacheAdjustData; import work.slhaf.partner.core.action.runner.SandboxRunnerClient; +import work.slhaf.partner.module.modules.action.interventor.entity.MetaIntervention; import java.util.List; import java.util.Map; @@ -49,4 +50,6 @@ public interface ActionCapability { boolean checkExists(String... actionKeys); SandboxRunnerClient runnerClient(); + + void handleInterventions(List interventions, T data); } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java index 9b6397db..22baffa4 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java @@ -14,6 +14,8 @@ import work.slhaf.partner.core.action.exception.ActionDataNotFoundException; import work.slhaf.partner.core.action.exception.MetaActionNotFoundException; import work.slhaf.partner.core.action.runner.RunnerClient; import work.slhaf.partner.core.action.runner.SandboxRunnerClient; +import work.slhaf.partner.module.modules.action.interventor.entity.InterventionType; +import work.slhaf.partner.module.modules.action.interventor.entity.MetaIntervention; import java.io.IOException; import java.util.*; @@ -259,6 +261,131 @@ public class ActionCore extends PartnerCore { return runnerClient; } + @CapabilityMethod + public void handleInterventions(List interventions, T data) { + // 加载数据 + Phaser phaser = null; + ActionData actionData = switch (data) { + case PhaserRecord record -> { + phaser = record.phaser(); + yield record.actionData(); + } + case ActionData tempData -> tempData; + default -> null; + }; + if (actionData == null) { + return; + } + + // 加锁确保同步 + synchronized (actionData) { + applyInterventions(interventions, actionData, phaser); + } + } + + private void applyInterventions(List interventions, ActionData actionData, Phaser phaser) { + boolean rebuildCleanTag = false; + + interventions.sort(Comparator.comparingInt(MetaIntervention::getOrder)); + + for (MetaIntervention intervention : interventions) { + List actions = intervention.getActions() + .stream() + .map(this::loadMetaAction) + .toList(); + + switch (intervention.getType()) { + case InterventionType.APPEND -> handleAppend(actionData, intervention.getOrder(), actions); + case InterventionType.INSERT -> handleInsert(actionData, intervention.getOrder(), actions, phaser); + case InterventionType.DELETE -> handleDelete(actionData, intervention.getOrder(), actions); + case InterventionType.CANCEL -> handleCancel(actionData); + case InterventionType.REBUILD -> { + if (!rebuildCleanTag) { + cleanActionData(actionData); + rebuildCleanTag = true; + } + handleRebuild(actionData, intervention.getOrder(), actions); + } + } + } + + } + + /** + * 在未进入执行阶段的行动单元组新增新的行动 + */ + private void handleAppend(ActionData actionData, int order, List actions) { + if (order <= actionData.getExecutingStage()) + return; + + actionData.getActionChain().put(order, actions); + } + + /** + * 在未进入执行阶段和正处于行动阶段的行动单元组插入新的行动, 如果插入位置正处于执行阶段, 则启动执行线程, 通过 Phaser 确保同步 + */ + private void handleInsert(ActionData actionData, int order, List actions, Phaser phaser) { + if (order < actionData.getExecutingStage()) + return; + + phaser.register(); + try { + Map> actionChain = actionData.getActionChain(); + actionChain.put(order, actions); + + if (order == actionData.getExecutingStage()) { + ExecutorService virtualExecutor = this.getExecutor(ExecutorType.VIRTUAL); + ExecutorService platformExecutor = this.getExecutor(ExecutorType.PLATFORM); + ExecutorService executor; + phaser.bulkRegister(actions.size()); + + for (MetaAction action : actions) { + executor = action.isIo() ? virtualExecutor : platformExecutor; + executor.execute(() -> { + try { + runnerClient.submit(action); + } finally { + phaser.arriveAndDeregister(); + } + }); + } + + } + } finally { + phaser.arriveAndDeregister(); + } + } + + private void handleDelete(ActionData actionData, int order, List actions) { + if (order <= actionData.getExecutingStage()) + return; + + Map> actionChain = actionData.getActionChain(); + if (actionChain.containsKey(order)) { + actionChain.get(order).removeAll(actions); + if (actionChain.get(order).isEmpty()) { + actionChain.remove(order); + } + } + } + + private void handleCancel(ActionData actionData) { + actionData.setStatus(ActionData.ActionStatus.FAILED); + actionData.setResult("行动取消"); + } + + private void handleRebuild(ActionData actionData, int order, List actions) { + Map> actionChain = actionData.getActionChain(); + actionChain.put(order, actions); + } + + private void cleanActionData(ActionData actionData) { + actionData.getActionChain().clear(); + actionData.setExecutingStage(0); + actionData.setStatus(ActionData.ActionStatus.PREPARE); + actionData.getHistory().clear(); + } + /** * 命中缓存且评估通过时 * diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/InterventionHandler.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/InterventionHandler.java index 2973de07..dad7402b 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/InterventionHandler.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/InterventionHandler.java @@ -3,27 +3,17 @@ package work.slhaf.partner.module.modules.action.interventor.handler; import lombok.extern.slf4j.Slf4j; import work.slhaf.partner.api.agent.factory.capability.annotation.InjectCapability; import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule; -import work.slhaf.partner.api.agent.factory.module.annotation.Init; import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.AgentRunningSubModule; import work.slhaf.partner.core.action.ActionCapability; import work.slhaf.partner.core.action.ActionCore.ExecutorType; -import work.slhaf.partner.core.action.entity.ActionData; -import work.slhaf.partner.core.action.entity.ActionData.ActionStatus; -import work.slhaf.partner.core.action.entity.MetaAction; -import work.slhaf.partner.core.action.entity.PhaserRecord; -import work.slhaf.partner.core.action.runner.SandboxRunnerClient; -import work.slhaf.partner.module.modules.action.interventor.entity.InterventionType; import work.slhaf.partner.module.modules.action.interventor.entity.MetaIntervention; import work.slhaf.partner.module.modules.action.interventor.handler.entity.HandlerInput; import work.slhaf.partner.module.modules.action.interventor.handler.entity.HandlerInput.ExecutingInterventionData; import work.slhaf.partner.module.modules.action.interventor.handler.entity.HandlerInput.InterventionData; import work.slhaf.partner.module.modules.action.interventor.handler.entity.HandlerInput.PreparedInterventionData; -import java.util.Comparator; import java.util.List; -import java.util.Map; import java.util.concurrent.ExecutorService; -import java.util.concurrent.Phaser; @Slf4j @AgentSubModule @@ -32,13 +22,6 @@ public class InterventionHandler extends AgentRunningSubModule interventions = interventionData.getInterventions(); if (interventionData instanceof ExecutingInterventionData data) { - handleInterventions(interventions, data.getRecord()); + actionCapability.handleInterventions(interventions, data.getRecord()); } else if (interventionData instanceof PreparedInterventionData data) { - handleInterventions(interventions, data.getActionData()); + actionCapability.handleInterventions(interventions, data.getActionData()); } }); }); } - - private void handleInterventions(List interventions, T data) { - // 加载数据 - Phaser phaser = null; - ActionData actionData = switch (data) { - case PhaserRecord record -> { - phaser = record.phaser(); - yield record.actionData(); - } - case ActionData tempData -> tempData; - default -> null; - }; - if (actionData == null) { - return; - } - - // 加锁确保同步 - synchronized (actionData) { - applyInterventions(interventions, actionData, phaser); - } - } - - private void applyInterventions(List interventions, ActionData actionData, Phaser phaser) { - boolean rebuildCleanTag = false; - - interventions.sort(Comparator.comparingInt(MetaIntervention::getOrder)); - - for (MetaIntervention intervention : interventions) { - List actions = intervention.getActions() - .stream() - .map(actionKey -> actionCapability.loadMetaAction(actionKey)) - .toList(); - - // TODO 需要将干预逻辑下放至 ActionCapability ,因为 ActionExecutor 中也存在干预操作 - switch (intervention.getType()) { - case InterventionType.APPEND -> handleAppend(actionData, intervention.getOrder(), actions); - case InterventionType.INSERT -> handleInsert(actionData, intervention.getOrder(), actions, phaser); - case InterventionType.DELETE -> handleDelete(actionData, intervention.getOrder(), actions); - case InterventionType.CANCEL -> handleCancel(actionData); - case InterventionType.REBUILD -> { - if (!rebuildCleanTag) { - cleanActionData(actionData); - rebuildCleanTag = true; - } - handleRebuild(actionData, intervention.getOrder(), actions); - } - } - } - - } - - /** - * 在未进入执行阶段的行动单元组新增新的行动 - */ - private void handleAppend(ActionData actionData, int order, List actions) { - if (order <= actionData.getExecutingStage()) - return; - - actionData.getActionChain().put(order, actions); - } - - /** - * 在未进入执行阶段和正处于行动阶段的行动单元组插入新的行动, 如果插入位置正处于执行阶段, 则启动执行线程, 通过 Phaser 确保同步 - */ - private void handleInsert(ActionData actionData, int order, List actions, Phaser phaser) { - if (order < actionData.getExecutingStage()) - return; - - phaser.register(); - try { - Map> actionChain = actionData.getActionChain(); - actionChain.put(order, actions); - - if (order == actionData.getExecutingStage()) { - ExecutorService virtualExecutor = actionCapability.getExecutor(ExecutorType.VIRTUAL); - ExecutorService platformExecutor = actionCapability.getExecutor(ExecutorType.PLATFORM); - ExecutorService executor; - phaser.bulkRegister(actions.size()); - - for (MetaAction action : actions) { - executor = action.isIo() ? virtualExecutor : platformExecutor; - executor.execute(() -> { - try { - runnerClient.submit(action); - } finally { - phaser.arriveAndDeregister(); - } - }); - } - - } - } finally { - phaser.arriveAndDeregister(); - } - } - - private void handleDelete(ActionData actionData, int order, List actions) { - if (order <= actionData.getExecutingStage()) - return; - - Map> actionChain = actionData.getActionChain(); - if (actionChain.containsKey(order)) { - actionChain.get(order).removeAll(actions); - if (actionChain.get(order).isEmpty()) { - actionChain.remove(order); - } - } - } - - private void handleCancel(ActionData actionData) { - actionData.setStatus(ActionStatus.FAILED); - actionData.setResult("行动取消"); - } - - private void handleRebuild(ActionData actionData, int order, List actions) { - Map> actionChain = actionData.getActionChain(); - actionChain.put(order, actions); - } - - private void cleanActionData(ActionData actionData) { - actionData.getActionChain().clear(); - actionData.setExecutingStage(0); - actionData.setStatus(ActionStatus.PREPARE); - actionData.getHistory().clear(); - } - } From 63d1552de22e6f3c19b9e1e89d0fc2c39e00b864 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 30 Jan 2026 20:52:36 +0800 Subject: [PATCH 123/182] refactor(ActionInterventor): remove InterventionHandler and related data class Context: Since last commit, the logic of interventions has been moved into ActionCapability, the InterventionHandler is not needed. --- .../action/interventor/ActionInterventor.java | 90 ++++--------------- .../evaluator/entity/EvaluatorResult.java | 2 +- .../handler/InterventionHandler.java | 58 ------------ .../handler/entity/HandlerInput.java | 39 -------- 4 files changed, 19 insertions(+), 170 deletions(-) delete mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/InterventionHandler.java delete mode 100644 Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/entity/HandlerInput.java diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/ActionInterventor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/ActionInterventor.java index 92f68ba8..2e64f934 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/ActionInterventor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/ActionInterventor.java @@ -2,13 +2,13 @@ package work.slhaf.partner.module.modules.action.interventor; import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; +import lombok.val; import work.slhaf.partner.api.agent.factory.capability.annotation.InjectCapability; import work.slhaf.partner.api.agent.factory.module.annotation.AgentModule; import work.slhaf.partner.api.agent.factory.module.annotation.InjectModule; import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.ActivateModel; import work.slhaf.partner.core.action.ActionCapability; -import work.slhaf.partner.core.action.entity.ActionData; -import work.slhaf.partner.core.action.entity.PhaserRecord; +import work.slhaf.partner.core.action.ActionCore; import work.slhaf.partner.core.cognation.CognationCapability; import work.slhaf.partner.core.memory.MemoryCapability; import work.slhaf.partner.module.common.module.PreRunningModule; @@ -18,11 +18,6 @@ import work.slhaf.partner.module.modules.action.interventor.evaluator.Interventi import work.slhaf.partner.module.modules.action.interventor.evaluator.entity.EvaluatorInput; import work.slhaf.partner.module.modules.action.interventor.evaluator.entity.EvaluatorResult; import work.slhaf.partner.module.modules.action.interventor.evaluator.entity.EvaluatorResult.EvaluatedInterventionData; -import work.slhaf.partner.module.modules.action.interventor.handler.InterventionHandler; -import work.slhaf.partner.module.modules.action.interventor.handler.entity.HandlerInput; -import work.slhaf.partner.module.modules.action.interventor.handler.entity.HandlerInput.ExecutingInterventionData; -import work.slhaf.partner.module.modules.action.interventor.handler.entity.HandlerInput.InterventionData; -import work.slhaf.partner.module.modules.action.interventor.handler.entity.HandlerInput.PreparedInterventionData; import work.slhaf.partner.module.modules.action.interventor.recognizer.InterventionRecognizer; import work.slhaf.partner.module.modules.action.interventor.recognizer.entity.RecognizerInput; import work.slhaf.partner.module.modules.action.interventor.recognizer.entity.RecognizerResult; @@ -32,7 +27,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.function.Supplier; import java.util.stream.Stream; /** @@ -45,8 +39,6 @@ public class ActionInterventor extends PreRunningModule implements ActivateModel private InterventionRecognizer interventionRecognizer; @InjectModule private InterventionEvaluator interventionEvaluator; - @InjectModule - private InterventionHandler interventionHandler; @InjectCapability private ActionCapability actionCapability; @@ -92,21 +84,33 @@ public class ActionInterventor extends PreRunningModule implements ActivateModel invalidActionKeysFilter(executingDataList); invalidActionKeysFilter(preparedDataList); - // 同步写入prompt,异步处理干预行为,‘异步’在 interventionHandler 中体现 + // 同步写入prompt,异步处理干预行为,‘异步’在处理流程中体现 promptHelper.setupInterventionPrompt(uuid, executingDataList, preparedDataList); - interventionHandler.execute(assemblyHelper.buildHandlerInput(executingDataList, preparedDataList, recognizerResult)); + handleInterventions(executingDataList, recognizerResult.getExecutingInterventions()); + handleInterventions(preparedDataList, recognizerResult.getPreparedInterventions()); } else { promptHelper.setupInterventionIgnoredPrompt(uuid, executingDataList, preparedDataList); } } + private void handleInterventions(List interventionDataList, Map interventionDataMap) { + val executor = actionCapability.getExecutor(ActionCore.ExecutorType.PLATFORM); + executor.execute(() -> { + for (EvaluatedInterventionData interventionData : interventionDataList) { + // 此处拿到的为 ActionData 或者 PhaserRecord, 来自 Recognizer 的封装 + val data = interventionDataMap.get(interventionData.getTendency()); + actionCapability.handleInterventions(interventionData.getMetaInterventionList(), data); + } + }); + } + private void invalidActionKeysFilter(List interventions) { List toRemove = new ArrayList<>(); for (EvaluatedInterventionData intervention : interventions) { - List interventionData = intervention.getInterventionData(); + List interventionData = intervention.getMetaInterventionList(); List actions = new ArrayList<>(); for (MetaIntervention metaData : interventionData) { actions.addAll(metaData.getActions()); @@ -163,64 +167,6 @@ public class ActionInterventor extends PreRunningModule implements ActivateModel private AssemblyHelper() { } - /** - * @param executingDataList 对应评估结果中的‘执行中行动’ - * @param preparedDataList 对应评估结果中的‘待执行行动’ - * @param recognizerResult 干预识别结果,包含‘执行中’‘待执行’两类评估结果各自对应的行动数据 - * @return 处理器输入 - */ - private HandlerInput buildHandlerInput(List executingDataList, - List preparedDataList, RecognizerResult recognizerResult) { - HandlerInput input = new HandlerInput(); - Map executingInterventions = recognizerResult.getExecutingInterventions(); - Map preparedInterventions = recognizerResult.getPreparedInterventions(); - - List executing = setupInputDataList(executingDataList, executingInterventions, - ExecutingInterventionData::new); - List prepared = setupInputDataList(preparedDataList, preparedInterventions, - PreparedInterventionData::new); - - input.setExecuting(executing); - input.setPrepared(prepared); - - return input; - } - - /** - * @param HandlerInput 中 List 对应的泛型 - * @param evaluatedDataList 评估结果列表 - * @param interventionMap 干预识别结果中的 tendency:data 映射 - * @param factory 输入类型构建工厂 - * @return 处理器输入(干预列表) - */ - private List setupInputDataList(List evaluatedDataList, - Map interventionMap, Supplier factory) { - - List result = new ArrayList<>(); - - for (EvaluatedInterventionData interventionData : evaluatedDataList) { - - I data = factory.get(); - - if (data instanceof InterventionData inputData) { - inputData.setTendency(interventionData.getTendency()); - inputData.setDescription(interventionData.getDescription()); - inputData.setInterventions(interventionData.getInterventionData()); - } - - if (data instanceof ExecutingInterventionData inputData) { - inputData.setRecord((PhaserRecord) interventionMap.get(interventionData.getTendency())); - } else if (data instanceof PreparedInterventionData inputData) { - inputData.setActionData((ActionData) interventionMap.get(interventionData.getTendency())); - } - - result.add(data); - } - - return result; - } - - private RecognizerInput buildRecognizerInput(String userId, String input) { RecognizerInput recognizerInput = new RecognizerInput(); recognizerInput.setInput(input); @@ -279,7 +225,7 @@ public class ActionInterventor extends PreRunningModule implements ActivateModel newElement.put("[干预倾向]", tendency); JSONArray changes = newElement.putArray("[行动链变动情况]"); - for (MetaIntervention intervention : data.getInterventionData()) { + for (MetaIntervention intervention : data.getMetaInterventionList()) { JSONObject change = changes.addObject(); change.put("[干预类型]", intervention.getType()); change.put("[干预序号]", intervention.getOrder()); diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/entity/EvaluatorResult.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/entity/EvaluatorResult.java index 5b927992..bd249426 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/entity/EvaluatorResult.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/entity/EvaluatorResult.java @@ -28,6 +28,6 @@ public class EvaluatorResult { * 描述信息(包括通过、失败原因) */ private String description; - private List interventionData; + private List metaInterventionList; } } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/InterventionHandler.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/InterventionHandler.java deleted file mode 100644 index dad7402b..00000000 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/InterventionHandler.java +++ /dev/null @@ -1,58 +0,0 @@ -package work.slhaf.partner.module.modules.action.interventor.handler; - -import lombok.extern.slf4j.Slf4j; -import work.slhaf.partner.api.agent.factory.capability.annotation.InjectCapability; -import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule; -import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.AgentRunningSubModule; -import work.slhaf.partner.core.action.ActionCapability; -import work.slhaf.partner.core.action.ActionCore.ExecutorType; -import work.slhaf.partner.module.modules.action.interventor.entity.MetaIntervention; -import work.slhaf.partner.module.modules.action.interventor.handler.entity.HandlerInput; -import work.slhaf.partner.module.modules.action.interventor.handler.entity.HandlerInput.ExecutingInterventionData; -import work.slhaf.partner.module.modules.action.interventor.handler.entity.HandlerInput.InterventionData; -import work.slhaf.partner.module.modules.action.interventor.handler.entity.HandlerInput.PreparedInterventionData; - -import java.util.List; -import java.util.concurrent.ExecutorService; - -@Slf4j -@AgentSubModule -public class InterventionHandler extends AgentRunningSubModule { - - @InjectCapability - private ActionCapability actionCapability; - - /** - * 针对‘行动干预’做出处理 - * - * @param data 行动干预输入 - * @return 无返回值 - */ - @Override - public Void execute(HandlerInput data) { - ExecutorService executor = actionCapability.getExecutor(ExecutorType.VIRTUAL); - handle(data.getExecuting(), executor); - handle(data.getPrepared(), executor); - return null; - } - - private void handle(List executing, ExecutorService executor) { - executor.execute(() -> { - executing.forEach(interventionData -> { - // 干预逻辑一致 - // 同步操作不同 - // HandlerAction 抽取同步逻辑 - // 此处进行遍历 intervention - // 根据Intervention类型进行分发 - - List interventions = interventionData.getInterventions(); - if (interventionData instanceof ExecutingInterventionData data) { - actionCapability.handleInterventions(interventions, data.getRecord()); - } else if (interventionData instanceof PreparedInterventionData data) { - actionCapability.handleInterventions(interventions, data.getActionData()); - } - - }); - }); - } -} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/entity/HandlerInput.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/entity/HandlerInput.java deleted file mode 100644 index 851e618d..00000000 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/handler/entity/HandlerInput.java +++ /dev/null @@ -1,39 +0,0 @@ -package work.slhaf.partner.module.modules.action.interventor.handler.entity; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import work.slhaf.partner.core.action.entity.ActionData; -import work.slhaf.partner.core.action.entity.PhaserRecord; -import work.slhaf.partner.module.modules.action.interventor.entity.MetaIntervention; - -import java.util.List; - -@Data -public class HandlerInput { - - private List executing; - private List prepared; - - @Data - @EqualsAndHashCode(callSuper = true) - public static class ExecutingInterventionData extends InterventionData { - private PhaserRecord record; - } - - @Data - @EqualsAndHashCode(callSuper = true) - public static class PreparedInterventionData extends InterventionData { - private ActionData actionData; - } - - /** - * 针对一个干预倾向而言,有可能针对一个行动数据做出多种、不同类型的干预操作,即封装为 InterventionData 内部的 MetaIntervention 列表 - */ - @Data - public static abstract class InterventionData { - protected String tendency; - protected String description; - protected List interventions; - } - -} From 04e8d9e5310e13e91da1c6352cbd7e637bb99391 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 30 Jan 2026 20:58:12 +0800 Subject: [PATCH 124/182] feat(ActionExecutor): support executing interventions in ActionExecutor --- .../modules/action/dispatcher/executor/ActionExecutor.java | 2 +- .../action/dispatcher/executor/entity/CorrectorResult.java | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java index 9bd93691..da46c9b8 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java @@ -94,7 +94,7 @@ public class ActionExecutor extends AgentRunningSubModule ++stageCount); // 结束 diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/CorrectorResult.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/CorrectorResult.java index b65a2269..a2c267e2 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/CorrectorResult.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/CorrectorResult.java @@ -1,7 +1,11 @@ package work.slhaf.partner.module.modules.action.dispatcher.executor.entity; import lombok.Data; +import work.slhaf.partner.module.modules.action.interventor.entity.MetaIntervention; + +import java.util.List; @Data public class CorrectorResult { + private List metaInterventionList; } From 346f925b661cb7eecf2c1e31b56835a7f353f378 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sat, 31 Jan 2026 23:35:17 +0800 Subject: [PATCH 125/182] chore(ActionExecutor): update comment --- .../modules/action/dispatcher/executor/ActionExecutor.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java index da46c9b8..bdd591d1 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java @@ -155,9 +155,6 @@ public class ActionExecutor extends AgentRunningSubModule Date: Sun, 1 Feb 2026 14:56:47 +0800 Subject: [PATCH 126/182] build(maven): import Mockito related dependencies --- Partner-Main/pom.xml | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/Partner-Main/pom.xml b/Partner-Main/pom.xml index f9e3db57..2cee853b 100644 --- a/Partner-Main/pom.xml +++ b/Partner-Main/pom.xml @@ -1,7 +1,7 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 work.slhaf @@ -54,13 +54,22 @@ work.slhaf Partner-Common 0.5.0 - test + compile - work.slhaf - Partner-Common - 0.5.0 - compile + org.mockito + mockito-core + 5.20.0 + + + org.mockito + mockito-junit-jupiter + 5.20.0 + + + org.mockito + mockito-inline + 5.2.0 @@ -84,7 +93,7 @@ + implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> work.slhaf.partner.Main From eec8f71096a5764cf5700e452b55fa64ccbf95de Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sun, 1 Feb 2026 16:43:12 +0800 Subject: [PATCH 127/182] fix(action): correct return type of method runnerClient() in ActionCapability --- .../java/work/slhaf/partner/core/action/ActionCapability.java | 4 ++-- .../modules/action/dispatcher/executor/ActionRepairer.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java index f7955c14..5bf38865 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java @@ -7,7 +7,7 @@ import work.slhaf.partner.core.action.entity.MetaAction; import work.slhaf.partner.core.action.entity.MetaActionInfo; import work.slhaf.partner.core.action.entity.PhaserRecord; import work.slhaf.partner.core.action.entity.cache.CacheAdjustData; -import work.slhaf.partner.core.action.runner.SandboxRunnerClient; +import work.slhaf.partner.core.action.runner.RunnerClient; import work.slhaf.partner.module.modules.action.interventor.entity.MetaIntervention; import java.util.List; @@ -49,7 +49,7 @@ public interface ActionCapability { boolean checkExists(String... actionKeys); - SandboxRunnerClient runnerClient(); + RunnerClient runnerClient(); void handleInterventions(List interventions, T data); } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionRepairer.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionRepairer.java index 96d3c471..60a88569 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionRepairer.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionRepairer.java @@ -17,7 +17,7 @@ import work.slhaf.partner.core.action.ActionCore.ExecutorType; import work.slhaf.partner.core.action.entity.MetaAction; import work.slhaf.partner.core.action.entity.MetaAction.Result; import work.slhaf.partner.core.action.entity.MetaAction.ResultStatus; -import work.slhaf.partner.core.action.runner.SandboxRunnerClient; +import work.slhaf.partner.core.action.runner.RunnerClient; import work.slhaf.partner.core.cognation.CognationCapability; import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.GeneratorInput; import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.GeneratorResult; @@ -57,7 +57,7 @@ public class ActionRepairer extends AgentRunningSubModule Date: Sun, 1 Feb 2026 19:49:21 +0800 Subject: [PATCH 128/182] test(ActionExecutor): add unit test for ActionExecutor --- .../executor/ActionExecutorTest.java | 431 ++++++++++++++++++ 1 file changed, 431 insertions(+) create mode 100644 Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java diff --git a/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java b/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java new file mode 100644 index 00000000..472f0566 --- /dev/null +++ b/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java @@ -0,0 +1,431 @@ +package work.slhaf.partner.module.modules.action.dispatcher.executor; + +import org.junit.jupiter.api.*; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import work.slhaf.partner.core.action.ActionCapability; +import work.slhaf.partner.core.action.ActionCore; +import work.slhaf.partner.core.action.entity.*; +import work.slhaf.partner.core.action.runner.RunnerClient; +import work.slhaf.partner.core.cognation.CognationCapability; +import work.slhaf.partner.core.memory.MemoryCapability; +import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.ActionExecutorInput; +import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.CorrectorResult; +import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.ExtractorResult; +import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.RepairerResult; + +import java.util.*; +import java.util.concurrent.*; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.*; + +/** + * 测试矩阵(与文档一致): + * 1) 单行动-单阶段-单MetaAction成功(已覆盖) + * 2) 多行动并发执行(未覆盖:需并发稳定性/线程调度控制) + * 3) status 非 PREPARE 直接返回(已覆盖) + * 4) 多阶段顺序执行(已覆盖) + * 5) IO 行动使用虚拟线程池(已覆盖) + * 6) extractor 失败 -> repairer OK -> 再成功(已覆盖) + * 7) extractor 失败 -> repairer FAILED(已覆盖) + * 8) extractor 失败 -> repairer ACQUIRE 阻塞后恢复(已覆盖) + * 9) runnerClient.submit 抛异常(未覆盖:需更精细的异常吞吐与线程结束校验) + * 10) paramsExtractor.execute 抛异常(未覆盖:与 #9 类似,需更精细的异常吞吐校验) + * 11) corrector.execute 抛异常导致资源未清理(已标记已知缺陷,@Disabled) + * 12) actionChain 为空导致异常与泄漏(已标记已知缺陷,@Disabled) + * 13) metaActions 为空导致 awaitAdvance 阻塞(未覆盖:更适合集成/压测) + * 17) result 状态不更新导致循环不退出(未覆盖:更适合集成/压测) + * 18) 同 stage 多 metaAction 并发完成顺序不固定(未覆盖:更适合集成/压测) + */ +@SuppressWarnings("unused") +@ExtendWith(MockitoExtension.class) +class ActionExecutorTest { + + @Mock + ActionCapability actionCapability; + @Mock + MemoryCapability memoryCapability; + @Mock + CognationCapability cognationCapability; + @Mock + ParamsExtractor paramsExtractor; + @Mock + ActionRepairer actionRepairer; + @Mock + ActionCorrector actionCorrector; + @Mock + RunnerClient runnerClient; + + @InjectMocks + ActionExecutor actionExecutor; + + @BeforeEach + void setUp() { + when(cognationCapability.getChatMessages()).thenReturn(Collections.emptyList()); + when(memoryCapability.getActivatedSlices(anyString())).thenReturn(Collections.emptyList()); + when(actionCapability.putPhaserRecord(any(Phaser.class), any(ActionData.class))) + .thenAnswer(inv -> new PhaserRecord(inv.getArgument(0), inv.getArgument(1))); + when(actionCapability.loadMetaActionInfo(anyString())).thenAnswer(inv -> { + MetaActionInfo info = new MetaActionInfo(); + info.setDescription("desc"); + info.setParams(Collections.emptyMap()); + return info; + }); + CorrectorResult correctorResult = new CorrectorResult(); + correctorResult.setMetaInterventionList(Collections.emptyList()); + when(actionCorrector.execute(any())).thenReturn(correctorResult); + doNothing().when(actionCapability).handleInterventions(any(), any()); + } + + // 场景1:B1 -> B3 -> B4 -> B7(成功) -> B10。目的:验证正常主路径与资源清理。 + @Test + void execute_singleAction_singleStage_success() { + ExecutorService directExecutor = new DirectExecutorService(); + stubExecutors(directExecutor, directExecutor); + + ImmediateActionData actionData = buildActionData(singleStageChain(false)); + ActionExecutorInput input = buildInput("u1", actionData); + + ExtractorResult extractorResult = new ExtractorResult(); + extractorResult.setOk(true); + when(paramsExtractor.execute(any())).thenReturn(extractorResult); + doAnswer(inv -> { + MetaAction metaAction = inv.getArgument(0); + metaAction.getResult().setStatus(MetaAction.ResultStatus.SUCCESS); + return null; + }).when(runnerClient).submit(any(MetaAction.class)); + + actionExecutor.init(); + actionExecutor.execute(input); + + verify(runnerClient, times(1)).submit(any(MetaAction.class)); + verify(actionCapability, times(1)).removePhaserRecord(any(Phaser.class)); + assertEquals(ActionData.ActionStatus.SUCCESS, actionData.getStatus()); + assertEquals(1, actionData.getHistory().get(0).size()); + } + + // 场景3:B1 -> B2。目的:验证非 PREPARE 不执行任何子任务。 + @Test + void execute_statusNotPrepare_shouldSkip() { + ExecutorService directExecutor = new DirectExecutorService(); + stubExecutors(directExecutor, directExecutor); + + ImmediateActionData actionData = buildActionData(singleStageChain(false)); + actionData.setStatus(ActionData.ActionStatus.EXECUTING); + ActionExecutorInput input = buildInput("u1", actionData); + + actionExecutor.init(); + actionExecutor.execute(input); + + verify(actionCapability, never()).putPhaserRecord(any(Phaser.class), any(ActionData.class)); + verify(runnerClient, never()).submit(any(MetaAction.class)); + } + + // 场景4:B1 -> B3 -> B4(两轮) -> B7(成功) -> B10。目的:验证多阶段顺序执行。 + @Test + void execute_multiStage_success() { + ExecutorService directExecutor = new DirectExecutorService(); + stubExecutors(directExecutor, directExecutor); + + Map> chain = new HashMap<>(); + chain.put(0, List.of(buildMetaAction("a1", false))); + chain.put(1, List.of(buildMetaAction("a2", false))); + ImmediateActionData actionData = buildActionData(chain); + ActionExecutorInput input = buildInput("u1", actionData); + + ExtractorResult extractorResult = new ExtractorResult(); + extractorResult.setOk(true); + when(paramsExtractor.execute(any())).thenReturn(extractorResult); + doAnswer(inv -> { + MetaAction metaAction = inv.getArgument(0); + metaAction.getResult().setStatus(MetaAction.ResultStatus.SUCCESS); + return null; + }).when(runnerClient).submit(any(MetaAction.class)); + + actionExecutor.init(); + actionExecutor.execute(input); + + verify(runnerClient, times(2)).submit(any(MetaAction.class)); + verify(actionCorrector, times(2)).execute(any()); + assertEquals(2, actionData.getHistory().size()); + assertEquals(ActionData.ActionStatus.SUCCESS, actionData.getStatus()); + } + + // 场景5:B4.2。目的:验证 IO 行动使用虚拟线程池。 + @Test + void execute_ioMetaAction_usesVirtualExecutor() { + ExecutorService directExecutor = new DirectExecutorService(); + ExecutorService virtualExecutor = Executors.newSingleThreadExecutor(); + stubExecutors(directExecutor, virtualExecutor); + + ImmediateActionData actionData = buildActionData(singleStageChain(true)); + ActionExecutorInput input = buildInput("u1", actionData); + + ExtractorResult extractorResult = new ExtractorResult(); + extractorResult.setOk(true); + when(paramsExtractor.execute(any())).thenReturn(extractorResult); + doAnswer(inv -> { + MetaAction metaAction = inv.getArgument(0); + metaAction.getResult().setStatus(MetaAction.ResultStatus.SUCCESS); + return null; + }).when(runnerClient).submit(any(MetaAction.class)); + + actionExecutor.init(); + actionExecutor.execute(input); + + verify(actionCapability, times(1)).getExecutor(ActionCore.ExecutorType.VIRTUAL); + shutdownExecutor(virtualExecutor); + } + + // 场景6:B7.2(失败) -> repairer OK -> B7(成功)。目的:验证修复后成功与上下文追加。 + @Test + void execute_extractorFail_thenRepairOk_thenSuccess() { + ExecutorService directExecutor = new DirectExecutorService(); + stubExecutors(directExecutor, directExecutor); + + ImmediateActionData actionData = buildActionData(singleStageChain(false)); + ActionExecutorInput input = buildInput("u1", actionData); + + ExtractorResult fail = new ExtractorResult(); + fail.setOk(false); + ExtractorResult ok = new ExtractorResult(); + ok.setOk(true); + when(paramsExtractor.execute(any())).thenReturn(fail, ok); + + RepairerResult repairerResult = new RepairerResult(); + repairerResult.setStatus(RepairerResult.RepairerStatus.OK); + repairerResult.setFixedData(List.of("fix-1")); + when(actionRepairer.execute(any())).thenReturn(repairerResult); + + doAnswer(inv -> { + MetaAction metaAction = inv.getArgument(0); + metaAction.getResult().setStatus(MetaAction.ResultStatus.SUCCESS); + return null; + }).when(runnerClient).submit(any(MetaAction.class)); + + actionExecutor.init(); + actionExecutor.execute(input); + + assertEquals(1, actionData.getAdditionalContext().get(0).size()); + verify(runnerClient, times(1)).submit(any(MetaAction.class)); + } + + // 场景7:B7.2(失败) -> repairer FAILED。目的:验证失败分支不提交外部执行。 + @Test + void execute_extractorFail_thenRepairFailed() { + ExecutorService directExecutor = new DirectExecutorService(); + stubExecutors(directExecutor, directExecutor); + + ImmediateActionData actionData = buildActionData(singleStageChain(false)); + ActionExecutorInput input = buildInput("u1", actionData); + + ExtractorResult fail = new ExtractorResult(); + fail.setOk(false); + when(paramsExtractor.execute(any())).thenReturn(fail); + + RepairerResult repairerResult = new RepairerResult(); + repairerResult.setStatus(RepairerResult.RepairerStatus.FAILED); + when(actionRepairer.execute(any())).thenReturn(repairerResult); + + actionExecutor.init(); + actionExecutor.execute(input); + + MetaAction metaAction = actionData.getActionChain().get(0).get(0); + assertEquals(MetaAction.ResultStatus.FAILED, metaAction.getResult().getStatus()); + verify(runnerClient, never()).submit(any(MetaAction.class)); + } + + // 场景8:B7.2(ACQUIRE) -> interrupt 阻塞 -> 状态恢复 -> B7(成功)。目的:验证阻塞可恢复且不死锁。 + @Test + @Timeout(3) + void execute_extractorFail_thenAcquire_thenResume() throws Exception { + ExecutorService platformExecutor = Executors.newCachedThreadPool(); + ExecutorService virtualExecutor = Executors.newCachedThreadPool(); + stubExecutors(platformExecutor, virtualExecutor); + + ImmediateActionData actionData = buildActionData(singleStageChain(false)); + ActionExecutorInput input = buildInput("u1", actionData); + + ExtractorResult fail = new ExtractorResult(); + fail.setOk(false); + ExtractorResult ok = new ExtractorResult(); + ok.setOk(true); + when(paramsExtractor.execute(any())).thenReturn(fail, ok); + + RepairerResult repairerResult = new RepairerResult(); + repairerResult.setStatus(RepairerResult.RepairerStatus.ACQUIRE); + when(actionRepairer.execute(any())).thenReturn(repairerResult); + + doAnswer(inv -> { + MetaAction metaAction = inv.getArgument(0); + metaAction.getResult().setStatus(MetaAction.ResultStatus.SUCCESS); + return null; + }).when(runnerClient).submit(any(MetaAction.class)); + + CountDownLatch doneLatch = new CountDownLatch(1); + doAnswer(inv -> { + doneLatch.countDown(); + return null; + }).when(actionCapability).removePhaserRecord(any(Phaser.class)); + + ExecutorService resumeExecutor = Executors.newSingleThreadExecutor(); + resumeExecutor.execute(() -> { + while (actionData.getStatus() != ActionData.ActionStatus.INTERRUPTED) { + try { + Thread.sleep(10); + } catch (InterruptedException ignored) { + } + } + actionData.setStatus(ActionData.ActionStatus.EXECUTING); + }); + + actionExecutor.init(); + actionExecutor.execute(input); + + assertTrue(doneLatch.await(2, TimeUnit.SECONDS)); + shutdownExecutor(platformExecutor); + shutdownExecutor(virtualExecutor); + shutdownExecutor(resumeExecutor); + } + + // 场景11:B4.4 异常 -> 资源未清理(已知缺陷)。目的:暴露当前行为。 + @Disabled("known-issue: corrector 抛异常时未清理 phaser 记录") + @Tag("known-issue") + @Test + void execute_correctorThrows_shouldLeakPhaserRecord() { + ExecutorService directExecutor = new DirectExecutorService(); + stubExecutors(directExecutor, directExecutor); + + ImmediateActionData actionData = buildActionData(singleStageChain(false)); + ActionExecutorInput input = buildInput("u1", actionData); + + ExtractorResult ok = new ExtractorResult(); + ok.setOk(true); + when(paramsExtractor.execute(any())).thenReturn(ok); + doAnswer(inv -> { + MetaAction metaAction = inv.getArgument(0); + metaAction.getResult().setStatus(MetaAction.ResultStatus.SUCCESS); + return null; + }).when(runnerClient).submit(any(MetaAction.class)); + + doThrow(new RuntimeException("boom")).when(actionCorrector).execute(any()); + + actionExecutor.init(); + actionExecutor.execute(input); + + verify(actionCapability, never()).removePhaserRecord(any(Phaser.class)); + } + + // 场景12:B4.1 actionChain 为空导致异常(已知缺陷)。目的:暴露当前行为。 + @Disabled("known-issue: actionChain 为空导致 IndexOutOfBounds 与资源未清理") + @Tag("known-issue") + @Test + void execute_emptyActionChain_shouldFail() { + ExecutorService directExecutor = new DirectExecutorService(); + stubExecutors(directExecutor, directExecutor); + + ImmediateActionData actionData = buildActionData(new HashMap<>()); + ActionExecutorInput input = buildInput("u1", actionData); + + actionExecutor.init(); + actionExecutor.execute(input); + + verify(actionCapability, never()).removePhaserRecord(any(Phaser.class)); + } + + private void stubExecutors(ExecutorService platformExecutor, ExecutorService virtualExecutor) { + when(actionCapability.getExecutor(ActionCore.ExecutorType.PLATFORM)).thenReturn(platformExecutor); + when(actionCapability.getExecutor(ActionCore.ExecutorType.VIRTUAL)).thenReturn(virtualExecutor); + when(actionCapability.runnerClient()).thenReturn(runnerClient); + } + + private ActionExecutorInput buildInput(String userId, ImmediateActionData actionData) { + ActionExecutorInput input = new ActionExecutorInput(); + input.setUserId(userId); + input.setImmediateActions(List.of(actionData)); + return input; + } + + private ImmediateActionData buildActionData(Map> actionChain) { + ImmediateActionData actionData = new ImmediateActionData(); + actionData.setStatus(ActionData.ActionStatus.PREPARE); + actionData.setActionChain(actionChain); + actionData.setAdditionalContext(initAdditionalContext(actionChain)); + actionData.setReason("reason"); + actionData.setDescription("desc"); + actionData.setSource("source"); + actionData.setTendency("tendency"); + return actionData; + } + + private Map> singleStageChain(boolean io) { + Map> chain = new HashMap<>(); + chain.put(0, List.of(buildMetaAction("a1", io))); + return chain; + } + + private MetaAction buildMetaAction(String name, boolean io) { + MetaAction metaAction = new MetaAction(); + metaAction.setName(name); + metaAction.setLocation("loc"); + metaAction.setIo(io); + return metaAction; + } + + private Map> initAdditionalContext(Map> actionChain) { + Map> context = new HashMap<>(); + for (Integer stage : actionChain.keySet()) { + context.put(stage, new ArrayList<>()); + } + return context; + } + + private void shutdownExecutor(ExecutorService executor) { + executor.shutdownNow(); + try { + executor.awaitTermination(1, TimeUnit.SECONDS); + } catch (InterruptedException ignored) { + } + } + + private static final class DirectExecutorService extends AbstractExecutorService { + private volatile boolean shutdown; + + @Override + public void shutdown() { + shutdown = true; + } + + @Override + public List shutdownNow() { + shutdown = true; + return Collections.emptyList(); + } + + @Override + public boolean isShutdown() { + return shutdown; + } + + @Override + public boolean isTerminated() { + return shutdown; + } + + @Override + public boolean awaitTermination(long timeout, TimeUnit unit) { + return true; + } + + @Override + public void execute(Runnable command) { + command.run(); + } + } +} From 80d7c283c55ab69d3174c3bf458a52511eff6b38 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Wed, 4 Feb 2026 00:29:42 +0800 Subject: [PATCH 129/182] refactor(ActionExecutor): update ActionChain execution, support executing and advancing correctly --- .../slhaf/partner/core/action/ActionCore.java | 39 +---- .../dispatcher/executor/ActionExecutor.java | 136 +++++++++++++++--- .../action/interventor/ActionInterventor.java | 3 +- 3 files changed, 127 insertions(+), 51 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java index 22baffa4..33abe702 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java @@ -278,12 +278,12 @@ public class ActionCore extends PartnerCore { } // 加锁确保同步 - synchronized (actionData) { - applyInterventions(interventions, actionData, phaser); + synchronized (actionData.getStatus()) { + applyInterventions(interventions, actionData); } } - private void applyInterventions(List interventions, ActionData actionData, Phaser phaser) { + private void applyInterventions(List interventions, ActionData actionData) { boolean rebuildCleanTag = false; interventions.sort(Comparator.comparingInt(MetaIntervention::getOrder)); @@ -296,7 +296,7 @@ public class ActionCore extends PartnerCore { switch (intervention.getType()) { case InterventionType.APPEND -> handleAppend(actionData, intervention.getOrder(), actions); - case InterventionType.INSERT -> handleInsert(actionData, intervention.getOrder(), actions, phaser); + case InterventionType.INSERT -> handleInsert(actionData, intervention.getOrder(), actions); case InterventionType.DELETE -> handleDelete(actionData, intervention.getOrder(), actions); case InterventionType.CANCEL -> handleCancel(actionData); case InterventionType.REBUILD -> { @@ -322,38 +322,13 @@ public class ActionCore extends PartnerCore { } /** - * 在未进入执行阶段和正处于行动阶段的行动单元组插入新的行动, 如果插入位置正处于执行阶段, 则启动执行线程, 通过 Phaser 确保同步 + * 在未进入执行阶段和正处于行动阶段的行动单元组插入新的行动 */ - private void handleInsert(ActionData actionData, int order, List actions, Phaser phaser) { + private void handleInsert(ActionData actionData, int order, List actions) { if (order < actionData.getExecutingStage()) return; - phaser.register(); - try { - Map> actionChain = actionData.getActionChain(); - actionChain.put(order, actions); - - if (order == actionData.getExecutingStage()) { - ExecutorService virtualExecutor = this.getExecutor(ExecutorType.VIRTUAL); - ExecutorService platformExecutor = this.getExecutor(ExecutorType.PLATFORM); - ExecutorService executor; - phaser.bulkRegister(actions.size()); - - for (MetaAction action : actions) { - executor = action.isIo() ? virtualExecutor : platformExecutor; - executor.execute(() -> { - try { - runnerClient.submit(action); - } finally { - phaser.arriveAndDeregister(); - } - }); - } - - } - } finally { - phaser.arriveAndDeregister(); - } + actionData.getActionChain().computeIfAbsent(order, k -> new ArrayList<>()).addAll(actions); } private void handleDelete(ActionData actionData, int order, List actions) { diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java index bdd591d1..02046471 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java @@ -18,8 +18,12 @@ import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.*; import java.util.ArrayList; import java.util.List; +import java.util.Map; +import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; import java.util.concurrent.Phaser; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; @Slf4j @AgentSubModule @@ -70,35 +74,77 @@ public class ActionExecutor extends AgentRunningSubModule(actionChain.keySet()); - orderList.sort(Integer::compareTo); - val executingStage = orderList.get(stageCount); - actionData.setExecutingStage(executingStage); + val stageCursor = new Object() { + final Map> actionChain = actionData.getActionChain(); + int stageCount; + boolean executingStageUpdated; + boolean stageCountUpdated; - val metaActions = actionChain.get(executingStage); - val phase = phaser.bulkRegister(metaActions.size()); - for (MetaAction metaAction : metaActions) { - val executor = metaAction.isIo() ? virtualExecutor : platformExecutor; - executor.execute(buildMataActionTask(metaAction, phaserRecord, userId)); + void init() { + stageCount = 0; + executingStageUpdated = false; + stageCountUpdated = false; + update(); + } + + void requestAdvance() { + if (!stageCountUpdated) { + stageCount++; + stageCountUpdated = true; + } + + if (stageCount < actionChain.size() && !executingStageUpdated) { + update(); + executingStageUpdated = true; + } + } + + boolean next() { + executingStageUpdated = false; + stageCountUpdated = false; + return stageCount < actionChain.size(); + } + + void update() { + val orderList = new ArrayList<>(actionChain.keySet()); + orderList.sort(Integer::compareTo); + actionData.setExecutingStage(orderList.get(stageCount)); + } + }; + + stageCursor.init(); + do { + val actionChain = actionData.getActionChain(); + val metaActions = actionChain.get(actionData.getExecutingStage()); + + val listeningRecord = executeAndListening(metaActions, phaserRecord, userId); + phaser.awaitAdvance(listeningRecord.phase()); + + // synchronized 同步防止 accepting 循环间、phase guard 判定后发生 stage 推进 + // 导致新行动的 phaser 投放阶段错乱无法阻塞的场景 + // 该 synchronized 将阶段推进与 accepting 监听 loop 捆绑为互斥的原子事件,避免了细粒度的 phaser 阶段竞态问题 + synchronized (listeningRecord.accepting()) { + listeningRecord.accepting().set(false); + + // 立即尝试推进,本次推进中,如果前方仍有未执行 stage,将执行一次阶段推进 + stageCursor.requestAdvance(); } - phaser.awaitAdvance(phase); // 针对行动链进行修正,修正需要传入执行历史、行动目标等内容 val correctorInput = assemblyHelper.buildCorrectorInput(actionData, userId); val correctorResult = actionCorrector.execute(correctorInput); - actionCapability.handleInterventions(correctorResult.getMetaInterventionList(), phaserRecord); - } while (actionChain.size() > ++stageCount); + actionCapability.handleInterventions(correctorResult.getMetaInterventionList(), actionData); + + // 第二次尝试进行阶段推进,本次负责补充上一次在不存在 stage时,但 corrector 执行期间发生了 actionChain 的插入事件 + // 如果第一次已经推进完毕,本次将会跳过 + stageCursor.requestAdvance(); + } while (stageCursor.next()); // 结束 - phaser.arriveAndDeregister(); actionCapability.removePhaserRecord(phaser); if (actionData.getStatus() != ActionData.ActionStatus.FAILED) { actionData.setStatus(ActionStatus.SUCCESS); @@ -110,7 +156,58 @@ public class ActionExecutor extends AgentRunningSubModule metaActions, PhaserRecord phaserRecord, String userId) { + AtomicBoolean accepting = new AtomicBoolean(true); + AtomicInteger cursor = new AtomicInteger(); + + CountDownLatch latch = new CountDownLatch(1); + val phaser = phaserRecord.phaser(); + val phase = phaser.register(); + platformExecutor.execute(() -> { + boolean first = true; + while (accepting.get()) { + synchronized (accepting) { + MetaAction next = null; + + synchronized (metaActions) { + if (cursor.get() < metaActions.size()) { + next = metaActions.get(cursor.getAndIncrement()); + } + } + + if (next == null) { + Thread.onSpinWait(); + continue; + } + + if (phaser.getPhase() != phase) { + metaActions.remove(next); + log.warn("行动阶段已推进,丢弃该行动: {}", next); + continue; + } + + ExecutorService executor = next.isIo() ? virtualExecutor : platformExecutor; + executor.execute(buildMataActionTask(next, phaserRecord, userId)); + + if (first) { + phaser.arriveAndDeregister(); + latch.countDown(); + first = false; + } + } + } + }); + try { + // 确保执行一次,防止没来得及注册任务就已经结束 + latch.await(); + } catch (InterruptedException ignored) { + } + return new MetaActionsListeningRecord(accepting, phase); + } + private Runnable buildMataActionTask(MetaAction metaAction, PhaserRecord phaserRecord, String userId) { + val phaser = phaserRecord.phaser(); + phaser.register(); return () -> { val actionKey = metaAction.getKey(); try { @@ -158,11 +255,14 @@ public class ActionExecutor extends AgentRunningSubModule interventionDataList, Map interventionDataMap) { + private void handleInterventions(List interventionDataList, Map interventionDataMap) { val executor = actionCapability.getExecutor(ActionCore.ExecutorType.PLATFORM); executor.execute(() -> { for (EvaluatedInterventionData interventionData : interventionDataList) { From 558b589830c9c25c031092ea98c94fc8ac7fed08 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Thu, 5 Feb 2026 15:48:58 +0800 Subject: [PATCH 130/182] refactor(ActionInterventor): redefine DTOs in ActionInterventor to adapt the actual intervention logic --- .../action/interventor/ActionInterventor.java | 3 +- .../evaluator/InterventionEvaluator.java | 40 ++++++++----------- .../evaluator/entity/EvaluatorInput.java | 3 +- .../recognizer/InterventionRecognizer.java | 19 +++------ .../recognizer/entity/RecognizerInput.java | 3 +- .../recognizer/entity/RecognizerResult.java | 5 +-- 6 files changed, 27 insertions(+), 46 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/ActionInterventor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/ActionInterventor.java index e80fa592..549e1685 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/ActionInterventor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/ActionInterventor.java @@ -10,6 +10,7 @@ import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.ActivateM import work.slhaf.partner.core.action.ActionCapability; import work.slhaf.partner.core.action.ActionCore; import work.slhaf.partner.core.action.entity.ActionData; +import work.slhaf.partner.core.action.entity.PhaserRecord; import work.slhaf.partner.core.cognation.CognationCapability; import work.slhaf.partner.core.memory.MemoryCapability; import work.slhaf.partner.module.common.module.PreRunningModule; @@ -174,7 +175,7 @@ public class ActionInterventor extends PreRunningModule implements ActivateModel recognizerInput.setUserDialogMapStr(memoryCapability.getUserDialogMapStr(userId)); // 参考的对话列表大小或需调整 recognizerInput.setRecentMessages(cognationCapability.getChatMessages()); - recognizerInput.setExecutingActions(actionCapability.listPhaserRecords()); + recognizerInput.setExecutingActions(actionCapability.listPhaserRecords().stream().map(PhaserRecord::actionData).toList()); recognizerInput.setPreparedActions(actionCapability.listPreparedAction(userId)); return recognizerInput; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/InterventionEvaluator.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/InterventionEvaluator.java index f0391293..f0675e9f 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/InterventionEvaluator.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/InterventionEvaluator.java @@ -11,7 +11,6 @@ import work.slhaf.partner.api.chat.pojo.Message; import work.slhaf.partner.core.action.ActionCapability; import work.slhaf.partner.core.action.ActionCore.ExecutorType; import work.slhaf.partner.core.action.entity.ActionData; -import work.slhaf.partner.core.action.entity.PhaserRecord; import work.slhaf.partner.core.memory.pojo.EvaluatedSlice; import work.slhaf.partner.module.modules.action.interventor.evaluator.entity.EvaluatorInput; import work.slhaf.partner.module.modules.action.interventor.evaluator.entity.EvaluatorResult; @@ -37,7 +36,7 @@ public class InterventionEvaluator extends AgentRunningSubModule executingInterventions = input.getExecutingInterventions(); + Map executingInterventions = input.getExecutingInterventions(); Map preparedInterventions = input.getPreparedInterventions(); CountDownLatch latch = new CountDownLatch(executingInterventions.size() + preparedInterventions.size()); @@ -59,30 +58,23 @@ public class InterventionEvaluator extends AgentRunningSubModule void evaluateIntervention(List evaluatedDataList, Map interventionMap, EvaluatorInput input, ExecutorService executor, CountDownLatch latch) { - interventionMap.forEach((tendency, data) -> { - executor.execute(() -> { - try { - ActionData actionData = switch (data) { - case PhaserRecord record -> record.actionData(); - case ActionData tempData -> tempData; - default -> null; - }; - String prompt = buildPrompt(input.getRecentMessages(), input.getActivatedSlices(), actionData, tendency); + private void evaluateIntervention(List evaluatedDataList, Map interventionMap, EvaluatorInput input, ExecutorService executor, CountDownLatch latch) { + interventionMap.forEach((tendency, actionData) -> executor.execute(() -> { + try { + String prompt = buildPrompt(input.getRecentMessages(), input.getActivatedSlices(), actionData, tendency); - ChatResponse response = this.singleChat(prompt); - EvaluatedInterventionData evaluatedData = JSONObject.parseObject(response.getMessage(), - EvaluatedInterventionData.class); - synchronized (evaluatedDataList) { - evaluatedDataList.add(evaluatedData); - } - } catch (Exception e) { - log.error("干预意图评估出错: {}", tendency, e); - } finally { - latch.countDown(); + ChatResponse response = this.singleChat(prompt); + EvaluatedInterventionData evaluatedData = JSONObject.parseObject(response.getMessage(), + EvaluatedInterventionData.class); + synchronized (evaluatedDataList) { + evaluatedDataList.add(evaluatedData); } - }); - }); + } catch (Exception e) { + log.error("干预意图评估出错: {}", tendency, e); + } finally { + latch.countDown(); + } + })); } private String buildPrompt(List recentMessages, List activatedSlices, diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/entity/EvaluatorInput.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/entity/EvaluatorInput.java index ab3345dd..d25d8729 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/entity/EvaluatorInput.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/evaluator/entity/EvaluatorInput.java @@ -3,7 +3,6 @@ package work.slhaf.partner.module.modules.action.interventor.evaluator.entity; import lombok.Data; import work.slhaf.partner.api.chat.pojo.Message; import work.slhaf.partner.core.action.entity.ActionData; -import work.slhaf.partner.core.action.entity.PhaserRecord; import work.slhaf.partner.core.memory.pojo.EvaluatedSlice; import java.util.List; @@ -11,7 +10,7 @@ import java.util.Map; @Data public class EvaluatorInput { - private Map executingInterventions; + private Map executingInterventions; private Map preparedInterventions; private List activatedSlices; private List recentMessages; diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/InterventionRecognizer.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/InterventionRecognizer.java index 2616da62..b809f35d 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/InterventionRecognizer.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/InterventionRecognizer.java @@ -10,7 +10,6 @@ import work.slhaf.partner.api.chat.pojo.ChatResponse; import work.slhaf.partner.core.action.ActionCapability; import work.slhaf.partner.core.action.ActionCore; import work.slhaf.partner.core.action.entity.ActionData; -import work.slhaf.partner.core.action.entity.PhaserRecord; import work.slhaf.partner.module.modules.action.interventor.recognizer.entity.MetaRecognizerResult; import work.slhaf.partner.module.modules.action.interventor.recognizer.entity.RecognizerInput; import work.slhaf.partner.module.modules.action.interventor.recognizer.entity.RecognizerResult; @@ -31,13 +30,13 @@ public class InterventionRecognizer extends AgentRunningSubModule executingActions = input.getExecutingActions(); + List executingActions = input.getExecutingActions(); List preparedActions = input.getPreparedActions(); CountDownLatch countDownLatch = new CountDownLatch(executingActions.size() + preparedActions.size()); // 创建结果容器 RecognizerResult recognizerResult = new RecognizerResult(); - Map executingInterventions = recognizerResult.getExecutingInterventions(); + Map executingInterventions = recognizerResult.getExecutingInterventions(); Map preparedInterventions = recognizerResult.getPreparedInterventions(); // 执行识别操作 @@ -52,8 +51,8 @@ public class InterventionRecognizer extends AgentRunningSubModule void recognizeIntervention(Map interventionsMap, List actions, ExecutorService executor, RecognizerInput input, CountDownLatch latch) { - for (T data : actions) { + private void recognizeIntervention(Map interventionsMap, List actions, ExecutorService executor, RecognizerInput input, CountDownLatch latch) { + for (ActionData data : actions) { executor.execute(() -> { try { String prompt = buildPrompt(data, input); @@ -73,15 +72,7 @@ public class InterventionRecognizer extends AgentRunningSubModule String buildPrompt(T data, RecognizerInput input) { - ActionData actionData = switch (data) { - case PhaserRecord record -> record.actionData(); - case ActionData tempData -> tempData; - default -> null; - }; - if (actionData == null) { - return null; - } + private String buildPrompt(ActionData actionData, RecognizerInput input) { JSONObject json = new JSONObject(); JSONObject actionInfo = json.putObject("行动信息"); diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/entity/RecognizerInput.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/entity/RecognizerInput.java index 2677aad8..9deca7cf 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/entity/RecognizerInput.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/entity/RecognizerInput.java @@ -3,7 +3,6 @@ package work.slhaf.partner.module.modules.action.interventor.recognizer.entity; import lombok.Data; import work.slhaf.partner.api.chat.pojo.Message; import work.slhaf.partner.core.action.entity.ActionData; -import work.slhaf.partner.core.action.entity.PhaserRecord; import java.util.List; @@ -18,6 +17,6 @@ public class RecognizerInput { /** * 正在执行的行动-Phaser记录列表,在Recognizer中结合本次输入并发评估(考虑到不同行动链之间对LLM的影响) */ - private List executingActions; + private List executingActions; private List preparedActions; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/entity/RecognizerResult.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/entity/RecognizerResult.java index 202b3061..e05511ec 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/entity/RecognizerResult.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/recognizer/entity/RecognizerResult.java @@ -2,7 +2,6 @@ package work.slhaf.partner.module.modules.action.interventor.recognizer.entity; import lombok.Data; import work.slhaf.partner.core.action.entity.ActionData; -import work.slhaf.partner.core.action.entity.PhaserRecord; import java.util.HashMap; import java.util.Map; @@ -16,9 +15,9 @@ public class RecognizerResult { *

将被干预的‘执行中行动’

* key: 干预倾向 *
- * value: 干预倾向将作用的 phaser 记录 + * value: 干预倾向将作用的行动数据 */ - private Map executingInterventions = new HashMap<>(); + private Map executingInterventions = new HashMap<>(); /** *

将被干预的‘等待中行动’

From 76da3c29f896d75fb4a572330f137a80d45c70c8 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Thu, 5 Feb 2026 16:13:21 +0800 Subject: [PATCH 131/182] fix(ActionExecutorTest): repair stub in test --- .../dispatcher/executor/ActionExecutorTest.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java b/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java index 472f0566..55d51348 100644 --- a/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java +++ b/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java @@ -67,11 +67,11 @@ class ActionExecutorTest { @BeforeEach void setUp() { - when(cognationCapability.getChatMessages()).thenReturn(Collections.emptyList()); - when(memoryCapability.getActivatedSlices(anyString())).thenReturn(Collections.emptyList()); - when(actionCapability.putPhaserRecord(any(Phaser.class), any(ActionData.class))) + lenient().when(cognationCapability.getChatMessages()).thenReturn(Collections.emptyList()); + lenient().when(memoryCapability.getActivatedSlices(anyString())).thenReturn(Collections.emptyList()); + lenient().when(actionCapability.putPhaserRecord(any(Phaser.class), any(ActionData.class))) .thenAnswer(inv -> new PhaserRecord(inv.getArgument(0), inv.getArgument(1))); - when(actionCapability.loadMetaActionInfo(anyString())).thenAnswer(inv -> { + lenient().when(actionCapability.loadMetaActionInfo(anyString())).thenAnswer(inv -> { MetaActionInfo info = new MetaActionInfo(); info.setDescription("desc"); info.setParams(Collections.emptyMap()); @@ -79,8 +79,8 @@ class ActionExecutorTest { }); CorrectorResult correctorResult = new CorrectorResult(); correctorResult.setMetaInterventionList(Collections.emptyList()); - when(actionCorrector.execute(any())).thenReturn(correctorResult); - doNothing().when(actionCapability).handleInterventions(any(), any()); + lenient().when(actionCorrector.execute(any())).thenReturn(correctorResult); + lenient().doNothing().when(actionCapability).handleInterventions(any(), any()); } // 场景1:B1 -> B3 -> B4 -> B7(成功) -> B10。目的:验证正常主路径与资源清理。 From 08bda844717505d9e43a0d3f3855812335af1b5d Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Thu, 5 Feb 2026 16:49:58 +0800 Subject: [PATCH 132/182] refactor(ActionCore): Specifies the minimum platform thread pool size Context: The ActionExecutor needs at least 2 platform thread to support async action execution, otherwise the current ActionExecutor logic cannot be executed --- .../work/slhaf/partner/core/action/ActionCore.java | 3 ++- .../dispatcher/executor/ActionExecutorTest.java | 12 ++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java index 33abe702..fa58a5a2 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java @@ -49,8 +49,9 @@ public class ActionCore extends PartnerCore { private final Lock cacheLock = new ReentrantLock(); + // 由于当前的执行器逻辑实现,平台线程池大小不得小于 2,这里规定为最小为 4 private final ExecutorService platformExecutor = Executors - .newFixedThreadPool(Runtime.getRuntime().availableProcessors()); + .newFixedThreadPool(Math.max(Runtime.getRuntime().availableProcessors(), 4)); private final ExecutorService virtualExecutor = Executors.newVirtualThreadPerTaskExecutor(); /** diff --git a/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java b/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java index 55d51348..9d8e90a1 100644 --- a/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java +++ b/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java @@ -1,5 +1,6 @@ package work.slhaf.partner.module.modules.action.dispatcher.executor; +import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.*; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; @@ -44,6 +45,7 @@ import static org.mockito.Mockito.*; * 18) 同 stage 多 metaAction 并发完成顺序不固定(未覆盖:更适合集成/压测) */ @SuppressWarnings("unused") +@Slf4j @ExtendWith(MockitoExtension.class) class ActionExecutorTest { @@ -130,8 +132,9 @@ class ActionExecutorTest { // 场景4:B1 -> B3 -> B4(两轮) -> B7(成功) -> B10。目的:验证多阶段顺序执行。 @Test void execute_multiStage_success() { - ExecutorService directExecutor = new DirectExecutorService(); - stubExecutors(directExecutor, directExecutor); + ExecutorService platformExecutor = Executors.newFixedThreadPool(4); + ExecutorService virtualExecutor = Executors.newVirtualThreadPerTaskExecutor(); + stubExecutors(platformExecutor, virtualExecutor); Map> chain = new HashMap<>(); chain.put(0, List.of(buildMetaAction("a1", false))); @@ -145,14 +148,15 @@ class ActionExecutorTest { doAnswer(inv -> { MetaAction metaAction = inv.getArgument(0); metaAction.getResult().setStatus(MetaAction.ResultStatus.SUCCESS); + log.info("metaAction result:{}", metaAction.getResult().getStatus()); return null; }).when(runnerClient).submit(any(MetaAction.class)); actionExecutor.init(); actionExecutor.execute(input); - verify(runnerClient, times(2)).submit(any(MetaAction.class)); - verify(actionCorrector, times(2)).execute(any()); + verify(runnerClient, timeout(5000).times(2)).submit(any(MetaAction.class)); + verify(actionCorrector, timeout(5000).times(2)).execute(any()); assertEquals(2, actionData.getHistory().size()); assertEquals(ActionData.ActionStatus.SUCCESS, actionData.getStatus()); } From 33df0fa017ca2c47da72c3c9ae7ad486ab7c353d Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Thu, 5 Feb 2026 16:53:38 +0800 Subject: [PATCH 133/182] test(ActionExecutor): test with virtual thread pool support --- .../action/dispatcher/executor/ActionExecutorTest.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java b/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java index 9d8e90a1..7227e982 100644 --- a/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java +++ b/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java @@ -164,17 +164,17 @@ class ActionExecutorTest { // 场景5:B4.2。目的:验证 IO 行动使用虚拟线程池。 @Test void execute_ioMetaAction_usesVirtualExecutor() { - ExecutorService directExecutor = new DirectExecutorService(); - ExecutorService virtualExecutor = Executors.newSingleThreadExecutor(); - stubExecutors(directExecutor, virtualExecutor); + ExecutorService platformExecutor = Executors.newFixedThreadPool(4); + ExecutorService virtualExecutor = Executors.newVirtualThreadPerTaskExecutor(); + stubExecutors(platformExecutor, virtualExecutor); ImmediateActionData actionData = buildActionData(singleStageChain(true)); ActionExecutorInput input = buildInput("u1", actionData); ExtractorResult extractorResult = new ExtractorResult(); extractorResult.setOk(true); - when(paramsExtractor.execute(any())).thenReturn(extractorResult); - doAnswer(inv -> { + lenient().when(paramsExtractor.execute(any())).thenReturn(extractorResult); + lenient().doAnswer(inv -> { MetaAction metaAction = inv.getArgument(0); metaAction.getResult().setStatus(MetaAction.ResultStatus.SUCCESS); return null; From 9c387195145dcea10d050bd46b61df35e60a8d01 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Thu, 5 Feb 2026 16:58:22 +0800 Subject: [PATCH 134/182] test(ActionExecutor): test with additionalContext appending --- .../dispatcher/executor/ActionExecutorTest.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java b/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java index 7227e982..f641c904 100644 --- a/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java +++ b/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java @@ -190,8 +190,9 @@ class ActionExecutorTest { // 场景6:B7.2(失败) -> repairer OK -> B7(成功)。目的:验证修复后成功与上下文追加。 @Test void execute_extractorFail_thenRepairOk_thenSuccess() { - ExecutorService directExecutor = new DirectExecutorService(); - stubExecutors(directExecutor, directExecutor); + ExecutorService platformExecutor = Executors.newFixedThreadPool(4); + ExecutorService virtualExecutor = Executors.newVirtualThreadPerTaskExecutor(); + stubExecutors(platformExecutor, virtualExecutor); ImmediateActionData actionData = buildActionData(singleStageChain(false)); ActionExecutorInput input = buildInput("u1", actionData); @@ -216,8 +217,12 @@ class ActionExecutorTest { actionExecutor.init(); actionExecutor.execute(input); + try { + Thread.sleep(500); + } catch (InterruptedException ignored) { + } assertEquals(1, actionData.getAdditionalContext().get(0).size()); - verify(runnerClient, times(1)).submit(any(MetaAction.class)); + verify(runnerClient, timeout(5000).times(1)).submit(any(MetaAction.class)); } // 场景7:B7.2(失败) -> repairer FAILED。目的:验证失败分支不提交外部执行。 From a1dcf4a6fa672e1e2eed5238ce58cf3f5f933b69 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Thu, 5 Feb 2026 17:05:53 +0800 Subject: [PATCH 135/182] test(ActionExecutor): test with action failure --- .../action/dispatcher/executor/ActionExecutorTest.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java b/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java index f641c904..8a64a9ea 100644 --- a/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java +++ b/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java @@ -228,8 +228,9 @@ class ActionExecutorTest { // 场景7:B7.2(失败) -> repairer FAILED。目的:验证失败分支不提交外部执行。 @Test void execute_extractorFail_thenRepairFailed() { - ExecutorService directExecutor = new DirectExecutorService(); - stubExecutors(directExecutor, directExecutor); + ExecutorService platformExecutor = Executors.newFixedThreadPool(4); + ExecutorService virtualExecutor = Executors.newVirtualThreadPerTaskExecutor(); + stubExecutors(platformExecutor, virtualExecutor); ImmediateActionData actionData = buildActionData(singleStageChain(false)); ActionExecutorInput input = buildInput("u1", actionData); @@ -245,6 +246,10 @@ class ActionExecutorTest { actionExecutor.init(); actionExecutor.execute(input); + try { + Thread.sleep(500); + } catch (InterruptedException ignored) { + } MetaAction metaAction = actionData.getActionChain().get(0).get(0); assertEquals(MetaAction.ResultStatus.FAILED, metaAction.getResult().getStatus()); verify(runnerClient, never()).submit(any(MetaAction.class)); From d33b6617c18dc60ffdd21cbf0d897912ac0a0bb3 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Thu, 5 Feb 2026 19:40:28 +0800 Subject: [PATCH 136/182] fix(ActionExecutor): support removing phaserRecord correctly when exception occurred in ActionCorrector --- .../dispatcher/executor/ActionExecutor.java | 12 +++++++---- .../executor/ActionExecutorTest.java | 21 ++++++++++++------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java index 02046471..07cdc8d4 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java @@ -134,10 +134,14 @@ public class ActionExecutor extends AgentRunningSubModule 资源未清理(已知缺陷)。目的:暴露当前行为。 - @Disabled("known-issue: corrector 抛异常时未清理 phaser 记录") - @Tag("known-issue") + // @Disabled("known-issue: corrector 抛异常时未清理 phaser 记录") + // @Tag("known-issue") @Test void execute_correctorThrows_shouldLeakPhaserRecord() { - ExecutorService directExecutor = new DirectExecutorService(); - stubExecutors(directExecutor, directExecutor); + ExecutorService platformExecutor = Executors.newCachedThreadPool(); + ExecutorService virtualExecutor = Executors.newCachedThreadPool(); + stubExecutors(platformExecutor, virtualExecutor); ImmediateActionData actionData = buildActionData(singleStageChain(false)); ActionExecutorInput input = buildInput("u1", actionData); ExtractorResult ok = new ExtractorResult(); ok.setOk(true); - when(paramsExtractor.execute(any())).thenReturn(ok); - doAnswer(inv -> { + lenient().when(paramsExtractor.execute(any())).thenReturn(ok); + lenient().doAnswer(inv -> { MetaAction metaAction = inv.getArgument(0); metaAction.getResult().setStatus(MetaAction.ResultStatus.SUCCESS); return null; }).when(runnerClient).submit(any(MetaAction.class)); - doThrow(new RuntimeException("boom")).when(actionCorrector).execute(any()); + lenient().doThrow(new RuntimeException("boom")).when(actionCorrector).execute(any()); actionExecutor.init(); actionExecutor.execute(input); - verify(actionCapability, never()).removePhaserRecord(any(Phaser.class)); + try { + Thread.sleep(500); + } catch (InterruptedException ignored) { + } + verify(actionCapability).removePhaserRecord(any(Phaser.class)); } // 场景12:B4.1 actionChain 为空导致异常(已知缺陷)。目的:暴露当前行为。 From 6b861f4b777967ea89244b2a6246194ade065f42 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Thu, 5 Feb 2026 20:40:02 +0800 Subject: [PATCH 137/182] fix(ActionExecutor): correct logic in ActionExecutor when actionChain is empty, which will skip execution --- .../action/dispatcher/executor/ActionExecutor.java | 9 ++++++--- .../action/dispatcher/executor/ActionExecutorTest.java | 10 +++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java index 07cdc8d4..a74d5f69 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java @@ -18,7 +18,6 @@ import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.*; import java.util.ArrayList; import java.util.List; -import java.util.Map; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; import java.util.concurrent.Phaser; @@ -72,6 +71,12 @@ public class ActionExecutor extends AgentRunningSubModule> actionChain = actionData.getActionChain(); int stageCount; boolean executingStageUpdated; boolean stageCountUpdated; @@ -118,7 +122,6 @@ public class ActionExecutor extends AgentRunningSubModule()); ActionExecutorInput input = buildInput("u1", actionData); @@ -355,7 +356,10 @@ class ActionExecutorTest { actionExecutor.init(); actionExecutor.execute(input); - verify(actionCapability, never()).removePhaserRecord(any(Phaser.class)); + try { + Thread.sleep(500); + } catch (InterruptedException ignored) { + } } private void stubExecutors(ExecutorService platformExecutor, ExecutorService virtualExecutor) { From 277c0d437ffc142c07427454edd32493a9650417 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 6 Feb 2026 20:36:50 +0800 Subject: [PATCH 138/182] chore(ActionCore): update comment --- .../main/java/work/slhaf/partner/core/action/ActionCore.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java index fa58a5a2..193e60ad 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java @@ -62,7 +62,7 @@ public class ActionCore extends PartnerCore { private RunnerClient runnerClient; public ActionCore() throws IOException, ClassNotFoundException { - // TODO 通过 AgentConfigManager指定 + // TODO 通过 AgentConfigManager指定采用何种 runnerClient runnerClient = new SandboxRunnerClient(existedMetaActions, virtualExecutor); setupShutdownHook(); } From 12df938d85d7025a7c3f39d869738cf0454610f3 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 6 Feb 2026 20:41:08 +0800 Subject: [PATCH 139/182] refactor(ActionCore): simplify handleInterventions to use ActionData --- .../partner/core/action/ActionCapability.java | 2 +- .../slhaf/partner/core/action/ActionCore.java | 16 ++-------------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java index 5bf38865..b0e5c41e 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java @@ -51,5 +51,5 @@ public interface ActionCapability { RunnerClient runnerClient(); - void handleInterventions(List interventions, T data); + void handleInterventions(List interventions, ActionData data); } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java index 193e60ad..e236b561 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java @@ -19,10 +19,7 @@ import work.slhaf.partner.module.modules.action.interventor.entity.MetaIntervent import java.io.IOException; import java.util.*; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Phaser; +import java.util.concurrent.*; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import java.util.stream.Collectors; @@ -263,17 +260,8 @@ public class ActionCore extends PartnerCore { } @CapabilityMethod - public void handleInterventions(List interventions, T data) { + public void handleInterventions(List interventions, ActionData actionData) { // 加载数据 - Phaser phaser = null; - ActionData actionData = switch (data) { - case PhaserRecord record -> { - phaser = record.phaser(); - yield record.actionData(); - } - case ActionData tempData -> tempData; - default -> null; - }; if (actionData == null) { return; } From 2cd0774834ac3589a551590a23a5f0914d9655d8 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 6 Feb 2026 21:05:10 +0800 Subject: [PATCH 140/182] refactor(ActionCapability): rename listAvailableActions to listAvailableMetaActions --- .../java/work/slhaf/partner/core/action/ActionCapability.java | 2 +- .../modules/action/planner/evaluator/ActionEvaluator.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java index b0e5c41e..49b6e8d3 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java @@ -45,7 +45,7 @@ public interface ActionCapability { MetaActionInfo loadMetaActionInfo(@NonNull String actionKey); - Map listAvailableActions(); + Map listAvailableMetaActions(); boolean checkExists(String... actionKeys); diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/evaluator/ActionEvaluator.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/evaluator/ActionEvaluator.java index 323ef5b8..8163b97c 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/evaluator/ActionEvaluator.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/evaluator/ActionEvaluator.java @@ -68,7 +68,7 @@ public class ActionEvaluator extends AgentRunningSubModule availableActions = new HashMap<>(); - actionCapability.listAvailableActions().forEach((key, info) -> availableActions.put(key, info.getDescription())); + actionCapability.listAvailableMetaActions().forEach((key, info) -> availableActions.put(key, info.getDescription())); temp.setAvailableActions(availableActions); list.add(temp); } From 08100aea8a54a89178b1b9be5205d3d32abdb7e6 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 6 Feb 2026 21:38:54 +0800 Subject: [PATCH 141/182] refactor(ActionCore): replace prepared action APIs with generic list/put --- .../partner/core/action/ActionCapability.java | 10 +++-- .../slhaf/partner/core/action/ActionCore.java | 43 ++++++++----------- .../action/dispatcher/ActionDispatcher.java | 3 +- .../action/interventor/ActionInterventor.java | 2 +- .../modules/action/planner/ActionPlanner.java | 14 +++--- 5 files changed, 34 insertions(+), 38 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java index 49b6e8d3..1f99bfe0 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCapability.java @@ -1,6 +1,7 @@ package work.slhaf.partner.core.action; import lombok.NonNull; +import org.jetbrains.annotations.Nullable; import work.slhaf.partner.api.agent.factory.capability.annotation.Capability; import work.slhaf.partner.core.action.entity.ActionData; import work.slhaf.partner.core.action.entity.MetaAction; @@ -12,17 +13,19 @@ import work.slhaf.partner.module.modules.action.interventor.entity.MetaIntervent import java.util.List; import java.util.Map; +import java.util.Set; import java.util.concurrent.ExecutorService; import java.util.concurrent.Phaser; @Capability(value = "action") public interface ActionCapability { - void putPreparedAction(String uuid, ActionData actionData); + + void putAction(@NonNull ActionData actionData); + + Set listActions(@Nullable ActionData.ActionStatus actionStatus, @Nullable String source); List popPendingAction(String userId); - List listPreparedAction(String userId); - List listPendingAction(String userId); void putPendingActions(String userId, ActionData actionData); @@ -52,4 +55,5 @@ public interface ActionCapability { RunnerClient runnerClient(); void handleInterventions(List interventions, ActionData data); + } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java index e236b561..06b88c88 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java @@ -2,6 +2,8 @@ package work.slhaf.partner.core.action; import lombok.NonNull; import lombok.extern.slf4j.Slf4j; +import lombok.val; +import org.jetbrains.annotations.Nullable; import work.slhaf.partner.api.agent.factory.capability.annotation.CapabilityCore; import work.slhaf.partner.api.agent.factory.capability.annotation.CapabilityMethod; import work.slhaf.partner.common.vector.VectorClient; @@ -30,9 +32,9 @@ import java.util.stream.Collectors; public class ActionCore extends PartnerCore { /** - * 持久行动池,以用户id为键存储所有状态的任务 + * 持久行动池 */ - private HashMap> actionPool = new HashMap<>();// TODO 考虑是否取消用户分池 + private CopyOnWriteArraySet actionPool = new CopyOnWriteArraySet<>(); /** * 待确认任务,以userId区分不同用户,因为需要跨请求确认 @@ -66,18 +68,24 @@ public class ActionCore extends PartnerCore { private void setupShutdownHook() { // 将执行中的行动状态置为失败 - List executingActionList = listExecutingAction(); - for (ActionData actionData : executingActionList) { + val executingActionSet = listActions(ActionData.ActionStatus.EXECUTING, null); + for (ActionData actionData : executingActionSet) { actionData.setStatus(ActionData.ActionStatus.FAILED); actionData.setResult("由于系统中断而失败"); } } - private List listExecutingAction() { - return actionPool.values().stream() - .flatMap(Collection::stream) - .filter(action -> action.getStatus() == ActionData.ActionStatus.EXECUTING) - .collect(Collectors.toList()); + @CapabilityMethod + public void putAction(@NonNull ActionData actionData) { + actionPool.add(actionData); + } + + @CapabilityMethod + public Set listActions(@Nullable ActionData.ActionStatus actionStatus, @Nullable String source) { + return actionPool.stream() + .filter(actionData -> actionStatus == null || actionData.getStatus().equals(actionStatus)) + .filter(actionData -> source == null || actionData.getSource().equals(source)) + .collect(Collectors.toSet()); } @CapabilityMethod @@ -96,23 +104,6 @@ public class ActionCore extends PartnerCore { return infos; } - @CapabilityMethod - public synchronized void putPreparedAction(String uuid, ActionData actionData) { - actionPool.computeIfAbsent(uuid, k -> { - List temp = new ArrayList<>(); - temp.add(actionData); - return temp; - }); - } - - @CapabilityMethod - public List listPreparedAction(String userId) { - List actions = actionPool.get(userId); - return actions.stream() - .filter(actionData -> actionData.getStatus().equals(ActionData.ActionStatus.PREPARE)) - .toList(); - } - @CapabilityMethod public List listPendingAction(String userId) { return pendingActions.get(userId); diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/ActionDispatcher.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/ActionDispatcher.java index 7d611a59..a4c7a659 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/ActionDispatcher.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/ActionDispatcher.java @@ -1,5 +1,6 @@ package work.slhaf.partner.module.modules.action.dispatcher; +import lombok.val; import work.slhaf.partner.api.agent.factory.capability.annotation.InjectCapability; import work.slhaf.partner.api.agent.factory.module.annotation.AgentModule; import work.slhaf.partner.api.agent.factory.module.annotation.Init; @@ -46,7 +47,7 @@ public class ActionDispatcher extends PostRunningModule { // action,理想做法是将执行工具做成执行链的形式,模型的自对话流程、是否通知用户都做成与普通工具同等的通用可选能力,避免绑定固定流程 executor.execute(() -> { String userId = context.getUserId(); - List preparedActions = actionCapability.listPreparedAction(userId); + val preparedActions = actionCapability.listActions(ActionData.ActionStatus.PREPARE, userId); // 分类成PLANNING和IMMEDIATE两类 List scheduledActions = new ArrayList<>(); List immediateActions = new ArrayList<>(); diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/ActionInterventor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/ActionInterventor.java index 549e1685..f81f1e88 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/ActionInterventor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/interventor/ActionInterventor.java @@ -176,7 +176,7 @@ public class ActionInterventor extends PreRunningModule implements ActivateModel // 参考的对话列表大小或需调整 recognizerInput.setRecentMessages(cognationCapability.getChatMessages()); recognizerInput.setExecutingActions(actionCapability.listPhaserRecords().stream().map(PhaserRecord::actionData).toList()); - recognizerInput.setPreparedActions(actionCapability.listPreparedAction(userId)); + recognizerInput.setPreparedActions(actionCapability.listActions(ActionData.ActionStatus.PREPARE, userId).stream().toList()); return recognizerInput; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java index fb834340..21fc04d9 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java @@ -1,6 +1,7 @@ package work.slhaf.partner.module.modules.action.planner; import lombok.extern.slf4j.Slf4j; +import lombok.val; import org.jetbrains.annotations.NotNull; import work.slhaf.partner.api.agent.factory.capability.annotation.InjectCapability; import work.slhaf.partner.api.agent.factory.module.annotation.AgentModule; @@ -142,11 +143,10 @@ public class ActionPlanner extends PreRunningModule { if (uuids == null) { return; } - String contextUuid = context.getUuid(); List pendingActions = actionCapability.popPendingAction(context.getUserId()); for (ActionData actionData : pendingActions) { if (uuids.contains(actionData.getUuid())) { - actionCapability.putPreparedAction(contextUuid, actionData); + actionCapability.putAction(actionData); } } } @@ -157,7 +157,7 @@ public class ActionPlanner extends PreRunningModule { if (evaluatorResult.isNeedConfirm()) { actionCapability.putPendingActions(context.getUserId(), actionData); } else { - actionCapability.putPreparedAction(context.getUuid(), actionData); + actionCapability.putAction(actionData); } } } @@ -183,13 +183,13 @@ public class ActionPlanner extends PreRunningModule { } private void setupPreparedActions(HashMap map, String userId) { - List actionData = actionCapability.listPreparedAction(userId); - if (actionData == null || actionData.isEmpty()) { + val preparedActions = actionCapability.listActions(ActionData.ActionStatus.PREPARE, userId).stream().toList(); + if (preparedActions.isEmpty()) { map.put("[预备行动] <预备执行或放入计划池的行动信息>", "无预备行动"); return; } - for (int i = 0; i < actionData.size(); i++) { - map.put("[预备行动 " + (i + 1) + " ] <预备执行或放入计划池的行动信息>", generateActionStr(actionData.get(i))); + for (int i = 0; i < preparedActions.size(); i++) { + map.put("[预备行动 " + (i + 1) + " ] <预备执行或放入计划池的行动信息>", generateActionStr(preparedActions.get(i))); } } From 050c39cbc7cd5dec5d4e82ab67a4b8abfa2ccbc6 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Fri, 6 Feb 2026 23:38:13 +0800 Subject: [PATCH 142/182] refactor(ActionExecutor): correct input actions' type in ActionExecutor --- .../action/dispatcher/ActionDispatcher.java | 26 +++++++------------ .../dispatcher/executor/ActionExecutor.java | 11 +++++--- .../executor/entity/ActionExecutorInput.java | 10 ++++--- .../executor/ActionExecutorTest.java | 8 +++--- 4 files changed, 26 insertions(+), 29 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/ActionDispatcher.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/ActionDispatcher.java index a4c7a659..8b001717 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/ActionDispatcher.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/ActionDispatcher.java @@ -16,8 +16,8 @@ import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.Actio import work.slhaf.partner.module.modules.action.dispatcher.scheduler.ActionScheduler; import work.slhaf.partner.runtime.interaction.data.context.PartnerRunningFlowContext; -import java.util.ArrayList; -import java.util.List; +import java.util.HashSet; +import java.util.Set; import java.util.concurrent.ExecutorService; @AgentModule(name = "action_dispatcher", order = 7) @@ -32,7 +32,6 @@ public class ActionDispatcher extends PostRunningModule { private ActionScheduler actionScheduler; private ExecutorService executor; - private final AssemblyHelper assemblyHelper = new AssemblyHelper(); @Init public void init() { @@ -49,8 +48,8 @@ public class ActionDispatcher extends PostRunningModule { String userId = context.getUserId(); val preparedActions = actionCapability.listActions(ActionData.ActionStatus.PREPARE, userId); // 分类成PLANNING和IMMEDIATE两类 - List scheduledActions = new ArrayList<>(); - List immediateActions = new ArrayList<>(); + Set scheduledActions = new HashSet<>(); + Set immediateActions = new HashSet<>(); for (ActionData preparedAction : preparedActions) { if (preparedAction instanceof ScheduledActionData actionInfo) { scheduledActions.add(actionInfo); @@ -58,7 +57,11 @@ public class ActionDispatcher extends PostRunningModule { immediateActions.add(actionInfo); } } - actionExecutor.execute(assemblyHelper.buildExecutorInput(immediateActions, userId)); + val actionExecutorInput = ActionExecutorInput.builder() + .userId(userId) + .actions(immediateActions) + .build(); + actionExecutor.execute(actionExecutorInput); actionScheduler.execute(scheduledActions); }); } @@ -68,15 +71,4 @@ public class ActionDispatcher extends PostRunningModule { return false; } - @SuppressWarnings("InnerClassMayBeStatic") - private class AssemblyHelper { - - public ActionExecutorInput buildExecutorInput(List immediateActions, String userId) { - ActionExecutorInput input = new ActionExecutorInput(); - input.setImmediateActions(immediateActions); - input.setUserId(userId); - return input; - } - - } } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java index a74d5f69..b659aadf 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java @@ -9,8 +9,11 @@ import work.slhaf.partner.api.agent.factory.module.annotation.InjectModule; import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.AgentRunningSubModule; import work.slhaf.partner.core.action.ActionCapability; import work.slhaf.partner.core.action.ActionCore; -import work.slhaf.partner.core.action.entity.*; +import work.slhaf.partner.core.action.entity.ActionData; import work.slhaf.partner.core.action.entity.ActionData.ActionStatus; +import work.slhaf.partner.core.action.entity.MetaAction; +import work.slhaf.partner.core.action.entity.MetaActionInfo; +import work.slhaf.partner.core.action.entity.PhaserRecord; import work.slhaf.partner.core.action.runner.RunnerClient; import work.slhaf.partner.core.cognation.CognationCapability; import work.slhaf.partner.core.memory.MemoryCapability; @@ -63,10 +66,10 @@ public class ActionExecutor extends AgentRunningSubModule { if (actionData.getStatus() != ActionData.ActionStatus.PREPARE) { return; @@ -298,7 +301,7 @@ public class ActionExecutor extends AgentRunningSubModule immediateActions; + private Set actions; } diff --git a/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java b/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java index fb262f54..d3991d5a 100644 --- a/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java +++ b/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java @@ -369,10 +369,10 @@ class ActionExecutorTest { } private ActionExecutorInput buildInput(String userId, ImmediateActionData actionData) { - ActionExecutorInput input = new ActionExecutorInput(); - input.setUserId(userId); - input.setImmediateActions(List.of(actionData)); - return input; + return ActionExecutorInput.builder() + .userId(userId) + .actions(Set.of(actionData)) + .build(); } private ImmediateActionData buildActionData(Map> actionChain) { From 0eb4765235f500d1784000b8274ebb827f01022c Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sat, 7 Feb 2026 15:35:34 +0800 Subject: [PATCH 143/182] refactor(ActionExecutor): use HistoryAction record and track scheduled history reset --- .../action/entity/ScheduledActionData.java | 30 +++++++++++++++++-- .../dispatcher/executor/ActionExecutor.java | 17 +++++------ .../dispatcher/executor/ActionRepairer.java | 6 ++-- .../dispatcher/executor/ParamsExtractor.java | 6 ++-- .../executor/entity/HistoryAction.java | 8 +---- 5 files changed, 43 insertions(+), 24 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ScheduledActionData.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ScheduledActionData.java index 00eaaaea..09bd04bf 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ScheduledActionData.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ScheduledActionData.java @@ -2,6 +2,12 @@ package work.slhaf.partner.core.action.entity; import lombok.Data; import lombok.EqualsAndHashCode; +import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.HistoryAction; + +import java.time.ZonedDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; /** * 计划行动数据类,继承自{@link ActionData},扩展了属性{@link ScheduledActionData#type}和{@link ScheduledActionData#scheduleContent},用于标识计划类型(单次还是周期性任务)和计划内容 @@ -10,9 +16,29 @@ import lombok.EqualsAndHashCode; @Data public class ScheduledActionData extends ActionData { private ScheduledType type; - private String scheduleContent; //如果为周期,则对应cron表达式,如果为一次性,则对应为LocalDateTime字符串 + private String scheduleContent; //如果为周期,则对应cron表达式,如果为一次性,则对应为ZonedDateTime字符串 + private List scheduledHistories = new ArrayList<>(); - enum ScheduledType { + public void recordAndReset() { + this.scheduledHistories.add(new ScheduledHistory(ZonedDateTime.now(), this.result, Map.copyOf(this.history))); + + // 清理执行时内容 + this.additionalContext.clear(); + this.executingStage = 0; + this.getActionChain().forEach((stage, actions) -> { + for (MetaAction action : actions) { + action.getParams().clear(); + action.setResult(new MetaAction.Result()); + } + }); + + this.setStatus(ActionStatus.PREPARE); + } + + public enum ScheduledType { CYCLE, ONCE } + + private record ScheduledHistory(ZonedDateTime endTime, String result, Map> history) { + } } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java index b659aadf..ec3181a1 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java @@ -9,11 +9,8 @@ import work.slhaf.partner.api.agent.factory.module.annotation.InjectModule; import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.AgentRunningSubModule; import work.slhaf.partner.core.action.ActionCapability; import work.slhaf.partner.core.action.ActionCore; -import work.slhaf.partner.core.action.entity.ActionData; +import work.slhaf.partner.core.action.entity.*; import work.slhaf.partner.core.action.entity.ActionData.ActionStatus; -import work.slhaf.partner.core.action.entity.MetaAction; -import work.slhaf.partner.core.action.entity.MetaActionInfo; -import work.slhaf.partner.core.action.entity.PhaserRecord; import work.slhaf.partner.core.action.runner.RunnerClient; import work.slhaf.partner.core.cognation.CognationCapability; import work.slhaf.partner.core.memory.MemoryCapability; @@ -157,7 +154,12 @@ public class ActionExecutor extends AgentRunningSubModule new ArrayList<>()) .add(historyAction); diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionRepairer.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionRepairer.java index 60a88569..ce6ec96c 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionRepairer.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionRepairer.java @@ -209,9 +209,9 @@ public class ActionRepairer extends AgentRunningSubModule { JSONObject historyItem = new JSONObject(); - historyItem.put("[行动Key]", historyAction.getActionKey()); - historyItem.put("[行动描述]", historyAction.getDescription()); - historyItem.put("[行动结果]", historyAction.getResult()); + historyItem.put("[行动Key]", historyAction.actionKey()); + historyItem.put("[行动描述]", historyAction.description()); + historyItem.put("[行动结果]", historyAction.result()); historyData.add(historyItem); }); diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ParamsExtractor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ParamsExtractor.java index 25a8d5cc..9caf2686 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ParamsExtractor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ParamsExtractor.java @@ -50,9 +50,9 @@ public class ParamsExtractor extends AgentRunningSubModule historyActions = input.getHistoryActionResults(); for (HistoryAction historyAction : historyActions) { JSONObject historyItem = new JSONObject(); - historyItem.put("[行动Key]", historyAction.getActionKey()); - historyItem.put("[行动描述]", historyAction.getDescription()); - historyItem.put("[行动结果]", historyAction.getResult()); + historyItem.put("[行动Key]", historyAction.actionKey()); + historyItem.put("[行动描述]", historyAction.description()); + historyItem.put("[行动结果]", historyAction.result()); historyData.add(historyItem); } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/HistoryAction.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/HistoryAction.java index 4d0b9a0e..cf36f1ed 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/HistoryAction.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/HistoryAction.java @@ -1,10 +1,4 @@ package work.slhaf.partner.module.modules.action.dispatcher.executor.entity; -import lombok.Data; - -@Data -public class HistoryAction { - private String actionKey; - private String description; - private String result; +public record HistoryAction(String actionKey, String description, String result) { } From c9b64fec2ae1064f95543aa379d034dacdacf43a Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sat, 7 Feb 2026 15:36:45 +0800 Subject: [PATCH 144/182] chore(pom): add cron-utils dependency --- Partner-Main/pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Partner-Main/pom.xml b/Partner-Main/pom.xml index 2cee853b..33bedecb 100644 --- a/Partner-Main/pom.xml +++ b/Partner-Main/pom.xml @@ -71,6 +71,11 @@ mockito-inline 5.2.0 + + com.cronutils + cron-utils + 9.2.1 + From ad58b83020e71fe1d9cadbee222522ecdfebfdc8 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sun, 8 Feb 2026 11:22:30 +0800 Subject: [PATCH 145/182] refactor(ActionExecutor): rename actions variable for clarity --- .../modules/action/dispatcher/executor/ActionExecutor.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java index ec3181a1..5dbe8419 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java @@ -63,10 +63,10 @@ public class ActionExecutor extends AgentRunningSubModule { if (actionData.getStatus() != ActionData.ActionStatus.PREPARE) { return; From 9f724cee5d4ca1a7845cb273f3cc6fbaf3997b98 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sun, 8 Feb 2026 11:22:47 +0800 Subject: [PATCH 146/182] chore(pom): remove test scope from coroutines dependency --- Partner-Main/pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/Partner-Main/pom.xml b/Partner-Main/pom.xml index 33bedecb..d7143d01 100644 --- a/Partner-Main/pom.xml +++ b/Partner-Main/pom.xml @@ -26,7 +26,6 @@ org.jetbrains.kotlinx kotlinx-coroutines-core 1.10.2 - test From fe5a366527672f50028048464ca243f4ac639922 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sun, 8 Feb 2026 11:29:36 +0800 Subject: [PATCH 147/182] refactor(ActionExecutor): remove userId from ActionExecutorInput and use source --- .../action/dispatcher/ActionDispatcher.java | 1 - .../dispatcher/executor/ActionExecutor.java | 30 +++++++++---------- .../executor/entity/ActionExecutorInput.java | 4 --- .../executor/ActionExecutorTest.java | 1 - 4 files changed, 15 insertions(+), 21 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/ActionDispatcher.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/ActionDispatcher.java index 8b001717..e8ac8e89 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/ActionDispatcher.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/ActionDispatcher.java @@ -58,7 +58,6 @@ public class ActionDispatcher extends PostRunningModule { } } val actionExecutorInput = ActionExecutorInput.builder() - .userId(userId) .actions(immediateActions) .build(); actionExecutor.execute(actionExecutorInput); diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java index 5dbe8419..c49ab7fa 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java @@ -64,11 +64,11 @@ public class ActionExecutor extends AgentRunningSubModule { - if (actionData.getStatus() != ActionData.ActionStatus.PREPARE) { + val source = actionData.getSource(); + if (actionData.getStatus() != ActionStatus.PREPARE) { return; } val actionChain = actionData.getActionChain(); @@ -80,7 +80,7 @@ public class ActionExecutor extends AgentRunningSubModule metaActions, PhaserRecord phaserRecord, String userId) { + private MetaActionsListeningRecord executeAndListening(List metaActions, PhaserRecord phaserRecord, String source) { AtomicBoolean accepting = new AtomicBoolean(true); AtomicInteger cursor = new AtomicInteger(); @@ -199,7 +199,7 @@ public class ActionExecutor extends AgentRunningSubModule { @@ -229,7 +229,7 @@ public class ActionExecutor extends AgentRunningSubModule new ArrayList<>()) .add(historyAction); } else { - val repairerInput = assemblyHelper.buildRepairerInput(historyActionResults, metaAction, userId); + val repairerInput = assemblyHelper.buildRepairerInput(historyActionResults, metaAction, source); val repairerResult = actionRepairer.execute(repairerInput); switch (repairerResult.getStatus()) { // 如果本次修复被认为成功,则将补充的信息添加至 additionalContext @@ -289,10 +289,10 @@ public class ActionExecutor extends AgentRunningSubModule historyActionResults, + private ExtractorInput buildExtractorInput(MetaAction action, String source, List historyActionResults, List additionalContext) { ExtractorInput input = new ExtractorInput(); - input.setEvaluatedSlices(memoryCapability.getActivatedSlices(userId)); + input.setEvaluatedSlices(memoryCapability.getActivatedSlices(source)); input.setRecentMessages(cognationCapability.getChatMessages()); input.setMetaActionInfo(actionCapability.loadMetaActionInfo(action.getKey())); input.setHistoryActionResults(historyActionResults); @@ -300,7 +300,7 @@ public class ActionExecutor extends AgentRunningSubModule Date: Sun, 8 Feb 2026 13:24:56 +0800 Subject: [PATCH 148/182] =?UTF-8?q?=E5=B0=86=20.java=20=E9=87=8D=E5=91=BD?= =?UTF-8?q?=E5=90=8D=E4=B8=BA=20.kt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scheduler/{ActionScheduler.java => ActionScheduler.kt} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/{ActionScheduler.java => ActionScheduler.kt} (100%) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt similarity index 100% rename from Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.java rename to Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt From be43b7eec6db181091ee2f91264225c4cc51b30a Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sun, 8 Feb 2026 13:24:56 +0800 Subject: [PATCH 149/182] refactor(ActionScheduler): implement Kotlin time-wheel scheduling and requeue scheduled actions after execution --- .../dispatcher/executor/ActionExecutor.java | 5 + .../dispatcher/scheduler/ActionScheduler.kt | 308 +++++++++++++++++- 2 files changed, 302 insertions(+), 11 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java index c49ab7fa..8ee7dc08 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java @@ -15,9 +15,11 @@ import work.slhaf.partner.core.action.runner.RunnerClient; import work.slhaf.partner.core.cognation.CognationCapability; import work.slhaf.partner.core.memory.MemoryCapability; import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.*; +import work.slhaf.partner.module.modules.action.dispatcher.scheduler.ActionScheduler; import java.util.ArrayList; import java.util.List; +import java.util.Set; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; import java.util.concurrent.Phaser; @@ -41,6 +43,8 @@ public class ActionExecutor extends AgentRunningSubModule, Void> { - @Override - public Void execute(List data) { +class ActionScheduler : AgentRunningSubModule, Void>() { - return null; + @InjectCapability + private lateinit var actionCapability: ActionCapability + + @InjectModule + private lateinit var actionExecutor: ActionExecutor + + private lateinit var timeWheel: TimeWheel + + companion object { + private val log = LoggerFactory.getLogger(ActionScheduler::class.java) } -} + + @Init + fun init() { + val actions = actionCapability.listActions(null, null) + .stream() + .filter { actionData -> actionData is ScheduledActionData } + .map { actionData -> actionData as ScheduledActionData } + .collect(Collectors.toSet()) + timeWheel = TimeWheel(actions) { actionDataSet -> + val input = ActionExecutorInput.builder() + .actions(actionDataSet) + .build() + actionExecutor.execute(input) + } + } + + override fun execute(scheduledActionDataSet: Set?): Void? { + scheduledActionDataSet?.run { + for (scheduledActionData in scheduledActionDataSet) { + actionCapability.putAction(scheduledActionData) + timeWheel.schedule(scheduledActionData) + } + } + return null + } + + private class TimeWheel( + val primaryActions: Set, + val onTrigger: (Set) -> Unit + ) { + + private val actionsGroupByHour = Array>(24) { mutableSetOf() } + private val wheel = Array>(60 * 60) { mutableSetOf() } + private var currentHour: Int = 0 + private val state = MutableStateFlow(WheelState.SLEEPING) + + private val cronDefinition: CronDefinition = CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ) + private val cronParser: CronParser = CronParser(cronDefinition) + + /** + * 根据 primaryActions 建立时间轮,并只加载当天任务,同时启动 tick 线程 + */ + init { + // 加载 primaryActions 进 actionsGroupByHour + loadDayActions() + // 依据当前时间移动至合适的 hour 并启动时间轮 + launchWheel() + } + + fun schedule(actionData: ScheduledActionData) { + if (actionData.status != ActionData.ActionStatus.PREPARE) { + return + } + + val parseToZonedDateTime = parseToZonedDateTime( + actionData.type, + actionData.scheduleContent, + ZonedDateTime.now() + ) ?: run { + logFailedStatus(actionData) + return + } + + val hour = parseToZonedDateTime.hour + actionsGroupByHour[hour].add(actionData) + if (currentHour == hour) { + state.value = WheelState.ACTIVE + } + } + + private fun launchWheel() { + val scope = CoroutineScope(SupervisorJob() + Dispatchers.Default + CoroutineName("TimeWheel")) + fun tickOnTrigger(tick: Int, previousTick: Int) { + if (tick > previousTick) { + val toTrigger = linkedSetOf() + for (i in (previousTick + 1)..tick) { + val bucket = wheel[i] + if (bucket.isNotEmpty()) { + toTrigger.addAll(bucket) + actionsGroupByHour[currentHour].removeAll(bucket) + bucket.clear() // 避免重复触发 + } + } + + if (toTrigger.isNotEmpty()) { + onTrigger(toTrigger) + } + } + } + + scope.launch { + while (isActive) { + // 判断是否该步入下一小时 + val actionsLoadingTime = loadHourActions() + currentHour = actionsLoadingTime.hour + + // 如果该时无任务则等待,插入事件可提前唤醒 + if (actionsGroupByHour[currentHour].isEmpty()) { + // 计算距离下一小时的时间,等待 + val seconds = java.time.Duration.between( + actionsLoadingTime, actionsLoadingTime.truncatedTo(ChronoUnit.HOURS).plusHours(1) + ).toMillis() + withTimeout(seconds) { + state.first { it == WheelState.ACTIVE } + } + state.value = WheelState.SLEEPING + continue + } + + // 唤醒进行时间轮循环 + // 计算当前距离时内下次任务的剩余时间, 秒级推进 + val now = ZonedDateTime.now() + var tick = now.minute * 60 + now.second + var lastTickAdvanceTime = System.nanoTime() + while (isActive) { + // tick 推进(nano -> second) + val current = System.nanoTime() + val step = ((current - lastTickAdvanceTime) / 1_000_000_000L).toInt() + if (step <= 0) { + delay(50) // 避免空转 + continue + } + + val previousTick = tick + tick = (tick + step).coerceAtMost(wheel.lastIndex) + lastTickAdvanceTime = current + + // 取当前 tick、推进过程中经过的 tick 对应任务,异步启动 + tickOnTrigger(tick, previousTick) + + // 推进到顶时停止循环、当前时无任务时停止循环 + if (tick >= wheel.lastIndex || actionsGroupByHour[currentHour].isEmpty()) { + break + } + + // 休眠一秒 + delay(1000) + } + } + + } + } + + private fun loadHourActions(): ZonedDateTime { + val load: (ZonedDateTime, ScheduledActionData) -> Unit = { latestExecutionTime, actionData -> + val secondsTime = latestExecutionTime.minute * 60 + latestExecutionTime.second - 1 + wheel[secondsTime].add(actionData) + } + + val invalid: (ZonedDateTime, ZonedDateTime) -> Boolean = { before, after -> + before.hour != after.hour + } + + val repair: () -> Unit = { + for (set in wheel) { + set.clear() + } + } + + return loadActions(load, invalid, repair) + } + + private fun loadDayActions() { + val load: (ZonedDateTime, ScheduledActionData) -> Unit = { latestExecutingTime, actionData -> + actionsGroupByHour[latestExecutingTime.hour].add(actionData) + } + + val invalid: (ZonedDateTime, ZonedDateTime) -> Boolean = { before, after -> + before.dayOfYear != after.dayOfYear + } + + val repair: () -> Unit = { + for (set in actionsGroupByHour) { + set.clear() + } + } + + loadActions(load, invalid, repair) + + } + + private fun loadActions( + load: (latestExecutingTime: ZonedDateTime, actionData: ScheduledActionData) -> Unit, + invalid: (before: ZonedDateTime, after: ZonedDateTime) -> Boolean, + repair: () -> Unit + ): ZonedDateTime { + val runLoading = { + val now = ZonedDateTime.now() + for (actionData in primaryActions) { + val latestExecutingTime = + parseToZonedDateTime( + actionData.type, + actionData.scheduleContent, + now + ) ?: run { + logFailedStatus(actionData) + continue + } + + load(latestExecutingTime, actionData) + } + } + + val before = ZonedDateTime.now() + runLoading() + val after = ZonedDateTime.now() + if (invalid(before, after)) { + repair() + runLoading() + } + return after + + } + + private fun parseToZonedDateTime( + scheduleType: ScheduledActionData.ScheduledType, + scheduleContent: String, + now: ZonedDateTime + ): ZonedDateTime? { + return when (scheduleType) { + ScheduledActionData.ScheduledType.CYCLE -> { + val cron = try { + cronParser.parse(scheduleContent).validate() + } catch (_: Exception) { + return null + } + val executionTime = ExecutionTime.forCron(cron) + executionTime.nextExecution(now).getOrNull() + } + + ScheduledActionData.ScheduledType.ONCE -> { + val executionTime = try { + ZonedDateTime.parse(scheduleContent) + } catch (_: Exception) { + return null + } + if (executionTime.isBefore(now) || executionTime.dayOfYear != now.dayOfYear) + null + else + executionTime + } + + } + + } + + private fun logFailedStatus(actionData: ScheduledActionData) { + log.warn( + "行动未加载,uuid: {}, source: {}, tendency: {}, scheduleContent: {}", + actionData.uuid, + actionData.source, + actionData.tendency, + actionData.scheduleContent, + ) + } + + private enum class WheelState { + ACTIVE, + SLEEPING, + } + } +} \ No newline at end of file From a43c87006e9b53ed0335a398d2086df5e2cb0d72 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sun, 8 Feb 2026 13:29:18 +0800 Subject: [PATCH 150/182] refactor(ActionCore): replace existing action with same UUID before putAction --- .../src/main/java/work/slhaf/partner/core/action/ActionCore.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java index 06b88c88..d9cad8e7 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java @@ -77,6 +77,7 @@ public class ActionCore extends PartnerCore { @CapabilityMethod public void putAction(@NonNull ActionData actionData) { + actionPool.removeIf(data -> data.getUuid().equals(actionData.getUuid())); // 用来应对 ScheduledActionData 的重新排列 actionPool.add(actionData); } From 70489e57f72d09d66e8524b0da3c3178d63e098f Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sun, 8 Feb 2026 14:34:19 +0800 Subject: [PATCH 151/182] chore(pom): add kotlinx-coroutines-test dependency --- Partner-Main/pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Partner-Main/pom.xml b/Partner-Main/pom.xml index d7143d01..2ac948f9 100644 --- a/Partner-Main/pom.xml +++ b/Partner-Main/pom.xml @@ -27,6 +27,11 @@ kotlinx-coroutines-core 1.10.2 + + org.jetbrains.kotlinx + kotlinx-coroutines-test + 1.10.2 + org.nd4j From 98e4d4cf1b0fc978ba5484c4d8b278a015fa4492 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sun, 8 Feb 2026 15:12:10 +0800 Subject: [PATCH 152/182] =?UTF-8?q?=E5=B0=86=20.java=20=E9=87=8D=E5=91=BD?= =?UTF-8?q?=E5=90=8D=E4=B8=BA=20.kt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/{ActionExecutorInput.java => ActionExecutorInput.kt} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/{ActionExecutorInput.java => ActionExecutorInput.kt} (100%) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ActionExecutorInput.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ActionExecutorInput.kt similarity index 100% rename from Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ActionExecutorInput.java rename to Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ActionExecutorInput.kt From d098b28f31d844127b7ac603d04650118972a9a4 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sun, 8 Feb 2026 15:12:10 +0800 Subject: [PATCH 153/182] refactor(ActionExecutorInput): migrate to Kotlin data class --- .../action/dispatcher/ActionDispatcher.java | 5 +---- .../executor/entity/ActionExecutorInput.kt | 17 +++-------------- .../dispatcher/scheduler/ActionScheduler.kt | 5 +---- .../dispatcher/executor/ActionExecutorTest.java | 4 +--- 4 files changed, 6 insertions(+), 25 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/ActionDispatcher.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/ActionDispatcher.java index e8ac8e89..40b5b240 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/ActionDispatcher.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/ActionDispatcher.java @@ -57,10 +57,7 @@ public class ActionDispatcher extends PostRunningModule { immediateActions.add(actionInfo); } } - val actionExecutorInput = ActionExecutorInput.builder() - .actions(immediateActions) - .build(); - actionExecutor.execute(actionExecutorInput); + actionExecutor.execute(new ActionExecutorInput(immediateActions)); actionScheduler.execute(scheduledActions); }); } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ActionExecutorInput.kt b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ActionExecutorInput.kt index 69a7d55e..f21db99d 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ActionExecutorInput.kt +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/entity/ActionExecutorInput.kt @@ -1,16 +1,5 @@ -package work.slhaf.partner.module.modules.action.dispatcher.executor.entity; +package work.slhaf.partner.module.modules.action.dispatcher.executor.entity -import lombok.Builder; -import lombok.Data; -import work.slhaf.partner.core.action.entity.ActionData; +import work.slhaf.partner.core.action.entity.ActionData -import java.util.Set; - -@Data -@Builder -public class ActionExecutorInput { - /** - * 将执行的行动数据列表 - */ - private Set actions; -} +data class ActionExecutorInput(val actions: Set) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt index 00878b5a..9f211e64 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt @@ -47,10 +47,7 @@ class ActionScheduler : AgentRunningSubModule, Void>() .map { actionData -> actionData as ScheduledActionData } .collect(Collectors.toSet()) timeWheel = TimeWheel(actions) { actionDataSet -> - val input = ActionExecutorInput.builder() - .actions(actionDataSet) - .build() - actionExecutor.execute(input) + actionExecutor.execute(ActionExecutorInput(actionDataSet)) } } diff --git a/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java b/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java index b336ae2d..262dea16 100644 --- a/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java +++ b/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java @@ -369,9 +369,7 @@ class ActionExecutorTest { } private ActionExecutorInput buildInput(String userId, ImmediateActionData actionData) { - return ActionExecutorInput.builder() - .actions(Set.of(actionData)) - .build(); + return new ActionExecutorInput(Set.of(actionData)); } private ImmediateActionData buildActionData(Map> actionChain) { From 8ca2b9998d8a6fb0651d08a293c027df1a5341b0 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sun, 8 Feb 2026 16:27:44 +0800 Subject: [PATCH 154/182] =?UTF-8?q?=E5=B0=86=20.java=20=E9=87=8D=E5=91=BD?= =?UTF-8?q?=E5=90=8D=E4=B8=BA=20.kt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../partner/core/action/entity/{ActionData.java => ActionData.kt} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/{ActionData.java => ActionData.kt} (100%) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.kt similarity index 100% rename from Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.java rename to Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.kt From cdea8d63229da895ce40929559b2ab35a2fb7d3d Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sun, 8 Feb 2026 16:27:44 +0800 Subject: [PATCH 155/182] refactor(ActionData): migrate to Kotlin sealed class and data classes, update planner/scheduler usage --- .../partner/core/action/entity/ActionData.kt | 105 ++++++++++++++---- .../action/entity/ImmediateActionData.java | 12 -- .../action/entity/ScheduledActionData.java | 44 -------- .../dispatcher/scheduler/ActionScheduler.kt | 11 +- .../modules/action/planner/ActionPlanner.java | 35 +++--- .../evaluator/entity/EvaluatorResult.java | 4 + .../executor/ActionExecutorTest.java | 19 ++-- 7 files changed, 122 insertions(+), 108 deletions(-) delete mode 100644 Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ImmediateActionData.java delete mode 100644 Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ScheduledActionData.java diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.kt b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.kt index 5494a14b..2260fbc5 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.kt +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.kt @@ -1,80 +1,143 @@ -package work.slhaf.partner.core.action.entity; +package work.slhaf.partner.core.action.entity -import lombok.Data; -import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.HistoryAction; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.HistoryAction +import java.time.ZonedDateTime +import java.util.* /** * 行动模块传递的行动数据,包含行动uuid、倾向、状态、行动链、结果、发起原因、行动描述等信息。 */ -@Data -public abstract class ActionData { +sealed class ActionData { /** * 行动ID */ - protected String uuid; + val uuid: String = UUID.randomUUID().toString() + /** * 行动倾向 */ - protected String tendency; + abstract val tendency: String /** * 行动状态 */ - protected ActionStatus status; + var status: ActionStatus = ActionStatus.PREPARE + /** * 行动链 */ - protected Map> actionChain; + abstract val actionChain: MutableMap> + /** * 行动阶段(当前阶段) */ - protected int executingStage; + var executingStage: Int = 0 + /** * 行动结果 */ - protected String result; - protected Map> history = new HashMap<>(); + lateinit var result: String + + val history: MutableMap> = mutableMapOf() + /** * 修复上下文 */ - protected Map> additionalContext; + val additionalContext: MutableMap> = mutableMapOf() + /** * 行动原因 */ - protected String reason; + abstract val reason: String + /** * 行动描述 */ - protected String description; + abstract val description: String + /** * 行动来源 */ - protected String source; + abstract val source: String - public enum ActionStatus { + enum class ActionStatus { /** * 执行成功 */ SUCCESS, + /** * 执行失败 */ FAILED, + /** * 执行中 */ EXECUTING, + /** * 暂时中断 */ INTERRUPTED, + /** * 预备执行 */ PREPARE } } + +/** + * 计划行动数据类,继承自{@link ActionData},扩展了属性{@link ScheduledActionData#type}和{@link ScheduledActionData#scheduleContent},用于标识计划类型(单次还是周期性任务)和计划内容 + */ +data class ScheduledActionData( + override val tendency: String, + override val actionChain: MutableMap>, + override val reason: String, + override val description: String, + override val source: String, + val scheduleType: ScheduleType, + val scheduleContent: String, +) : ActionData() { + + val scheduleHistories = ArrayList() + + fun recordAndReset() { + val newHistory = ScheduleHistory(ZonedDateTime.now(), result, history.toMap()) + scheduleHistories.add(newHistory) + + additionalContext.clear() + executingStage = 0 + for (entry in actionChain) { + for (action in entry.value) { + action.params.clear() + action.result = MetaAction.Result() + } + } + + status = ActionStatus.PREPARE + } + + enum class ScheduleType { + CYCLE, + ONCE + } + + data class ScheduleHistory( + val endTime: ZonedDateTime, + val result: String, + val history: Map> + ) +} + +/** + * 即时行动数据类 + */ +data class ImmediateActionData( + override val tendency: String, + override val actionChain: MutableMap>, + override val reason: String, + override val description: String, + override val source: String, +) : ActionData() diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ImmediateActionData.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ImmediateActionData.java deleted file mode 100644 index 388ea0b1..00000000 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ImmediateActionData.java +++ /dev/null @@ -1,12 +0,0 @@ -package work.slhaf.partner.core.action.entity; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 即时行动数据类,继承自{@link ActionData} - */ -@EqualsAndHashCode(callSuper = true) -@Data -public class ImmediateActionData extends ActionData { -} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ScheduledActionData.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ScheduledActionData.java deleted file mode 100644 index 09bd04bf..00000000 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ScheduledActionData.java +++ /dev/null @@ -1,44 +0,0 @@ -package work.slhaf.partner.core.action.entity; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.HistoryAction; - -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -/** - * 计划行动数据类,继承自{@link ActionData},扩展了属性{@link ScheduledActionData#type}和{@link ScheduledActionData#scheduleContent},用于标识计划类型(单次还是周期性任务)和计划内容 - */ -@EqualsAndHashCode(callSuper = true) -@Data -public class ScheduledActionData extends ActionData { - private ScheduledType type; - private String scheduleContent; //如果为周期,则对应cron表达式,如果为一次性,则对应为ZonedDateTime字符串 - private List scheduledHistories = new ArrayList<>(); - - public void recordAndReset() { - this.scheduledHistories.add(new ScheduledHistory(ZonedDateTime.now(), this.result, Map.copyOf(this.history))); - - // 清理执行时内容 - this.additionalContext.clear(); - this.executingStage = 0; - this.getActionChain().forEach((stage, actions) -> { - for (MetaAction action : actions) { - action.getParams().clear(); - action.setResult(new MetaAction.Result()); - } - }); - - this.setStatus(ActionStatus.PREPARE); - } - - public enum ScheduledType { - CYCLE, ONCE - } - - private record ScheduledHistory(ZonedDateTime endTime, String result, Map> history) { - } -} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt index 9f211e64..c68dc002 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt @@ -90,7 +90,7 @@ class ActionScheduler : AgentRunningSubModule, Void>() } val parseToZonedDateTime = parseToZonedDateTime( - actionData.type, + actionData.scheduleType, actionData.scheduleContent, ZonedDateTime.now() ) ?: run { @@ -226,7 +226,7 @@ class ActionScheduler : AgentRunningSubModule, Void>() for (actionData in primaryActions) { val latestExecutingTime = parseToZonedDateTime( - actionData.type, + actionData.scheduleType, actionData.scheduleContent, now ) ?: run { @@ -250,12 +250,13 @@ class ActionScheduler : AgentRunningSubModule, Void>() } private fun parseToZonedDateTime( - scheduleType: ScheduledActionData.ScheduledType, + scheduleType: ScheduledActionData.ScheduleType, scheduleContent: String, now: ZonedDateTime ): ZonedDateTime? { return when (scheduleType) { - ScheduledActionData.ScheduledType.CYCLE -> { + ScheduledActionData.ScheduleType.CYCLE + -> { val cron = try { cronParser.parse(scheduleContent).validate() } catch (_: Exception) { @@ -265,7 +266,7 @@ class ActionScheduler : AgentRunningSubModule, Void>() executionTime.nextExecution(now).getOrNull() } - ScheduledActionData.ScheduledType.ONCE -> { + ScheduledActionData.ScheduleType.ONCE -> { val executionTime = try { ZonedDateTime.parse(scheduleContent) } catch (_: Exception) { diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java index 21fc04d9..4456406a 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/ActionPlanner.java @@ -153,7 +153,7 @@ public class ActionPlanner extends PreRunningModule { private void putActionData(List evaluatorResults, PartnerRunningFlowContext context) { for (EvaluatorResult evaluatorResult : evaluatorResults) { - ActionData actionData = assemblyHelper.buildActionData(evaluatorResult); + ActionData actionData = assemblyHelper.buildActionData(evaluatorResult, context.getUserId()); if (evaluatorResult.isNeedConfirm()) { actionCapability.putPendingActions(context.getUserId(), actionData); } else { @@ -231,24 +231,25 @@ public class ActionPlanner extends PreRunningModule { return input; } - private ActionData buildActionData(EvaluatorResult evaluatorResult) { + private ActionData buildActionData(EvaluatorResult evaluatorResult, String userId) { Map> actionChain = getActionChain(evaluatorResult); return switch (evaluatorResult.getType()) { - case PLANNING -> { - ScheduledActionData actionInfo = new ScheduledActionData(); - actionInfo.setActionChain(actionChain); - actionInfo.setScheduleContent(evaluatorResult.getScheduleContent()); - actionInfo.setStatus(ActionData.ActionStatus.PREPARE); - actionInfo.setUuid(UUID.randomUUID().toString()); - yield actionInfo; - } - case IMMEDIATE -> { - ImmediateActionData actionInfo = new ImmediateActionData(); - actionInfo.setActionChain(actionChain); - actionInfo.setStatus(ActionData.ActionStatus.PREPARE); - actionInfo.setUuid(UUID.randomUUID().toString()); - yield actionInfo; - } + case PLANNING -> new ScheduledActionData( + evaluatorResult.getTendency(), + actionChain, + evaluatorResult.getReason(), + evaluatorResult.getDescription(), + userId, + evaluatorResult.getScheduleType(), + evaluatorResult.getScheduleContent() + ); + case IMMEDIATE -> new ImmediateActionData( + evaluatorResult.getTendency(), + actionChain, + evaluatorResult.getReason(), + evaluatorResult.getDescription(), + userId + ); }; } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/evaluator/entity/EvaluatorResult.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/evaluator/entity/EvaluatorResult.java index 1db2a03c..f6cf7c01 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/evaluator/entity/EvaluatorResult.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/planner/evaluator/entity/EvaluatorResult.java @@ -1,6 +1,7 @@ package work.slhaf.partner.module.modules.action.planner.evaluator.entity; import lombok.Data; +import work.slhaf.partner.core.action.entity.ScheduledActionData; import java.util.List; import java.util.Map; @@ -11,8 +12,11 @@ public class EvaluatorResult { private boolean needConfirm; private ActionType type; private String scheduleContent; + private ScheduledActionData.ScheduleType scheduleType; private Map> primaryActionChain; private String tendency; + private String reason; + private String description; public enum ActionType { IMMEDIATE, PLANNING diff --git a/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java b/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java index 262dea16..a2f9441d 100644 --- a/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java +++ b/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java @@ -1,6 +1,7 @@ package work.slhaf.partner.module.modules.action.dispatcher.executor; import lombok.extern.slf4j.Slf4j; +import lombok.val; import org.junit.jupiter.api.*; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; @@ -373,15 +374,15 @@ class ActionExecutorTest { } private ImmediateActionData buildActionData(Map> actionChain) { - ImmediateActionData actionData = new ImmediateActionData(); - actionData.setStatus(ActionData.ActionStatus.PREPARE); - actionData.setActionChain(actionChain); - actionData.setAdditionalContext(initAdditionalContext(actionChain)); - actionData.setReason("reason"); - actionData.setDescription("desc"); - actionData.setSource("source"); - actionData.setTendency("tendency"); - return actionData; + val immediateActionData = new ImmediateActionData( + "tendency", + actionChain, + "reason", + "desc", + "source" + ); + immediateActionData.getAdditionalContext().putAll(initAdditionalContext(actionChain)); + return immediateActionData; } private Map> singleStageChain(boolean io) { From 6ba5784a7f23c69ac9ddc3dfe3277a5e02318725 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sun, 8 Feb 2026 17:15:58 +0800 Subject: [PATCH 156/182] =?UTF-8?q?=E5=B0=86=20.java=20=E9=87=8D=E5=91=BD?= =?UTF-8?q?=E5=90=8D=E4=B8=BA=20.kt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../partner/core/action/entity/{MetaAction.java => MetaAction.kt} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/{MetaAction.java => MetaAction.kt} (100%) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.kt similarity index 100% rename from Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.java rename to Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.kt From 7dd21046899d76f3d3353adc817a89f7aea4a50a Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sun, 8 Feb 2026 17:15:58 +0800 Subject: [PATCH 157/182] refactor(MetaAction): migrate to Kotlin data class, merge MetaActionType/ResultStatus into nested enums, and update runner/action usages --- .../slhaf/partner/core/action/ActionCore.java | 19 +++-- .../partner/core/action/entity/MetaAction.kt | 82 +++++++++++-------- .../core/action/entity/MetaActionType.java | 12 --- .../core/action/runner/LocalRunnerClient.java | 9 +- .../core/action/runner/RunnerClient.java | 7 +- .../action/runner/SandboxRunnerClient.java | 2 +- .../dispatcher/executor/ActionExecutor.java | 12 +-- .../dispatcher/executor/ActionRepairer.java | 5 +- .../executor/DynamicActionGenerator.java | 22 +++-- .../action/runner/LocalRunnerClientTest.java | 27 +++--- .../core/action/runner/RunnerClientTest.java | 2 +- .../executor/ActionExecutorTest.java | 25 +++--- 12 files changed, 112 insertions(+), 112 deletions(-) delete mode 100644 Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaActionType.java diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java index d9cad8e7..140238f7 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/ActionCore.java @@ -8,7 +8,10 @@ import work.slhaf.partner.api.agent.factory.capability.annotation.CapabilityCore import work.slhaf.partner.api.agent.factory.capability.annotation.CapabilityMethod; import work.slhaf.partner.common.vector.VectorClient; import work.slhaf.partner.core.PartnerCore; -import work.slhaf.partner.core.action.entity.*; +import work.slhaf.partner.core.action.entity.ActionData; +import work.slhaf.partner.core.action.entity.MetaAction; +import work.slhaf.partner.core.action.entity.MetaActionInfo; +import work.slhaf.partner.core.action.entity.PhaserRecord; import work.slhaf.partner.core.action.entity.cache.ActionCacheData; import work.slhaf.partner.core.action.entity.cache.CacheAdjustData; import work.slhaf.partner.core.action.entity.cache.CacheAdjustMetaData; @@ -214,17 +217,17 @@ public class ActionCore extends PartnerCore { if (metaActionInfo == null) { throw new MetaActionNotFoundException("未找到对应的行动程序信息" + actionKey); } - MetaAction metaAction = new MetaAction(); - metaAction.setParams(metaActionInfo.getParams()); - metaAction.setType(MetaActionType.MCP); - metaAction.setIo(metaActionInfo.isIo()); + String[] split = actionKey.split("::"); if (split.length < 2) { throw new MetaActionNotFoundException("未找到对应的行动程序,原因: 传入的 actionKey(" + actionKey + ") 存在异常"); } - metaAction.setLocation(split[0]); - metaAction.setName(split[1]); - return metaAction; + return new MetaAction( + split[1], + metaActionInfo.isIo(), + MetaAction.Type.MCP, + split[0] + ); } @CapabilityMethod diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.kt b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.kt index 379a790a..99833816 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.kt +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.kt @@ -1,61 +1,73 @@ -package work.slhaf.partner.core.action.entity; +package work.slhaf.partner.core.action.entity -import lombok.Data; - -import java.util.Map; /** - * 行动链中的单一元素,封装了调用外部行动程序的必要信息与结果容器,可被{@link work.slhaf.partner.core.action.ActionCapability}执行 + * 行动链中的单一元素,封装了调用外部行动程序的必要信息与结果容器,可被[work.slhaf.partner.core.action.ActionCapability]执行 */ -@Data -public class MetaAction { - +data class MetaAction( /** * 行动name,用于标识行动程序 */ - private String name; - /** - * 行动程序可接受的参数,由调用处设置 - */ - private Map params; - /** - * 行动结果,包括执行状态和相应内容(执行结果或者错误信息) - */ - private Result result = new Result(); + val name: String, /** * 是否IO密集,用于决定使用何种线程池 */ - private boolean io; + val io: Boolean = false, /** * 行动程序类型,可分为 MCP、ORIGIN 两种,前者对应读取到的 MCP Tool、后者对应生成的临时行动程序 */ - private MetaActionType type; - + val type: Type, /** * 当类型为 MCP 时,该字段对应相应 MCP Client 注册时生成的 id; * 当类型为 ORIGIN 时,该字段对应相应的磁盘路径字符串 */ - private String location; + val location: String, +) { /** - * actionKey 将由 location+name 共同定位 - * - * @return actionKey + * 行动程序可接受的参数,由调用处设置 */ - public String getKey() { - return location + "::" + name; + val params: MutableMap = mutableMapOf() + + /** + * 行动结果,包括执行状态和相应内容(执行结果或者错误信息) + */ + var result = Result() + + val key: String + /** + * actionKey 将由 location+name 共同定位 + * + * @return actionKey + */ + get() = "$location::$name" + + class Result { + var status = Status.WAITING + var data: String? = null + + fun reset() { + status = Status.WAITING + data = null + } + + enum class Status { + SUCCESS, + FAILED, + WAITING + } } - @Data - public static class Result { - private ResultStatus status = ResultStatus.WAITING; - private String data = null; - } + enum class Type { + /** + * 将调用的 MCP 工具,可包括远程、本地任意服务 + */ + MCP, - public enum ResultStatus { - SUCCESS, - FAILED, - WAITING + /** + * 适用于‘临时生成’的行动程序,在生成后根据序列化选项及执行情况,进行持久化 + */ + ORIGIN } } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaActionType.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaActionType.java deleted file mode 100644 index 5de3a85a..00000000 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaActionType.java +++ /dev/null @@ -1,12 +0,0 @@ -package work.slhaf.partner.core.action.entity; - -public enum MetaActionType { - /** - * 将调用的 MCP 工具,可包括远程、本地任意服务 - */ - MCP, - /** - * 适用于‘临时生成’的行动程序,在生成后根据序列化选项及执行情况,进行持久化 - */ - ORIGIN -} diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java index 21e20f1c..1e2c5a42 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/LocalRunnerClient.java @@ -29,7 +29,6 @@ import work.slhaf.partner.common.mcp.InProcessMcpTransport; import work.slhaf.partner.core.action.entity.ActionFileMetaData; import work.slhaf.partner.core.action.entity.MetaAction; import work.slhaf.partner.core.action.entity.MetaActionInfo; -import work.slhaf.partner.core.action.entity.MetaActionType; import work.slhaf.partner.core.action.exception.ActionInitFailedException; import work.slhaf.partner.core.action.exception.ActionSerializeFailedException; @@ -200,8 +199,8 @@ public class LocalRunnerClient extends RunnerClient { RunnerResponse response; try { response = switch (metaAction.getType()) { - case MetaActionType.MCP -> doRunWithMcp(metaAction); - case MetaActionType.ORIGIN -> doRunWithOrigin(metaAction); + case MetaAction.Type.MCP -> doRunWithMcp(metaAction); + case MetaAction.Type.ORIGIN -> doRunWithOrigin(metaAction); }; } catch (Exception e) { response = new RunnerResponse(); @@ -251,8 +250,8 @@ public class LocalRunnerClient extends RunnerClient { } @Override - public String buildTmpPath(MetaAction tempAction, String codeType) { - return Path.of(TMP_ACTION_PATH, System.currentTimeMillis() + "-" + tempAction.getKey() + codeType).toString(); + public String buildTmpPath(String actionKey, String codeType) { + return Path.of(TMP_ACTION_PATH, System.currentTimeMillis() + "-" + actionKey + codeType).toString(); } @Override diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java index 7b5f045f..ddc32673 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/RunnerClient.java @@ -9,7 +9,6 @@ import org.jetbrains.annotations.Nullable; import work.slhaf.partner.core.action.entity.ActionFileMetaData; import work.slhaf.partner.core.action.entity.MetaAction; import work.slhaf.partner.core.action.entity.MetaAction.Result; -import work.slhaf.partner.core.action.entity.MetaAction.ResultStatus; import work.slhaf.partner.core.action.entity.MetaActionInfo; import work.slhaf.partner.core.action.exception.ActionInitFailedException; @@ -67,17 +66,17 @@ public abstract class RunnerClient { public void submit(MetaAction metaAction) { // 获取已存在行动列表 Result result = metaAction.getResult(); - if (!result.getStatus().equals(ResultStatus.WAITING)) { + if (!result.getStatus().equals(Result.Status.WAITING)) { return; } RunnerResponse response = doRun(metaAction); result.setData(response.getData()); - result.setStatus(response.isOk() ? ResultStatus.SUCCESS : ResultStatus.FAILED); + result.setStatus(response.isOk() ? Result.Status.SUCCESS : Result.Status.FAILED); } protected abstract RunnerResponse doRun(MetaAction metaAction); - public abstract String buildTmpPath(MetaAction tempAction, String codeType); + public abstract String buildTmpPath(String actionKey, String codeType); public abstract void tmpSerialize(MetaAction tempAction, String code, String codeType) throws IOException; diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/SandboxRunnerClient.java b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/SandboxRunnerClient.java index 410c1af9..7bc34fcf 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/SandboxRunnerClient.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/runner/SandboxRunnerClient.java @@ -40,7 +40,7 @@ public class SandboxRunnerClient extends RunnerClient { } @Override - public String buildTmpPath(MetaAction tempAction, String codeType) { + public String buildTmpPath(String actionKey, String codeType) { throw new UnsupportedOperationException("Unimplemented method 'buildTmpPath'"); } diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java index 8ee7dc08..28b46149 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutor.java @@ -203,7 +203,7 @@ public class ActionExecutor extends AgentRunningSubModule { additionalContext.addAll(repairerResult.getFixedData()); - result.setStatus(MetaAction.ResultStatus.WAITING); + result.setStatus(MetaAction.Result.Status.WAITING); } // 此处的修复失败来自系统内部的执行失败:其余方式均不可行时将回退至当前分支 case RepairerResult.RepairerStatus.FAILED -> { - result.setStatus(MetaAction.ResultStatus.FAILED); + result.setStatus(MetaAction.Result.Status.FAILED); result.setData("行动执行失败"); } // 此处对应已在 repairer 内发起外部请求,故在此处进行阻塞 case RepairerResult.RepairerStatus.ACQUIRE -> { phaserRecord.interrupt(); - result.setStatus(MetaAction.ResultStatus.WAITING); + result.setStatus(MetaAction.Result.Status.WAITING); } } } - } while (result.getStatus().equals(MetaAction.ResultStatus.WAITING)); + } while (result.getStatus().equals(MetaAction.Result.Status.WAITING)); } catch (Exception e) { log.error("Action executing failed: {}", actionKey, e); } finally { diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionRepairer.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionRepairer.java index ce6ec96c..c5496b8a 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionRepairer.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionRepairer.java @@ -16,7 +16,6 @@ import work.slhaf.partner.core.action.ActionCapability; import work.slhaf.partner.core.action.ActionCore.ExecutorType; import work.slhaf.partner.core.action.entity.MetaAction; import work.slhaf.partner.core.action.entity.MetaAction.Result; -import work.slhaf.partner.core.action.entity.MetaAction.ResultStatus; import work.slhaf.partner.core.action.runner.RunnerClient; import work.slhaf.partner.core.cognation.CognationCapability; import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.GeneratorInput; @@ -112,7 +111,7 @@ public class ActionRepairer extends AgentRunningSubModule { try { runnerClient.submit(action); diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/DynamicActionGenerator.java b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/DynamicActionGenerator.java index 45ac8e90..e366198b 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/DynamicActionGenerator.java +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/executor/DynamicActionGenerator.java @@ -1,6 +1,7 @@ package work.slhaf.partner.module.modules.action.dispatcher.executor; import com.alibaba.fastjson2.JSONObject; +import lombok.val; import work.slhaf.partner.api.agent.factory.capability.annotation.InjectCapability; import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule; import work.slhaf.partner.api.agent.factory.module.annotation.Init; @@ -11,7 +12,6 @@ import work.slhaf.partner.common.util.ExtractUtil; import work.slhaf.partner.core.action.ActionCapability; import work.slhaf.partner.core.action.entity.GeneratedData; import work.slhaf.partner.core.action.entity.MetaAction; -import work.slhaf.partner.core.action.entity.MetaActionType; import work.slhaf.partner.core.action.runner.RunnerClient; import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.GeneratorInput; import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.GeneratorResult; @@ -40,15 +40,22 @@ public class DynamicActionGenerator extends AgentRunningSubModule params) { - MetaAction metaAction = new MetaAction(); - metaAction.setType(type); - metaAction.setLocation(location); - metaAction.setName(name); - metaAction.setParams(params); + static MetaAction buildMetaAction(MetaAction.Type type, String location, String name, Map params) { + MetaAction metaAction = new MetaAction( + name, + false, + type, + location + ); + metaAction.getParams().putAll(params); return metaAction; } } @@ -782,7 +783,7 @@ public class LocalRunnerClientTest { try { Path script = tempDir.resolve("run"); Files.writeString(script, "echo ok\n"); - MetaAction metaAction = buildMetaAction(MetaActionType.ORIGIN, script.toString(), "run", Map.of()); + MetaAction metaAction = buildMetaAction(MetaAction.Type.ORIGIN, script.toString(), "run", Map.of()); RunnerClient.RunnerResponse response = client.doRun(metaAction); Assertions.assertNotNull(response); Assertions.assertFalse(response.isOk()); @@ -801,7 +802,7 @@ public class LocalRunnerClientTest { try { Path script = tempDir.resolve("run.sh"); Files.writeString(script, "echo ok\n"); - MetaAction metaAction = buildMetaAction(MetaActionType.ORIGIN, script.toString(), "run", Map.of()); + MetaAction metaAction = buildMetaAction(MetaAction.Type.ORIGIN, script.toString(), "run", Map.of()); RunnerClient.RunnerResponse response = client.doRun(metaAction); Assertions.assertNotNull(response); Assertions.assertTrue(response.isOk()); @@ -818,7 +819,7 @@ public class LocalRunnerClientTest { LocalRunnerClient client = new LocalRunnerClient(existedMetaActions, executor, tempDir.toString()); try { - MetaAction metaAction = buildMetaAction(MetaActionType.MCP, "missing-client", "missing-tool", Map.of()); + MetaAction metaAction = buildMetaAction(MetaAction.Type.MCP, "missing-client", "missing-tool", Map.of()); RunnerClient.RunnerResponse response = client.doRun(metaAction); Assertions.assertNotNull(response); Assertions.assertFalse(response.isOk()); @@ -834,7 +835,7 @@ public class LocalRunnerClientTest { RunnerClient client = new LocalRunnerClient(existedMetaActions, executor, tempDir.toString()); try { - MetaAction metaAction = buildMetaAction(MetaActionType.MCP, "missing-client", "missing-tool", Map.of()); + MetaAction metaAction = buildMetaAction(MetaAction.Type.MCP, "missing-client", "missing-tool", Map.of()); client.submit(metaAction); Assertions.assertNotNull(metaAction.getResult().getData()); } finally { @@ -861,9 +862,9 @@ public class LocalRunnerClientTest { waitForCondition(() -> hasActionKey(existedMetaActions, key -> key.startsWith("playwright::")), 20000); Assertions.assertTrue(hasActionKey(existedMetaActions, key -> key.startsWith("playwright::"))); - MetaAction metaAction = buildMetaAction(MetaActionType.MCP, "playwright", "browser_navigate", Map.of("url", "https://deepwiki.com/microsoft/vscode")); + MetaAction metaAction = buildMetaAction(MetaAction.Type.MCP, "playwright", "browser_navigate", Map.of("url", "https://deepwiki.com/microsoft/vscode")); client.submit(metaAction); - Assertions.assertNotEquals(MetaAction.ResultStatus.WAITING, metaAction.getResult().getStatus()); + Assertions.assertNotEquals(MetaAction.Result.Status.WAITING, metaAction.getResult().getStatus()); } finally { executor.shutdownNow(); } diff --git a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/RunnerClientTest.java b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/RunnerClientTest.java index 722c41b5..6f0e7fe1 100644 --- a/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/RunnerClientTest.java +++ b/Partner-Main/src/test/java/work/slhaf/partner/core/action/runner/RunnerClientTest.java @@ -23,7 +23,7 @@ public class RunnerClientTest { } @Override - public String buildTmpPath(MetaAction tempAction, String codeType) { + public String buildTmpPath(String actionKey, String codeType) { return null; } diff --git a/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java b/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java index a2f9441d..ee4cfe6b 100644 --- a/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java +++ b/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionExecutorTest.java @@ -100,7 +100,7 @@ class ActionExecutorTest { when(paramsExtractor.execute(any())).thenReturn(extractorResult); doAnswer(inv -> { MetaAction metaAction = inv.getArgument(0); - metaAction.getResult().setStatus(MetaAction.ResultStatus.SUCCESS); + metaAction.getResult().setStatus(MetaAction.Result.Status.SUCCESS); return null; }).when(runnerClient).submit(any(MetaAction.class)); @@ -148,7 +148,7 @@ class ActionExecutorTest { when(paramsExtractor.execute(any())).thenReturn(extractorResult); doAnswer(inv -> { MetaAction metaAction = inv.getArgument(0); - metaAction.getResult().setStatus(MetaAction.ResultStatus.SUCCESS); + metaAction.getResult().setStatus(MetaAction.Result.Status.SUCCESS); log.info("metaAction result:{}", metaAction.getResult().getStatus()); return null; }).when(runnerClient).submit(any(MetaAction.class)); @@ -177,7 +177,7 @@ class ActionExecutorTest { lenient().when(paramsExtractor.execute(any())).thenReturn(extractorResult); lenient().doAnswer(inv -> { MetaAction metaAction = inv.getArgument(0); - metaAction.getResult().setStatus(MetaAction.ResultStatus.SUCCESS); + metaAction.getResult().setStatus(MetaAction.Result.Status.SUCCESS); return null; }).when(runnerClient).submit(any(MetaAction.class)); @@ -211,7 +211,7 @@ class ActionExecutorTest { doAnswer(inv -> { MetaAction metaAction = inv.getArgument(0); - metaAction.getResult().setStatus(MetaAction.ResultStatus.SUCCESS); + metaAction.getResult().setStatus(MetaAction.Result.Status.SUCCESS); return null; }).when(runnerClient).submit(any(MetaAction.class)); @@ -252,7 +252,7 @@ class ActionExecutorTest { } catch (InterruptedException ignored) { } MetaAction metaAction = actionData.getActionChain().get(0).get(0); - assertEquals(MetaAction.ResultStatus.FAILED, metaAction.getResult().getStatus()); + assertEquals(MetaAction.Result.Status.FAILED, metaAction.getResult().getStatus()); verify(runnerClient, never()).submit(any(MetaAction.class)); } @@ -279,7 +279,7 @@ class ActionExecutorTest { doAnswer(inv -> { MetaAction metaAction = inv.getArgument(0); - metaAction.getResult().setStatus(MetaAction.ResultStatus.SUCCESS); + metaAction.getResult().setStatus(MetaAction.Result.Status.SUCCESS); return null; }).when(runnerClient).submit(any(MetaAction.class)); @@ -326,7 +326,7 @@ class ActionExecutorTest { lenient().when(paramsExtractor.execute(any())).thenReturn(ok); lenient().doAnswer(inv -> { MetaAction metaAction = inv.getArgument(0); - metaAction.getResult().setStatus(MetaAction.ResultStatus.SUCCESS); + metaAction.getResult().setStatus(MetaAction.Result.Status.SUCCESS); return null; }).when(runnerClient).submit(any(MetaAction.class)); @@ -392,11 +392,12 @@ class ActionExecutorTest { } private MetaAction buildMetaAction(String name, boolean io) { - MetaAction metaAction = new MetaAction(); - metaAction.setName(name); - metaAction.setLocation("loc"); - metaAction.setIo(io); - return metaAction; + return new MetaAction( + name, + io, + MetaAction.Type.ORIGIN, + "location" + ); } private Map> initAdditionalContext(Map> actionChain) { From 8524ca6f9fd9cdac1c47229d3b3ad38cab650a6e Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sun, 8 Feb 2026 17:22:10 +0800 Subject: [PATCH 158/182] refactor(ActionData): use `action.result.reset()` when clearing action chain state --- .../java/work/slhaf/partner/core/action/entity/ActionData.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.kt b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.kt index 2260fbc5..9aededd8 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.kt +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/ActionData.kt @@ -112,7 +112,7 @@ data class ScheduledActionData( for (entry in actionChain) { for (action in entry.value) { action.params.clear() - action.result = MetaAction.Result() + action.result.reset() } } From 76c9c2753284deafa9ff51fd4e1bacbcb8bcb123 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sun, 8 Feb 2026 17:22:47 +0800 Subject: [PATCH 159/182] refactor(MetaAction): make `result` a read-only property --- .../java/work/slhaf/partner/core/action/entity/MetaAction.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.kt b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.kt index 99833816..ca201293 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.kt +++ b/Partner-Main/src/main/java/work/slhaf/partner/core/action/entity/MetaAction.kt @@ -32,7 +32,7 @@ data class MetaAction( /** * 行动结果,包括执行状态和相应内容(执行结果或者错误信息) */ - var result = Result() + val result = Result() val key: String /** From 9bff74c8c7c5dfc43dd3597ed78290acc54e4623 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sun, 8 Feb 2026 21:51:30 +0800 Subject: [PATCH 160/182] fix(ActionScheduler): remove second offset when loading hour actions --- .../modules/action/dispatcher/scheduler/ActionScheduler.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt index c68dc002..11838311 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt @@ -180,7 +180,7 @@ class ActionScheduler : AgentRunningSubModule, Void>() private fun loadHourActions(): ZonedDateTime { val load: (ZonedDateTime, ScheduledActionData) -> Unit = { latestExecutionTime, actionData -> - val secondsTime = latestExecutionTime.minute * 60 + latestExecutionTime.second - 1 + val secondsTime = latestExecutionTime.minute * 60 + latestExecutionTime.second wheel[secondsTime].add(actionData) } From 21693760620b354b86be50a86748d20d153eab06 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sun, 8 Feb 2026 21:51:57 +0800 Subject: [PATCH 161/182] test(ActionScheduler): add unit test for ActionScheduler --- .../executor/ActionSchedulerTest.kt | 264 ++++++++++++++++++ 1 file changed, 264 insertions(+) create mode 100644 Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionSchedulerTest.kt diff --git a/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionSchedulerTest.kt b/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionSchedulerTest.kt new file mode 100644 index 00000000..3aae4ce4 --- /dev/null +++ b/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionSchedulerTest.kt @@ -0,0 +1,264 @@ +package work.slhaf.partner.module.modules.action.dispatcher.executor + +import kotlinx.coroutines.flow.MutableStateFlow +import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith +import org.mockito.ArgumentMatchers.any +import org.mockito.InjectMocks +import org.mockito.Mock +import org.mockito.Mockito +import org.mockito.Mockito.times +import org.mockito.Mockito.verify +import org.mockito.junit.jupiter.MockitoExtension +import work.slhaf.partner.core.action.ActionCapability +import work.slhaf.partner.core.action.entity.ActionData +import work.slhaf.partner.core.action.entity.ScheduledActionData +import work.slhaf.partner.module.modules.action.dispatcher.scheduler.ActionScheduler +import java.time.ZonedDateTime + +/** + * ActionScheduler.execute(...) 测试矩阵(控制流入口:execute)。 + * + * 场景编号与矩阵对应: + * 1) null 入参早退(B1) + * 2) PREPARE + ONCE 合法时间入轮(B2 → B2.3) + * 3) 非 PREPARE 状态忽略(B2 → B2.1) + * 4) ONCE 过期/跨日解析失败(B2 → B2.2) + * 5) CYCLE cron 非法解析失败(B2 → B2.2) + * 6) putAction 异常传播(B2 异常中断) + * 7) 同小时调度触发 ACTIVE(B2.3 + 状态变更) + * 15) 混合输入(成功/失败/忽略路径混合) + * + * 以下矩阵场景因并发/时间依赖难以稳定复现,仅在文档中标注,不在本类实现: + * 8) withTimeout 超时导致协程取消 + * 9) tick 触发 onTrigger 并调用 ActionExecutor + * 10) tick step<=0 空转延迟 + * 11) loadActions 跨小时修复 + * 13) actionExecutor 阻塞导致调度延迟 + * 14) schedule 与 tick 并发访问竞态 + */ +@ExtendWith(MockitoExtension::class) +class ActionSchedulerTest { + + @Mock + private lateinit var actionExecutor: ActionExecutor + + @Mock + private lateinit var actionCapability: ActionCapability + + @InjectMocks + private lateinit var actionScheduler: ActionScheduler + + @Test + fun `execute with null input should return null and no side effects`() { + // 场景编号:1;路径:B1;目的:验证正常早退 + val result = actionScheduler.execute(null) + + assertEquals(null, result) + verify(actionCapability, Mockito.never()).putAction(any(ActionData::class.java)) + } + + @Test + fun `execute should put action and schedule valid ONCE prepare action`() { + // 场景编号:2;路径:B2 → B2.3;目的:验证正常入轮与副作用 + initTimeWheelWithPrimaryActions(emptySet()) + val action = buildScheduledAction( + type = ScheduledActionData.ScheduleType.ONCE, + ZonedDateTime.now().plusHours(1).toString() + ) + + actionScheduler.execute(setOf(action)) + + verify(actionCapability, times(1)).putAction(action) + val timeWheel = timeWheel() + val bucket = actionsGroupByHour(timeWheel)[action.scheduleContentHour()] + assertTrue(bucket.contains(action)) + } + + @Test + fun `execute should ignore non-prepare action for scheduling`() { + // 场景编号:3;路径:B2 → B2.1;目的:验证忽略非 PREPARE 状态 + initTimeWheelWithPrimaryActions(emptySet()) + val action = buildScheduledAction( + type = ScheduledActionData.ScheduleType.ONCE + ) + + actionScheduler.execute(setOf(action)) + + verify(actionCapability, times(1)).putAction(action) + val allScheduled = allScheduledActions(timeWheel()) + assertFalse(allScheduled.contains(action)) + } + + @Test + fun `execute should skip expired ONCE action`() { + // 场景编号:4;路径:B2 → B2.2;目的:验证解析失败被跳过 + initTimeWheelWithPrimaryActions(emptySet()) + val action = buildScheduledAction( + type = ScheduledActionData.ScheduleType.ONCE + ) + + actionScheduler.execute(setOf(action)) + + val allScheduled = allScheduledActions(timeWheel()) + assertFalse(allScheduled.contains(action)) + } + + @Test + fun `execute should skip invalid CYCLE cron`() { + // 场景编号:5;路径:B2 → B2.2;目的:验证 cron 解析失败被跳过 + initTimeWheelWithPrimaryActions(emptySet()) + val action = buildScheduledAction( + type = ScheduledActionData.ScheduleType.CYCLE, + scheduleContentOverride = "invalid-cron" + ) + + actionScheduler.execute(setOf(action)) + + val allScheduled = allScheduledActions(timeWheel()) + assertFalse(allScheduled.contains(action)) + } + + @Test + fun `execute should propagate exception from putAction`() { + // 场景编号:6;路径:B2 异常中断;目的:验证异常传播 + initTimeWheelWithPrimaryActions(emptySet()) + val action = buildScheduledAction( + type = ScheduledActionData.ScheduleType.ONCE + ) + Mockito.doThrow(RuntimeException("boom")) + .`when`(actionCapability) + .putAction(action) + + assertThrows(RuntimeException::class.java) { + actionScheduler.execute(setOf(action)) + } + } + + @Test + fun `execute should activate wheel when scheduling current hour`() { + // 场景编号:7;路径:B2.3;目的:验证同小时调度触发 ACTIVE + initTimeWheelWithPrimaryActions(emptySet()) + val action = buildScheduledAction( + type = ScheduledActionData.ScheduleType.ONCE, + scheduleContentOverride = ZonedDateTime.now().plusMinutes(2).toString() + ) + + val timeWheel = timeWheel() + val actionHour = action.scheduleContentHour() + setCurrentHour(timeWheel, actionHour) + setWheelState(timeWheel, "SLEEPING") + + actionScheduler.execute(setOf(action)) + + assertEquals("ACTIVE", wheelStateName(timeWheel)) + } + + @Test + fun `execute should handle mixed actions consistently`() { + // 场景编号:15;路径:B2 + B2.1/B2.2/B2.3;目的:验证混合输入行为 + initTimeWheelWithPrimaryActions(emptySet()) + val ok = buildScheduledAction( + type = ScheduledActionData.ScheduleType.ONCE, + scheduleContentOverride = ZonedDateTime.now().plusMinutes(2).toString() + ) + val nonPrepare = buildScheduledAction( + type = ScheduledActionData.ScheduleType.ONCE, + scheduleContentOverride = ZonedDateTime.now().plusMinutes(2).toString() + ) + nonPrepare.status = ActionData.ActionStatus.FAILED + val invalid = buildScheduledAction( + type = ScheduledActionData.ScheduleType.CYCLE, + scheduleContentOverride = "invalid-cron" + ) + + actionScheduler.execute(setOf(ok, nonPrepare, invalid)) + + verify(actionCapability, times(1)).putAction(ok) + verify(actionCapability, times(1)).putAction(nonPrepare) + verify(actionCapability, times(1)).putAction(invalid) + val allScheduled = allScheduledActions(timeWheel()) + assertTrue(allScheduled.contains(ok)) + assertFalse(allScheduled.contains(nonPrepare)) + assertFalse(allScheduled.contains(invalid)) + } + + private fun initTimeWheelWithPrimaryActions(actions: Set) { + @Suppress("UNCHECKED_CAST") + Mockito.`when`(actionCapability.listActions(null, null)) + .thenReturn(actions as Set) + actionScheduler.init() + } + + private fun buildScheduledAction( + type: ScheduledActionData.ScheduleType, + scheduleContentOverride: String? = null + ): ScheduledActionData { + val action = ScheduledActionData( + "test", + mutableMapOf(), + "reason", + "description", + "test", + type, + scheduleContentOverride ?: scheduleContentOverride.toString() + ) + return action + } + + private fun ScheduledActionData.scheduleContentHour(): Int { + return ZonedDateTime.parse(this.scheduleContent).hour + } + + private fun timeWheel(): Any { + val field = actionScheduler.javaClass.getDeclaredField("timeWheel") + field.isAccessible = true + return field.get(actionScheduler) + } + + @Suppress("UNCHECKED_CAST") + private fun actionsGroupByHour(timeWheel: Any): Array> { + val field = timeWheel.javaClass.getDeclaredField("actionsGroupByHour") + field.isAccessible = true + return field.get(timeWheel) as Array> + } + + private fun allScheduledActions(timeWheel: Any): Set { + val result = linkedSetOf() + for (bucket in actionsGroupByHour(timeWheel)) { + result.addAll(bucket) + } + return result + } + + private fun setCurrentHour(timeWheel: Any, hour: Int) { + val field = timeWheel.javaClass.getDeclaredField("currentHour") + field.isAccessible = true + field.setInt(timeWheel, hour) + } + + private fun setWheelState(timeWheel: Any, name: String) { + val field = timeWheel.javaClass.getDeclaredField("state") + field.isAccessible = true + @Suppress("UNCHECKED_CAST") + val state = field.get(timeWheel) as MutableStateFlow + state.value = wheelStateEnum(name) + } + + private fun wheelStateName(timeWheel: Any): String { + val field = timeWheel.javaClass.getDeclaredField("state") + field.isAccessible = true + val state = field.get(timeWheel) as MutableStateFlow<*> + val value = state.value as Enum<*> + return value.name + } + + private fun wheelStateEnum(name: String): Any { + @Suppress("UNCHECKED_CAST") + val clazz = Class.forName( + $$"work.slhaf.partner.module.modules.action.dispatcher.scheduler.ActionScheduler$TimeWheel$WheelState" + ) as Class> + return java.lang.Enum.valueOf(clazz, name) + } +} From 84b96b664556657c3ea11f639ee3d661f6bc73fe Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sun, 8 Feb 2026 21:52:16 +0800 Subject: [PATCH 162/182] test(ActionScheduler): remove unused `actionExecutor` mock --- .../modules/action/dispatcher/executor/ActionSchedulerTest.kt | 3 --- 1 file changed, 3 deletions(-) diff --git a/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionSchedulerTest.kt b/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionSchedulerTest.kt index 3aae4ce4..d7fd5396 100644 --- a/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionSchedulerTest.kt +++ b/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionSchedulerTest.kt @@ -41,9 +41,6 @@ import java.time.ZonedDateTime @ExtendWith(MockitoExtension::class) class ActionSchedulerTest { - @Mock - private lateinit var actionExecutor: ActionExecutor - @Mock private lateinit var actionCapability: ActionCapability From 7cb565fd1bb79038c83ccf2c857b5a0e10512ca9 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sun, 8 Feb 2026 21:56:35 +0800 Subject: [PATCH 163/182] fix(ActionScheduler): use `withTimeoutOrNull` when waiting for ACTIVE state, to avoid exception leading to wheel stopped --- .../modules/action/dispatcher/scheduler/ActionScheduler.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt index 11838311..dd71b924 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt @@ -137,7 +137,7 @@ class ActionScheduler : AgentRunningSubModule, Void>() val seconds = java.time.Duration.between( actionsLoadingTime, actionsLoadingTime.truncatedTo(ChronoUnit.HOURS).plusHours(1) ).toMillis() - withTimeout(seconds) { + withTimeoutOrNull(seconds) { state.first { it == WheelState.ACTIVE } } state.value = WheelState.SLEEPING From 882ec43f2bc8808d63182a0bf27dad914483fb26 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Sun, 8 Feb 2026 23:07:03 +0800 Subject: [PATCH 164/182] fix(ActionScheduler): make scheduling thread-safe with Mutex and cancel scheduler/time wheel scopes on shutdown --- .../dispatcher/scheduler/ActionScheduler.kt | 88 +++++++++++++------ 1 file changed, 59 insertions(+), 29 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt index dd71b924..06d76d12 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt @@ -8,6 +8,8 @@ import com.cronutils.parser.CronParser import kotlinx.coroutines.* import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.first +import kotlinx.coroutines.sync.Mutex +import kotlinx.coroutines.sync.withLock import org.slf4j.LoggerFactory import work.slhaf.partner.api.agent.factory.capability.annotation.InjectCapability import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule @@ -19,6 +21,7 @@ import work.slhaf.partner.core.action.entity.ActionData import work.slhaf.partner.core.action.entity.ScheduledActionData import work.slhaf.partner.module.modules.action.dispatcher.executor.ActionExecutor import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.ActionExecutorInput +import java.io.Closeable import java.time.ZonedDateTime import java.time.temporal.ChronoUnit import java.util.stream.Collectors @@ -35,6 +38,9 @@ class ActionScheduler : AgentRunningSubModule, Void>() private lateinit var timeWheel: TimeWheel + private val schedulerScope = + CoroutineScope(Dispatchers.Default + SupervisorJob() + CoroutineName("ActionScheduler")) + companion object { private val log = LoggerFactory.getLogger(ActionScheduler::class.java) } @@ -49,13 +55,24 @@ class ActionScheduler : AgentRunningSubModule, Void>() timeWheel = TimeWheel(actions) { actionDataSet -> actionExecutor.execute(ActionExecutorInput(actionDataSet)) } + + setupShutdownHook() + } + + private fun setupShutdownHook() { + Runtime.getRuntime().addShutdownHook(Thread { + timeWheel.close() + schedulerScope.cancel() + }) } override fun execute(scheduledActionDataSet: Set?): Void? { - scheduledActionDataSet?.run { - for (scheduledActionData in scheduledActionDataSet) { - actionCapability.putAction(scheduledActionData) - timeWheel.schedule(scheduledActionData) + schedulerScope.launch { + scheduledActionDataSet?.run { + for (scheduledActionData in scheduledActionDataSet) { + actionCapability.putAction(scheduledActionData) + timeWheel.schedule(scheduledActionData) + } } } return null @@ -64,13 +81,16 @@ class ActionScheduler : AgentRunningSubModule, Void>() private class TimeWheel( val primaryActions: Set, val onTrigger: (Set) -> Unit - ) { + ) : Closeable { private val actionsGroupByHour = Array>(24) { mutableSetOf() } private val wheel = Array>(60 * 60) { mutableSetOf() } private var currentHour: Int = 0 private val state = MutableStateFlow(WheelState.SLEEPING) + private val wheelActionsLock = Mutex() + private val timeWheelScope = CoroutineScope(SupervisorJob() + Dispatchers.Default + CoroutineName("TimeWheel")) + private val cronDefinition: CronDefinition = CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ) private val cronParser: CronParser = CronParser(cronDefinition) @@ -84,38 +104,42 @@ class ActionScheduler : AgentRunningSubModule, Void>() launchWheel() } - fun schedule(actionData: ScheduledActionData) { + suspend fun schedule(actionData: ScheduledActionData) { if (actionData.status != ActionData.ActionStatus.PREPARE) { return } - val parseToZonedDateTime = parseToZonedDateTime( - actionData.scheduleType, - actionData.scheduleContent, - ZonedDateTime.now() - ) ?: run { - logFailedStatus(actionData) - return - } + wheelActionsLock.withLock { + val parseToZonedDateTime = parseToZonedDateTime( + actionData.scheduleType, + actionData.scheduleContent, + ZonedDateTime.now() + ) ?: run { + logFailedStatus(actionData) + return + } - val hour = parseToZonedDateTime.hour - actionsGroupByHour[hour].add(actionData) - if (currentHour == hour) { - state.value = WheelState.ACTIVE + val hour = parseToZonedDateTime.hour + actionsGroupByHour[hour].add(actionData) + if (currentHour == hour) { + state.value = WheelState.ACTIVE + } } } private fun launchWheel() { - val scope = CoroutineScope(SupervisorJob() + Dispatchers.Default + CoroutineName("TimeWheel")) - fun tickOnTrigger(tick: Int, previousTick: Int) { + + suspend fun tickOnTrigger(tick: Int, previousTick: Int) { if (tick > previousTick) { val toTrigger = linkedSetOf() - for (i in (previousTick + 1)..tick) { - val bucket = wheel[i] - if (bucket.isNotEmpty()) { - toTrigger.addAll(bucket) - actionsGroupByHour[currentHour].removeAll(bucket) - bucket.clear() // 避免重复触发 + wheelActionsLock.withLock { + for (i in (previousTick + 1)..tick) { + val bucket = wheel[i] + if (bucket.isNotEmpty()) { + toTrigger.addAll(bucket) + actionsGroupByHour[currentHour].removeAll(bucket) + bucket.clear() // 避免重复触发 + } } } @@ -125,7 +149,7 @@ class ActionScheduler : AgentRunningSubModule, Void>() } } - scope.launch { + timeWheelScope.launch { while (isActive) { // 判断是否该步入下一小时 val actionsLoadingTime = loadHourActions() @@ -178,7 +202,7 @@ class ActionScheduler : AgentRunningSubModule, Void>() } } - private fun loadHourActions(): ZonedDateTime { + private suspend fun loadHourActions(): ZonedDateTime { val load: (ZonedDateTime, ScheduledActionData) -> Unit = { latestExecutionTime, actionData -> val secondsTime = latestExecutionTime.minute * 60 + latestExecutionTime.second wheel[secondsTime].add(actionData) @@ -194,7 +218,9 @@ class ActionScheduler : AgentRunningSubModule, Void>() } } - return loadActions(load, invalid, repair) + wheelActionsLock.withLock { + return loadActions(load, invalid, repair) + } } private fun loadDayActions() { @@ -292,6 +318,10 @@ class ActionScheduler : AgentRunningSubModule, Void>() ) } + override fun close() { + timeWheelScope.cancel() + } + private enum class WheelState { ACTIVE, SLEEPING, From b05b665960e5820193b746915d7ab6565cf75d5a Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 9 Feb 2026 00:03:21 +0800 Subject: [PATCH 165/182] fix(ActionScheduler): reload day/hour action buckets on time changes via `checkTimeAndLoad`, and reorganize functions --- .../dispatcher/scheduler/ActionScheduler.kt | 211 ++++++++++-------- 1 file changed, 117 insertions(+), 94 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt index 06d76d12..ee02d6cb 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt @@ -22,6 +22,7 @@ import work.slhaf.partner.core.action.entity.ScheduledActionData import work.slhaf.partner.module.modules.action.dispatcher.executor.ActionExecutor import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.ActionExecutorInput import java.io.Closeable +import java.time.Duration import java.time.ZonedDateTime import java.time.temporal.ChronoUnit import java.util.stream.Collectors @@ -85,7 +86,8 @@ class ActionScheduler : AgentRunningSubModule, Void>() private val actionsGroupByHour = Array>(24) { mutableSetOf() } private val wheel = Array>(60 * 60) { mutableSetOf() } - private var currentHour: Int = 0 + private var recordHour: Int = -1 + private var recordDay: Int = -1 private val state = MutableStateFlow(WheelState.SLEEPING) private val wheelActionsLock = Mutex() @@ -98,9 +100,7 @@ class ActionScheduler : AgentRunningSubModule, Void>() * 根据 primaryActions 建立时间轮,并只加载当天任务,同时启动 tick 线程 */ init { - // 加载 primaryActions 进 actionsGroupByHour - loadDayActions() - // 依据当前时间移动至合适的 hour 并启动时间轮 + // 启动时间轮 launchWheel() } @@ -109,19 +109,21 @@ class ActionScheduler : AgentRunningSubModule, Void>() return } - wheelActionsLock.withLock { - val parseToZonedDateTime = parseToZonedDateTime( - actionData.scheduleType, - actionData.scheduleContent, - ZonedDateTime.now() - ) ?: run { - logFailedStatus(actionData) - return - } + val parseToZonedDateTime = parseToZonedDateTime( + actionData.scheduleType, + actionData.scheduleContent, + ZonedDateTime.now() + ) ?: run { + logFailedStatus(actionData) + return + } + checkTimeAndLoad() + + wheelActionsLock.withLock { val hour = parseToZonedDateTime.hour actionsGroupByHour[hour].add(actionData) - if (currentHour == hour) { + if (recordHour == hour) { state.value = WheelState.ACTIVE } } @@ -137,7 +139,7 @@ class ActionScheduler : AgentRunningSubModule, Void>() val bucket = wheel[i] if (bucket.isNotEmpty()) { toTrigger.addAll(bucket) - actionsGroupByHour[currentHour].removeAll(bucket) + actionsGroupByHour[recordHour].removeAll(bucket) bucket.clear() // 避免重复触发 } } @@ -149,104 +151,85 @@ class ActionScheduler : AgentRunningSubModule, Void>() } } + suspend fun CoroutineScope.wheel() { + // 计算当前距离时内下次任务的剩余时间, 秒级推进 + val now = ZonedDateTime.now() + var tick = now.minute * 60 + now.second + var lastTickAdvanceTime = System.nanoTime() + while (isActive) { + // tick 推进(nano -> second) + val current = System.nanoTime() + val step = ((current - lastTickAdvanceTime) / 1_000_000_000L).toInt() + if (step <= 0) { + delay(50) // 避免空转 + continue + } + + val previousTick = tick + tick = (tick + step).coerceAtMost(wheel.lastIndex) + lastTickAdvanceTime = current + + // 取当前 tick、推进过程中经过的 tick 对应任务,异步启动 + tickOnTrigger(tick, previousTick) + + // 推进到顶时停止循环、当前时无任务时停止循环 + if (tick >= wheel.lastIndex || actionsGroupByHour[recordHour].isEmpty()) { + break + } + + // 休眠一秒 + delay(1000) + } + } + + suspend fun wait(currentTime: ZonedDateTime) { + val seconds = Duration.between( + currentTime, currentTime.truncatedTo(ChronoUnit.HOURS).plusHours(1) + ).toMillis() + withTimeoutOrNull(seconds) { + state.first { it == WheelState.ACTIVE } + } + state.value = WheelState.SLEEPING + } + timeWheelScope.launch { while (isActive) { // 判断是否该步入下一小时 - val actionsLoadingTime = loadHourActions() - currentHour = actionsLoadingTime.hour + val currentTime = checkTimeAndLoad() // 如果该时无任务则等待,插入事件可提前唤醒 - if (actionsGroupByHour[currentHour].isEmpty()) { + if (actionsGroupByHour[recordHour].isEmpty()) { // 计算距离下一小时的时间,等待 - val seconds = java.time.Duration.between( - actionsLoadingTime, actionsLoadingTime.truncatedTo(ChronoUnit.HOURS).plusHours(1) - ).toMillis() - withTimeoutOrNull(seconds) { - state.first { it == WheelState.ACTIVE } - } - state.value = WheelState.SLEEPING + wait(currentTime) continue } // 唤醒进行时间轮循环 - // 计算当前距离时内下次任务的剩余时间, 秒级推进 - val now = ZonedDateTime.now() - var tick = now.minute * 60 + now.second - var lastTickAdvanceTime = System.nanoTime() - while (isActive) { - // tick 推进(nano -> second) - val current = System.nanoTime() - val step = ((current - lastTickAdvanceTime) / 1_000_000_000L).toInt() - if (step <= 0) { - delay(50) // 避免空转 - continue - } - - val previousTick = tick - tick = (tick + step).coerceAtMost(wheel.lastIndex) - lastTickAdvanceTime = current - - // 取当前 tick、推进过程中经过的 tick 对应任务,异步启动 - tickOnTrigger(tick, previousTick) - - // 推进到顶时停止循环、当前时无任务时停止循环 - if (tick >= wheel.lastIndex || actionsGroupByHour[currentHour].isEmpty()) { - break - } - - // 休眠一秒 - delay(1000) - } + wheel() } - } } - private suspend fun loadHourActions(): ZonedDateTime { - val load: (ZonedDateTime, ScheduledActionData) -> Unit = { latestExecutionTime, actionData -> - val secondsTime = latestExecutionTime.minute * 60 + latestExecutionTime.second - wheel[secondsTime].add(actionData) - } - - val invalid: (ZonedDateTime, ZonedDateTime) -> Boolean = { before, after -> - before.hour != after.hour - } - - val repair: () -> Unit = { - for (set in wheel) { - set.clear() - } - } - - wheelActionsLock.withLock { - return loadActions(load, invalid, repair) + suspend fun checkTimeAndLoad(): ZonedDateTime { + val currentTime = ZonedDateTime.now() + val currentDay = currentTime.dayOfMonth + if (currentDay != recordDay) { + recordDay = currentDay + recordHour = currentTime.hour + loadDayActions() + loadHourActions() + } else if (currentTime.hour != recordHour) { + recordHour = currentTime.hour + loadHourActions() } + return currentTime } - private fun loadDayActions() { - val load: (ZonedDateTime, ScheduledActionData) -> Unit = { latestExecutingTime, actionData -> - actionsGroupByHour[latestExecutingTime.hour].add(actionData) - } - - val invalid: (ZonedDateTime, ZonedDateTime) -> Boolean = { before, after -> - before.dayOfYear != after.dayOfYear - } - - val repair: () -> Unit = { - for (set in actionsGroupByHour) { - set.clear() - } - } - - loadActions(load, invalid, repair) - - } - - private fun loadActions( + fun loadActions( load: (latestExecutingTime: ZonedDateTime, actionData: ScheduledActionData) -> Unit, invalid: (before: ZonedDateTime, after: ZonedDateTime) -> Boolean, repair: () -> Unit - ): ZonedDateTime { + ) { val runLoading = { val now = ZonedDateTime.now() for (actionData in primaryActions) { @@ -271,7 +254,47 @@ class ActionScheduler : AgentRunningSubModule, Void>() repair() runLoading() } - return after + } + + suspend fun loadHourActions() { + val load: (ZonedDateTime, ScheduledActionData) -> Unit = { latestExecutionTime, actionData -> + val secondsTime = latestExecutionTime.minute * 60 + latestExecutionTime.second + wheel[secondsTime].add(actionData) + } + + val invalid: (ZonedDateTime, ZonedDateTime) -> Boolean = { before, after -> + before.hour != after.hour + } + + val repair: () -> Unit = { + for (set in wheel) { + set.clear() + } + } + + wheelActionsLock.withLock { + loadActions(load, invalid, repair) + } + } + + suspend fun loadDayActions() { + val load: (ZonedDateTime, ScheduledActionData) -> Unit = { latestExecutingTime, actionData -> + actionsGroupByHour[latestExecutingTime.hour].add(actionData) + } + + val invalid: (ZonedDateTime, ZonedDateTime) -> Boolean = { before, after -> + before.dayOfMonth != after.dayOfMonth + } + + val repair: () -> Unit = { + for (set in actionsGroupByHour) { + set.clear() + } + } + + wheelActionsLock.withLock { + loadActions(load, invalid, repair) + } } From 227c735667b62e73fa64868e5eaa274e462c9e8c Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 9 Feb 2026 00:13:36 +0800 Subject: [PATCH 166/182] fix(ActionScheduler): make TimeWheel load scheduled actions dynamically instead of using init snapshot --- .../dispatcher/scheduler/ActionScheduler.kt | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt index ee02d6cb..0796f60f 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt @@ -48,15 +48,18 @@ class ActionScheduler : AgentRunningSubModule, Void>() @Init fun init() { - val actions = actionCapability.listActions(null, null) - .stream() - .filter { actionData -> actionData is ScheduledActionData } - .map { actionData -> actionData as ScheduledActionData } - .collect(Collectors.toSet()) - timeWheel = TimeWheel(actions) { actionDataSet -> - actionExecutor.execute(ActionExecutorInput(actionDataSet)) + val listScheduledActions: () -> Set = { + actionCapability.listActions(null, null) + .stream() + .filter { it is ScheduledActionData } + .map { it as ScheduledActionData } + .collect(Collectors.toSet()) } + val onTrigger: (Set) -> Unit = { actionExecutor.execute(ActionExecutorInput(it)) } + + timeWheel = TimeWheel(listScheduledActions, onTrigger) + setupShutdownHook() } @@ -80,8 +83,8 @@ class ActionScheduler : AgentRunningSubModule, Void>() } private class TimeWheel( - val primaryActions: Set, - val onTrigger: (Set) -> Unit + val listScheduledActions: () -> Set, + val onTrigger: (toTrigger: Set) -> Unit ) : Closeable { private val actionsGroupByHour = Array>(24) { mutableSetOf() } @@ -232,7 +235,7 @@ class ActionScheduler : AgentRunningSubModule, Void>() ) { val runLoading = { val now = ZonedDateTime.now() - for (actionData in primaryActions) { + for (actionData in listScheduledActions()) { val latestExecutingTime = parseToZonedDateTime( actionData.scheduleType, From 9f479c5f6f55c882c5189c6b8d1ce4993673c5f8 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 9 Feb 2026 14:57:13 +0800 Subject: [PATCH 167/182] fix(ActionScheduler): unify time check/loading under `checkThenExecute` and guard wheel loop with launch-hour consistency --- .../dispatcher/scheduler/ActionScheduler.kt | 119 ++++++++++-------- 1 file changed, 66 insertions(+), 53 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt index 0796f60f..4312bafa 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt @@ -112,39 +112,36 @@ class ActionScheduler : AgentRunningSubModule, Void>() return } - val parseToZonedDateTime = parseToZonedDateTime( - actionData.scheduleType, - actionData.scheduleContent, - ZonedDateTime.now() - ) ?: run { - logFailedStatus(actionData) - return - } + checkThenExecute { + val parseToZonedDateTime = parseToZonedDateTime( + actionData.scheduleType, + actionData.scheduleContent, + it + ) ?: run { + logFailedStatus(actionData) + return@checkThenExecute + } - checkTimeAndLoad() - - wheelActionsLock.withLock { val hour = parseToZonedDateTime.hour actionsGroupByHour[hour].add(actionData) if (recordHour == hour) { state.value = WheelState.ACTIVE } + } } private fun launchWheel() { - suspend fun tickOnTrigger(tick: Int, previousTick: Int) { + fun tickOnTrigger(tick: Int, previousTick: Int) { if (tick > previousTick) { val toTrigger = linkedSetOf() - wheelActionsLock.withLock { - for (i in (previousTick + 1)..tick) { - val bucket = wheel[i] - if (bucket.isNotEmpty()) { - toTrigger.addAll(bucket) - actionsGroupByHour[recordHour].removeAll(bucket) - bucket.clear() // 避免重复触发 - } + for (i in (previousTick + 1)..tick) { + val bucket = wheel[i] + if (bucket.isNotEmpty()) { + toTrigger.addAll(bucket) + actionsGroupByHour[recordHour].removeAll(bucket) + bucket.clear() // 避免重复触发 } } @@ -154,10 +151,10 @@ class ActionScheduler : AgentRunningSubModule, Void>() } } - suspend fun CoroutineScope.wheel() { + suspend fun CoroutineScope.wheel(launchingTime: ZonedDateTime) { // 计算当前距离时内下次任务的剩余时间, 秒级推进 - val now = ZonedDateTime.now() - var tick = now.minute * 60 + now.second + val launchingHour = launchingTime.hour + var tick = launchingTime.minute * 60 + launchingTime.second var lastTickAdvanceTime = System.nanoTime() while (isActive) { // tick 推进(nano -> second) @@ -172,11 +169,24 @@ class ActionScheduler : AgentRunningSubModule, Void>() tick = (tick + step).coerceAtMost(wheel.lastIndex) lastTickAdvanceTime = current - // 取当前 tick、推进过程中经过的 tick 对应任务,异步启动 - tickOnTrigger(tick, previousTick) + var shouldBreak: Boolean? = null + checkThenExecute { - // 推进到顶时停止循环、当前时无任务时停止循环 - if (tick >= wheel.lastIndex || actionsGroupByHour[recordHour].isEmpty()) { + if (recordHour != launchingHour) { + // recordHour 在外部受到更新,不等于启动时的 hour,则需要停止 + shouldBreak = true + return@checkThenExecute + } + // 推进到顶时停止循环、当前时无任务时停止循环 + if (tick >= wheel.lastIndex || actionsGroupByHour[recordHour].isEmpty()) { + shouldBreak = true + return@checkThenExecute + } + + // 取当前 tick、推进过程中经过的 tick 对应任务,异步启动 + tickOnTrigger(tick, previousTick) + } + if (shouldBreak!!) { break } @@ -189,6 +199,7 @@ class ActionScheduler : AgentRunningSubModule, Void>() val seconds = Duration.between( currentTime, currentTime.truncatedTo(ChronoUnit.HOURS).plusHours(1) ).toMillis() + // withTimeoutOrNull 内部已处理 seconds 小于 0 的情况 withTimeoutOrNull(seconds) { state.first { it == WheelState.ACTIVE } } @@ -198,35 +209,42 @@ class ActionScheduler : AgentRunningSubModule, Void>() timeWheelScope.launch { while (isActive) { // 判断是否该步入下一小时 - val currentTime = checkTimeAndLoad() + var shouldWait: Boolean? = null + var currentTime: ZonedDateTime? = null + checkThenExecute { + currentTime = it + shouldWait = actionsGroupByHour[recordHour].isEmpty() + } // 如果该时无任务则等待,插入事件可提前唤醒 - if (actionsGroupByHour[recordHour].isEmpty()) { + if (shouldWait!!) { // 计算距离下一小时的时间,等待 - wait(currentTime) + currentTime?.let { wait(it) } continue } // 唤醒进行时间轮循环 - wheel() + wheel(currentTime!!) } } } - suspend fun checkTimeAndLoad(): ZonedDateTime { - val currentTime = ZonedDateTime.now() - val currentDay = currentTime.dayOfMonth - if (currentDay != recordDay) { - recordDay = currentDay - recordHour = currentTime.hour - loadDayActions() - loadHourActions() - } else if (currentTime.hour != recordHour) { - recordHour = currentTime.hour - loadHourActions() + suspend fun checkThenExecute(then: (currentTime: ZonedDateTime) -> Unit) = + wheelActionsLock.withLock { + val currentTime = ZonedDateTime.now() + val currentDay = currentTime.dayOfMonth + if (currentDay != recordDay) { + recordDay = currentDay + recordHour = currentTime.hour + loadDayActions() + loadHourActions() + } else if (currentTime.hour != recordHour) { + recordHour = currentTime.hour + loadHourActions() + } + + then(currentTime) } - return currentTime - } fun loadActions( load: (latestExecutingTime: ZonedDateTime, actionData: ScheduledActionData) -> Unit, @@ -259,7 +277,7 @@ class ActionScheduler : AgentRunningSubModule, Void>() } } - suspend fun loadHourActions() { + fun loadHourActions() { val load: (ZonedDateTime, ScheduledActionData) -> Unit = { latestExecutionTime, actionData -> val secondsTime = latestExecutionTime.minute * 60 + latestExecutionTime.second wheel[secondsTime].add(actionData) @@ -275,12 +293,10 @@ class ActionScheduler : AgentRunningSubModule, Void>() } } - wheelActionsLock.withLock { - loadActions(load, invalid, repair) - } + loadActions(load, invalid, repair) } - suspend fun loadDayActions() { + fun loadDayActions() { val load: (ZonedDateTime, ScheduledActionData) -> Unit = { latestExecutingTime, actionData -> actionsGroupByHour[latestExecutingTime.hour].add(actionData) } @@ -295,10 +311,7 @@ class ActionScheduler : AgentRunningSubModule, Void>() } } - wheelActionsLock.withLock { - loadActions(load, invalid, repair) - } - + loadActions(load, invalid, repair) } private fun parseToZonedDateTime( From 650f9b27a15ab37f7fc5f844c84884487de8fcff Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 9 Feb 2026 15:56:12 +0800 Subject: [PATCH 168/182] fix(ActionScheduler): use `checkThenExecute` current hour consistently and trigger wheel tasks outside lock --- .../dispatcher/scheduler/ActionScheduler.kt | 159 ++++++++---------- 1 file changed, 73 insertions(+), 86 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt index 4312bafa..7562b35f 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt @@ -124,7 +124,7 @@ class ActionScheduler : AgentRunningSubModule, Void>() val hour = parseToZonedDateTime.hour actionsGroupByHour[hour].add(actionData) - if (recordHour == hour) { + if (it.hour == hour) { state.value = WheelState.ACTIVE } @@ -133,22 +133,20 @@ class ActionScheduler : AgentRunningSubModule, Void>() private fun launchWheel() { - fun tickOnTrigger(tick: Int, previousTick: Int) { + fun collectToTrigger(tick: Int, previousTick: Int, triggerHour: Int): Set? { if (tick > previousTick) { - val toTrigger = linkedSetOf() + val toTrigger = mutableSetOf() for (i in (previousTick + 1)..tick) { val bucket = wheel[i] if (bucket.isNotEmpty()) { toTrigger.addAll(bucket) - actionsGroupByHour[recordHour].removeAll(bucket) + actionsGroupByHour[triggerHour].removeAll(bucket) bucket.clear() // 避免重复触发 } } - - if (toTrigger.isNotEmpty()) { - onTrigger(toTrigger) - } + return toTrigger } + return null } suspend fun CoroutineScope.wheel(launchingTime: ZonedDateTime) { @@ -170,22 +168,27 @@ class ActionScheduler : AgentRunningSubModule, Void>() lastTickAdvanceTime = current var shouldBreak: Boolean? = null + var toTrigger: Set? = null checkThenExecute { - if (recordHour != launchingHour) { - // recordHour 在外部受到更新,不等于启动时的 hour,则需要停止 + if (it.hour != launchingHour) { + // recordHout 已更新,此时后执行无意义,不等于启动时的 hour,则需要停止 shouldBreak = true return@checkThenExecute } + + toTrigger = collectToTrigger(tick, previousTick, it.hour) + // 推进到顶时停止循环、当前时无任务时停止循环 - if (tick >= wheel.lastIndex || actionsGroupByHour[recordHour].isEmpty()) { + if (tick >= wheel.lastIndex || actionsGroupByHour[it.hour].isEmpty()) { + state.value = WheelState.SLEEPING shouldBreak = true return@checkThenExecute } // 取当前 tick、推进过程中经过的 tick 对应任务,异步启动 - tickOnTrigger(tick, previousTick) } + toTrigger?.let { onTrigger(it) } if (shouldBreak!!) { break } @@ -203,7 +206,6 @@ class ActionScheduler : AgentRunningSubModule, Void>() withTimeoutOrNull(seconds) { state.first { it == WheelState.ACTIVE } } - state.value = WheelState.SLEEPING } timeWheelScope.launch { @@ -213,7 +215,7 @@ class ActionScheduler : AgentRunningSubModule, Void>() var currentTime: ZonedDateTime? = null checkThenExecute { currentTime = it - shouldWait = actionsGroupByHour[recordHour].isEmpty() + shouldWait = actionsGroupByHour[it.hour].isEmpty() } // 如果该时无任务则等待,插入事件可提前唤醒 @@ -229,89 +231,74 @@ class ActionScheduler : AgentRunningSubModule, Void>() } } - suspend fun checkThenExecute(then: (currentTime: ZonedDateTime) -> Unit) = - wheelActionsLock.withLock { - val currentTime = ZonedDateTime.now() - val currentDay = currentTime.dayOfMonth - if (currentDay != recordDay) { - recordDay = currentDay - recordHour = currentTime.hour - loadDayActions() - loadHourActions() - } else if (currentTime.hour != recordHour) { - recordHour = currentTime.hour - loadHourActions() + suspend fun checkThenExecute(then: (currentTime: ZonedDateTime) -> Unit) = wheelActionsLock.withLock { + fun loadActions( + now: ZonedDateTime, + load: (latestExecutingTime: ZonedDateTime, actionData: ScheduledActionData) -> Unit, + repair: () -> Unit + ) { + val runLoading = { + for (actionData in listScheduledActions()) { + val latestExecutingTime = + parseToZonedDateTime( + actionData.scheduleType, + actionData.scheduleContent, + now + ) ?: run { + logFailedStatus(actionData) + continue + } + + load(latestExecutingTime, actionData) + } } - then(currentTime) - } - - fun loadActions( - load: (latestExecutingTime: ZonedDateTime, actionData: ScheduledActionData) -> Unit, - invalid: (before: ZonedDateTime, after: ZonedDateTime) -> Boolean, - repair: () -> Unit - ) { - val runLoading = { - val now = ZonedDateTime.now() - for (actionData in listScheduledActions()) { - val latestExecutingTime = - parseToZonedDateTime( - actionData.scheduleType, - actionData.scheduleContent, - now - ) ?: run { - logFailedStatus(actionData) - continue - } - - load(latestExecutingTime, actionData) - } - } - - val before = ZonedDateTime.now() - runLoading() - val after = ZonedDateTime.now() - if (invalid(before, after)) { repair() runLoading() } - } - fun loadHourActions() { - val load: (ZonedDateTime, ScheduledActionData) -> Unit = { latestExecutionTime, actionData -> - val secondsTime = latestExecutionTime.minute * 60 + latestExecutionTime.second - wheel[secondsTime].add(actionData) - } - - val invalid: (ZonedDateTime, ZonedDateTime) -> Boolean = { before, after -> - before.hour != after.hour - } - - val repair: () -> Unit = { - for (set in wheel) { - set.clear() + fun loadHourActions(currentTime: ZonedDateTime) { + val load: (ZonedDateTime, ScheduledActionData) -> Unit = { latestExecutionTime, actionData -> + val secondsTime = latestExecutionTime.minute * 60 + latestExecutionTime.second + wheel[secondsTime].add(actionData) } - } - loadActions(load, invalid, repair) - } - - fun loadDayActions() { - val load: (ZonedDateTime, ScheduledActionData) -> Unit = { latestExecutingTime, actionData -> - actionsGroupByHour[latestExecutingTime.hour].add(actionData) - } - - val invalid: (ZonedDateTime, ZonedDateTime) -> Boolean = { before, after -> - before.dayOfMonth != after.dayOfMonth - } - - val repair: () -> Unit = { - for (set in actionsGroupByHour) { - set.clear() + val repair: () -> Unit = { + for (set in wheel) { + set.clear() + } } + + loadActions(currentTime, load, repair) } - loadActions(load, invalid, repair) + fun loadDayActions(currentTime: ZonedDateTime) { + val load: (ZonedDateTime, ScheduledActionData) -> Unit = { latestExecutingTime, actionData -> + actionsGroupByHour[latestExecutingTime.hour].add(actionData) + } + + val repair: () -> Unit = { + for (set in actionsGroupByHour) { + set.clear() + } + } + + loadActions(currentTime, load, repair) + } + + val currentTime = ZonedDateTime.now() + val currentDay = currentTime.dayOfMonth + if (currentDay != recordDay) { + recordDay = currentDay + recordHour = currentTime.hour + loadDayActions(currentTime) + loadHourActions(currentTime) + } else if (currentTime.hour != recordHour) { + recordHour = currentTime.hour + loadHourActions(currentTime) + } + + then(currentTime) } private fun parseToZonedDateTime( From 4b77f26e7b40b24bfac69e547d5f2f60a56bf62f Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 9 Feb 2026 16:37:46 +0800 Subject: [PATCH 169/182] refactor(ActionScheduler): capture current hour once and reuse it for day/hour rollover checks --- .../modules/action/dispatcher/scheduler/ActionScheduler.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt index 7562b35f..8a864d7b 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt @@ -288,13 +288,14 @@ class ActionScheduler : AgentRunningSubModule, Void>() val currentTime = ZonedDateTime.now() val currentDay = currentTime.dayOfMonth + val currentHour = currentTime.hour if (currentDay != recordDay) { recordDay = currentDay - recordHour = currentTime.hour + recordHour = currentHour loadDayActions(currentTime) loadHourActions(currentTime) - } else if (currentTime.hour != recordHour) { - recordHour = currentTime.hour + } else if (currentHour != recordHour) { + recordHour = currentHour loadHourActions(currentTime) } From d47e9fbf95faac42939016e5116c3f98b095c003 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 9 Feb 2026 17:29:32 +0800 Subject: [PATCH 170/182] fix(ActionScheduler): initialize wheel tick baseline before launch to avoid check-to-wheel startup drift --- .../action/dispatcher/scheduler/ActionScheduler.kt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt index 8a864d7b..b1bb7b46 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt @@ -149,11 +149,12 @@ class ActionScheduler : AgentRunningSubModule, Void>() return null } - suspend fun CoroutineScope.wheel(launchingTime: ZonedDateTime) { + suspend fun CoroutineScope.wheel(launchingTime: ZonedDateTime, primaryTickAdvanceTime: Long) { // 计算当前距离时内下次任务的剩余时间, 秒级推进 val launchingHour = launchingTime.hour var tick = launchingTime.minute * 60 + launchingTime.second - var lastTickAdvanceTime = System.nanoTime() + var lastTickAdvanceTime = primaryTickAdvanceTime + while (isActive) { // tick 推进(nano -> second) val current = System.nanoTime() @@ -213,9 +214,14 @@ class ActionScheduler : AgentRunningSubModule, Void>() // 判断是否该步入下一小时 var shouldWait: Boolean? = null var currentTime: ZonedDateTime? = null + var primaryTickAdvanceTime: Long? = null checkThenExecute { currentTime = it shouldWait = actionsGroupByHour[it.hour].isEmpty() + // 由于 wheel 的启动时间可能存在延迟,而时内推进由 nanoTime 保证不会漏发, + // 正常的时序结束又由 tick 是否触顶、当前时是否存在额外任务触发, + // 而启动时无触发保障,此时一并初始化 tick 推进时间,足以应对 check 与 wheel 间的这段时间间隔 + primaryTickAdvanceTime = System.nanoTime() } // 如果该时无任务则等待,插入事件可提前唤醒 @@ -226,7 +232,7 @@ class ActionScheduler : AgentRunningSubModule, Void>() } // 唤醒进行时间轮循环 - wheel(currentTime!!) + wheel(currentTime!!, primaryTickAdvanceTime!!) } } } From eab3d00fe836b92de240a00b1767469845be4f5e Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 9 Feb 2026 20:02:26 +0800 Subject: [PATCH 171/182] refactor(ActionScheduler): remove useless delay in TimeWheel#wheel --- .../modules/action/dispatcher/scheduler/ActionScheduler.kt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt index b1bb7b46..500168e4 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt @@ -159,10 +159,6 @@ class ActionScheduler : AgentRunningSubModule, Void>() // tick 推进(nano -> second) val current = System.nanoTime() val step = ((current - lastTickAdvanceTime) / 1_000_000_000L).toInt() - if (step <= 0) { - delay(50) // 避免空转 - continue - } val previousTick = tick tick = (tick + step).coerceAtMost(wheel.lastIndex) From 406b4250aaae387e2b374db33d4e5dc478e8df00 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 9 Feb 2026 20:03:10 +0800 Subject: [PATCH 172/182] refactor(ActionScheduler): correct actions loading logic in hour/day updating --- .../modules/action/dispatcher/scheduler/ActionScheduler.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt index 500168e4..f335e1d6 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt @@ -235,12 +235,13 @@ class ActionScheduler : AgentRunningSubModule, Void>() suspend fun checkThenExecute(then: (currentTime: ZonedDateTime) -> Unit) = wheelActionsLock.withLock { fun loadActions( + source: Set, now: ZonedDateTime, load: (latestExecutingTime: ZonedDateTime, actionData: ScheduledActionData) -> Unit, repair: () -> Unit ) { val runLoading = { - for (actionData in listScheduledActions()) { + for (actionData in source) { val latestExecutingTime = parseToZonedDateTime( actionData.scheduleType, @@ -271,7 +272,7 @@ class ActionScheduler : AgentRunningSubModule, Void>() } } - loadActions(currentTime, load, repair) + loadActions(actionsGroupByHour[currentTime.hour], currentTime, load, repair) } fun loadDayActions(currentTime: ZonedDateTime) { @@ -285,7 +286,7 @@ class ActionScheduler : AgentRunningSubModule, Void>() } } - loadActions(currentTime, load, repair) + loadActions(listScheduledActions(), currentTime, load, repair) } val currentTime = ZonedDateTime.now() From 7c46f1d1ffa17c5262dfcc9872897f79845d2ec2 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 9 Feb 2026 20:03:24 +0800 Subject: [PATCH 173/182] fix(ActionScheduler): remove triggered hour actions by uuid to avoid removeAll mismatch --- .../modules/action/dispatcher/scheduler/ActionScheduler.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt index f335e1d6..5d4a0f06 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt @@ -140,7 +140,8 @@ class ActionScheduler : AgentRunningSubModule, Void>() val bucket = wheel[i] if (bucket.isNotEmpty()) { toTrigger.addAll(bucket) - actionsGroupByHour[triggerHour].removeAll(bucket) + val bucketUuids = bucket.asSequence().map { it.uuid }.toHashSet() + actionsGroupByHour[triggerHour].removeIf { it.uuid in bucketUuids } bucket.clear() // 避免重复触发 } } From 656d6b65e35bb1675d3142e1a8b23290099df986 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 9 Feb 2026 20:41:01 +0800 Subject: [PATCH 174/182] refactor(ActionScheduler): add debug logs for wheel start/stop, wait window, and action loading --- .../action/dispatcher/scheduler/ActionScheduler.kt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt index 5d4a0f06..620f0499 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt @@ -151,6 +151,7 @@ class ActionScheduler : AgentRunningSubModule, Void>() } suspend fun CoroutineScope.wheel(launchingTime: ZonedDateTime, primaryTickAdvanceTime: Long) { + log.debug("Wheel launched at {}, current nanoTime: {}", launchingTime, primaryTickAdvanceTime) // 计算当前距离时内下次任务的剩余时间, 秒级推进 val launchingHour = launchingTime.hour var tick = launchingTime.minute * 60 + launchingTime.second @@ -165,7 +166,7 @@ class ActionScheduler : AgentRunningSubModule, Void>() tick = (tick + step).coerceAtMost(wheel.lastIndex) lastTickAdvanceTime = current - var shouldBreak: Boolean? = null + var shouldBreak = false var toTrigger: Set? = null checkThenExecute { @@ -187,7 +188,8 @@ class ActionScheduler : AgentRunningSubModule, Void>() // 取当前 tick、推进过程中经过的 tick 对应任务,异步启动 } toTrigger?.let { onTrigger(it) } - if (shouldBreak!!) { + if (shouldBreak) { + log.debug("Wheel stopped") break } @@ -197,13 +199,16 @@ class ActionScheduler : AgentRunningSubModule, Void>() } suspend fun wait(currentTime: ZonedDateTime) { + val nextHour = currentTime.truncatedTo(ChronoUnit.HOURS).plusHours(1) val seconds = Duration.between( - currentTime, currentTime.truncatedTo(ChronoUnit.HOURS).plusHours(1) + currentTime, nextHour ).toMillis() // withTimeoutOrNull 内部已处理 seconds 小于 0 的情况 + log.debug("Start waiting {} ms at {}, target time: {}", seconds, currentTime, nextHour) withTimeoutOrNull(seconds) { state.first { it == WheelState.ACTIVE } } + log.debug("Waiting ended at {}", ZonedDateTime.now()) } timeWheelScope.launch { @@ -265,6 +270,7 @@ class ActionScheduler : AgentRunningSubModule, Void>() val load: (ZonedDateTime, ScheduledActionData) -> Unit = { latestExecutionTime, actionData -> val secondsTime = latestExecutionTime.minute * 60 + latestExecutionTime.second wheel[secondsTime].add(actionData) + log.debug("Action loaded to hour: {}", actionData) } val repair: () -> Unit = { @@ -279,6 +285,7 @@ class ActionScheduler : AgentRunningSubModule, Void>() fun loadDayActions(currentTime: ZonedDateTime) { val load: (ZonedDateTime, ScheduledActionData) -> Unit = { latestExecutingTime, actionData -> actionsGroupByHour[latestExecutingTime.hour].add(actionData) + log.debug("Action loaded to day: {}", actionData) } val repair: () -> Unit = { From 2db1bdf3e94ad23ff3164f9cf4771a51028ecd7f Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 9 Feb 2026 20:50:36 +0800 Subject: [PATCH 175/182] refactor(ActionScheduler): add debug log for action execution --- .../modules/action/dispatcher/scheduler/ActionScheduler.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt index 620f0499..e382d253 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt @@ -187,7 +187,10 @@ class ActionScheduler : AgentRunningSubModule, Void>() // 取当前 tick、推进过程中经过的 tick 对应任务,异步启动 } - toTrigger?.let { onTrigger(it) } + toTrigger?.let { + onTrigger(it) + log.debug("Executing action at hour {} tick {}", launchingHour, tick) + } if (shouldBreak) { log.debug("Wheel stopped") break From a5d26769e8aa34469468818d74a02da848f385de Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 9 Feb 2026 20:54:35 +0800 Subject: [PATCH 176/182] fix(ActionScheduler): skip trigger callback when tick has no actions --- .../modules/action/dispatcher/scheduler/ActionScheduler.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt index e382d253..f1e8a266 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt @@ -188,6 +188,8 @@ class ActionScheduler : AgentRunningSubModule, Void>() // 取当前 tick、推进过程中经过的 tick 对应任务,异步启动 } toTrigger?.let { + if (it.isEmpty()) return@let + onTrigger(it) log.debug("Executing action at hour {} tick {}", launchingHour, tick) } From ecbbbc995496d8fab1b537865017597308d5c977 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 9 Feb 2026 20:56:45 +0800 Subject: [PATCH 177/182] refactor(ActionScheduler): include tick in wheel stop debug log --- .../modules/action/dispatcher/scheduler/ActionScheduler.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt index f1e8a266..6dcded0e 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt @@ -194,7 +194,7 @@ class ActionScheduler : AgentRunningSubModule, Void>() log.debug("Executing action at hour {} tick {}", launchingHour, tick) } if (shouldBreak) { - log.debug("Wheel stopped") + log.debug("Wheel stopped at tick {}", tick) break } From 9ec03c4c952a088cb60758bda8b20621493ba5f4 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 9 Feb 2026 21:01:22 +0800 Subject: [PATCH 178/182] fix(ActionScheduler): include previous tick in trigger scan and tighten next execution filtering --- .../action/dispatcher/scheduler/ActionScheduler.kt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt index 6dcded0e..102ee506 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt @@ -136,7 +136,7 @@ class ActionScheduler : AgentRunningSubModule, Void>() fun collectToTrigger(tick: Int, previousTick: Int, triggerHour: Int): Set? { if (tick > previousTick) { val toTrigger = mutableSetOf() - for (i in (previousTick + 1)..tick) { + for (i in previousTick..tick) { val bucket = wheel[i] if (bucket.isNotEmpty()) { toTrigger.addAll(bucket) @@ -193,13 +193,15 @@ class ActionScheduler : AgentRunningSubModule, Void>() onTrigger(it) log.debug("Executing action at hour {} tick {}", launchingHour, tick) } + + // 休眠一秒 + delay(1000) + if (shouldBreak) { log.debug("Wheel stopped at tick {}", tick) break } - // 休眠一秒 - delay(1000) } } @@ -253,7 +255,7 @@ class ActionScheduler : AgentRunningSubModule, Void>() ) { val runLoading = { for (actionData in source) { - val latestExecutingTime = + val nextExecutingTime = parseToZonedDateTime( actionData.scheduleType, actionData.scheduleContent, @@ -263,7 +265,7 @@ class ActionScheduler : AgentRunningSubModule, Void>() continue } - load(latestExecutingTime, actionData) + load(nextExecutingTime, actionData) } } @@ -341,7 +343,7 @@ class ActionScheduler : AgentRunningSubModule, Void>() } catch (_: Exception) { return null } - if (executionTime.isBefore(now) || executionTime.dayOfYear != now.dayOfYear) + if (executionTime.plusSeconds(1).isBefore(now) || executionTime.dayOfMonth != now.dayOfMonth) null else executionTime From e2bd9eb0af75c319091863694164f0a6393524f8 Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 9 Feb 2026 21:19:40 +0800 Subject: [PATCH 179/182] fix(ActionScheduler): enqueue same-hour actions in wheel and add scheduling debug logs --- .../modules/action/dispatcher/scheduler/ActionScheduler.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt index 102ee506..bc3f584b 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt @@ -74,6 +74,7 @@ class ActionScheduler : AgentRunningSubModule, Void>() schedulerScope.launch { scheduledActionDataSet?.run { for (scheduledActionData in scheduledActionDataSet) { + log.debug("New action to schedule: {}", scheduledActionData) actionCapability.putAction(scheduledActionData) timeWheel.schedule(scheduledActionData) } @@ -121,11 +122,17 @@ class ActionScheduler : AgentRunningSubModule, Void>() logFailedStatus(actionData) return@checkThenExecute } + log.debug("Action next execution time: {}", parseToZonedDateTime) val hour = parseToZonedDateTime.hour actionsGroupByHour[hour].add(actionData) + log.debug("Action scheduled at {}", hour) + if (it.hour == hour) { + val wheelOffset = parseToZonedDateTime.minute * 60 + parseToZonedDateTime.second + wheel[wheelOffset].add(actionData) state.value = WheelState.ACTIVE + log.debug("Action scheduled at wheel offset {}", wheelOffset) } } From 69d9f04f11b9661ef57f8e96b6f122025032db4d Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 9 Feb 2026 21:04:48 +0800 Subject: [PATCH 180/182] fix(ActionScheduler): stabilize wheel tick pacing and run trigger scan before hour/day refresh --- .../dispatcher/scheduler/ActionScheduler.kt | 182 ++++++++++-------- 1 file changed, 97 insertions(+), 85 deletions(-) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt index bc3f584b..e8472fbd 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt @@ -158,57 +158,59 @@ class ActionScheduler : AgentRunningSubModule, Void>() } suspend fun CoroutineScope.wheel(launchingTime: ZonedDateTime, primaryTickAdvanceTime: Long) { - log.debug("Wheel launched at {}, current nanoTime: {}", launchingTime, primaryTickAdvanceTime) - // 计算当前距离时内下次任务的剩余时间, 秒级推进 val launchingHour = launchingTime.hour var tick = launchingTime.minute * 60 + launchingTime.second - var lastTickAdvanceTime = primaryTickAdvanceTime + + // 让节拍器从“启动时刻的下一秒”开始(避免立即 step=0) + var nextTickNanos = primaryTickAdvanceTime + 1_000_000_000L while (isActive) { - // tick 推进(nano -> second) - val current = System.nanoTime() - val step = ((current - lastTickAdvanceTime) / 1_000_000_000L).toInt() + // 1) 计算落后多少秒:至少 1(正常推进),也可能 >1(追赶) + val now0 = System.nanoTime() + val lagNanos = now0 - nextTickNanos + val step = if (lagNanos < 0) 1 else (lagNanos / 1_000_000_000L).toInt() + 1 val previousTick = tick tick = (tick + step).coerceAtMost(wheel.lastIndex) - lastTickAdvanceTime = current + + // 2) 推进节拍器:按“理论秒”前进 step 次 + nextTickNanos += step.toLong() * 1_000_000_000L var shouldBreak = false var toTrigger: Set? = null - checkThenExecute { + checkThenExecute(false) { if (it.hour != launchingHour) { - // recordHout 已更新,此时后执行无意义,不等于启动时的 hour,则需要停止 shouldBreak = true + toTrigger = collectToTrigger(wheel.lastIndex, previousTick, launchingHour) return@checkThenExecute } - toTrigger = collectToTrigger(tick, previousTick, it.hour) + toTrigger = collectToTrigger(tick, previousTick, launchingHour) - // 推进到顶时停止循环、当前时无任务时停止循环 - if (tick >= wheel.lastIndex || actionsGroupByHour[it.hour].isEmpty()) { + if (tick >= wheel.lastIndex || actionsGroupByHour[launchingHour].isEmpty()) { state.value = WheelState.SLEEPING shouldBreak = true return@checkThenExecute } - - // 取当前 tick、推进过程中经过的 tick 对应任务,异步启动 } - toTrigger?.let { - if (it.isEmpty()) return@let + toTrigger?.takeIf { it.isNotEmpty() }?.let { onTrigger(it) log.debug("Executing action at hour {} tick {}", launchingHour, tick) } - // 休眠一秒 - delay(1000) - if (shouldBreak) { log.debug("Wheel stopped at tick {}", tick) break } + // 3) 精确睡到下一次理论 tick(用最新 nanoTime) + val now1 = System.nanoTime() + val sleepNanos = nextTickNanos - now1 + if (sleepNanos > 0) { + delay(sleepNanos / 1_000_000L) // 毫秒级 delay 足够;剩余 nanos 不必忙等 + } } } @@ -253,80 +255,90 @@ class ActionScheduler : AgentRunningSubModule, Void>() } } - suspend fun checkThenExecute(then: (currentTime: ZonedDateTime) -> Unit) = wheelActionsLock.withLock { - fun loadActions( - source: Set, - now: ZonedDateTime, - load: (latestExecutingTime: ZonedDateTime, actionData: ScheduledActionData) -> Unit, - repair: () -> Unit - ) { - val runLoading = { - for (actionData in source) { - val nextExecutingTime = - parseToZonedDateTime( - actionData.scheduleType, - actionData.scheduleContent, - now - ) ?: run { - logFailedStatus(actionData) - continue - } + suspend fun checkThenExecute(finallyToExecute: Boolean = true, then: (currentTime: ZonedDateTime) -> Unit) = + wheelActionsLock.withLock { + fun loadActions( + source: Set, + now: ZonedDateTime, + load: (latestExecutingTime: ZonedDateTime, actionData: ScheduledActionData) -> Unit, + repair: () -> Unit + ) { + val runLoading = { + for (actionData in source) { + val nextExecutingTime = + parseToZonedDateTime( + actionData.scheduleType, + actionData.scheduleContent, + now + ) ?: run { + logFailedStatus(actionData) + continue + } - load(nextExecutingTime, actionData) + load(nextExecutingTime, actionData) + } + } + + repair() + runLoading() + } + + fun loadHourActions(currentTime: ZonedDateTime) { + val load: (ZonedDateTime, ScheduledActionData) -> Unit = { latestExecutionTime, actionData -> + val secondsTime = latestExecutionTime.minute * 60 + latestExecutionTime.second + wheel[secondsTime].add(actionData) + log.debug("Action loaded to hour: {}", actionData) + } + + val repair: () -> Unit = { + for (set in wheel) { + set.clear() + } + } + + loadActions(actionsGroupByHour[currentTime.hour], currentTime, load, repair) + } + + fun loadDayActions(currentTime: ZonedDateTime) { + val load: (ZonedDateTime, ScheduledActionData) -> Unit = { latestExecutingTime, actionData -> + actionsGroupByHour[latestExecutingTime.hour].add(actionData) + log.debug("Action loaded to day: {}", actionData) + } + + val repair: () -> Unit = { + for (set in actionsGroupByHour) { + set.clear() + } + } + + loadActions(listScheduledActions(), currentTime, load, repair) + } + + fun refreshIfNeeded(now: ZonedDateTime) { + val d = now.dayOfMonth + val h = now.hour + if (d != recordDay) { + recordDay = d + recordHour = h + loadDayActions(now) + loadHourActions(now) + } else if (h != recordHour) { + recordHour = h + loadHourActions(now) } } - repair() - runLoading() - } + val now = ZonedDateTime.now() - fun loadHourActions(currentTime: ZonedDateTime) { - val load: (ZonedDateTime, ScheduledActionData) -> Unit = { latestExecutionTime, actionData -> - val secondsTime = latestExecutionTime.minute * 60 + latestExecutionTime.second - wheel[secondsTime].add(actionData) - log.debug("Action loaded to hour: {}", actionData) + if (finallyToExecute) { + refreshIfNeeded(now) + then(now) + } else { + then(now) + refreshIfNeeded(now) } - - val repair: () -> Unit = { - for (set in wheel) { - set.clear() - } - } - - loadActions(actionsGroupByHour[currentTime.hour], currentTime, load, repair) } - fun loadDayActions(currentTime: ZonedDateTime) { - val load: (ZonedDateTime, ScheduledActionData) -> Unit = { latestExecutingTime, actionData -> - actionsGroupByHour[latestExecutingTime.hour].add(actionData) - log.debug("Action loaded to day: {}", actionData) - } - - val repair: () -> Unit = { - for (set in actionsGroupByHour) { - set.clear() - } - } - - loadActions(listScheduledActions(), currentTime, load, repair) - } - - val currentTime = ZonedDateTime.now() - val currentDay = currentTime.dayOfMonth - val currentHour = currentTime.hour - if (currentDay != recordDay) { - recordDay = currentDay - recordHour = currentHour - loadDayActions(currentTime) - loadHourActions(currentTime) - } else if (currentHour != recordHour) { - recordHour = currentHour - loadHourActions(currentTime) - } - - then(currentTime) - } - private fun parseToZonedDateTime( scheduleType: ScheduledActionData.ScheduleType, scheduleContent: String, From 940beb2587858f370feabb9c7f7dd3b0eb63580d Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 9 Feb 2026 21:05:08 +0800 Subject: [PATCH 181/182] test(ActionScheduler): add test --- .../executor/ActionSchedulerTest.kt | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionSchedulerTest.kt b/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionSchedulerTest.kt index d7fd5396..24d9c88c 100644 --- a/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionSchedulerTest.kt +++ b/Partner-Main/src/test/java/work/slhaf/partner/module/modules/action/dispatcher/executor/ActionSchedulerTest.kt @@ -1,5 +1,6 @@ package work.slhaf.partner.module.modules.action.dispatcher.executor +import kotlinx.coroutines.* import kotlinx.coroutines.flow.MutableStateFlow import org.junit.jupiter.api.Assertions.* import org.junit.jupiter.api.Test @@ -11,11 +12,14 @@ import org.mockito.Mockito import org.mockito.Mockito.times import org.mockito.Mockito.verify import org.mockito.junit.jupiter.MockitoExtension +import org.slf4j.LoggerFactory import work.slhaf.partner.core.action.ActionCapability import work.slhaf.partner.core.action.entity.ActionData import work.slhaf.partner.core.action.entity.ScheduledActionData +import work.slhaf.partner.module.modules.action.dispatcher.executor.entity.ActionExecutorInput import work.slhaf.partner.module.modules.action.dispatcher.scheduler.ActionScheduler import java.time.ZonedDateTime +import java.time.temporal.ChronoUnit /** * ActionScheduler.execute(...) 测试矩阵(控制流入口:execute)。 @@ -41,12 +45,62 @@ import java.time.ZonedDateTime @ExtendWith(MockitoExtension::class) class ActionSchedulerTest { + @Mock + private lateinit var actionExecutor: ActionExecutor + @Mock private lateinit var actionCapability: ActionCapability @InjectMocks private lateinit var actionScheduler: ActionScheduler + companion object { + val log = LoggerFactory.getLogger(ActionSchedulerTest::class.java)!! + } + + @Test + fun `running test`() { + fun buildAction(time: ZonedDateTime): ScheduledActionData { + return ScheduledActionData( + "tendency", + mutableMapOf(), + "reason", + "description", + "source", + ScheduledActionData.ScheduleType.ONCE, + time.toString() + ) + } + + val now = ZonedDateTime.now() + val actions = setOf( + buildAction(now.plusMinutes(1)), + buildAction(now.truncatedTo(ChronoUnit.HOURS).plusHours(1).minusSeconds(1)), + ) + Mockito.`when`(actionCapability.listActions(null, null)) + .thenReturn(actions as Set) + Mockito.`when`(actionExecutor.execute(any())) + .thenAnswer { + val input = it.arguments[0] as ActionExecutorInput + for (actionData in input.actions) { + log.info("Executed action $actionData at ${ZonedDateTime.now()}") + } + null + } + actionScheduler.init() + + + val scope = CoroutineScope(SupervisorJob() + Dispatchers.Default + CoroutineName("ActionSchedulerTest")) + scope.launch { + actionScheduler.execute( + setOf( + buildAction(now.plusSeconds(5)), + ) + ) + } + readlnOrNull() + } + @Test fun `execute with null input should return null and no side effects`() { // 场景编号:1;路径:B1;目的:验证正常早退 From d381a97731ee813e6daa28885ea0cc9a4396a87f Mon Sep 17 00:00:00 2001 From: slhafzjw Date: Mon, 9 Feb 2026 21:12:38 +0800 Subject: [PATCH 182/182] refactor(ActionScheduler): add debug log for hour-change trigger scan --- .../modules/action/dispatcher/scheduler/ActionScheduler.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt index e8472fbd..2c867e4a 100644 --- a/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt +++ b/Partner-Main/src/main/java/work/slhaf/partner/module/modules/action/dispatcher/scheduler/ActionScheduler.kt @@ -183,6 +183,12 @@ class ActionScheduler : AgentRunningSubModule, Void>() if (it.hour != launchingHour) { shouldBreak = true toTrigger = collectToTrigger(wheel.lastIndex, previousTick, launchingHour) + log.debug( + "Hour changed, previousTick: {}, tick: {}, toTriggerSize: {}", + previousTick, + tick, + toTrigger?.size + ) return@checkThenExecute }