feat: 添加 Plus 模式和贡献模式支持,增强步骤执行延迟和提示逻辑

This commit is contained in:
QLHazyCoder
2026-04-26 08:51:20 +08:00
parent f558194185
commit 227ebedda4
10 changed files with 577 additions and 14 deletions
+22 -1
View File
@@ -5505,6 +5505,9 @@ const STEP_COMPLETION_SIGNAL_STEP_KEYS = new Set([
'fill-profile',
'platform-verify',
]);
const AUTO_RUN_PRE_EXECUTION_DELAYS_BY_STEP_KEY = new Map([
['plus-checkout-create', 20000],
]);
function waitForStepComplete(step, timeoutMs = 120000) {
return new Promise((resolve, reject) => {
@@ -5549,6 +5552,14 @@ function doesStepUseCompletionSignal(step, state = {}) {
return STEP_COMPLETION_SIGNAL_STEPS.has(step);
}
function getAutoRunPreExecutionDelayMs(step, state = {}) {
const stepKey = getStepExecutionKeyForState(step, state);
if (stepKey) {
return AUTO_RUN_PRE_EXECUTION_DELAYS_BY_STEP_KEY.get(stepKey) || 0;
}
return 0;
}
function notifyStepComplete(step, payload) {
const waiter = stepWaiters.get(step);
console.log(LOG_PREFIX, `[notifyStepComplete] step ${step}, hasWaiter=${Boolean(waiter)}`);
@@ -5914,7 +5925,17 @@ async function executeStepAndWait(step, delayAfter = 2000) {
await sleepWithStop(delaySeconds * 1000);
}
const executionState = await getState();
let executionState = await getState();
const preExecutionDelayMs = getAutoRunPreExecutionDelayMs(step, executionState);
if (preExecutionDelayMs > 0) {
await addLog(
`自动运行:步骤 ${step} 执行前固定等待 ${Math.round(preExecutionDelayMs / 1000)} 秒,确保 Plus Checkout 创建前页面稳定。`,
'info'
);
await sleepWithStop(preExecutionDelayMs);
executionState = await getState();
}
if (doesStepUseBackgroundCompletion(step, executionState)) {
await addLog(`自动运行:步骤 ${step} 由后台流程负责收尾,执行函数返回后将直接进入下一步。`, 'info');
await executeStep(step);