@shipfox/client-workflows 17.0.0 → 19.0.0
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/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-type.log +0 -1
- package/CHANGELOG.md +23 -0
- package/dist/components/job-detail/job-context-panel.d.ts.map +1 -1
- package/dist/components/job-detail/job-context-panel.js +5 -1
- package/dist/components/job-detail/job-context-panel.js.map +1 -1
- package/dist/components/job-detail/job-detail-view.d.ts.map +1 -1
- package/dist/components/job-detail/job-detail-view.js +34 -27
- package/dist/components/job-detail/job-detail-view.js.map +1 -1
- package/dist/components/job-detail/job-empty-states.d.ts +4 -0
- package/dist/components/job-detail/job-empty-states.d.ts.map +1 -1
- package/dist/components/job-detail/job-empty-states.js +43 -3
- package/dist/components/job-detail/job-empty-states.js.map +1 -1
- package/dist/components/job-detail/step-troubleshooting.js +4 -0
- package/dist/components/job-detail/step-troubleshooting.js.map +1 -1
- package/dist/components/step-list/step-list-model.d.ts.map +1 -1
- package/dist/components/step-list/step-list-model.js +1 -0
- package/dist/components/step-list/step-list-model.js.map +1 -1
- package/dist/components/workflow-run-list/job-status-strip.d.ts.map +1 -1
- package/dist/components/workflow-run-list/job-status-strip.js +20 -7
- package/dist/components/workflow-run-list/job-status-strip.js.map +1 -1
- package/dist/components/workflow-run-view/run-workspace-nav.d.ts.map +1 -1
- package/dist/components/workflow-run-view/run-workspace-nav.js +6 -5
- package/dist/components/workflow-run-view/run-workspace-nav.js.map +1 -1
- package/dist/core/entities/job-execution.d.ts +2 -0
- package/dist/core/entities/job-execution.d.ts.map +1 -1
- package/dist/core/entities/job-execution.js.map +1 -1
- package/dist/core/entities/job.d.ts +6 -3
- package/dist/core/entities/job.d.ts.map +1 -1
- package/dist/core/entities/job.js +8 -1
- package/dist/core/entities/job.js.map +1 -1
- package/dist/core/entities/workflow-run.d.ts +7 -4
- package/dist/core/entities/workflow-run.d.ts.map +1 -1
- package/dist/core/entities/workflow-run.js.map +1 -1
- package/dist/hooks/api/workflow-run-mapper.d.ts.map +1 -1
- package/dist/hooks/api/workflow-run-mapper.js +12 -1
- package/dist/hooks/api/workflow-run-mapper.js.map +1 -1
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/components/job-detail/job-context-panel.tsx +4 -0
- package/src/components/job-detail/job-detail-view.tsx +37 -33
- package/src/components/job-detail/job-empty-states.test.ts +105 -1
- package/src/components/job-detail/job-empty-states.tsx +56 -2
- package/src/components/job-detail/step-troubleshooting.tsx +4 -0
- package/src/components/job-graph/job-node.test.tsx +2 -2
- package/src/components/step-list/step-list-model.ts +1 -0
- package/src/components/workflow-run-list/job-status-strip.tsx +25 -12
- package/src/components/workflow-run-list/workflow-run-list-view.test.tsx +73 -0
- package/src/components/workflow-run-list/workflow-run-list.stories.tsx +31 -0
- package/src/components/workflow-run-view/run-workspace-nav.tsx +13 -6
- package/src/core/entities/job-execution.ts +2 -0
- package/src/core/entities/job-status.test.ts +47 -1
- package/src/core/entities/job.ts +18 -4
- package/src/core/entities/workflow-run-display.test.ts +28 -0
- package/src/core/entities/workflow-run.ts +18 -4
- package/src/core/workflow-run.test.ts +13 -0
- package/src/hooks/api/workflow-run-mapper.ts +19 -1
- package/test/fixtures/workflow-run.ts +32 -12
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/entities/job-execution.ts"],"sourcesContent":["import {type Duration, intervalToDuration} from 'date-fns';\nimport type {Step} from './step.js';\nimport type {EvaluationTraceEntry} from './step-attempt.js';\n\nexport type JobExecutionStatus = 'pending' | 'running' | 'succeeded' | 'failed' | 'cancelled';\nexport type JobExecutionDisplayStatus = JobExecutionStatus;\nexport interface WorkflowExecutionEvent {\n source: string;\n event: string;\n deliveryId: string;\n receivedAt: string;\n project: {id: string} | null;\n repository: string | null;\n ref: string | null;\n commit: string | null;\n data: unknown;\n}\nexport type JobExecutionTime =\n | {state: 'fixed'; elapsed: Duration}\n | {state: 'live'; fromIso: string};\nexport type JobExecutionDisplayDuration =\n | ({kind: 'queue'} & JobExecutionTime)\n | ({kind: 'run'} & JobExecutionTime);\n\ninterface JobExecutionFields {\n id: string;\n jobId: string;\n sequence: number;\n name: string;\n status: JobExecutionStatus;\n statusReason: string | null;\n runner: string[] | null;\n outputs: Record<string, unknown> | null;\n triggerEvents: WorkflowExecutionEvent[];\n queuedAt: string | null;\n startedAt: string | null;\n finishedAt: string | null;\n timedOutAt: string | null;\n evaluationTrace: EvaluationTraceEntry[] | null;\n createdAt: string;\n updatedAt: string;\n steps: Step[];\n}\n\nexport class JobExecution {\n id!: string;\n jobId!: string;\n sequence!: number;\n name!: string;\n status!: JobExecutionStatus;\n statusReason!: string | null;\n runner!: string[] | null;\n outputs!: Record<string, unknown> | null;\n triggerEvents!: WorkflowExecutionEvent[];\n queuedAt!: string | null;\n startedAt!: string | null;\n finishedAt!: string | null;\n timedOutAt!: string | null;\n evaluationTrace!: EvaluationTraceEntry[] | null;\n createdAt!: string;\n updatedAt!: string;\n steps!: Step[];\n\n constructor(fields: JobExecutionFields) {\n Object.assign(this, fields);\n }\n\n get displayName(): string {\n return this.name;\n }\n\n get queueTime(): JobExecutionTime | null {\n return jobExecutionQueueTimeFromTimestamps(this);\n }\n\n get runTime(): JobExecutionTime | null {\n return jobExecutionRunTimeFromTimestamps(this);\n }\n\n get displayDuration(): JobExecutionDisplayDuration | null {\n return jobExecutionDisplayDurationFromTimestamps(this);\n }\n}\n\nexport function deriveJobExecutionDisplayStatus({\n status,\n steps,\n}: Pick<JobExecution, 'status' | 'steps'>): JobExecutionDisplayStatus {\n if (isTerminalJobExecutionStatus(status)) return status;\n if (steps.some((step) => step.status === 'running')) return 'running';\n return 'pending';\n}\n\nexport function isTerminalJobExecutionStatus(status: JobExecutionStatus): boolean {\n return status === 'succeeded' || status === 'failed' || status === 'cancelled';\n}\n\nexport function jobExecutionQueueTimeFromTimestamps({\n queuedAt,\n startedAt,\n finishedAt,\n}: {\n queuedAt: string | null;\n startedAt: string | null;\n finishedAt: string | null;\n}): JobExecutionTime | null {\n if (queuedAt === null) return null;\n if (finishedAt !== null && startedAt === null) return null;\n if (startedAt === null) return {state: 'live', fromIso: queuedAt};\n\n const elapsed = durationBetween(queuedAt, startedAt);\n return elapsed === null ? null : {state: 'fixed', elapsed};\n}\n\nexport function jobExecutionRunTimeFromTimestamps({\n startedAt,\n finishedAt,\n}: {\n startedAt: string | null;\n finishedAt: string | null;\n}): JobExecutionTime | null {\n if (startedAt === null) return null;\n return elapsedTimeFromTimestamps({from: startedAt, to: finishedAt});\n}\n\n/**\n * The elapsed span between two marks, still accruing while the closing mark is missing. Every\n * duration this app shows is one of these, so queue time and run time measure the same way and\n * only differ in which marks they read.\n */\nexport function elapsedTimeFromTimestamps({\n from,\n to,\n}: {\n from: string;\n to: string | null;\n}): JobExecutionTime | null {\n if (to === null) return {state: 'live', fromIso: from};\n\n const elapsed = durationBetween(from, to);\n return elapsed === null ? null : {state: 'fixed', elapsed};\n}\n\nexport function jobExecutionDisplayDurationFromTimestamps(timestamps: {\n queuedAt: string | null;\n startedAt: string | null;\n finishedAt: string | null;\n}): JobExecutionDisplayDuration | null {\n const runTime = jobExecutionRunTimeFromTimestamps(timestamps);\n if (runTime !== null) return {kind: 'run', ...runTime};\n\n const queueTime = jobExecutionQueueTimeFromTimestamps(timestamps);\n if (queueTime !== null) return {kind: 'queue', ...queueTime};\n\n return null;\n}\n\nfunction durationBetween(from: string, to: string): Duration | null {\n const start = new Date(from);\n const end = new Date(to);\n if (!Number.isFinite(start.getTime()) || !Number.isFinite(end.getTime())) return null;\n\n return intervalToDuration({\n start,\n end: end < start ? start : end,\n });\n}\n"],"names":["intervalToDuration","JobExecution","fields","Object","assign","displayName","name","queueTime","jobExecutionQueueTimeFromTimestamps","runTime","jobExecutionRunTimeFromTimestamps","displayDuration","jobExecutionDisplayDurationFromTimestamps","deriveJobExecutionDisplayStatus","status","steps","isTerminalJobExecutionStatus","some","step","queuedAt","startedAt","finishedAt","state","fromIso","elapsed","durationBetween","elapsedTimeFromTimestamps","from","to","timestamps","kind","start","Date","end","Number","isFinite","getTime"],"mappings":"AAAA,SAAuBA,kBAAkB,QAAO,WAAW;
|
|
1
|
+
{"version":3,"sources":["../../../src/core/entities/job-execution.ts"],"sourcesContent":["import {type Duration, intervalToDuration} from 'date-fns';\nimport type {Step} from './step.js';\nimport type {EvaluationTraceEntry} from './step-attempt.js';\n\nexport type JobExecutionStatus = 'pending' | 'running' | 'succeeded' | 'failed' | 'cancelled';\nexport type JobExecutionDisplayStatus = JobExecutionStatus;\nexport interface WorkflowExecutionEvent {\n source: string;\n event: string;\n deliveryId: string;\n receivedAt: string;\n project: {id: string} | null;\n repository: string | null;\n ref: string | null;\n commit: string | null;\n data: unknown;\n}\nexport type JobExecutionTime =\n | {state: 'fixed'; elapsed: Duration}\n | {state: 'live'; fromIso: string};\nexport type JobExecutionDisplayDuration =\n | ({kind: 'queue'} & JobExecutionTime)\n | ({kind: 'run'} & JobExecutionTime);\n\ninterface JobExecutionFields {\n id: string;\n jobId: string;\n sequence: number;\n name: string;\n status: JobExecutionStatus;\n statusReason: string | null;\n statusReasonMessage: string | null;\n runner: string[] | null;\n outputs: Record<string, unknown> | null;\n triggerEvents: WorkflowExecutionEvent[];\n queuedAt: string | null;\n startedAt: string | null;\n finishedAt: string | null;\n timedOutAt: string | null;\n evaluationTrace: EvaluationTraceEntry[] | null;\n createdAt: string;\n updatedAt: string;\n steps: Step[];\n}\n\nexport class JobExecution {\n id!: string;\n jobId!: string;\n sequence!: number;\n name!: string;\n status!: JobExecutionStatus;\n statusReason!: string | null;\n statusReasonMessage!: string | null;\n runner!: string[] | null;\n outputs!: Record<string, unknown> | null;\n triggerEvents!: WorkflowExecutionEvent[];\n queuedAt!: string | null;\n startedAt!: string | null;\n finishedAt!: string | null;\n timedOutAt!: string | null;\n evaluationTrace!: EvaluationTraceEntry[] | null;\n createdAt!: string;\n updatedAt!: string;\n steps!: Step[];\n\n constructor(fields: JobExecutionFields) {\n Object.assign(this, fields);\n }\n\n get displayName(): string {\n return this.name;\n }\n\n get queueTime(): JobExecutionTime | null {\n return jobExecutionQueueTimeFromTimestamps(this);\n }\n\n get runTime(): JobExecutionTime | null {\n return jobExecutionRunTimeFromTimestamps(this);\n }\n\n get displayDuration(): JobExecutionDisplayDuration | null {\n return jobExecutionDisplayDurationFromTimestamps(this);\n }\n}\n\nexport function deriveJobExecutionDisplayStatus({\n status,\n steps,\n}: Pick<JobExecution, 'status' | 'steps'>): JobExecutionDisplayStatus {\n if (isTerminalJobExecutionStatus(status)) return status;\n if (steps.some((step) => step.status === 'running')) return 'running';\n return 'pending';\n}\n\nexport function isTerminalJobExecutionStatus(status: JobExecutionStatus): boolean {\n return status === 'succeeded' || status === 'failed' || status === 'cancelled';\n}\n\nexport function jobExecutionQueueTimeFromTimestamps({\n queuedAt,\n startedAt,\n finishedAt,\n}: {\n queuedAt: string | null;\n startedAt: string | null;\n finishedAt: string | null;\n}): JobExecutionTime | null {\n if (queuedAt === null) return null;\n if (finishedAt !== null && startedAt === null) return null;\n if (startedAt === null) return {state: 'live', fromIso: queuedAt};\n\n const elapsed = durationBetween(queuedAt, startedAt);\n return elapsed === null ? null : {state: 'fixed', elapsed};\n}\n\nexport function jobExecutionRunTimeFromTimestamps({\n startedAt,\n finishedAt,\n}: {\n startedAt: string | null;\n finishedAt: string | null;\n}): JobExecutionTime | null {\n if (startedAt === null) return null;\n return elapsedTimeFromTimestamps({from: startedAt, to: finishedAt});\n}\n\n/**\n * The elapsed span between two marks, still accruing while the closing mark is missing. Every\n * duration this app shows is one of these, so queue time and run time measure the same way and\n * only differ in which marks they read.\n */\nexport function elapsedTimeFromTimestamps({\n from,\n to,\n}: {\n from: string;\n to: string | null;\n}): JobExecutionTime | null {\n if (to === null) return {state: 'live', fromIso: from};\n\n const elapsed = durationBetween(from, to);\n return elapsed === null ? null : {state: 'fixed', elapsed};\n}\n\nexport function jobExecutionDisplayDurationFromTimestamps(timestamps: {\n queuedAt: string | null;\n startedAt: string | null;\n finishedAt: string | null;\n}): JobExecutionDisplayDuration | null {\n const runTime = jobExecutionRunTimeFromTimestamps(timestamps);\n if (runTime !== null) return {kind: 'run', ...runTime};\n\n const queueTime = jobExecutionQueueTimeFromTimestamps(timestamps);\n if (queueTime !== null) return {kind: 'queue', ...queueTime};\n\n return null;\n}\n\nfunction durationBetween(from: string, to: string): Duration | null {\n const start = new Date(from);\n const end = new Date(to);\n if (!Number.isFinite(start.getTime()) || !Number.isFinite(end.getTime())) return null;\n\n return intervalToDuration({\n start,\n end: end < start ? start : end,\n });\n}\n"],"names":["intervalToDuration","JobExecution","fields","Object","assign","displayName","name","queueTime","jobExecutionQueueTimeFromTimestamps","runTime","jobExecutionRunTimeFromTimestamps","displayDuration","jobExecutionDisplayDurationFromTimestamps","deriveJobExecutionDisplayStatus","status","steps","isTerminalJobExecutionStatus","some","step","queuedAt","startedAt","finishedAt","state","fromIso","elapsed","durationBetween","elapsedTimeFromTimestamps","from","to","timestamps","kind","start","Date","end","Number","isFinite","getTime"],"mappings":"AAAA,SAAuBA,kBAAkB,QAAO,WAAW;AA6C3D,OAAO,MAAMC;IAoBX,YAAYC,MAA0B,CAAE;QACtCC,OAAOC,MAAM,CAAC,IAAI,EAAEF;IACtB;IAEA,IAAIG,cAAsB;QACxB,OAAO,IAAI,CAACC,IAAI;IAClB;IAEA,IAAIC,YAAqC;QACvC,OAAOC,oCAAoC,IAAI;IACjD;IAEA,IAAIC,UAAmC;QACrC,OAAOC,kCAAkC,IAAI;IAC/C;IAEA,IAAIC,kBAAsD;QACxD,OAAOC,0CAA0C,IAAI;IACvD;AACF;AAEA,OAAO,SAASC,gCAAgC,EAC9CC,MAAM,EACNC,KAAK,EACkC;IACvC,IAAIC,6BAA6BF,SAAS,OAAOA;IACjD,IAAIC,MAAME,IAAI,CAAC,CAACC,OAASA,KAAKJ,MAAM,KAAK,YAAY,OAAO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AAO,CAACF,OAAOC,QAAQ,CAACF,IAAIG,OAAO,KAAK,OAAO;IAEjF,OAAOpC,mBAAmB;QACxB+B;QACAE,KAAKA,MAAMF,QAAQA,QAAQE;IAC7B;AACF"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { type JobExecution, type JobExecutionDisplayDuration } from './job-execution.js';
|
|
1
|
+
import { type JobExecution, type JobExecutionDisplayDuration, type JobExecutionStatus } from './job-execution.js';
|
|
2
2
|
import type { EvaluationTraceEntry } from './step-attempt.js';
|
|
3
3
|
export type JobStatus = 'pending' | 'running' | 'succeeded' | 'failed' | 'cancelled' | 'skipped';
|
|
4
4
|
export type JobDisplayStatus = JobStatus | 'listening';
|
|
5
5
|
export type JobMode = 'one_shot' | 'listening';
|
|
6
6
|
export type ListenerStatus = 'inactive' | 'listening' | 'resolved';
|
|
7
7
|
export type ResolutionReason = 'until' | 'timeout' | 'max_executions' | 'cancelled';
|
|
8
|
-
export type JobStatusReason = 'dependency_not_completed' | 'condition_false' | 'default_gate_rejected' | 'condition_rejected' | 'condition_errored' | 'user_cancelled' | 'run_cancelled' | 'timed_out' | 'runner_lost' | 'step_failed' | 'unknown';
|
|
8
|
+
export type JobStatusReason = 'dependency_not_completed' | 'condition_false' | 'default_gate_rejected' | 'condition_rejected' | 'condition_errored' | 'user_cancelled' | 'run_cancelled' | 'timed_out' | 'runner_lost' | 'output_too_large' | 'step_failed' | 'unknown' | 'output_invalid';
|
|
9
9
|
export interface JobListening {
|
|
10
10
|
on: Array<{
|
|
11
11
|
source: string;
|
|
@@ -82,7 +82,10 @@ export declare class Job {
|
|
|
82
82
|
get executionCountVisible(): boolean;
|
|
83
83
|
}
|
|
84
84
|
export declare function isTerminalJobStatus(status: JobStatus): boolean;
|
|
85
|
-
export declare function deriveJobDisplayStatus(job: Pick<Job, 'mode' | 'status' | 'listenerStatus' | 'jobExecutions'>
|
|
85
|
+
export declare function deriveJobDisplayStatus(job: Pick<Job, 'mode' | 'status' | 'listenerStatus' | 'jobExecutions'> & {
|
|
86
|
+
/** List previews carry the selected execution state without its step tree. */
|
|
87
|
+
executionStatus?: JobExecutionStatus | null | undefined;
|
|
88
|
+
}): JobDisplayStatus;
|
|
86
89
|
export declare function resolveJobExecution(job: Job, jobExecutionId: string | undefined): JobExecution | undefined;
|
|
87
90
|
export declare function defaultJobExecution(job: Pick<Job, 'jobExecutions'>): JobExecution | undefined;
|
|
88
91
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"job.d.ts","sourceRoot":"","sources":["../../../src/core/entities/job.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,2BAA2B,
|
|
1
|
+
{"version":3,"file":"job.d.ts","sourceRoot":"","sources":["../../../src/core/entities/job.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,2BAA2B,EAChC,KAAK,kBAAkB,EACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,mBAAmB,CAAC;AAE5D,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAC;AACjG,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,WAAW,CAAC;AACvD,MAAM,MAAM,OAAO,GAAG,UAAU,GAAG,WAAW,CAAC;AAC/C,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,WAAW,GAAG,UAAU,CAAC;AACnE,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,SAAS,GAAG,gBAAgB,GAAG,WAAW,CAAC;AACpF,MAAM,MAAM,eAAe,GACvB,0BAA0B,GAC1B,iBAAiB,GACjB,uBAAuB,GACvB,oBAAoB,GACpB,mBAAmB,GACnB,gBAAgB,GAChB,eAAe,GACf,WAAW,GACX,aAAa,GACb,kBAAkB,GAClB,aAAa,GACb,SAAS,GACT,gBAAgB,CAAC;A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AAE,CAAC;IACxB,QAAQ,EAAG,MAAM,CAAC;IAClB,SAAS,EAAG,MAAM,CAAC;IACnB,SAAS,EAAG,MAAM,CAAC;IACnB,aAAa,EAAG,YAAY,EAAE,CAAC;IAE/B,YAAY,MAAM,EAAE,SAAS,EAE5B;IAED,IAAI,WAAW,IAAI,MAAM,CAExB;IAED,IAAI,eAAe,IAAI,kBAAkB,GAAG,IAAI,CAI/C;IAED,IAAI,qBAAqB,IAAI,OAAO,CAInC;CACF;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAE9D;AAED,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,GAAG,gBAAgB,GAAG,eAAe,CAAC,GAAG;IACvE,8EAA8E;IAC9E,eAAe,CAAC,EAAE,kBAAkB,GAAG,IAAI,GAAG,SAAS,CAAC;CACzD,GACA,gBAAgB,CAclB;AAED,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,GAAG,EACR,cAAc,EAAE,MAAM,GAAG,SAAS,GACjC,YAAY,GAAG,SAAS,CAO1B;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,eAAe,CAAC,GAAG,YAAY,GAAG,SAAS,CAU7F"}
|
|
@@ -36,7 +36,14 @@ export function isTerminalJobStatus(status) {
|
|
|
36
36
|
export function deriveJobDisplayStatus(job) {
|
|
37
37
|
if (isTerminalJobStatus(job.status)) return job.status;
|
|
38
38
|
if (job.mode === 'listening' && job.listenerStatus === 'listening') return 'listening';
|
|
39
|
-
const execution = defaultJobExecution(job)
|
|
39
|
+
const execution = job.executionStatus === undefined ? defaultJobExecution(job) : job.executionStatus === null ? undefined : {
|
|
40
|
+
status: job.executionStatus,
|
|
41
|
+
steps: []
|
|
42
|
+
};
|
|
43
|
+
// A running execution is the shared display rule for both list previews and detail jobs.
|
|
44
|
+
// The list has no step tree, while the detail path can still use the execution's steps for
|
|
45
|
+
// other non-running states.
|
|
46
|
+
if (execution?.status === 'running') return 'running';
|
|
40
47
|
return execution ? deriveJobExecutionDisplayStatus(execution) : 'pending';
|
|
41
48
|
}
|
|
42
49
|
export function resolveJobExecution(job, jobExecutionId) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/entities/job.ts"],"sourcesContent":["import {\n deriveJobExecutionDisplayStatus,\n type JobExecution,\n type JobExecutionDisplayDuration,\n} from './job-execution.js';\nimport type {EvaluationTraceEntry} from './step-attempt.js';\n\nexport type JobStatus = 'pending' | 'running' | 'succeeded' | 'failed' | 'cancelled' | 'skipped';\nexport type JobDisplayStatus = JobStatus | 'listening';\nexport type JobMode = 'one_shot' | 'listening';\nexport type ListenerStatus = 'inactive' | 'listening' | 'resolved';\nexport type ResolutionReason = 'until' | 'timeout' | 'max_executions' | 'cancelled';\nexport type JobStatusReason =\n | 'dependency_not_completed'\n | 'condition_false'\n | 'default_gate_rejected'\n | 'condition_rejected'\n | 'condition_errored'\n | 'user_cancelled'\n | 'run_cancelled'\n | 'timed_out'\n | 'runner_lost'\n | 'step_failed'\n | 'unknown';\nexport interface JobListening {\n on: Array<{\n source: string;\n event: string;\n inputs?: Record<string, unknown> | undefined;\n filter?: string | undefined;\n }>;\n until: Array<{\n source: string;\n event: string;\n inputs?: Record<string, unknown> | undefined;\n filter?: string | undefined;\n }> | null;\n timeoutMs: number | null;\n maxExecutions: number | null;\n batch: {\n debounceMs?: number | undefined;\n maxSize?: number | undefined;\n maxWaitMs?: number | undefined;\n } | null;\n onResolve: 'finish' | 'cancel';\n executionTimeoutMs: number | null;\n name: string | null;\n}\n\nexport type JobDisplayDuration = JobExecutionDisplayDuration;\n\nexport const WORKFLOW_JOB_STATUSES = [\n 'pending',\n 'running',\n 'succeeded',\n 'failed',\n 'cancelled',\n 'skipped',\n] as const satisfies readonly JobStatus[];\n\nexport const TERMINAL_WORKFLOW_JOB_STATUSES = [\n 'succeeded',\n 'failed',\n 'cancelled',\n 'skipped',\n] as const satisfies readonly JobStatus[];\n\nconst TERMINAL_JOB_STATUS_SET = new Set<JobStatus>(TERMINAL_WORKFLOW_JOB_STATUSES);\n\ninterface JobFields {\n id: string;\n runAttemptId: string;\n key: string;\n name: string | null;\n mode: JobMode;\n status: JobStatus;\n statusReason: JobStatusReason | null;\n carriedOver: boolean;\n outputs: Record<string, unknown> | null;\n success: string | null;\n runner: string[] | null;\n evaluationTrace: EvaluationTraceEntry[] | null;\n listening: JobListening | null;\n listenerStatus: ListenerStatus;\n resolutionReason: ResolutionReason | null;\n dependencies: string[];\n position: number;\n createdAt: string;\n updatedAt: string;\n jobExecutions: JobExecution[];\n}\n\nexport class Job {\n id!: string;\n runAttemptId!: string;\n key!: string;\n name!: string | null;\n mode!: JobMode;\n status!: JobStatus;\n statusReason!: JobStatusReason | null;\n carriedOver!: boolean;\n outputs!: Record<string, unknown> | null;\n success!: string | null;\n runner!: string[] | null;\n evaluationTrace!: EvaluationTraceEntry[] | null;\n listening!: JobListening | null;\n listenerStatus!: ListenerStatus;\n resolutionReason!: ResolutionReason | null;\n dependencies!: string[];\n position!: number;\n createdAt!: string;\n updatedAt!: string;\n jobExecutions!: JobExecution[];\n\n constructor(fields: JobFields) {\n Object.assign(this, fields);\n }\n\n get displayName(): string {\n return this.name ?? this.key;\n }\n\n get displayDuration(): JobDisplayDuration | null {\n if (this.mode === 'listening') return null;\n if (this.jobExecutions.length !== 1) return null;\n return this.jobExecutions[0]?.displayDuration ?? null;\n }\n\n get executionCountVisible(): boolean {\n return (\n this.jobExecutions.length > 0 && (this.mode === 'listening' || this.jobExecutions.length > 1)\n );\n }\n}\n\nexport function isTerminalJobStatus(status: JobStatus): boolean {\n return TERMINAL_JOB_STATUS_SET.has(status);\n}\n\nexport function deriveJobDisplayStatus(\n job: Pick<Job, 'mode' | 'status' | 'listenerStatus' | 'jobExecutions'
|
|
1
|
+
{"version":3,"sources":["../../../src/core/entities/job.ts"],"sourcesContent":["import {\n deriveJobExecutionDisplayStatus,\n type JobExecution,\n type JobExecutionDisplayDuration,\n type JobExecutionStatus,\n} from './job-execution.js';\nimport type {EvaluationTraceEntry} from './step-attempt.js';\n\nexport type JobStatus = 'pending' | 'running' | 'succeeded' | 'failed' | 'cancelled' | 'skipped';\nexport type JobDisplayStatus = JobStatus | 'listening';\nexport type JobMode = 'one_shot' | 'listening';\nexport type ListenerStatus = 'inactive' | 'listening' | 'resolved';\nexport type ResolutionReason = 'until' | 'timeout' | 'max_executions' | 'cancelled';\nexport type JobStatusReason =\n | 'dependency_not_completed'\n | 'condition_false'\n | 'default_gate_rejected'\n | 'condition_rejected'\n | 'condition_errored'\n | 'user_cancelled'\n | 'run_cancelled'\n | 'timed_out'\n | 'runner_lost'\n | 'output_too_large'\n | 'step_failed'\n | 'unknown'\n | 'output_invalid';\nexport interface JobListening {\n on: Array<{\n source: string;\n event: string;\n inputs?: Record<string, unknown> | undefined;\n filter?: string | undefined;\n }>;\n until: Array<{\n source: string;\n event: string;\n inputs?: Record<string, unknown> | undefined;\n filter?: string | undefined;\n }> | null;\n timeoutMs: number | null;\n maxExecutions: number | null;\n batch: {\n debounceMs?: number | undefined;\n maxSize?: number | undefined;\n maxWaitMs?: number | undefined;\n } | null;\n onResolve: 'finish' | 'cancel';\n executionTimeoutMs: number | null;\n name: string | null;\n}\n\nexport type JobDisplayDuration = JobExecutionDisplayDuration;\n\nexport const WORKFLOW_JOB_STATUSES = [\n 'pending',\n 'running',\n 'succeeded',\n 'failed',\n 'cancelled',\n 'skipped',\n] as const satisfies readonly JobStatus[];\n\nexport const TERMINAL_WORKFLOW_JOB_STATUSES = [\n 'succeeded',\n 'failed',\n 'cancelled',\n 'skipped',\n] as const satisfies readonly JobStatus[];\n\nconst TERMINAL_JOB_STATUS_SET = new Set<JobStatus>(TERMINAL_WORKFLOW_JOB_STATUSES);\n\ninterface JobFields {\n id: string;\n runAttemptId: string;\n key: string;\n name: string | null;\n mode: JobMode;\n status: JobStatus;\n statusReason: JobStatusReason | null;\n carriedOver: boolean;\n outputs: Record<string, unknown> | null;\n success: string | null;\n runner: string[] | null;\n evaluationTrace: EvaluationTraceEntry[] | null;\n listening: JobListening | null;\n listenerStatus: ListenerStatus;\n resolutionReason: ResolutionReason | null;\n dependencies: string[];\n position: number;\n createdAt: string;\n updatedAt: string;\n jobExecutions: JobExecution[];\n}\n\nexport class Job {\n id!: string;\n runAttemptId!: string;\n key!: string;\n name!: string | null;\n mode!: JobMode;\n status!: JobStatus;\n statusReason!: JobStatusReason | null;\n carriedOver!: boolean;\n outputs!: Record<string, unknown> | null;\n success!: string | null;\n runner!: string[] | null;\n evaluationTrace!: EvaluationTraceEntry[] | null;\n listening!: JobListening | null;\n listenerStatus!: ListenerStatus;\n resolutionReason!: ResolutionReason | null;\n dependencies!: string[];\n position!: number;\n createdAt!: string;\n updatedAt!: string;\n jobExecutions!: JobExecution[];\n\n constructor(fields: JobFields) {\n Object.assign(this, fields);\n }\n\n get displayName(): string {\n return this.name ?? this.key;\n }\n\n get displayDuration(): JobDisplayDuration | null {\n if (this.mode === 'listening') return null;\n if (this.jobExecutions.length !== 1) return null;\n return this.jobExecutions[0]?.displayDuration ?? null;\n }\n\n get executionCountVisible(): boolean {\n return (\n this.jobExecutions.length > 0 && (this.mode === 'listening' || this.jobExecutions.length > 1)\n );\n }\n}\n\nexport function isTerminalJobStatus(status: JobStatus): boolean {\n return TERMINAL_JOB_STATUS_SET.has(status);\n}\n\nexport function deriveJobDisplayStatus(\n job: Pick<Job, 'mode' | 'status' | 'listenerStatus' | 'jobExecutions'> & {\n /** List previews carry the selected execution state without its step tree. */\n executionStatus?: JobExecutionStatus | null | undefined;\n },\n): JobDisplayStatus {\n if (isTerminalJobStatus(job.status)) return job.status;\n if (job.mode === 'listening' && job.listenerStatus === 'listening') return 'listening';\n const execution =\n job.executionStatus === undefined\n ? defaultJobExecution(job)\n : job.executionStatus === null\n ? undefined\n : {status: job.executionStatus, steps: []};\n // A running execution is the shared display rule for both list previews and detail jobs.\n // The list has no step tree, while the detail path can still use the execution's steps for\n // other non-running states.\n if (execution?.status === 'running') return 'running';\n return execution ? deriveJobExecutionDisplayStatus(execution) : 'pending';\n}\n\nexport function resolveJobExecution(\n job: Job,\n jobExecutionId: string | undefined,\n): JobExecution | undefined {\n const selectedExecution = jobExecutionId\n ? job.jobExecutions.find((jobExecution) => jobExecution.id === jobExecutionId)\n : undefined;\n if (selectedExecution) return selectedExecution;\n\n return defaultJobExecution(job);\n}\n\nexport function defaultJobExecution(job: Pick<Job, 'jobExecutions'>): JobExecution | undefined {\n const runningExecution = job.jobExecutions.find(\n (jobExecution) => jobExecution.status === 'running',\n );\n if (runningExecution) return runningExecution;\n\n return job.jobExecutions.reduce<JobExecution | undefined>((latest, jobExecution) => {\n if (!latest) return jobExecution;\n return jobExecution.sequence > latest.sequence ? jobExecution : latest;\n }, undefined);\n}\n"],"names":["deriveJobExecutionDisplayStatus","WORKFLOW_JOB_STATUSES","TERMINAL_WORKFLOW_JOB_STATUSES","TERMINAL_JOB_STATUS_SET","Set","Job","fields","Object","assign","displayName","name","key","displayDuration","mode","jobExecutions","length","executionCountVisible","isTerminalJobStatus","status","has","deriveJobDisplayStatus","job","listenerStatus","execution","executionStatus","undefined","defaultJobExecution","steps","resolveJobExecution","jobExecutionId","selectedExecution","find","jobExecution","id","runningExecution","reduce","latest","sequence"],"mappings":"AAAA,SACEA,+BAA+B,QAI1B,qBAAqB;AAiD5B,OAAO,MAAMC,wBAAwB;IACnC;IACA;IACA;IACA;IACA;IACA;CACD,CAAyC;AAE1C,OAAO,MAAMC,iCAAiC;IAC5C;IACA;IACA;IACA;CACD,CAAyC;AAE1C,MAAMC,0BAA0B,IAAIC,IAAeF;AAyBnD,OAAO,MAAMG;IAsBX,YAAYC,MAAiB,CAAE;QAC7BC,OAAOC,MAAM,CAAC,IAAI,EAAEF;IACtB;IAEA,IAAIG,cAAsB;QACxB,OAAO,IAAI,CAACC,IAAI,IAAI,IAAI,CAACC,GAA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AK;IAE5C,IAAIgB,kBAAkB,OAAOA;IAE7B,OAAOb,IAAIP,aAAa,CAACqB,MAAM,CAA2B,CAACC,QAAQJ;QACjE,IAAI,CAACI,QAAQ,OAAOJ;QACpB,OAAOA,aAAaK,QAAQ,GAAGD,OAAOC,QAAQ,GAAGL,eAAeI;IAClE,GAAGX;AACL"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type Job, type JobStatus, WORKFLOW_JOB_STATUSES } from './job.js';
|
|
2
|
-
import { type JobExecutionDisplayDuration } from './job-execution.js';
|
|
1
|
+
import { type Job, type JobDisplayStatus, type JobMode, type JobStatus, type ListenerStatus, WORKFLOW_JOB_STATUSES } from './job.js';
|
|
2
|
+
import { type JobExecutionDisplayDuration, type JobExecutionStatus } from './job-execution.js';
|
|
3
3
|
import type { WorkflowRunAttempt, WorkflowRunAttemptSummary } from './workflow-run-attempt.js';
|
|
4
4
|
export type WorkflowRunStatus = 'pending' | 'running' | 'succeeded' | 'failed' | 'cancelled';
|
|
5
5
|
export type WorkflowRunRerunMode = 'all' | 'failed';
|
|
@@ -32,10 +32,13 @@ export interface WorkflowRunJobSummary {
|
|
|
32
32
|
key: string;
|
|
33
33
|
name: string | null;
|
|
34
34
|
status: JobStatus;
|
|
35
|
+
mode: JobMode;
|
|
36
|
+
listenerStatus: ListenerStatus;
|
|
37
|
+
executionStatus: JobExecutionStatus | null;
|
|
35
38
|
position: number;
|
|
36
39
|
}
|
|
37
40
|
export interface WorkflowRunJobStatusCount {
|
|
38
|
-
status:
|
|
41
|
+
status: JobDisplayStatus;
|
|
39
42
|
count: number;
|
|
40
43
|
}
|
|
41
44
|
/**
|
|
@@ -133,7 +136,7 @@ export interface WorkflowRunProgress {
|
|
|
133
136
|
runStatus: WorkflowRunStatus;
|
|
134
137
|
startedAt: string | null;
|
|
135
138
|
finishedAt: string | null;
|
|
136
|
-
jobStatuses:
|
|
139
|
+
jobStatuses: JobDisplayStatus[];
|
|
137
140
|
firstStartedAt?: string | null | undefined;
|
|
138
141
|
}
|
|
139
142
|
/** When the run's earliest execution began, or null while none of them has. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-run.d.ts","sourceRoot":"","sources":["../../../src/core/entities/workflow-run.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"workflow-run.d.ts","sourceRoot":"","sources":["../../../src/core/entities/workflow-run.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,GAAG,EACR,KAAK,gBAAgB,EACrB,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,qBAAqB,EACtB,MAAM,UAAU,CAAC;AAClB,OAAO,EAEL,KAAK,2BAA2B,EAChC,KAAK,kBAAkB,EACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAC,kBAAkB,EAAE,yBAAyB,EAAC,MAAM,2BAA2B,CAAC;AAE7F,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;AAC7F,MAAM,MAAM,oBAAoB,GAAG,KAAK,GAAG,QAAQ,CAAC;AACpD,MAAM,MAAM,cAAc,GAAG,iBAAiB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AACxF;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG,cAAc,GAAG,WAAW,GAAG,QAAQ,CAAC;AAE5E,eAAO,MAAM,qBAAqB,qEAMe,CAAC;AAElD,eAAO,MAAM,yBAAyB,iKAKe,CAAC;AAEtD,eAAO,MAAM,8BAA8B,+CAIM,CAAC;AAQlD,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC1C,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,GAAG,EAAE,MAAM,GAAG,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F;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,CAe9D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/entities/workflow-run.ts"],"sourcesContent":["import {type Job, type JobStatus, WORKFLOW_JOB_STATUSES} from './job.js';\nimport {elapsedTimeFromTimestamps, type JobExecutionDisplayDuration} from './job-execution.js';\nimport type {WorkflowRunAttempt, WorkflowRunAttemptSummary} from './workflow-run-attempt.js';\n\nexport type WorkflowRunStatus = 'pending' | 'running' | 'succeeded' | 'failed' | 'cancelled';\nexport type WorkflowRunRerunMode = 'all' | 'failed';\nexport type WorkflowStatus = WorkflowRunStatus | (typeof WORKFLOW_JOB_STATUSES)[number];\n/**\n * `listening` and `queued` are display-only: the API never returns them, and both are derived\n * from the jobs a run already carries.\n */\nexport type WorkflowDisplayStatus = WorkflowStatus | 'listening' | 'queued';\n\nexport const WORKFLOW_RUN_STATUSES = [\n 'pending',\n 'running',\n 'succeeded',\n 'failed',\n 'cancelled',\n] as const satisfies readonly WorkflowRunStatus[];\n\nexport const WORKFLOW_DISPLAY_STATUSES = [\n ...WORKFLOW_RUN_STATUSES,\n ...WORKFLOW_JOB_STATUSES,\n 'listening',\n 'queued',\n] as const satisfies readonly WorkflowDisplayStatus[];\n\nexport const TERMINAL_WORKFLOW_RUN_STATUSES = [\n 'succeeded',\n 'failed',\n 'cancelled',\n] as const satisfies readonly WorkflowRunStatus[];\n\nconst WORKFLOW_STATUSES = new Set<WorkflowStatus>([\n ...WORKFLOW_RUN_STATUSES,\n ...WORKFLOW_JOB_STATUSES,\n]);\nconst TERMINAL_WORKFLOW_RUN_STATUS_SET = new Set<WorkflowRunStatus>(TERMINAL_WORKFLOW_RUN_STATUSES);\n\nexport interface WorkflowSourceSnapshot {\n content: string;\n format: 'yaml';\n}\n\n/**\n * Provider-neutral trigger facts. Every field is nullable: only source-control triggers\n * resolve a reference at all, and a payload can name a ref without naming an actor.\n */\nexport interface WorkflowRunTriggerReference {\n repository: string | null;\n ref: string | null;\n commit: string | null;\n actor: string | null;\n}\n\n/** One glyph in a run row's job status strip: enough to draw and label it, nothing more. */\nexport interface WorkflowRunJobSummary {\n id: string;\n key: string;\n name: string | null;\n status: JobStatus;\n position: number;\n}\n\nexport interface WorkflowRunJobStatusCount {\n status: JobStatus;\n count: number;\n}\n\n/**\n * A run's jobs as the list receives them: a bounded slice to draw, plus totals covering all\n * of them.\n *\n * `preview` is capped by the API, so `preview.length` is not the job count and the strip\n * reads `total` and `statusCounts` for anything it says rather than anything it draws.\n */\nexport interface WorkflowRunJobs {\n preview: WorkflowRunJobSummary[];\n statusCounts: WorkflowRunJobStatusCount[];\n total: number;\n}\n\nexport interface WorkflowRun {\n id: string;\n projectId: string;\n definitionId: string;\n number: number | null;\n name: string;\n workflowName: string;\n currentAttempt: number;\n triggerProvider: string | null;\n triggerSource: string;\n triggerEvent: string;\n triggerDisplayLabel: string;\n triggerLabel: string;\n triggerPayload: Record<string, unknown>;\n triggerReference: WorkflowRunTriggerReference | null;\n inputs: Record<string, unknown> | null;\n sourceSnapshot: WorkflowSourceSnapshot | null;\n createdAt: string;\n updatedAt: string;\n isTemporary: boolean;\n}\n\n/** A run as the API returns it outside the list: no job strip, because none was fetched. */\nexport interface WorkflowRunRecord extends WorkflowRun {\n status: WorkflowRunStatus;\n latestAttempt: number;\n runAttempt: WorkflowRunAttemptSummary;\n}\n\nexport interface WorkflowRunListItem extends WorkflowRunRecord {\n jobs: WorkflowRunJobs;\n}\n\nexport interface WorkflowRunDetail extends WorkflowRun {\n latestAttempt: number;\n runAttempt: WorkflowRunAttempt;\n jobs: Job[];\n}\n\nexport interface WorkflowRunListPage {\n runs: WorkflowRunListItem[];\n nextCursor: string | null;\n filteredTotalCount: number | null;\n}\n\nexport interface ManualWorkflowLaunch {\n workflowRunId: string;\n}\n\nexport function workflowRunTriggerLabel({\n triggerSource,\n triggerEvent,\n}: {\n triggerSource: string;\n triggerEvent: string;\n}): string {\n return [triggerSource, triggerEvent].filter(Boolean).join(' · ');\n}\n\nexport function workflowRunTriggerDisplayLabel({\n triggerSource,\n triggerEvent,\n}: {\n triggerSource: string;\n triggerEvent: string;\n}): string {\n return triggerEvent || triggerSource;\n}\n\nconst SHORT_COMMIT_LENGTH = 7;\nconst PULL_REQUEST_REF_PATTERN = /^refs\\/pull\\/(\\d+)\\/head$/u;\n\n/**\n * The ref as a person names it: `main` for a branch, `#42` for a pull request, the tag for a\n * tag. An unrecognized ref is shown verbatim rather than hidden, since a ref nobody can read\n * is still better evidence than a blank cell.\n */\nexport function workflowRunBranchLabel(run: Pick<WorkflowRun, 'triggerReference'>): string | null {\n const ref = run.triggerReference?.ref;\n if (!ref) return null;\n const pullRequest = PULL_REQUEST_REF_PATTERN.exec(ref);\n if (pullRequest) return `#${pullRequest[1]}`;\n if (ref.startsWith('refs/heads/')) return ref.slice('refs/heads/'.length);\n if (ref.startsWith('refs/tags/')) return ref.slice('refs/tags/'.length);\n return ref;\n}\n\nexport function workflowRunCommitLabel(run: Pick<WorkflowRun, 'triggerReference'>): string | null {\n const commit = run.triggerReference?.commit;\n return commit ? commit.slice(0, SHORT_COMMIT_LENGTH) : null;\n}\n\nexport function workflowRunActor(run: Pick<WorkflowRun, 'triggerReference'>): string | null {\n return run.triggerReference?.actor ?? null;\n}\n\nexport function isWorkflowRunTerminal(status: WorkflowRunStatus): boolean {\n return TERMINAL_WORKFLOW_RUN_STATUS_SET.has(status);\n}\n\nexport function isWorkflowStatus(status: string): status is WorkflowStatus {\n return WORKFLOW_STATUSES.has(status as WorkflowStatus);\n}\n\n/**\n * A run's headline duration, split the way a job's already is. An attempt's `startedAt` marks\n * when the orchestrator picked the run up, not when work began, so a run whose jobs are all\n * still waiting for a runner reads as queue time rather than as run time.\n */\nexport type WorkflowRunDisplayDuration = JobExecutionDisplayDuration;\n\n/** What every surface shows for a run, derived together so status and duration cannot disagree. */\nexport interface WorkflowRunDisplay {\n status: WorkflowDisplayStatus;\n duration: WorkflowRunDisplayDuration | null;\n}\n\n/**\n * The evidence a surface can offer about a run's progress.\n *\n * `jobStatuses` is what every surface has: the list carries status counts, the detail carries\n * whole jobs. `firstStartedAt` is the detail's extra precision, and where it is absent the\n * attempt's own mark stands in.\n */\nexport interface WorkflowRunProgress {\n runStatus: WorkflowRunStatus;\n startedAt: string | null;\n finishedAt: string | null;\n jobStatuses: JobStatus[];\n firstStartedAt?: string | null | undefined;\n}\n\n/** When the run's earliest execution began, or null while none of them has. */\nexport function workflowRunFirstStartedAt(jobs: Job[]): string | null {\n let earliest: string | null = null;\n let earliestMs = Number.POSITIVE_INFINITY;\n\n for (const job of jobs) {\n for (const {startedAt} of job.jobExecutions) {\n if (startedAt === null) continue;\n const startedMs = new Date(startedAt).getTime();\n if (!Number.isFinite(startedMs) || startedMs >= earliestMs) continue;\n earliest = startedAt;\n earliestMs = startedMs;\n }\n }\n\n return earliest;\n}\n\n/**\n * Whether any work has begun. A run with no jobs on hand is a run whose jobs were not fetched,\n * which is no evidence that nothing started, so it counts as started rather than claiming a\n * queue this surface cannot see.\n */\nfunction workflowRunHasStarted({jobStatuses, firstStartedAt}: WorkflowRunProgress): boolean {\n if (firstStartedAt != null) return true;\n if (jobStatuses.length === 0) return true;\n return jobStatuses.some((status) => status !== 'pending' && status !== 'skipped');\n}\n\n/**\n * The single rule behind every run readout. An attempt's `startedAt` marks when the\n * orchestrator picked the run up, not when work began, so a run whose jobs are all still\n * waiting reads as `Queued` for queue time. Calling that \"running for 2h\" sends an operator to\n * debug a build that never began.\n */\nexport function deriveWorkflowRunDisplay(progress: WorkflowRunProgress): WorkflowRunDisplay {\n const {runStatus, startedAt, finishedAt, firstStartedAt} = progress;\n const hasStarted = workflowRunHasStarted(progress);\n const status = runStatus === 'running' && !hasStarted ? 'queued' : runStatus;\n\n if (startedAt === null) return {status, duration: null};\n\n // A run cancelled before anything started keeps its queue reading rather than reporting a\n // run that never was.\n const time = elapsedTimeFromTimestamps({from: firstStartedAt ?? startedAt, to: finishedAt});\n if (time === null) return {status, duration: null};\n\n return {status, duration: {kind: hasStarted ? 'run' : 'queue', ...time}};\n}\n\n/** The run detail's reading: whole jobs, so queue and run time split on the first execution. */\nexport function workflowRunDetailDisplay(run: {\n runAttempt: Pick<WorkflowRunAttemptSummary, 'status' | 'startedAt' | 'finishedAt'>;\n jobs: Job[];\n}): WorkflowRunDisplay {\n return deriveWorkflowRunDisplay({\n runStatus: run.runAttempt.status,\n startedAt: run.runAttempt.startedAt,\n finishedAt: run.runAttempt.finishedAt,\n jobStatuses: run.jobs.map((job) => job.status),\n firstStartedAt: workflowRunFirstStartedAt(run.jobs),\n });\n}\n\n/**\n * The run list's reading: status counts cover every job, not just the drawn preview, so a row\n * reaches the same verdict as the detail page without fetching a single timestamp more.\n */\nexport function workflowRunListItemDisplay(run: WorkflowRunListItem): WorkflowRunDisplay {\n return deriveWorkflowRunDisplay({\n runStatus: run.status,\n startedAt: run.runAttempt.startedAt,\n finishedAt: run.runAttempt.finishedAt,\n jobStatuses: run.jobs.statusCounts.filter(({count}) => count > 0).map(({status}) => status),\n });\n}\n\n/**\n * The job the run is waiting on: the one queued longest without starting. Named only so a\n * queued run says what it waits for instead of showing a number with no subject.\n */\nexport function workflowRunBlockingJob(jobs: Job[]): Job | null {\n let blocking: Job | null = null;\n let queuedMs = Number.POSITIVE_INFINITY;\n\n for (const job of jobs) {\n for (const {queuedAt, startedAt, finishedAt} of job.jobExecutions) {\n if (queuedAt === null || startedAt !== null || finishedAt !== null) continue;\n const candidateMs = new Date(queuedAt).getTime();\n if (!Number.isFinite(candidateMs) || candidateMs >= queuedMs) continue;\n blocking = job;\n queuedMs = candidateMs;\n }\n }\n\n return blocking;\n}\n"],"names":["WORKFLOW_JOB_STATUSES","elapsedTimeFromTimestamps","WORKFLOW_RUN_STATUSES","WORKFLOW_DISPLAY_STATUSES","TERMINAL_WORKFLOW_RUN_STATUSES","WORKFLOW_STATUSES","Set","TERMINAL_WORKFLOW_RUN_STATUS_SET","workflowRunTriggerLabel","triggerSource","triggerEvent","filter","Boolean","join","workflowRunTriggerDisplayLabel","SHORT_COMMIT_LENGTH","PULL_REQUEST_REF_PATTERN","workflowRunBranchLabel","run","ref","triggerReference","pullRequest","exec","startsWith","slice","length","workflowRunCommitLabel","commit","workflowRunActor","actor","isWorkflowRunTerminal","status","has","isWorkflowStatus","workflowRunFirstStartedAt","jobs","earliest","earliestMs","Number","POSITIVE_INFINITY","job","startedAt","jobExecutions","startedMs","Date","getTime","isFinite","workflowRunHasStarted","jobStatuses","firstStartedAt","some","deriveWorkflowRunDisplay","progress","runStatus","finishedAt","hasStarted","duration","time","from","to","kind","workflowRunDetailDisplay","runAttempt","map","workflowRunListItemDisplay","statusCounts","count","workflowRunBlockingJob","blocking","queuedMs","queuedAt","candidateMs"],"mappings":"AAAA,SAAkCA,qBAAqB,QAAO,WAAW;AACzE,SAAQC,yBAAyB,QAAyC,qBAAqB;AAY/F,OAAO,MAAMC,wBAAwB;IACnC;IACA;IACA;IACA;IACA;CACD,CAAiD;AAElD,OAAO,MAAMC,4BAA4B;OACpCD;OACAF;IACH;IACA;CACD,CAAqD;AAEtD,OAAO,MAAMI,iCAAiC;IAC5C;IACA;IACA;CACD,CAAiD;AAElD,MAAMC,oBAAoB,IAAIC,IAAoB;OAC7CJ;OACAF;CACJ;AACD,MAAMO,mCAAmC,IAAID,IAAuBF;AA8FpE,OAAO,SAASI,wBAAwB,EACtCC,aAAa,EACbC,YAAY,EAIb;IACC,OAAO;QAACD;QAAeC;KAAa,CAACC,MAAM,CAACC,SAASC,IAAI,CAAC;AAC5D;AAEA,OAAO,SAASC,+BAA+B,EAC7CL,aAAa,EACbC,YAAY,EAIb;IACC,OAAOA,gBAAgBD;AACzB;AAEA,MAAMM,sBAAsB;AAC5B,MAAMC,2BAA2B;AAEjC;;;;CAIC,GACD,OAAO,SAASC,uBAAuBC,GAA0C;IAC/E,MAAMC,MAAMD,IAAIE,gBAA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KAAK,EAAC,GAAKA,QAAQ,GAAGH,GAAG,CAAC,CAAC,EAAChC,MAAM,EAAC,GAAKA;IACtF;AACF;AAEA;;;CAGC,GACD,OAAO,SAASoC,uBAAuBhC,IAAW;IAChD,IAAIiC,WAAuB;IAC3B,IAAIC,WAAW/B,OAAOC,iBAAiB;IAEvC,KAAK,MAAMC,OAAOL,KAAM;QACtB,KAAK,MAAM,EAACmC,QAAQ,EAAE7B,SAAS,EAAEa,UAAU,EAAC,IAAId,IAAIE,aAAa,CAAE;YACjE,IAAI4B,aAAa,QAAQ7B,cAAc,QAAQa,eAAe,MAAM;YACpE,MAAMiB,cAAc,IAAI3B,KAAK0B,UAAUzB,OAAO;YAC9C,IAAI,CAACP,OAAOQ,QAAQ,CAACyB,gBAAgBA,eAAeF,UAAU;YAC9DD,WAAW5B;YACX6B,WAAWE;QACb;IACF;IAEA,OAAOH;AACT"}
|
|
1
|
+
{"version":3,"sources":["../../../src/core/entities/workflow-run.ts"],"sourcesContent":["import {\n type Job,\n type JobDisplayStatus,\n type JobMode,\n type JobStatus,\n type ListenerStatus,\n WORKFLOW_JOB_STATUSES,\n} from './job.js';\nimport {\n elapsedTimeFromTimestamps,\n type JobExecutionDisplayDuration,\n type JobExecutionStatus,\n} from './job-execution.js';\nimport type {WorkflowRunAttempt, WorkflowRunAttemptSummary} from './workflow-run-attempt.js';\n\nexport type WorkflowRunStatus = 'pending' | 'running' | 'succeeded' | 'failed' | 'cancelled';\nexport type WorkflowRunRerunMode = 'all' | 'failed';\nexport type WorkflowStatus = WorkflowRunStatus | (typeof WORKFLOW_JOB_STATUSES)[number];\n/**\n * `listening` and `queued` are display-only: the API never returns them, and both are derived\n * from the jobs a run already carries.\n */\nexport type WorkflowDisplayStatus = WorkflowStatus | 'listening' | 'queued';\n\nexport const WORKFLOW_RUN_STATUSES = [\n 'pending',\n 'running',\n 'succeeded',\n 'failed',\n 'cancelled',\n] as const satisfies readonly WorkflowRunStatus[];\n\nexport const WORKFLOW_DISPLAY_STATUSES = [\n ...WORKFLOW_RUN_STATUSES,\n ...WORKFLOW_JOB_STATUSES,\n 'listening',\n 'queued',\n] as const satisfies readonly WorkflowDisplayStatus[];\n\nexport const TERMINAL_WORKFLOW_RUN_STATUSES = [\n 'succeeded',\n 'failed',\n 'cancelled',\n] as const satisfies readonly WorkflowRunStatus[];\n\nconst WORKFLOW_STATUSES = new Set<WorkflowStatus>([\n ...WORKFLOW_RUN_STATUSES,\n ...WORKFLOW_JOB_STATUSES,\n]);\nconst TERMINAL_WORKFLOW_RUN_STATUS_SET = new Set<WorkflowRunStatus>(TERMINAL_WORKFLOW_RUN_STATUSES);\n\nexport interface WorkflowSourceSnapshot {\n content: string;\n format: 'yaml';\n}\n\n/**\n * Provider-neutral trigger facts. Every field is nullable: only source-control triggers\n * resolve a reference at all, and a payload can name a ref without naming an actor.\n */\nexport interface WorkflowRunTriggerReference {\n repository: string | null;\n ref: string | null;\n commit: string | null;\n actor: string | null;\n}\n\n/** One glyph in a run row's job status strip: enough to draw and label it, nothing more. */\nexport interface WorkflowRunJobSummary {\n id: string;\n key: string;\n name: string | null;\n status: JobStatus;\n mode: JobMode;\n listenerStatus: ListenerStatus;\n executionStatus: JobExecutionStatus | null;\n position: number;\n}\n\nexport interface WorkflowRunJobStatusCount {\n status: JobDisplayStatus;\n count: number;\n}\n\n/**\n * A run's jobs as the list receives them: a bounded slice to draw, plus totals covering all\n * of them.\n *\n * `preview` is capped by the API, so `preview.length` is not the job count and the strip\n * reads `total` and `statusCounts` for anything it says rather than anything it draws.\n */\nexport interface WorkflowRunJobs {\n preview: WorkflowRunJobSummary[];\n statusCounts: WorkflowRunJobStatusCount[];\n total: number;\n}\n\nexport interface WorkflowRun {\n id: string;\n projectId: string;\n definitionId: string;\n number: number | null;\n name: string;\n workflowName: string;\n currentAttempt: number;\n triggerProvider: string | null;\n triggerSource: string;\n triggerEvent: string;\n triggerDisplayLabel: string;\n triggerLabel: string;\n triggerPayload: Record<string, unknown>;\n triggerReference: WorkflowRunTriggerReference | null;\n inputs: Record<string, unknown> | null;\n sourceSnapshot: WorkflowSourceSnapshot | null;\n createdAt: string;\n updatedAt: string;\n isTemporary: boolean;\n}\n\n/** A run as the API returns it outside the list: no job strip, because none was fetched. */\nexport interface WorkflowRunRecord extends WorkflowRun {\n status: WorkflowRunStatus;\n latestAttempt: number;\n runAttempt: WorkflowRunAttemptSummary;\n}\n\nexport interface WorkflowRunListItem extends WorkflowRunRecord {\n jobs: WorkflowRunJobs;\n}\n\nexport interface WorkflowRunDetail extends WorkflowRun {\n latestAttempt: number;\n runAttempt: WorkflowRunAttempt;\n jobs: Job[];\n}\n\nexport interface WorkflowRunListPage {\n runs: WorkflowRunListItem[];\n nextCursor: string | null;\n filteredTotalCount: number | null;\n}\n\nexport interface ManualWorkflowLaunch {\n workflowRunId: string;\n}\n\nexport function workflowRunTriggerLabel({\n triggerSource,\n triggerEvent,\n}: {\n triggerSource: string;\n triggerEvent: string;\n}): string {\n return [triggerSource, triggerEvent].filter(Boolean).join(' · ');\n}\n\nexport function workflowRunTriggerDisplayLabel({\n triggerSource,\n triggerEvent,\n}: {\n triggerSource: string;\n triggerEvent: string;\n}): string {\n return triggerEvent || triggerSource;\n}\n\nconst SHORT_COMMIT_LENGTH = 7;\nconst PULL_REQUEST_REF_PATTERN = /^refs\\/pull\\/(\\d+)\\/head$/u;\n\n/**\n * The ref as a person names it: `main` for a branch, `#42` for a pull request, the tag for a\n * tag. An unrecognized ref is shown verbatim rather than hidden, since a ref nobody can read\n * is still better evidence than a blank cell.\n */\nexport function workflowRunBranchLabel(run: Pick<WorkflowRun, 'triggerReference'>): string | null {\n const ref = run.triggerReference?.ref;\n if (!ref) return null;\n const pullRequest = PULL_REQUEST_REF_PATTERN.exec(ref);\n if (pullRequest) return `#${pullRequest[1]}`;\n if (ref.startsWith('refs/heads/')) return ref.slice('refs/heads/'.length);\n if (ref.startsWith('refs/tags/')) return ref.slice('refs/tags/'.length);\n return ref;\n}\n\nexport function workflowRunCommitLabel(run: Pick<WorkflowRun, 'triggerReference'>): string | null {\n const commit = run.triggerReference?.commit;\n return commit ? commit.slice(0, SHORT_COMMIT_LENGTH) : null;\n}\n\nexport function workflowRunActor(run: Pick<WorkflowRun, 'triggerReference'>): string | null {\n return run.triggerReference?.actor ?? null;\n}\n\nexport function isWorkflowRunTerminal(status: WorkflowRunStatus): boolean {\n return TERMINAL_WORKFLOW_RUN_STATUS_SET.has(status);\n}\n\nexport function isWorkflowStatus(status: string): status is WorkflowStatus {\n return WORKFLOW_STATUSES.has(status as WorkflowStatus);\n}\n\n/**\n * A run's headline duration, split the way a job's already is. An attempt's `startedAt` marks\n * when the orchestrator picked the run up, not when work began, so a run whose jobs are all\n * still waiting for a runner reads as queue time rather than as run time.\n */\nexport type WorkflowRunDisplayDuration = JobExecutionDisplayDuration;\n\n/** What every surface shows for a run, derived together so status and duration cannot disagree. */\nexport interface WorkflowRunDisplay {\n status: WorkflowDisplayStatus;\n duration: WorkflowRunDisplayDuration | null;\n}\n\n/**\n * The evidence a surface can offer about a run's progress.\n *\n * `jobStatuses` is what every surface has: the list carries status counts, the detail carries\n * whole jobs. `firstStartedAt` is the detail's extra precision, and where it is absent the\n * attempt's own mark stands in.\n */\nexport interface WorkflowRunProgress {\n runStatus: WorkflowRunStatus;\n startedAt: string | null;\n finishedAt: string | null;\n jobStatuses: JobDisplayStatus[];\n firstStartedAt?: string | null | undefined;\n}\n\n/** When the run's earliest execution began, or null while none of them has. */\nexport function workflowRunFirstStartedAt(jobs: Job[]): string | null {\n let earliest: string | null = null;\n let earliestMs = Number.POSITIVE_INFINITY;\n\n for (const job of jobs) {\n for (const {startedAt} of job.jobExecutions) {\n if (startedAt === null) continue;\n const startedMs = new Date(startedAt).getTime();\n if (!Number.isFinite(startedMs) || startedMs >= earliestMs) continue;\n earliest = startedAt;\n earliestMs = startedMs;\n }\n }\n\n return earliest;\n}\n\n/**\n * Whether any work has begun. A run with no jobs on hand is a run whose jobs were not fetched,\n * which is no evidence that nothing started, so it counts as started rather than claiming a\n * queue this surface cannot see.\n */\nfunction workflowRunHasStarted({jobStatuses, firstStartedAt}: WorkflowRunProgress): boolean {\n if (firstStartedAt != null) return true;\n if (jobStatuses.length === 0) return true;\n return jobStatuses.some((status) => status !== 'pending' && status !== 'skipped');\n}\n\n/**\n * The single rule behind every run readout. An attempt's `startedAt` marks when the\n * orchestrator picked the run up, not when work began, so a run whose jobs are all still\n * waiting reads as `Queued` for queue time. Calling that \"running for 2h\" sends an operator to\n * debug a build that never began.\n */\nexport function deriveWorkflowRunDisplay(progress: WorkflowRunProgress): WorkflowRunDisplay {\n const {runStatus, startedAt, finishedAt, firstStartedAt} = progress;\n const hasStarted = workflowRunHasStarted(progress);\n const status = runStatus === 'running' && !hasStarted ? 'queued' : runStatus;\n\n if (startedAt === null) return {status, duration: null};\n\n // A run cancelled before anything started keeps its queue reading rather than reporting a\n // run that never was.\n const time = elapsedTimeFromTimestamps({from: firstStartedAt ?? startedAt, to: finishedAt});\n if (time === null) return {status, duration: null};\n\n return {status, duration: {kind: hasStarted ? 'run' : 'queue', ...time}};\n}\n\n/** The run detail's reading: whole jobs, so queue and run time split on the first execution. */\nexport function workflowRunDetailDisplay(run: {\n runAttempt: Pick<WorkflowRunAttemptSummary, 'status' | 'startedAt' | 'finishedAt'>;\n jobs: Job[];\n}): WorkflowRunDisplay {\n return deriveWorkflowRunDisplay({\n runStatus: run.runAttempt.status,\n startedAt: run.runAttempt.startedAt,\n finishedAt: run.runAttempt.finishedAt,\n jobStatuses: run.jobs.map((job) => job.status),\n firstStartedAt: workflowRunFirstStartedAt(run.jobs),\n });\n}\n\n/**\n * The run list's reading: status counts cover every job, not just the drawn preview, so a row\n * reaches the same verdict as the detail page without fetching a single timestamp more.\n */\nexport function workflowRunListItemDisplay(run: WorkflowRunListItem): WorkflowRunDisplay {\n return deriveWorkflowRunDisplay({\n runStatus: run.status,\n startedAt: run.runAttempt.startedAt,\n finishedAt: run.runAttempt.finishedAt,\n jobStatuses: run.jobs.statusCounts.filter(({count}) => count > 0).map(({status}) => status),\n });\n}\n\n/**\n * The job the run is waiting on: the one queued longest without starting. Named only so a\n * queued run says what it waits for instead of showing a number with no subject.\n */\nexport function workflowRunBlockingJob(jobs: Job[]): Job | null {\n let blocking: Job | null = null;\n let queuedMs = Number.POSITIVE_INFINITY;\n\n for (const job of jobs) {\n for (const {queuedAt, startedAt, finishedAt} of job.jobExecutions) {\n if (queuedAt === null || startedAt !== null || finishedAt !== null) continue;\n const candidateMs = new Date(queuedAt).getTime();\n if (!Number.isFinite(candidateMs) || candidateMs >= queuedMs) continue;\n blocking = job;\n queuedMs = candidateMs;\n }\n }\n\n return blocking;\n}\n"],"names":["WORKFLOW_JOB_STATUSES","elapsedTimeFromTimestamps","WORKFLOW_RUN_STATUSES","WORKFLOW_DISPLAY_STATUSES","TERMINAL_WORKFLOW_RUN_STATUSES","WORKFLOW_STATUSES","Set","TERMINAL_WORKFLOW_RUN_STATUS_SET","workflowRunTriggerLabel","triggerSource","triggerEvent","filter","Boolean","join","workflowRunTriggerDisplayLabel","SHORT_COMMIT_LENGTH","PULL_REQUEST_REF_PATTERN","workflowRunBranchLabel","run","ref","triggerReference","pullRequest","exec","startsWith","slice","length","workflowRunCommitLabel","commit","workflowRunActor","actor","isWorkflowRunTerminal","status","has","isWorkflowStatus","workflowRunFirstStartedAt","jobs","earliest","earliestMs","Number","POSITIVE_INFINITY","job","startedAt","jobExecutions","startedMs","Date","getTime","isFinite","workflowRunHasStarted","jobStatuses","firstStartedAt","some","deriveWorkflowRunDisplay","progress","runStatus","finishedAt","hasStarted","duration","time","from","to","kind","workflowRunDetailDisplay","runAttempt","map","workflowRunListItemDisplay","statusCounts","count","workflowRunBlockingJob","blocking","queuedMs","queuedAt","candidateMs"],"mappings":"AAAA,SAMEA,qBAAqB,QAChB,WAAW;AAClB,SACEC,yBAAyB,QAGpB,qBAAqB;AAY5B,OAAO,MAAMC,wBAAwB;IACnC;IACA;IACA;IACA;IACA;CAC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.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,4BAA4B,EAC5B,cAAc,EAGd,qBAAqB,EACrB,4BAA4B,EAC5B,uBAAuB,EACvB,gCAAgC,EAChC,sBAAsB,EACtB,0BAA0B,EAC1B,sBAAsB,EACtB,wBAAwB,EACzB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,KAAK,oBAAoB,EACzB,GAAG,EACH,YAAY,EAEZ,KAAK,IAAI,EACT,WAAW,EAGX,KAAK,WAAW,EAChB,kBAAkB,EAElB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EAGvB,MAAM,uBAAuB,CAAC;AAE/B,wBAAgB,aAAa,CAAC,GAAG,EAAE,sBAAsB,GAAG,WAAW,CA8BtE;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,qBAAqB,GAAG,kBAAkB,CAWnF;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,sBAAsB,GAAG,iBAAiB,CAclF;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,sBAAsB,GAAG,mBAAmB,
|
|
1
|
+
{"version":3,"file":"workflow-run-mapper.d.ts","sourceRoot":"","sources":["../../../src/hooks/api/workflow-run-mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,4BAA4B,EAC5B,cAAc,EAGd,qBAAqB,EACrB,4BAA4B,EAC5B,uBAAuB,EACvB,gCAAgC,EAChC,sBAAsB,EACtB,0BAA0B,EAC1B,sBAAsB,EACtB,wBAAwB,EACzB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,KAAK,oBAAoB,EACzB,GAAG,EACH,YAAY,EAEZ,KAAK,IAAI,EACT,WAAW,EAGX,KAAK,WAAW,EAChB,kBAAkB,EAElB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EAGvB,MAAM,uBAAuB,CAAC;AAE/B,wBAAgB,aAAa,CAAC,GAAG,EAAE,sBAAsB,GAAG,WAAW,CA8BtE;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,qBAAqB,GAAG,kBAAkB,CAWnF;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,sBAAsB,GAAG,iBAAiB,CAclF;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,sBAAsB,GAAG,mBAAmB,CA6BtF;AAQD,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,0BAA0B,GAAG,mBAAmB,CAM1F;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,4BAA4B,GAAG,iBAAiB,CAOxF;AAED,wBAAgB,KAAK,CAAC,GAAG,EAAE,uBAAuB,GAAG,GAAG,CAuBvD;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,gCAAgC,GAAG,YAAY,CAqBlF;AAED,wBAAgB,MAAM,CAAC,GAAG,EAAE,wBAAwB,GAAG,IAAI,CA+B1D;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,GAAG,WAAW,CAkBtF;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,4BAA4B;IAEjE,MAAM;IACN,OAAO;IACP,cAAc;IACd,MAAM;IACN,eAAe;EAElB"}
|
|
@@ -59,7 +59,8 @@ export function toWorkflowRunRecord(dto) {
|
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
61
|
export function toWorkflowRunListItem(dto) {
|
|
62
|
-
const
|
|
62
|
+
const hasDisplayStatusCounts = dto.job_display_status_counts !== undefined;
|
|
63
|
+
const statusCounts = (dto.job_display_status_counts ?? dto.job_status_counts).map(({ status, count })=>({
|
|
63
64
|
status,
|
|
64
65
|
count
|
|
65
66
|
}));
|
|
@@ -71,6 +72,12 @@ export function toWorkflowRunListItem(dto) {
|
|
|
71
72
|
key: job.key,
|
|
72
73
|
name: job.name,
|
|
73
74
|
status: job.status,
|
|
75
|
+
mode: job.mode ?? 'one_shot',
|
|
76
|
+
listenerStatus: job.listener_status ?? 'inactive',
|
|
77
|
+
// The optional display-count field is the rollout capability signal. Pre-display API
|
|
78
|
+
// responses only carry raw verdict counts, so mirror their non-terminal verdict into
|
|
79
|
+
// execution evidence to keep each legacy glyph aligned with those fallback counts.
|
|
80
|
+
executionStatus: hasDisplayStatusCounts ? job.execution_status ?? null : legacyExecutionStatus(job.status),
|
|
74
81
|
position: job.position
|
|
75
82
|
})),
|
|
76
83
|
statusCounts,
|
|
@@ -80,6 +87,9 @@ export function toWorkflowRunListItem(dto) {
|
|
|
80
87
|
}
|
|
81
88
|
};
|
|
82
89
|
}
|
|
90
|
+
function legacyExecutionStatus(status) {
|
|
91
|
+
return status === 'pending' || status === 'running' ? status : null;
|
|
92
|
+
}
|
|
83
93
|
export function toWorkflowRunListPage(dto) {
|
|
84
94
|
return {
|
|
85
95
|
runs: dto.runs.map(toWorkflowRunListItem),
|
|
@@ -127,6 +137,7 @@ export function toJobExecution(dto) {
|
|
|
127
137
|
name: dto.name,
|
|
128
138
|
status: dto.status,
|
|
129
139
|
statusReason: dto.status_reason,
|
|
140
|
+
statusReasonMessage: dto.status_reason_message ?? null,
|
|
130
141
|
runner: dto.runner ?? null,
|
|
131
142
|
outputs: dto.outputs ?? null,
|
|
132
143
|
triggerEvents: (dto.trigger_events ?? []).map(toWorkflowExecutionEvent),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/hooks/api/workflow-run-mapper.ts"],"sourcesContent":["import type {\n EvaluationTraceDto,\n JobListeningDto,\n StepAttemptDetailResponseDto,\n StepAttemptDto,\n StepGateResultDto,\n WorkflowExecutionEventDto,\n WorkflowRunAttemptDto,\n WorkflowRunDetailResponseDto,\n WorkflowRunJobDetailDto,\n WorkflowRunJobExecutionDetailDto,\n WorkflowRunListItemDto,\n WorkflowRunListResponseDto,\n WorkflowRunResponseDto,\n WorkflowRunStepDetailDto,\n} from '@shipfox/api-workflows-dto';\nimport {\n type EvaluationTraceEntry,\n Job,\n JobExecution,\n type JobListening,\n type Step,\n StepAttempt,\n type StepGateResult,\n type WorkflowExecutionEvent,\n type WorkflowRun,\n WorkflowRunAttempt,\n WorkflowRunAttemptSummary,\n type WorkflowRunDetail,\n type WorkflowRunListItem,\n type WorkflowRunListPage,\n type WorkflowRunRecord,\n workflowRunTriggerDisplayLabel,\n workflowRunTriggerLabel,\n} from '#core/workflow-run.js';\n\nexport function toWorkflowRun(dto: WorkflowRunResponseDto): WorkflowRun {\n return {\n id: dto.id,\n projectId: dto.project_id,\n definitionId: dto.definition_id,\n number: dto.number,\n name: dto.name,\n workflowName: dto.workflow_name,\n currentAttempt: dto.current_attempt,\n triggerProvider: dto.trigger_provider,\n triggerSource: dto.trigger_source,\n triggerEvent: dto.trigger_event,\n triggerDisplayLabel: workflowRunTriggerDisplayLabel({\n triggerSource: dto.trigger_source,\n triggerEvent: dto.trigger_event,\n }),\n triggerLabel: workflowRunTriggerLabel({\n triggerSource: dto.trigger_source,\n triggerEvent: dto.trigger_event,\n }),\n triggerPayload: dto.trigger_payload,\n triggerReference: dto.trigger_reference,\n inputs: dto.inputs ?? null,\n sourceSnapshot: dto.source_snapshot\n ? {content: dto.source_snapshot.content, format: dto.source_snapshot.format}\n : null,\n createdAt: dto.created_at,\n updatedAt: dto.updated_at,\n isTemporary: dto.id.startsWith('temp-'),\n };\n}\n\nexport function toWorkflowRunAttempt(dto: WorkflowRunAttemptDto): WorkflowRunAttempt {\n return new WorkflowRunAttempt({\n id: dto.id,\n workflowRunId: dto.workflow_run_id,\n attempt: dto.attempt,\n status: dto.status,\n createdAt: dto.created_at,\n startedAt: dto.started_at ?? null,\n finishedAt: dto.finished_at ?? null,\n rerunMode: dto.rerun_mode,\n });\n}\n\nexport function toWorkflowRunRecord(dto: WorkflowRunResponseDto): WorkflowRunRecord {\n return {\n ...toWorkflowRun(dto),\n status: dto.status,\n latestAttempt: dto.latest_attempt,\n runAttempt: new WorkflowRunAttemptSummary({\n workflowRunId: dto.id,\n attempt: dto.current_attempt,\n status: dto.status,\n createdAt: dto.created_at,\n startedAt: dto.started_at ?? null,\n finishedAt: dto.finished_at ?? null,\n }),\n };\n}\n\nexport function toWorkflowRunListItem(dto: WorkflowRunListItemDto): WorkflowRunListItem {\n const statusCounts = dto.job_status_counts.map(({status, count}) => ({status, count}));\n return {\n ...toWorkflowRunRecord(dto),\n jobs: {\n preview: dto.jobs.map((job) => ({\n id: job.id,\n key: job.key,\n name: job.name,\n status: job.status,\n position: job.position,\n })),\n statusCounts,\n // Derived rather than sent: the counts already cover every job, and a separate total\n // would be a second source of truth that could disagree with them.\n total: statusCounts.reduce((sum, entry) => sum + entry.count, 0),\n },\n };\n}\n\nexport function toWorkflowRunListPage(dto: WorkflowRunListResponseDto): WorkflowRunListPage {\n return {\n runs: dto.runs.map(toWorkflowRunListItem),\n nextCursor: dto.next_cursor,\n filteredTotalCount: dto.filtered_total_count,\n };\n}\n\nexport function toWorkflowRunDetail(dto: WorkflowRunDetailResponseDto): WorkflowRunDetail {\n return {\n ...toWorkflowRun(dto),\n latestAttempt: dto.latest_attempt,\n runAttempt: toWorkflowRunAttempt(dto.run_attempt),\n jobs: dto.jobs.map(toJob),\n };\n}\n\nexport function toJob(dto: WorkflowRunJobDetailDto): Job {\n return new Job({\n id: dto.id,\n runAttemptId: dto.run_attempt_id,\n key: dto.key,\n name: dto.name,\n mode: dto.mode,\n status: dto.status,\n statusReason: dto.status_reason,\n carriedOver: dto.carried_over,\n outputs: dto.outputs ?? null,\n success: dto.success ?? null,\n runner: dto.runner ?? null,\n evaluationTrace: toEvaluationTrace(dto.evaluation_trace),\n listening: dto.listening ? toJobListening(dto.listening) : null,\n listenerStatus: dto.listener_status,\n resolutionReason: dto.resolution_reason,\n dependencies: dto.dependencies,\n position: dto.position,\n createdAt: dto.created_at,\n updatedAt: dto.updated_at,\n jobExecutions: dto.job_executions.map(toJobExecution),\n });\n}\n\nexport function toJobExecution(dto: WorkflowRunJobExecutionDetailDto): JobExecution {\n return new JobExecution({\n id: dto.id,\n jobId: dto.job_id,\n sequence: dto.sequence,\n name: dto.name,\n status: dto.status,\n statusReason: dto.status_reason,\n runner: dto.runner ?? null,\n outputs: dto.outputs ?? null,\n triggerEvents: (dto.trigger_events ?? []).map(toWorkflowExecutionEvent),\n queuedAt: dto.queued_at ?? null,\n startedAt: dto.started_at ?? null,\n finishedAt: dto.finished_at ?? null,\n timedOutAt: dto.timed_out_at ?? null,\n evaluationTrace: toEvaluationTrace(dto.evaluation_trace),\n createdAt: dto.created_at,\n updatedAt: dto.updated_at,\n steps: dto.steps.map(toStep),\n });\n}\n\nexport function toStep(dto: WorkflowRunStepDetailDto): Step {\n return {\n id: dto.id,\n jobExecutionId: dto.job_execution_id,\n key: dto.key,\n name: dto.name,\n sourceLocation: dto.source_location\n ? {startLine: dto.source_location.start_line, endLine: dto.source_location.end_line}\n : null,\n status: dto.status,\n statusReason: dto.status_reason,\n type: dto.type,\n config: dto.config,\n evaluationTrace: toEvaluationTrace(dto.evaluation_trace),\n agentConfig: toAgentStepConfig(dto),\n error: dto.error\n ? {\n message: dto.error.message,\n exitCode: dto.error.exit_code ?? null,\n signal: dto.error.signal,\n reason: dto.error.reason,\n agentConfigIssue: dto.error.agent_config_issue,\n category: dto.error.category,\n }\n : null,\n position: dto.position,\n currentAttempt: dto.current_attempt,\n createdAt: dto.created_at,\n updatedAt: dto.updated_at,\n attempts: dto.attempts.map((attempt) => toStepAttempt(attempt, dto.job_execution_id)),\n };\n}\n\nexport function toStepAttempt(dto: StepAttemptDto, jobExecutionId: string): StepAttempt {\n return new StepAttempt({\n id: dto.id,\n stepId: dto.step_id,\n jobExecutionId,\n attempt: dto.attempt,\n executionOrder: dto.execution_order,\n status: dto.status,\n exitCode: dto.exit_code ?? null,\n output: dto.output ?? null,\n outputs: dto.outputs ?? dto.output ?? null,\n response: dto.response ?? null,\n error: dto.error ?? null,\n gateResult: toStepGateResult(dto.gate_result),\n restartFeedback: dto.restart_feedback ?? null,\n startedAt: dto.started_at,\n finishedAt: dto.finished_at ?? null,\n });\n}\n\nexport function toStepAttemptDetail(dto: StepAttemptDetailResponseDto) {\n return {\n stepId: dto.step_id,\n attempt: dto.attempt,\n authoredConfig: dto.authored_config,\n config: dto.config,\n evaluationTrace: toEvaluationTrace(dto.evaluation_trace),\n };\n}\n\nfunction toJobListening(dto: JobListeningDto): JobListening {\n return {\n on: dto.on,\n until: dto.until,\n timeoutMs: dto.timeout_ms,\n maxExecutions: dto.max_executions,\n batch: dto.batch\n ? {\n debounceMs: dto.batch.debounce_ms,\n maxSize: dto.batch.max_size,\n maxWaitMs: dto.batch.max_wait_ms,\n }\n : null,\n onResolve: dto.on_resolve,\n executionTimeoutMs: dto.execution_timeout_ms,\n name: dto.name,\n };\n}\n\nfunction toWorkflowExecutionEvent(dto: WorkflowExecutionEventDto): WorkflowExecutionEvent {\n return {\n source: dto.source,\n event: dto.event,\n deliveryId: dto.delivery_id,\n receivedAt: dto.received_at,\n project: dto.project,\n repository: dto.repository,\n ref: dto.ref,\n commit: dto.commit,\n data: dto.data,\n };\n}\n\nfunction toStepGateResult(dto: StepGateResultDto): StepGateResult {\n if (dto === null || dto.kind === 'none' || dto.kind === 'not_evaluated') return dto;\n if (dto.kind === 'passed' || dto.kind === 'failed') return {...dto, exitCode: dto.exit_code};\n if (dto.kind === 'uncheckable' || dto.kind === 'evaluation_error')\n return {...dto, exitCode: dto.exit_code};\n return dto;\n}\n\nfunction toEvaluationTrace(trace: EvaluationTraceDto | null): EvaluationTraceEntry[] | null {\n return (\n trace?.map((entry) =>\n 'dropped' in entry\n ? entry\n : {\n expression: entry.expression,\n roots: entry.roots,\n fillTarget: entry.fill_target,\n evaluatedAt: entry.evaluated_at,\n field: entry.field,\n ...(entry.value === undefined ? {} : {value: entry.value}),\n ...(entry.truncated === undefined ? {} : {truncated: entry.truncated}),\n ...(entry.expr_truncated === undefined ? {} : {exprTruncated: entry.expr_truncated}),\n ...(entry.reference === undefined ? {} : {reference: entry.reference}),\n ...(entry.degraded === undefined ? {} : {degraded: entry.degraded}),\n ...(entry.env_key === undefined ? {} : {envKey: entry.env_key}),\n },\n ) ?? null\n );\n}\n\nfunction toAgentStepConfig(dto: WorkflowRunStepDetailDto): Step['agentConfig'] {\n if (dto.type !== 'agent') return null;\n return {\n provider: stringConfigValue(dto.config.provider),\n model: stringConfigValue(dto.config.model),\n thinking: stringConfigValue(dto.config.thinking),\n };\n}\n\nfunction stringConfigValue(value: unknown): string | null {\n return typeof value === 'string' && value.trim() ? value.trim() : null;\n}\n"],"names":["Job","JobExecution","StepAttempt","WorkflowRunAttempt","WorkflowRunAttemptSummary","workflowRunTriggerDisplayLabel","workflowRunTriggerLabel","toWorkflowRun","dto","id","projectId","project_id","definitionId","definition_id","number","name","workflowName","workflow_name","currentAttempt","current_attempt","triggerProvider","trigger_provider","triggerSource","trigger_source","triggerEvent","trigger_event","triggerDisplayLabel","triggerLabel","triggerPayload","trigger_payload","triggerReference","trigger_reference","inputs","sourceSnapshot","source_snapshot","content","format","createdAt","created_at","updatedAt","updated_at","isTemporary","startsWith","toWorkflowRunAttempt","workflowRunId","workflow_run_id","attempt","status","startedAt","started_at","finishedAt","finished_at","rerunMode","rerun_mode","toWorkflowRunRecord","latestAttempt","latest_attempt","runAttempt","toWorkflowRunListItem","statusCounts","job_status_counts","map","count","jobs","preview","job","key","position","total","reduce","sum","entry","toWorkflowRunListPage","runs","nextCursor","next_cursor","filteredTotalCount","filtered_total_count","toWorkflowRunDetail","run_attempt","toJob","runAttemptId","run_attempt_id","mode","statusReason","status_reason","carriedOver","carried_over","outputs","success","runner","evaluationTrace","toEvaluationTrace","evaluation_trace","listening","toJobListening","listenerStatus","listener_status","resolutionReason","resolution_reason","dependencies","jobExecutions","job_executions","toJobExecution","jobId","job_id","sequence","triggerEvents","trigger_events","toWorkflowExecutionEvent","queuedAt","queued_at","timedOutAt","timed_out_at","steps","toStep","jobExecutionId","job_execution_id","sourceLocation","source_location","startLine","start_line","endLine","end_line","type","config","agentConfig","toAgentStepConfig","error","message","exitCode","exit_code","signal","reason","agentConfigIssue","agent_config_issue","category","attempts","toStepAttempt","stepId","step_id","executionOrder","execution_order","output","response","gateResult","toStepGateResult","gate_result","restartFeedback","restart_feedback","toStepAttemptDetail","authoredConfig","authored_config","on","until","timeoutMs","timeout_ms","maxExecutions","max_executions","batch","debounceMs","debounce_ms","maxSize","max_size","maxWaitMs","max_wait_ms","onResolve","on_resolve","executionTimeoutMs","execution_timeout_ms","source","event","deliveryId","delivery_id","receivedAt","received_at","project","repository","ref","commit","data","kind","trace","expression","roots","fillTarget","fill_target","evaluatedAt","evaluated_at","field","value","undefined","truncated","expr_truncated","exprTruncated","reference","degraded","env_key","envKey","provider","stringConfigValue","model","thinking","trim"],"mappings":"AAgBA,SAEEA,GAAG,EACHC,YAAY,EAGZC,WAAW,EAIXC,kBAAkB,EAClBC,yBAAyB,EAKzBC,8BAA8B,EAC9BC,uBAAuB,QAClB,wBAAwB;AAE/B,OAAO,SAASC,cAAcC,GAA2B;IACvD,OAAO;QACLC,IAAID,IAAIC,EAAE;QACVC,WAAWF,IAAIG,UAAU;QACzBC,cAAcJ,IAAIK,aAAa;QAC/BC,QAAQN,IAAIM,MAAM;QAClBC,MAAMP,IAAIO,IAAI;QACdC,cAAcR,IAAIS,aAAa;QAC/BC,gBAAgBV,IAAIW,eAAe;QACnCC,iBAAiBZ,IAAIa,gBAAgB;QACrCC,eAAed,IAAIe,cAAc;QACjCC,cAAchB,IAAIiB,aAAa;QAC/BC,qBAAqBrB,+BAA+B;YAClDiB,eAAed,IAAIe,cAAc;YACjCC,cAAchB,IAAIiB,aAAa;QACjC;QACAE,cAAcrB,wBAAwB;YACpCgB,eAAed,IAAIe,cAAc;YACjCC,cAAchB,IAAIiB,aAAa;QACjC;QACAG,gBAAgBpB,IAAIqB,eAAe;QACnCC,kBAAkBtB,IAAIuB,iBAAiB;QACvCC,QAAQxB,IAAIwB,MAAM,IAAI;QACtBC,gBAAgBz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jC,OAAO;QACL2E,UAAUC,kBAAkBhM,IAAIqH,MAAM,CAAC0E,QAAQ;QAC/CE,OAAOD,kBAAkBhM,IAAIqH,MAAM,CAAC4E,KAAK;QACzCC,UAAUF,kBAAkBhM,IAAIqH,MAAM,CAAC6E,QAAQ;IACjD;AACF;AAEA,SAASF,kBAAkBV,KAAc;IACvC,OAAO,OAAOA,UAAU,YAAYA,MAAMa,IAAI,KAAKb,MAAMa,IAAI,KAAK;AACpE"}
|
|
1
|
+
{"version":3,"sources":["../../../src/hooks/api/workflow-run-mapper.ts"],"sourcesContent":["import type {\n EvaluationTraceDto,\n JobListeningDto,\n StepAttemptDetailResponseDto,\n StepAttemptDto,\n StepGateResultDto,\n WorkflowExecutionEventDto,\n WorkflowRunAttemptDto,\n WorkflowRunDetailResponseDto,\n WorkflowRunJobDetailDto,\n WorkflowRunJobExecutionDetailDto,\n WorkflowRunListItemDto,\n WorkflowRunListResponseDto,\n WorkflowRunResponseDto,\n WorkflowRunStepDetailDto,\n} from '@shipfox/api-workflows-dto';\nimport {\n type EvaluationTraceEntry,\n Job,\n JobExecution,\n type JobListening,\n type Step,\n StepAttempt,\n type StepGateResult,\n type WorkflowExecutionEvent,\n type WorkflowRun,\n WorkflowRunAttempt,\n WorkflowRunAttemptSummary,\n type WorkflowRunDetail,\n type WorkflowRunListItem,\n type WorkflowRunListPage,\n type WorkflowRunRecord,\n workflowRunTriggerDisplayLabel,\n workflowRunTriggerLabel,\n} from '#core/workflow-run.js';\n\nexport function toWorkflowRun(dto: WorkflowRunResponseDto): WorkflowRun {\n return {\n id: dto.id,\n projectId: dto.project_id,\n definitionId: dto.definition_id,\n number: dto.number,\n name: dto.name,\n workflowName: dto.workflow_name,\n currentAttempt: dto.current_attempt,\n triggerProvider: dto.trigger_provider,\n triggerSource: dto.trigger_source,\n triggerEvent: dto.trigger_event,\n triggerDisplayLabel: workflowRunTriggerDisplayLabel({\n triggerSource: dto.trigger_source,\n triggerEvent: dto.trigger_event,\n }),\n triggerLabel: workflowRunTriggerLabel({\n triggerSource: dto.trigger_source,\n triggerEvent: dto.trigger_event,\n }),\n triggerPayload: dto.trigger_payload,\n triggerReference: dto.trigger_reference,\n inputs: dto.inputs ?? null,\n sourceSnapshot: dto.source_snapshot\n ? {content: dto.source_snapshot.content, format: dto.source_snapshot.format}\n : null,\n createdAt: dto.created_at,\n updatedAt: dto.updated_at,\n isTemporary: dto.id.startsWith('temp-'),\n };\n}\n\nexport function toWorkflowRunAttempt(dto: WorkflowRunAttemptDto): WorkflowRunAttempt {\n return new WorkflowRunAttempt({\n id: dto.id,\n workflowRunId: dto.workflow_run_id,\n attempt: dto.attempt,\n status: dto.status,\n createdAt: dto.created_at,\n startedAt: dto.started_at ?? null,\n finishedAt: dto.finished_at ?? null,\n rerunMode: dto.rerun_mode,\n });\n}\n\nexport function toWorkflowRunRecord(dto: WorkflowRunResponseDto): WorkflowRunRecord {\n return {\n ...toWorkflowRun(dto),\n status: dto.status,\n latestAttempt: dto.latest_attempt,\n runAttempt: new WorkflowRunAttemptSummary({\n workflowRunId: dto.id,\n attempt: dto.current_attempt,\n status: dto.status,\n createdAt: dto.created_at,\n startedAt: dto.started_at ?? null,\n finishedAt: dto.finished_at ?? null,\n }),\n };\n}\n\nexport function toWorkflowRunListItem(dto: WorkflowRunListItemDto): WorkflowRunListItem {\n const hasDisplayStatusCounts = dto.job_display_status_counts !== undefined;\n const statusCounts = (dto.job_display_status_counts ?? dto.job_status_counts).map(\n ({status, count}) => ({status, count}),\n );\n return {\n ...toWorkflowRunRecord(dto),\n jobs: {\n preview: dto.jobs.map((job) => ({\n id: job.id,\n key: job.key,\n name: job.name,\n status: job.status,\n mode: job.mode ?? 'one_shot',\n listenerStatus: job.listener_status ?? 'inactive',\n // The optional display-count field is the rollout capability signal. Pre-display API\n // responses only carry raw verdict counts, so mirror their non-terminal verdict into\n // execution evidence to keep each legacy glyph aligned with those fallback counts.\n executionStatus: hasDisplayStatusCounts\n ? (job.execution_status ?? null)\n : legacyExecutionStatus(job.status),\n position: job.position,\n })),\n statusCounts,\n // Derived rather than sent: the counts already cover every job, and a separate total\n // would be a second source of truth that could disagree with them.\n total: statusCounts.reduce((sum, entry) => sum + entry.count, 0),\n },\n };\n}\n\nfunction legacyExecutionStatus(\n status: WorkflowRunListItemDto['jobs'][number]['status'],\n): 'pending' | 'running' | null {\n return status === 'pending' || status === 'running' ? status : null;\n}\n\nexport function toWorkflowRunListPage(dto: WorkflowRunListResponseDto): WorkflowRunListPage {\n return {\n runs: dto.runs.map(toWorkflowRunListItem),\n nextCursor: dto.next_cursor,\n filteredTotalCount: dto.filtered_total_count,\n };\n}\n\nexport function toWorkflowRunDetail(dto: WorkflowRunDetailResponseDto): WorkflowRunDetail {\n return {\n ...toWorkflowRun(dto),\n latestAttempt: dto.latest_attempt,\n runAttempt: toWorkflowRunAttempt(dto.run_attempt),\n jobs: dto.jobs.map(toJob),\n };\n}\n\nexport function toJob(dto: WorkflowRunJobDetailDto): Job {\n return new Job({\n id: dto.id,\n runAttemptId: dto.run_attempt_id,\n key: dto.key,\n name: dto.name,\n mode: dto.mode,\n status: dto.status,\n statusReason: dto.status_reason,\n carriedOver: dto.carried_over,\n outputs: dto.outputs ?? null,\n success: dto.success ?? null,\n runner: dto.runner ?? null,\n evaluationTrace: toEvaluationTrace(dto.evaluation_trace),\n listening: dto.listening ? toJobListening(dto.listening) : null,\n listenerStatus: dto.listener_status,\n resolutionReason: dto.resolution_reason,\n dependencies: dto.dependencies,\n position: dto.position,\n createdAt: dto.created_at,\n updatedAt: dto.updated_at,\n jobExecutions: dto.job_executions.map(toJobExecution),\n });\n}\n\nexport function toJobExecution(dto: WorkflowRunJobExecutionDetailDto): JobExecution {\n return new JobExecution({\n id: dto.id,\n jobId: dto.job_id,\n sequence: dto.sequence,\n name: dto.name,\n status: dto.status,\n statusReason: dto.status_reason,\n statusReasonMessage: dto.status_reason_message ?? null,\n runner: dto.runner ?? null,\n outputs: dto.outputs ?? null,\n triggerEvents: (dto.trigger_events ?? []).map(toWorkflowExecutionEvent),\n queuedAt: dto.queued_at ?? null,\n startedAt: dto.started_at ?? null,\n finishedAt: dto.finished_at ?? null,\n timedOutAt: dto.timed_out_at ?? null,\n evaluationTrace: toEvaluationTrace(dto.evaluation_trace),\n createdAt: dto.created_at,\n updatedAt: dto.updated_at,\n steps: dto.steps.map(toStep),\n });\n}\n\nexport function toStep(dto: WorkflowRunStepDetailDto): Step {\n return {\n id: dto.id,\n jobExecutionId: dto.job_execution_id,\n key: dto.key,\n name: dto.name,\n sourceLocation: dto.source_location\n ? {startLine: dto.source_location.start_line, endLine: dto.source_location.end_line}\n : null,\n status: dto.status,\n statusReason: dto.status_reason,\n type: dto.type,\n config: dto.config,\n evaluationTrace: toEvaluationTrace(dto.evaluation_trace),\n agentConfig: toAgentStepConfig(dto),\n error: dto.error\n ? {\n message: dto.error.message,\n exitCode: dto.error.exit_code ?? null,\n signal: dto.error.signal,\n reason: dto.error.reason,\n agentConfigIssue: dto.error.agent_config_issue,\n category: dto.error.category,\n }\n : null,\n position: dto.position,\n currentAttempt: dto.current_attempt,\n createdAt: dto.created_at,\n updatedAt: dto.updated_at,\n attempts: dto.attempts.map((attempt) => toStepAttempt(attempt, dto.job_execution_id)),\n };\n}\n\nexport function toStepAttempt(dto: StepAttemptDto, jobExecutionId: string): StepAttempt {\n return new StepAttempt({\n id: dto.id,\n stepId: dto.step_id,\n jobExecutionId,\n attempt: dto.attempt,\n executionOrder: dto.execution_order,\n status: dto.status,\n exitCode: dto.exit_code ?? null,\n output: dto.output ?? null,\n outputs: dto.outputs ?? dto.output ?? null,\n response: dto.response ?? null,\n error: dto.error ?? null,\n gateResult: toStepGateResult(dto.gate_result),\n restartFeedback: dto.restart_feedback ?? null,\n startedAt: dto.started_at,\n finishedAt: dto.finished_at ?? null,\n });\n}\n\nexport function toStepAttemptDetail(dto: StepAttemptDetailResponseDto) {\n return {\n stepId: dto.step_id,\n attempt: dto.attempt,\n authoredConfig: dto.authored_config,\n config: dto.config,\n evaluationTrace: toEvaluationTrace(dto.evaluation_trace),\n };\n}\n\nfunction toJobListening(dto: JobListeningDto): JobListening {\n return {\n on: dto.on,\n until: dto.until,\n timeoutMs: dto.timeout_ms,\n maxExecutions: dto.max_executions,\n batch: dto.batch\n ? {\n debounceMs: dto.batch.debounce_ms,\n maxSize: dto.batch.max_size,\n maxWaitMs: dto.batch.max_wait_ms,\n }\n : null,\n onResolve: dto.on_resolve,\n executionTimeoutMs: dto.execution_timeout_ms,\n name: dto.name,\n };\n}\n\nfunction toWorkflowExecutionEvent(dto: WorkflowExecutionEventDto): WorkflowExecutionEvent {\n return {\n source: dto.source,\n event: dto.event,\n deliveryId: dto.delivery_id,\n receivedAt: dto.received_at,\n project: dto.project,\n repository: dto.repository,\n ref: dto.ref,\n commit: dto.commit,\n data: dto.data,\n };\n}\n\nfunction toStepGateResult(dto: StepGateResultDto): StepGateResult {\n if (dto === null || dto.kind === 'none' || dto.kind === 'not_evaluated') return dto;\n if (dto.kind === 'passed' || dto.kind === 'failed') return {...dto, exitCode: dto.exit_code};\n if (dto.kind === 'uncheckable' || dto.kind === 'evaluation_error')\n return {...dto, exitCode: dto.exit_code};\n return dto;\n}\n\nfunction toEvaluationTrace(trace: EvaluationTraceDto | null): EvaluationTraceEntry[] | null {\n return (\n trace?.map((entry) =>\n 'dropped' in entry\n ? entry\n : {\n expression: entry.expression,\n roots: entry.roots,\n fillTarget: entry.fill_target,\n evaluatedAt: entry.evaluated_at,\n field: entry.field,\n ...(entry.value === undefined ? {} : {value: entry.value}),\n ...(entry.truncated === undefined ? {} : {truncated: entry.truncated}),\n ...(entry.expr_truncated === undefined ? {} : {exprTruncated: entry.expr_truncated}),\n ...(entry.reference === undefined ? {} : {reference: entry.reference}),\n ...(entry.degraded === undefined ? {} : {degraded: entry.degraded}),\n ...(entry.env_key === undefined ? {} : {envKey: entry.env_key}),\n },\n ) ?? null\n );\n}\n\nfunction toAgentStepConfig(dto: WorkflowRunStepDetailDto): Step['agentConfig'] {\n if (dto.type !== 'agent') return null;\n return {\n provider: stringConfigValue(dto.config.provider),\n model: stringConfigValue(dto.config.model),\n thinking: stringConfigValue(dto.config.thinking),\n };\n}\n\nfunction stringConfigValue(value: unknown): string | null {\n return typeof value === 'string' && value.trim() ? value.trim() : null;\n}\n"],"names":["Job","JobExecution","StepAttempt","WorkflowRunAttempt","WorkflowRunAttemptSummary","workflowRunTriggerDisplayLabel","workflowRunTriggerLabel","toWorkflowRun","dto","id","projectId","project_id","definitionId","definition_id","number","name","workflowName","workflow_name","currentAttempt","current_attempt","triggerProvider","trigger_provider","triggerSource","trigger_source","triggerEvent","trigger_event","triggerDisplayLabel","triggerLabel","triggerPayload","trigger_payload","triggerReference","trigger_reference","inputs","sourceSnapshot","source_snapshot","content","format","createdAt","created_at","updatedAt","updated_at","isTemporary","startsWith","toWorkflowRunAttempt","workflowRunId","workflow_run_id","attempt","status","startedAt","started_at","finishedAt","finished_at","rerunMode","rerun_mode","toWorkflowRunRecord","latestAttempt","latest_attempt","runAttempt","toWorkflowRunListItem","hasDisplayStatusCounts","job_display_status_counts","undefined","statusCounts","job_status_counts","map","count","jobs","preview","job","key","mode","listenerStatus","listener_status","executionStatus","execution_status","legacyExecutionStatus","position","total","reduce","sum","entry","toWorkflowRunListPage","runs","nextCursor","next_cursor","filteredTotalCount","filtered_total_count","toWorkflowRunDetail","run_attempt","toJob","runAttemptId","run_attempt_id","statusReason","status_reason","carriedOver","carried_over","outputs","success","runner","evaluationTrace","toEvaluationTrace","evaluation_trace","listening","toJobListening","resolutionReason","resolution_reason","dependencies","jobExecutions","job_executions","toJobExecution","jobId","job_id","sequence","statusReasonMessage","status_reason_message","triggerEvents","trigger_events","toWorkflowExecutionEvent","queuedAt","queued_at","timedOutAt","timed_out_at","steps","toStep","jobExecutionId","job_execution_id","sourceLocation","source_location","startLine","start_line","endLine","end_line","type","config","agentConfig","toAgentStepConfig","error","message","exitCode","exit_code","signal","reason","agentConfigIssue","agent_config_issue","category","attempts","toStepAttempt","stepId","step_id","executionOrder","execution_order","output","response","gateResult","toStepGateResult","gate_result","restartFeedback","restart_feedback","toStepAttemptDetail","authoredConfig","authored_config","on","until","timeoutMs","timeout_ms","maxExecutions","max_executions","batch","debounceMs","debounce_ms","maxSize","max_size","maxWaitMs","max_wait_ms","onResolve","on_resolve","executionTimeoutMs","execution_timeout_ms","source","event","deliveryId","delivery_id","receivedAt","received_at","project","repository","ref","commit","data","kind","trace","expression","roots","fillTarget","fill_target","evaluatedAt","evaluated_at","field","value","truncated","expr_truncated","exprTruncated","reference","degraded","env_key","envKey","provider","stringConfigValue","model","thinking","trim"],"mappings":"AAgBA,SAEEA,GAAG,EACHC,YAAY,EAGZC,WAAW,EAIXC,kBAAkB,EAClBC,yBAAyB,EAKzBC,8BAA8B,EAC9BC,uBAAuB,QAClB,wBAAwB;AAE/B,OAAO,SAASC,cAAcC,GAA2B;IACvD,OAAO;QACLC,IAAID,IAAIC,EAAE;QACVC,WAAWF,IAAIG,UAAU;QACzBC,cAAcJ,IAAIK,aAAa;QAC/BC,QAAQN,IAAIM,MAAM;QAClBC,MAAMP,IAAIO,IAAI;QACdC,cAAcR,IAAIS,aAAa;QAC/BC,gBAAgBV,IAAIW,eAAe;QACnCC,iBAAiBZ,IAAIa,gBAAgB;QACrCC,eAAed,IAAIe,cAAc;QACjCC,cAAchB,IAAIiB,aAAa;QAC/BC,qBAAqBrB,+BAA+B;YAClDiB,eAAed,IAAIe,cAAc;YACjCC,cAAchB,IAAIiB,aAAa;QACjC;QACAE,cAAcrB,wBAAwB;YACpCgB,eAAed,IAAIe,cAAc;YACjCC,cAAchB,IAAIiB,aAAa;QACjC;QACAG,gBAAgBpB,IAAIqB,eAAe;QACnCC,kBAAkBtB,IAAIuB,iBAAiB;QACvCC,QAAQxB,IAAIwB,MAAM,IAAI;QACtBC,gBAAgBzB,IAAI0B,eAAe,GAC/B;YAACC,SAAS3B,IAAI0B,eAAe,CAACC,OAAO;YAAEC,QAAQ5B,IAAI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