MCPcopy Index your code
hub / github.com/QLHazyCoder/FlowPilot / invalidateDownstreamAfterStepRestart

Function invalidateDownstreamAfterStepRestart

background.js:3716–3745  ·  view source on GitHub ↗
(step, options = {})

Source from the content-addressed store, hash-verified

3714}
3715
3716async function invalidateDownstreamAfterStepRestart(step, options = {}) {
3717 const { logLabel = `步骤 ${step} 重新执行` } = options;
3718 const state = await getState();
3719 const statuses = { ...(state.stepStatuses || {}) };
3720 const changedSteps = [];
3721
3722 for (let downstream = step + 1; downstream <= 9; downstream++) {
3723 if (statuses[downstream] !== 'pending') {
3724 statuses[downstream] = 'pending';
3725 changedSteps.push(downstream);
3726 }
3727 }
3728
3729 if (changedSteps.length) {
3730 await setState({ stepStatuses: statuses });
3731 for (const downstream of changedSteps) {
3732 chrome.runtime.sendMessage({
3733 type: 'STEP_STATUS_CHANGED',
3734 payload: { step: downstream, status: 'pending' },
3735 }).catch(() => { });
3736 }
3737 await addLog(`${logLabel},已重置后续步骤状态:${changedSteps.join(', ')}`, 'warn');
3738 }
3739
3740 const resets = getDownstreamStateResets(step);
3741 if (Object.keys(resets).length) {
3742 await setState(resets);
3743 broadcastDataUpdate(resets);
3744 }
3745}
3746
3747function clearStopRequest() {
3748 stopRequested = false;

Callers 2

runAutoSequenceFromStepFunction · 0.85
handleMessageFunction · 0.85

Calls 5

getStateFunction · 0.85
setStateFunction · 0.85
getDownstreamStateResetsFunction · 0.85
broadcastDataUpdateFunction · 0.85
addLogFunction · 0.70

Tested by

no test coverage detected