@guanlin4924/devflow-pi 0.1.56 → 0.1.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/constants.ts +1 -1
- package/src/runtime.ts +33 -5
package/package.json
CHANGED
package/src/constants.ts
CHANGED
package/src/runtime.ts
CHANGED
|
@@ -278,6 +278,29 @@ export async function runInteractiveRuntime(project: ProjectContext, options: Ru
|
|
|
278
278
|
void consumeControlledRollover();
|
|
279
279
|
}, delay);
|
|
280
280
|
};
|
|
281
|
+
const waitForControlledRollover = async (): Promise<void> => {
|
|
282
|
+
const requestPath = path.join(project.root, ".planning", "rollover-request.json");
|
|
283
|
+
let requestObserved = false;
|
|
284
|
+
// The input hook may finish its async state transition just after
|
|
285
|
+
// submitInteractiveInput resolves. Wait briefly for that durable request
|
|
286
|
+
// so approval starts the fresh session without requiring another input.
|
|
287
|
+
for (let attempt = 0; attempt < 50; attempt += 1) {
|
|
288
|
+
try {
|
|
289
|
+
await readFile(requestPath, "utf8");
|
|
290
|
+
requestObserved = true;
|
|
291
|
+
} catch {
|
|
292
|
+
if (requestObserved) return;
|
|
293
|
+
}
|
|
294
|
+
await consumeControlledRollover();
|
|
295
|
+
try {
|
|
296
|
+
await readFile(requestPath, "utf8");
|
|
297
|
+
} catch {
|
|
298
|
+
if (requestObserved) return;
|
|
299
|
+
}
|
|
300
|
+
await new Promise(resolve => setTimeout(resolve, 100));
|
|
301
|
+
}
|
|
302
|
+
scheduleControlledRolloverRetry();
|
|
303
|
+
};
|
|
281
304
|
// A control-plane request may be created by an extension input handler that
|
|
282
305
|
// marks the message handled, so it is not guaranteed to pass through the
|
|
283
306
|
// normal submitInteractiveInput return path. Keep a small runtime-owned
|
|
@@ -298,11 +321,16 @@ export async function runInteractiveRuntime(project: ProjectContext, options: Ru
|
|
|
298
321
|
} finally {
|
|
299
322
|
interactiveSubmissionInFlight = false;
|
|
300
323
|
}
|
|
301
|
-
|
|
324
|
+
// Only an explicit approval can create a user-driven rollover after this
|
|
325
|
+
// input. Ordinary chat messages must return to the prompt immediately.
|
|
326
|
+
if (/^(?:批准|确认|同意|通过)(?:\s*(?:(?:full|完整|全量)?\s*初始化|执行|完成|继续|推进|当前(?:方案|步骤|计划)))?[。!!]?$/i.test(input.trim())) {
|
|
327
|
+
await waitForControlledRollover();
|
|
328
|
+
} else {
|
|
329
|
+
await consumeControlledRollover();
|
|
330
|
+
scheduleControlledRolloverRetry();
|
|
331
|
+
}
|
|
302
332
|
// The submitted turn may create a durable rollover request after the
|
|
303
|
-
//
|
|
304
|
-
//
|
|
305
|
-
// trigger the fresh-session handoff.
|
|
306
|
-
scheduleControlledRolloverRetry();
|
|
333
|
+
// input hook settles; the bounded wait above handles the normal path and
|
|
334
|
+
// the poller remains as a recovery path for a slow or interrupted hook.
|
|
307
335
|
}
|
|
308
336
|
}
|