@@ -23,6 +23,7 @@ class StepFields extends Utils {
23
23
name ! : string ;
24
24
type ! : StepType ;
25
25
threadId ?: string ;
26
+ rootRunId ?: Maybe < string > ;
26
27
createdAt ?: Maybe < string > ;
27
28
startTime ?: Maybe < string > ;
28
29
id ?: Maybe < string > ;
@@ -73,9 +74,10 @@ export class Step extends StepFields {
73
74
return ;
74
75
}
75
76
76
- // Automatically assign parent thread & step if there are any in the store.
77
+ // Automatically assign parent thread & step & rootRun if there are any in the store.
77
78
this . threadId = this . threadId ?? this . client . _currentThread ( ) ?. id ;
78
79
this . parentId = this . parentId ?? this . client . _currentStep ( ) ?. id ;
80
+ this . rootRunId = this . rootRunId ?? this . client . _rootRun ( ) ?. id ;
79
81
80
82
// Set the creation and start time to the current time if not provided.
81
83
if ( ! this . createdAt ) {
@@ -167,7 +169,12 @@ export class Step extends StepFields {
167
169
currentThread : currentStore ?. currentThread ?? null ,
168
170
currentExperimentItemRunId :
169
171
currentStore ?. currentExperimentItemRunId ?? null ,
170
- currentStep : this
172
+ currentStep : this ,
173
+ rootRun : currentStore ?. rootRun
174
+ ? currentStore ?. rootRun
175
+ : this . type === 'run'
176
+ ? this
177
+ : null
171
178
} ,
172
179
( ) => cb ( this )
173
180
) ;
@@ -197,6 +204,7 @@ export class Step extends StepFields {
197
204
this . scores = updatedStep . scores ?? this . scores ;
198
205
this . attachments = updatedStep . attachments ?? this . attachments ;
199
206
this . environment = updatedStep . environment ?? this . environment ;
207
+ this . rootRunId = updatedStep . rootRunId ?? this . rootRunId ;
200
208
}
201
209
202
210
this . send ( ) . catch ( console . error ) ;
0 commit comments