@guanlin4924/devflow-pi 0.1.33 → 0.1.34
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/README.md +1 -1
- package/package.json +1 -1
- package/plugins/devflow-core/extensions/devflow-core.ts +21 -0
- package/src/constants.ts +1 -1
- package/src/runtime.ts +8 -1
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -2722,6 +2722,27 @@ export default function devflowCore(pi: ExtensionAPI) {
|
|
|
2722
2722
|
ctx.ui.notify("Devflow workflow is already complete.", "info");
|
|
2723
2723
|
return;
|
|
2724
2724
|
}
|
|
2725
|
+
// Re-arm a durable rollover left by an interrupted runtime. The
|
|
2726
|
+
// original source session is the only session allowed to resume a
|
|
2727
|
+
// prepared handoff; the runtime will claim it after the next command.
|
|
2728
|
+
const rolloverResult = await runRuby(ctx.cwd, "workflow-orchestrator/scripts/session_rollover.rb", ["inspect", "--json"]);
|
|
2729
|
+
const rolloverState = parseJsonResult(rolloverResult);
|
|
2730
|
+
const rollover = rolloverState?.rollover as Record<string, unknown> | undefined;
|
|
2731
|
+
const currentSessionId = ctx.sessionManager.getSessionId();
|
|
2732
|
+
if (
|
|
2733
|
+
rolloverState &&
|
|
2734
|
+
typeof rolloverState.revision === "number" &&
|
|
2735
|
+
rollover?.status === "prepared" &&
|
|
2736
|
+
rollover.source_session_id === currentSessionId &&
|
|
2737
|
+
typeof rollover.id === "string"
|
|
2738
|
+
) {
|
|
2739
|
+
pendingRollover = {
|
|
2740
|
+
snapshot: inspected.snapshot,
|
|
2741
|
+
preparedRevision: rolloverState.revision,
|
|
2742
|
+
rolloverId: rollover.id,
|
|
2743
|
+
};
|
|
2744
|
+
await enqueueControlledRolloverRequest(ctx.cwd, rollover.id, currentSessionId);
|
|
2745
|
+
}
|
|
2725
2746
|
setControlState(ctx, waitingUserState("等待用户审查步骤产物"));
|
|
2726
2747
|
ctx.ui.notify(
|
|
2727
2748
|
`Devflow 已恢复到 ${String((compactStep(inspected.snapshot.next_step) ?? compactStep(inspected.snapshot.current_step))?.id ?? "当前步骤")};请审查当前产物后明确回复“批准执行”,或直接提出修改意见。`,
|
package/src/constants.ts
CHANGED
package/src/runtime.ts
CHANGED
|
@@ -203,7 +203,14 @@ export async function runInteractiveRuntime(project: ProjectContext, options: Ru
|
|
|
203
203
|
mode.showWarning("已忽略无效或陈旧的 Devflow 会话轮换请求;STATE 未被修改。");
|
|
204
204
|
return;
|
|
205
205
|
}
|
|
206
|
-
|
|
206
|
+
// Session creation can briefly be unavailable while the interactive mode
|
|
207
|
+
// finishes flushing the previous turn. Retry here because the handoff is
|
|
208
|
+
// already durable and STATE remains frozen until the target consumes it.
|
|
209
|
+
let switched = false;
|
|
210
|
+
for (let attempt = 0; attempt < 3 && !switched; attempt += 1) {
|
|
211
|
+
switched = await runtime.session.newSession();
|
|
212
|
+
if (!switched && attempt < 2) await new Promise(resolve => setTimeout(resolve, 100));
|
|
213
|
+
}
|
|
207
214
|
if (!switched) {
|
|
208
215
|
mode.showWarning("Devflow 会话轮换被运行时取消;当前会话保持不变。请检查控制面状态后重试。");
|
|
209
216
|
return;
|