feat(pi-workflow): improve workflow usability and recovery

This commit is contained in:
jb
2026-08-26 00:20:24 -04:00
parent c291ca083c
commit ea74dbc6a7
23 changed files with 4422 additions and 913 deletions
+13 -6
View File
@@ -17,6 +17,7 @@ import {
import { isValidContextContinuation } from "./continuation.ts";
import { deriveRunLabel, deriveRunLabels } from "./run-label.ts";
import { readVerifiedPlanArtifact, type WorkflowStore } from "./store.ts";
import { workflowInput, workflowSelect } from "./tui.ts";
const MAX_HANDOFF_BYTES = 32 * 1024;
type NewSessionOptions = NonNullable<
@@ -259,11 +260,16 @@ async function selectRun(
title: string,
runs: WorkflowRun[],
) {
const labels = deriveRunLabels(runs).map(
(label, index) => `${label} · ${runs[index]!.status}`,
const labels = deriveRunLabels(runs);
return workflowSelect(
ctx,
title,
runs.map((run, index) => ({
value: run,
label: labels[index]!,
description: run.status,
})),
);
const selected = await ctx.ui.select(title, labels);
return runs[labels.indexOf(selected ?? "")];
}
async function continueRun(
@@ -336,9 +342,10 @@ async function handleStart(
return;
}
initialRequest =
(await ctx.ui.input(
(await workflowInput(
ctx,
"Start Workflow Run",
"What do you want to start working on?",
"Describe the feature request",
))?.trim() ?? "";
if (!initialRequest) return;
}