Harden runtime debug and task pipeline

This commit is contained in:
Youzini-afk
2026-03-27 01:26:56 +08:00
parent b20e8dbb44
commit c31af1d1a4
17 changed files with 1750 additions and 238 deletions

View File

@@ -319,16 +319,26 @@ function collectLocalRules(regexConfig = {}) {
}
function shouldApplyRuleForStage(rule, stage = "", stagesConfig = {}) {
// 将细粒度的 stage 名映射到 input / output 两大类
if (PROMPT_STAGES.has(stage)) {
const normalizedStage = String(stage || "").trim();
if (
normalizedStage &&
Object.prototype.hasOwnProperty.call(stagesConfig, normalizedStage)
) {
return (
stagesConfig[normalizedStage] !== false &&
rule.destinationFlags.prompt !== false
);
}
if (PROMPT_STAGES.has(normalizedStage)) {
return (
stagesConfig.input !== false && rule.destinationFlags.prompt !== false
);
}
if (OUTPUT_STAGES.has(stage)) {
return stagesConfig.output !== false;
if (OUTPUT_STAGES.has(normalizedStage)) {
return (
stagesConfig.output !== false && rule.destinationFlags.prompt !== false
);
}
// 未知 stage 回退到 input
return stagesConfig.input !== false && rule.destinationFlags.prompt !== false;
}