feat(pi-workflow): add human-readable run labels

This commit is contained in:
jb
2026-08-25 21:22:08 -04:00
parent a1d0b1415c
commit 54a7921227
17 changed files with 385 additions and 52 deletions
+5 -3
View File
@@ -5,6 +5,7 @@ import type {
} from "@earendil-works/pi-coding-agent";
import type { WorkflowRun } from "./domain.ts";
import type { ContextTransitionRuntime } from "./context-transition.ts";
import { deriveRunLabel } from "./run-label.ts";
const NOTIFICATION_TYPE = "pi-workflow-notification";
const DELIVERY_OWNER_TOKEN = `${process.pid}:${randomUUID()}`;
@@ -50,18 +51,19 @@ function deliveryIsCurrent(run: WorkflowRun, key: string) {
}
function deliveryText(run: WorkflowRun, key: string) {
const label = deriveRunLabel(run);
if (key.startsWith("gate:")) {
const gate = [...run.gates]
.reverse()
.find((candidate) => key.includes(`:${candidate.id}:`));
return gate
? `pi-workflow ${run.runId} is waiting at the ${gate.kind} Gate (revision ${run.revision}). Inspect the run before obtaining and recording the user's Decision.`
: `pi-workflow ${run.runId} is waiting for a Gate Decision.`;
? `pi-workflow ${label} is waiting at the ${gate.kind} Gate (revision ${run.revision}). Inspect the run before obtaining and recording the user's Decision.`
: `pi-workflow ${label} is waiting for a Gate Decision.`;
}
const report = run.reportArtifact?.path
? ` Report: ${run.reportArtifact.path}`
: "";
return `pi-workflow ${run.runId} finished with status ${run.status}.${report}`;
return `pi-workflow ${label} finished with status ${run.status}.${report}`;
}
function belongsToSession(run: WorkflowRun, sessionId: string) {