feat(pi-workflow): improve workflow usability and recovery
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user