Add fallback guidance to wrapper MVP
This commit is contained in:
@@ -12,9 +12,7 @@ function parseArgs(argv) {
|
||||
}
|
||||
|
||||
function readInput(path) {
|
||||
if (!path || path === '-') {
|
||||
return fs.readFileSync(0, 'utf8');
|
||||
}
|
||||
if (!path || path === '-') return fs.readFileSync(0, 'utf8');
|
||||
return fs.readFileSync(path, 'utf8');
|
||||
}
|
||||
|
||||
@@ -72,27 +70,42 @@ function bootstrapTaskState(input, classificationResult) {
|
||||
|
||||
function validateSilentLaunch(input, classificationResult) {
|
||||
if (!classificationResult.silentCandidate) {
|
||||
return { ok: true, reason: 'not a silent long-task' };
|
||||
return {
|
||||
ok: true,
|
||||
reason: 'not a silent long-task',
|
||||
recommendedFallback: 'none',
|
||||
requiredNextAction: 'proceed_with_normal_long_task_flow',
|
||||
};
|
||||
}
|
||||
|
||||
if (!input.checkpointTrigger) {
|
||||
return { ok: false, reason: 'missing first forced checkpoint trigger' };
|
||||
return {
|
||||
ok: false,
|
||||
reason: 'missing first forced checkpoint trigger',
|
||||
recommendedFallback: 'non_silent_follow_up',
|
||||
requiredNextAction: 'define_first_checkpoint_trigger_before_silent_launch',
|
||||
};
|
||||
}
|
||||
|
||||
if (!input.externalizedTrigger) {
|
||||
return { ok: false, reason: 'missing externalized checkpoint path' };
|
||||
return {
|
||||
ok: false,
|
||||
reason: 'missing externalized checkpoint path',
|
||||
recommendedFallback: 'non_silent_follow_up',
|
||||
requiredNextAction: 'bind_externalized_checkpoint_path_or_abort_silent_launch',
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
ok: true,
|
||||
reason: `${input.triggerKind || 'externalized'} trigger is defined`,
|
||||
recommendedFallback: 'none',
|
||||
requiredNextAction: 'proceed_with_silent_launch',
|
||||
};
|
||||
}
|
||||
|
||||
function planHandoff(classificationResult) {
|
||||
if (classificationResult.needsOwnerDecision) {
|
||||
return { mode: 'button_path' };
|
||||
}
|
||||
if (classificationResult.needsOwnerDecision) return { mode: 'button_path' };
|
||||
return { mode: 'direct_reply' };
|
||||
}
|
||||
|
||||
@@ -114,6 +127,8 @@ function main() {
|
||||
taskRecord,
|
||||
silentLaunchOk: silentLaunch.ok,
|
||||
silentLaunchReason: silentLaunch.reason,
|
||||
recommendedFallback: silentLaunch.recommendedFallback,
|
||||
requiredNextAction: silentLaunch.requiredNextAction,
|
||||
handoff,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user