feat: require auto-chain action evidence
This commit is contained in:
@@ -98,6 +98,23 @@ 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;
|
||||
@@ -152,11 +169,8 @@ function buildGateLockInput(wrapperResult: any): Record<string, unknown> {
|
||||
concreteNextAction: requiredNextAction,
|
||||
}
|
||||
: null;
|
||||
const autoChainDispatchEvidence = progressEvidence && hasConcreteExecutionEvidence
|
||||
? {
|
||||
sessionKey: typeof progressEvidence.sessionKey === "string" ? progressEvidence.sessionKey : "",
|
||||
concreteNextAction: requiredNextAction,
|
||||
}
|
||||
const autoChainDispatchEvidence = hasConcreteExecutionEvidence
|
||||
? buildAutoChainDispatchEvidence(wrapperResult, progressEvidence)
|
||||
: null;
|
||||
const claimedProgression = shouldClaimProgression(wrapperResult, progressEvidence)
|
||||
? "already progressing to the next step in background"
|
||||
@@ -184,6 +198,9 @@ function buildGateLockInput(wrapperResult: any): Record<string, unknown> {
|
||||
statusSummary: claimedProgression,
|
||||
executionEvidence,
|
||||
progressEvidence,
|
||||
autoChainDispatchEvidenceReason: hasConcreteExecutionEvidence && !autoChainDispatchEvidence
|
||||
? "explicit auto-chain next action requires dispatched-action evidence"
|
||||
: "",
|
||||
progressEvidenceReason,
|
||||
sessionKey: typeof progressEvidence?.sessionKey === "string" ? progressEvidence.sessionKey : "",
|
||||
runId: typeof progressEvidence?.runId === "string" ? progressEvidence.runId : "",
|
||||
|
||||
Reference in New Issue
Block a user