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

Function executeStep

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

Source from the content-addressed store, hash-verified

4645// ============================================================
4646
4647async function executeStep(step, options = {}) {
4648 const { deferRetryableTransportError = false } = options;
4649 console.log(LOG_PREFIX, `Executing step ${step}`);
4650 throwIfStopped();
4651 await setStepStatus(step, 'running');
4652 await addLog(`步骤 ${step} 开始执行`);
4653 await humanStepDelay();
4654
4655 const state = await getState();
4656
4657 // Set flow start time on first step
4658 if (step === 1 && !state.flowStartTime) {
4659 await setState({ flowStartTime: Date.now() });
4660 }
4661
4662 try {
4663 await stepRegistry.executeStep(step, state);
4664 } catch (err) {
4665 if (isStopError(err)) {
4666 await setStepStatus(step, 'stopped');
4667 await addLog(`步骤 ${step} 已被用户停止`, 'warn');
4668 await appendManualAccountRunRecordIfNeeded(`step${step}_stopped`, state, getErrorMessage(err));
4669 throw err;
4670 }
4671 if (!(deferRetryableTransportError && doesStepUseCompletionSignal(step) && isRetryableContentScriptTransportError(err))) {
4672 await setStepStatus(step, 'failed');
4673 await addLog(`步骤 ${step} 失败:${err.message}`, 'error');
4674 await appendManualAccountRunRecordIfNeeded(`step${step}_failed`, state, getErrorMessage(err));
4675 } else {
4676 console.warn(
4677 LOG_PREFIX,
4678 `[executeStep] deferring retryable transport error for step ${step}: ${getErrorMessage(err)}`
4679 );
4680 }
4681 throw err;
4682 }
4683}
4684
4685/**
4686 * Execute a step and wait for it to complete before returning.

Callers 2

executeStepAndWaitFunction · 0.70

Calls 11

humanStepDelayFunction · 0.85
getStateFunction · 0.85
setStateFunction · 0.85
throwIfStoppedFunction · 0.70
setStepStatusFunction · 0.70
addLogFunction · 0.70
isStopErrorFunction · 0.70
getErrorMessageFunction · 0.70

Tested by

no test coverage detected