@@ -73,6 +73,8 @@ export interface WorkflowRunSummary {
7373 triggerSource ?: string | null ;
7474 triggerLabel ?: string | null ;
7575 inputPreview : ExecutionInputPreview ;
76+ parentRunId ?: string | null ;
77+ parentNodeRef ?: string | null ;
7678}
7779
7880const SHIPSEC_WORKFLOW_TYPE = 'shipsecWorkflowRun' ;
@@ -494,6 +496,8 @@ export class WorkflowsService {
494496 triggerSource,
495497 triggerLabel,
496498 inputPreview,
499+ parentRunId : run . parentRunId ?? null ,
500+ parentNodeRef : run . parentNodeRef ?? null ,
497501 } ;
498502 }
499503
@@ -519,6 +523,44 @@ export class WorkflowsService {
519523 return { runs : summaries } ;
520524 }
521525
526+ async listChildRuns (
527+ parentRunId : string ,
528+ auth ?: AuthContext | null ,
529+ options : { limit ?: number } = { } ,
530+ ) : Promise < {
531+ runs : Array < {
532+ runId : string ;
533+ workflowId : string ;
534+ workflowName : string ;
535+ parentNodeRef : string | null ;
536+ status : ExecutionStatus ;
537+ startedAt : string ;
538+ completedAt ?: string ;
539+ } > ;
540+ } > {
541+ const { organizationId } = await this . requireRunAccess ( parentRunId , auth ) ;
542+ const children = await this . runRepository . listChildren ( parentRunId , {
543+ organizationId,
544+ limit : options . limit ,
545+ } ) ;
546+
547+ const summaries = await Promise . all (
548+ children . map ( ( run ) => this . buildRunSummary ( run , organizationId ) ) ,
549+ ) ;
550+
551+ const runs = summaries . map ( ( summary , index ) => ( {
552+ runId : summary . id ,
553+ workflowId : summary . workflowId ,
554+ workflowName : summary . workflowName ,
555+ parentNodeRef : children [ index ] ?. parentNodeRef ?? null ,
556+ status : summary . status ,
557+ startedAt : new Date ( summary . startTime ) . toISOString ( ) ,
558+ completedAt : summary . endTime ? new Date ( summary . endTime ) . toISOString ( ) : undefined ,
559+ } ) ) ;
560+
561+ return { runs } ;
562+ }
563+
522564 async getRun ( runId : string , auth ?: AuthContext | null ) : Promise < WorkflowRunSummary > {
523565 const organizationId = this . requireOrganizationId ( auth ) ;
524566 const run = await this . runRepository . findByRunId ( runId , { organizationId } ) ;
@@ -713,6 +755,8 @@ export class WorkflowsService {
713755 nodeOverrides ?: Record < string , Record < string , unknown > > ;
714756 runId ?: string ;
715757 idempotencyKey ?: string ;
758+ parentRunId ?: string ;
759+ parentNodeRef ?: string ;
716760 } = { } ,
717761 ) : Promise < PreparedRunPayload > {
718762 const organizationId = this . requireOrganizationId ( auth ) ;
@@ -763,6 +807,8 @@ export class WorkflowsService {
763807 triggerSource : triggerMetadata . sourceId ,
764808 triggerLabel : triggerMetadata . label ,
765809 inputPreview,
810+ parentRunId : options . parentRunId ,
811+ parentNodeRef : options . parentNodeRef ,
766812 } ) ;
767813
768814 this . analyticsService . trackWorkflowStarted ( {
0 commit comments