Refactor workflow auto-run to node graph

This commit is contained in:
QLHazyCoder
2026-05-15 17:41:35 +08:00
parent f6f804f1a2
commit 81fc40706a
76 changed files with 4028 additions and 1453 deletions
+20 -3
View File
@@ -12,8 +12,9 @@
closeConflictingTabsForSource,
CLOUDFLARE_TEMP_EMAIL_PROVIDER,
CLOUD_MAIL_PROVIDER = 'cloudmail',
completeStepFromBackground,
completeNodeFromBackground,
confirmCustomVerificationStepBypassRequest,
getNodeIdByStepForState,
getHotmailVerificationPollConfig,
getHotmailVerificationRequestTimestamp,
handleMail2925LimitReachedError,
@@ -32,6 +33,7 @@
sendToContentScript,
sendToContentScriptResilient,
sendToMailContentScriptResilient,
setNodeStatus,
setState,
sleepWithStop,
throwIfStopped,
@@ -65,6 +67,13 @@
return rawAddLog(normalizeVerificationLogMessage(message), level, normalizedOptions);
}
async function getNodeIdForStep(step) {
const state = typeof getState === 'function' ? await getState() : {};
return typeof getNodeIdByStepForState === 'function'
? String(getNodeIdByStepForState(step, state) || '').trim()
: '';
}
const isRetryableVerificationTransportError = typeof deps.isRetryableContentScriptTransportError === 'function'
? deps.isRetryableContentScriptTransportError
: ((error) => /back\/forward cache|message channel is closed|Receiving end does not exist|port closed before a response was received|A listener indicated an asynchronous response|did not respond in \d+s/i.test(
@@ -404,7 +413,11 @@
signupVerificationRequestedAt: null,
loginVerificationRequestedAt: null,
});
await deps.setStepStatus(completionStep, 'skipped');
const completionNodeId = await getNodeIdForStep(completionStep);
if (!completionNodeId) {
throw new Error(`步骤 ${completionStep} 未映射到验证码节点。`);
}
await setNodeStatus(completionNodeId, 'skipped');
await addLog(`步骤 ${completionStep}:已确认手动完成${verificationLabel}验证码输入,当前步骤已跳过。`, 'warn');
}
@@ -1387,7 +1400,11 @@
[stateKey]: result.code,
});
await completeStepFromBackground(completionStep, {
const completionNodeId = await getNodeIdForStep(completionStep);
if (!completionNodeId) {
throw new Error(`步骤 ${completionStep} 未映射到验证码节点。`);
}
await completeNodeFromBackground(completionNodeId, {
emailTimestamp: result.emailTimestamp,
code: result.code,
phoneVerificationRequired: Boolean(submitResult.addPhonePage),