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

Function waitForStepComplete

background.js:4417–4435  ·  view source on GitHub ↗
(step, timeoutMs = 120000)

Source from the content-addressed store, hash-verified

4415const STEP_COMPLETION_SIGNAL_STEPS = new Set([3, 5, 9]);
4416
4417function waitForStepComplete(step, timeoutMs = 120000) {
4418 return new Promise((resolve, reject) => {
4419 throwIfStopped();
4420 if (stepWaiters.has(step)) {
4421 console.warn(LOG_PREFIX, `[waitForStepComplete] replacing existing waiter for step ${step}`);
4422 }
4423 console.log(LOG_PREFIX, `[waitForStepComplete] register step ${step}, timeout=${timeoutMs}ms`);
4424 const timer = setTimeout(() => {
4425 stepWaiters.delete(step);
4426 console.warn(LOG_PREFIX, `[waitForStepComplete] timeout for step ${step} after ${timeoutMs}ms`);
4427 reject(new Error(`步骤 ${step} 等待超时(>${timeoutMs / 1000} 秒)`));
4428 }, timeoutMs);
4429
4430 stepWaiters.set(step, {
4431 resolve: (data) => { clearTimeout(timer); stepWaiters.delete(step); resolve(data); },
4432 reject: (err) => { clearTimeout(timer); stepWaiters.delete(step); reject(err); },
4433 });
4434 });
4435}
4436
4437function doesStepUseCompletionSignal(step) {
4438 return STEP_COMPLETION_SIGNAL_STEPS.has(step);

Callers 1

Calls 1

throwIfStoppedFunction · 0.70

Tested by

no test coverage detected