fix: tighten auto-chain dispatch evidence
This commit is contained in:
@@ -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"
|
||||
: "";
|
||||
|
||||
Reference in New Issue
Block a user