Add hard-gate guidance to hook preflight
This commit is contained in:
@@ -64,6 +64,33 @@ async function runLongTaskWrapper(workspaceDir: string, ctx: any): Promise<any |
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function buildWrapperEnforcement(wrapperResult: any): string[] {
|
||||||
|
const lines = [
|
||||||
|
"- Treat this as ingress preflight guidance from the wrapper MVP.",
|
||||||
|
];
|
||||||
|
|
||||||
|
if (wrapperResult.classification === "long_task") {
|
||||||
|
lines.push("- ENFORCEMENT: This request defaults to long-task governance; do not treat it as ordinary single-turn chat unless you can clearly justify overriding the classifier.");
|
||||||
|
lines.push("- ENFORCEMENT: If you proceed, prefer explicit task state and checkpoint discipline over ad-hoc continuation.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wrapperResult.handoff?.mode === "button_path") {
|
||||||
|
lines.push("- ENFORCEMENT: Owner decision is expected; plan Telegram button-path early instead of ending with a plain-text menu.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wrapperResult.silentCandidate === true && wrapperResult.silentLaunchOk === false) {
|
||||||
|
lines.push("- ENFORCEMENT: Silent launch is NOT allowed in the current form.");
|
||||||
|
lines.push("- ENFORCEMENT: Use the recommended fallback before proceeding.");
|
||||||
|
if (wrapperResult.requiredNextAction) {
|
||||||
|
lines.push(`- ENFORCEMENT: Required next action = ${wrapperResult.requiredNextAction}`);
|
||||||
|
}
|
||||||
|
} else if (wrapperResult.silentCandidate === true && wrapperResult.silentLaunchOk === true) {
|
||||||
|
lines.push("- ENFORCEMENT: Silent launch is only acceptable if you preserve externalized checkpoint discipline and do not rely on memory alone.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return lines;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Force Recall hook handler
|
* Force Recall hook handler
|
||||||
*
|
*
|
||||||
@@ -103,9 +130,7 @@ const forceRecall = async (event: any) => {
|
|||||||
wrapperResult.recommendedFallback ? `recommendedFallback=${wrapperResult.recommendedFallback}` : null,
|
wrapperResult.recommendedFallback ? `recommendedFallback=${wrapperResult.recommendedFallback}` : null,
|
||||||
wrapperResult.requiredNextAction ? `requiredNextAction=${wrapperResult.requiredNextAction}` : null,
|
wrapperResult.requiredNextAction ? `requiredNextAction=${wrapperResult.requiredNextAction}` : null,
|
||||||
wrapperResult.handoff?.mode ? `handoff.mode=${wrapperResult.handoff.mode}` : null,
|
wrapperResult.handoff?.mode ? `handoff.mode=${wrapperResult.handoff.mode}` : null,
|
||||||
"- Treat this as preflight guidance from the wrapper MVP, not final truth.",
|
...buildWrapperEnforcement(wrapperResult),
|
||||||
"- If classification=long_task, prefer task state + checkpoint discipline.",
|
|
||||||
"- If silentCandidate=true and silentLaunchOk=false, do not launch silent mode as-is.",
|
|
||||||
"[/LONG_TASK_GOVERNOR_PREFLIGHT]",
|
"[/LONG_TASK_GOVERNOR_PREFLIGHT]",
|
||||||
"",
|
"",
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user