feat(pi-workflow): add human-readable run labels
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user