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

Function executeStepViaCompletionSignal

background.js:4503–4544  ·  view source on GitHub ↗
(step, timeoutMs = AUTO_RUN_SIGNAL_COMPLETION_TIMEOUT_MS)

Source from the content-addressed store, hash-verified

4501}
4502
4503async function executeStepViaCompletionSignal(step, timeoutMs = AUTO_RUN_SIGNAL_COMPLETION_TIMEOUT_MS) {
4504 const completionResultPromise = waitForStepComplete(step, timeoutMs).then(
4505 payload => ({ ok: true, payload }),
4506 error => ({ ok: false, error }),
4507 );
4508
4509 let executeError = null;
4510 try {
4511 await executeStep(step, { deferRetryableTransportError: true });
4512 } catch (err) {
4513 executeError = err;
4514 if (isStopError(err) || !isRetryableContentScriptTransportError(err)) {
4515 notifyStepError(step, getErrorMessage(err));
4516 }
4517 }
4518
4519 const completionResult = await completionResultPromise;
4520 if (completionResult.ok) {
4521 if (executeError) {
4522 console.warn(
4523 LOG_PREFIX,
4524 `[executeStepViaCompletionSignal] step ${step} completed after deferred execute error: ${getErrorMessage(executeError)}`
4525 );
4526 }
4527 return completionResult.payload;
4528 }
4529
4530 if (executeError && isRetryableContentScriptTransportError(executeError)) {
4531 const completionMessage = getErrorMessage(completionResult.error);
4532 if (/等待超时/.test(completionMessage)) {
4533 await finalizeDeferredStepExecutionError(step, executeError);
4534 throw executeError;
4535 }
4536 throw completionResult.error;
4537 }
4538
4539 if (executeError) {
4540 throw executeError;
4541 }
4542
4543 throw completionResult.error;
4544}
4545
4546async function waitForRunningStepsToFinish(payload = {}) {
4547 let currentState = await getState();

Callers 2

executeStepAndWaitFunction · 0.85
handleMessageFunction · 0.85

Calls 7

waitForStepCompleteFunction · 0.85
notifyStepErrorFunction · 0.85
executeStepFunction · 0.70
isStopErrorFunction · 0.70
getErrorMessageFunction · 0.70

Tested by

no test coverage detected