fix: tighten auto-chain dispatch evidence

This commit is contained in:
Eve
2026-04-23 20:11:49 +08:00
parent bff9146280
commit d8290b7ba2
3 changed files with 128 additions and 39 deletions

View File

@@ -98,23 +98,6 @@ function buildProgressEvidence(wrapperResult: any): Record<string, unknown> | nu
return Object.keys(progressEvidence).length > 0 ? progressEvidence : null;
}
function buildAutoChainDispatchEvidence(wrapperResult: any, progressEvidence: Record<string, unknown> | null): Record<string, unknown> | null {
const taskName = typeof progressEvidence?.sessionKey === "string"
? progressEvidence.sessionKey.trim()
: "";
const requiredNextAction = typeof wrapperResult?.requiredNextAction === "string"
? wrapperResult.requiredNextAction.trim()
: "";
if (!requiredNextAction || !taskName) return null;
return {
action: requiredNextAction,
sessionKey: taskName,
dispatched: true,
};
}
function shouldClaimProgression(wrapperResult: any, progressEvidence: Record<string, unknown> | null): boolean {
if (!wrapperResult || wrapperResult.classification !== "long_task") return false;
if (progressEvidence && Object.keys(progressEvidence).length > 0) return true;
@@ -170,8 +153,11 @@ function buildGateLockInput(wrapperResult: any): Record<string, unknown> {
}
: null;
const autoChainDispatchEvidence = hasConcreteExecutionEvidence
? buildAutoChainDispatchEvidence(wrapperResult, progressEvidence)
: null;
&& wrapperResult.autoChainDispatchEvidence
&& typeof wrapperResult.autoChainDispatchEvidence === "object"
&& !Array.isArray(wrapperResult.autoChainDispatchEvidence)
? wrapperResult.autoChainDispatchEvidence
: null;
const claimedProgression = shouldClaimProgression(wrapperResult, progressEvidence)
? "already progressing to the next step in background"
: "";