fix: add wrapper-backed progress evidence integration path
This commit is contained in:
@@ -72,6 +72,15 @@ function inferFromRequestText(input) {
|
||||
if (!input.needsSubagent && /\bsubagent\b/.test(text)) {
|
||||
inferred.needsSubagent = true;
|
||||
}
|
||||
if (!input.checkpointTrigger && inferred.needsSubagent) {
|
||||
inferred.checkpointTrigger = 'when delegated work returns or the next checkpoint fires';
|
||||
}
|
||||
if (!input.externalizedTrigger && inferred.needsSubagent) {
|
||||
inferred.externalizedTrigger = 'wrapper-derived checkpoint artifact';
|
||||
}
|
||||
if (!input.triggerKind && inferred.needsSubagent) {
|
||||
inferred.triggerKind = 'artifact';
|
||||
}
|
||||
|
||||
return inferred;
|
||||
}
|
||||
@@ -107,6 +116,39 @@ function bootstrapTaskState(input, classificationResult) {
|
||||
};
|
||||
}
|
||||
|
||||
function toSlug(value) {
|
||||
return String(value || '')
|
||||
.toLowerCase()
|
||||
.replace(/[^a-z0-9]+/g, '-')
|
||||
.replace(/^-+|-+$/g, '')
|
||||
.slice(0, 48);
|
||||
}
|
||||
|
||||
function buildExternalizedCheckpointPath(input, classificationResult) {
|
||||
if (classificationResult.classification !== 'long_task') return '';
|
||||
if (!classificationResult.silentCandidate) return '';
|
||||
if (!input.externalizedTrigger) return '';
|
||||
|
||||
const taskSeed = [input.currentStep, input.nextStep, input.waitingOn, input.blocker]
|
||||
.map((value) => toSlug(value))
|
||||
.filter(Boolean)
|
||||
.join('-');
|
||||
const stableSeed = taskSeed || 'long-task';
|
||||
|
||||
return `checkpoints/${stableSeed}.json`;
|
||||
}
|
||||
|
||||
function buildProgressEvidence(input, classificationResult, externalizedCheckpointPath) {
|
||||
if (classificationResult.classification !== 'long_task') return null;
|
||||
if (!classificationResult.silentCandidate) return null;
|
||||
if (!externalizedCheckpointPath) return null;
|
||||
|
||||
return {
|
||||
sessionKey: toSlug([input.currentStep, input.waitingOn, input.nextStep].filter(Boolean).join('-')) || 'long-task-session',
|
||||
checkpointPath: externalizedCheckpointPath,
|
||||
};
|
||||
}
|
||||
|
||||
function validateSilentLaunch(input, classificationResult) {
|
||||
if (!classificationResult.silentCandidate) {
|
||||
return {
|
||||
@@ -154,6 +196,8 @@ function main() {
|
||||
const input = inferFromRequestText(normalizeRequest(raw));
|
||||
const classificationResult = classify(input);
|
||||
const taskRecord = bootstrapTaskState(input, classificationResult);
|
||||
const externalizedCheckpointPath = buildExternalizedCheckpointPath(input, classificationResult);
|
||||
const progressEvidence = buildProgressEvidence(input, classificationResult, externalizedCheckpointPath);
|
||||
const silentLaunch = validateSilentLaunch(input, classificationResult);
|
||||
const handoff = planHandoff(classificationResult);
|
||||
|
||||
@@ -164,6 +208,8 @@ function main() {
|
||||
needsCheckpoint: classificationResult.needsCheckpoint,
|
||||
needsSubagent: classificationResult.needsSubagent,
|
||||
taskRecord,
|
||||
progressEvidence,
|
||||
externalizedCheckpointPath,
|
||||
silentLaunchOk: silentLaunch.ok,
|
||||
silentLaunchReason: silentLaunch.reason,
|
||||
recommendedFallback: silentLaunch.recommendedFallback,
|
||||
|
||||
Reference in New Issue
Block a user