@@ -12,6 +12,7 @@ import type {
1212 Prisma ,
1313 TaskEvent ,
1414 TaskEventKind ,
15+ TaskEventLevel ,
1516 TaskEventStatus ,
1617 TaskRun ,
1718} from "@trigger.dev/database" ;
@@ -181,6 +182,70 @@ export type RunPreparedEvent = PreparedEvent & {
181182 taskSlug ?: string ;
182183} ;
183184
185+ export type SpanDetail = {
186+ // ============================================================================
187+ // Core Identity & Structure
188+ // ============================================================================
189+ spanId : string ; // Tree structure, span identification
190+ parentId : string | null ; // Tree hierarchy
191+ message : string ; // Displayed as span title
192+
193+ // ============================================================================
194+ // Status & State
195+ // ============================================================================
196+ isError : boolean ; // Error status display, filtering, status icons
197+ isPartial : boolean ; // In-progress status display, timeline calculations
198+ isCancelled : boolean ; // Cancelled status display, status determination
199+ level : TaskEventLevel ; // Text styling, timeline rendering decisions
200+ kind : TaskEventKind ; // Filter "UNSPECIFIED" events, determine debug status
201+
202+ // ============================================================================
203+ // Timing
204+ // ============================================================================
205+ startTime : Date ; // Timeline calculations, display
206+ duration : number ; // Timeline width, duration display, calculations
207+
208+ // ============================================================================
209+ // Content & Display
210+ // ============================================================================
211+ events : SpanEvents ; // Timeline events, SpanEvents component
212+ style : TaskEventStyle ; // Icons, variants, accessories (RunIcon, SpanTitle)
213+ properties : Record < string , unknown > | string | number | boolean | null | undefined ; // Displayed as JSON in span properties (CodeBlock)
214+
215+ // ============================================================================
216+ // Context (Used in Span Details)
217+ // ============================================================================
218+ idempotencyKey : string | null ; // Displayed in span detail properties (conditional)
219+ taskSlug : string ; // Displayed in span details, task filtering
220+ workerVersion : string | null ; // Displayed in span version field
221+
222+ // ============================================================================
223+ // Entity & Relationships
224+ // ============================================================================
225+ entity : {
226+ // Used for entity type switching in SpanEntity
227+ type : string | undefined ;
228+ id : string | undefined ;
229+ } ;
230+ triggeredRuns : Array < {
231+ // Used in triggered runs table
232+ friendlyId : string ;
233+ taskIdentifier : string ;
234+ spanId : string ;
235+ createdAt : Date ;
236+ number : number ;
237+ lockedToVersion ?: { version : string } ;
238+ } > ;
239+ showActionBar : boolean ; // Computed from show.actions, used for action display
240+
241+ // ============================================================================
242+ // Additional Properties (Used by SpanPresenter)
243+ // ============================================================================
244+ originalRun : string | undefined ; // Used by SpanPresenter for run lookup
245+ show : { actions ?: boolean } | undefined ; // Used by SpanPresenter to compute showActionBar
246+ metadata : any ; // Used by SpanPresenter for entity processing
247+ } ;
248+
184249// ============================================================================
185250// Span and Link Types
186251// ============================================================================
@@ -344,7 +409,7 @@ export interface IEventRepository {
344409 startCreatedAt : Date ,
345410 endCreatedAt ?: Date ,
346411 options ?: { includeDebugLogs ?: boolean }
347- ) : Promise < any > ;
412+ ) : Promise < SpanDetail | undefined > ;
348413
349414 // Event recording methods
350415 recordEvent (
0 commit comments