@guanlin4924/devflow-pi 0.1.85 → 0.1.86
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
CHANGED
|
@@ -923,6 +923,12 @@ function compactStep(value: unknown): Record<string, unknown> | null {
|
|
|
923
923
|
};
|
|
924
924
|
}
|
|
925
925
|
|
|
926
|
+
function selectedWorkflowStep(snapshot: Record<string, unknown>): Record<string, unknown> | null {
|
|
927
|
+
return snapshot.action === "run_parallel_window"
|
|
928
|
+
? compactStep(snapshot.next_step) ?? compactStep(snapshot.current_step)
|
|
929
|
+
: compactStep(snapshot.current_step) ?? compactStep(snapshot.next_step);
|
|
930
|
+
}
|
|
931
|
+
|
|
926
932
|
/**
|
|
927
933
|
* The approval prompt is session-local, while the completed step outputs are
|
|
928
934
|
* durable. After a rollover, compaction, or runtime restart the in-memory
|
|
@@ -968,9 +974,7 @@ export function workflowResumeDisposition(snapshot: Record<string, unknown>): Wo
|
|
|
968
974
|
|
|
969
975
|
const feature = typeof snapshot.current_feature === "string" ? snapshot.current_feature : "";
|
|
970
976
|
const revision = snapshot.revision;
|
|
971
|
-
const selectedStep = snapshot
|
|
972
|
-
? compactStep(snapshot.next_step) ?? compactStep(snapshot.current_step)
|
|
973
|
-
: compactStep(snapshot.current_step) ?? compactStep(snapshot.next_step);
|
|
977
|
+
const selectedStep = selectedWorkflowStep(snapshot);
|
|
974
978
|
const stepId = typeof selectedStep?.id === "string" ? selectedStep.id : "";
|
|
975
979
|
if (!feature || !stepId || typeof revision !== "number" || !Number.isInteger(revision)) return "idle";
|
|
976
980
|
|
|
@@ -987,9 +991,7 @@ export function workflowResumeDisposition(snapshot: Record<string, unknown>): Wo
|
|
|
987
991
|
}
|
|
988
992
|
|
|
989
993
|
function workflowDirective(snapshot: Record<string, unknown>, source: "start" | "approval", requirementDraft?: string): string {
|
|
990
|
-
const selectedStep = snapshot
|
|
991
|
-
? compactStep(snapshot.next_step) ?? compactStep(snapshot.current_step)
|
|
992
|
-
: compactStep(snapshot.current_step) ?? compactStep(snapshot.next_step);
|
|
994
|
+
const selectedStep = selectedWorkflowStep(snapshot);
|
|
993
995
|
const envelope = {
|
|
994
996
|
source,
|
|
995
997
|
action: snapshot.action,
|
|
@@ -1041,7 +1043,7 @@ function projectInitializationDirective(summary: string): string {
|
|
|
1041
1043
|
|
|
1042
1044
|
function explainWorkflowSnapshot(snapshot: Record<string, unknown> | null): string {
|
|
1043
1045
|
if (!snapshot) return "Devflow 当前没有可解释的工作流状态。可使用 /devflow start <功能名> 创建新功能。";
|
|
1044
|
-
const step =
|
|
1046
|
+
const step = selectedWorkflowStep(snapshot);
|
|
1045
1047
|
const lines = [
|
|
1046
1048
|
`功能:${String(snapshot.current_feature ?? "未开始")}`,
|
|
1047
1049
|
`阶段:${workflowPhaseName(snapshot.current_phase)}`,
|
|
@@ -2049,7 +2051,7 @@ export default function devflowCore(pi: ExtensionAPI) {
|
|
|
2049
2051
|
snapshot: Record<string, unknown>,
|
|
2050
2052
|
): Promise<WorkflowResumeDisposition> {
|
|
2051
2053
|
const disposition = workflowResumeDisposition(snapshot);
|
|
2052
|
-
const stepId = String((
|
|
2054
|
+
const stepId = String(selectedWorkflowStep(snapshot)?.id ?? "当前步骤");
|
|
2053
2055
|
if (disposition === "execute") {
|
|
2054
2056
|
setControlState(ctx, executingState(`恢复并执行 ${stepId}`));
|
|
2055
2057
|
ctx.ui.notify(`Devflow 已恢复到 ${stepId},当前步骤产物尚未完成,正在继续执行。`, "info");
|
|
@@ -2602,7 +2604,7 @@ export default function devflowCore(pi: ExtensionAPI) {
|
|
|
2602
2604
|
}
|
|
2603
2605
|
const revision = typeof inspected.snapshot.revision === "number" ? inspected.snapshot.revision : undefined;
|
|
2604
2606
|
const checkpoint = inspected.snapshot.status === "waiting_checkpoint";
|
|
2605
|
-
const step =
|
|
2607
|
+
const step = selectedWorkflowStep(inspected.snapshot);
|
|
2606
2608
|
const stepId = typeof step?.id === "string" ? step.id : undefined;
|
|
2607
2609
|
if (revision === undefined || (!checkpoint && !stepId)) {
|
|
2608
2610
|
ctx.ui.notify("当前状态缺少可确认的 revision 或步骤,拒绝推进。", "error");
|
|
@@ -3975,7 +3977,7 @@ export default function devflowCore(pi: ExtensionAPI) {
|
|
|
3975
3977
|
const revision = plan?.expected_revision;
|
|
3976
3978
|
if (!inspected.result.ok || !plan || plan.classification !== "safe_repairable" || typeof revision !== "number") {
|
|
3977
3979
|
const status = typeof inspected.snapshot?.status === "string" ? inspected.snapshot.status : "unknown";
|
|
3978
|
-
const step =
|
|
3980
|
+
const step = inspected.snapshot ? selectedWorkflowStep(inspected.snapshot) : null;
|
|
3979
3981
|
const stepId = typeof step?.id === "string" ? step.id : "当前步骤";
|
|
3980
3982
|
if (inspected.result.ok && status === "in_progress") {
|
|
3981
3983
|
ctx.ui.notify(`控制面状态一致,无需恢复。当前步骤是 ${stepId};请审查当前产物后明确回复“批准执行”或提出修改意见。`, "info");
|
package/src/constants.ts
CHANGED