@@ -58,11 +58,11 @@ export class Workflow {
5858 private originalMethods : Map < string , Function > = new Map ( ) ;
5959 public readonly step : < T = any > ( config : StepConfig < T > ) => Promise < T > ;
6060
61- constructor ( config : WorkflowConfig ) {
61+ constructor ( config ? : WorkflowConfig ) {
6262 this . context = { outputs : { } } ;
63- this . debug = config . debug ?? false ;
64- this . name = config . name ?? 'workflow' ;
65- this . langbase = config . langbase ;
63+ this . debug = config ? .debug ?? false ;
64+ this . name = config ? .name ?? 'workflow' ;
65+ this . langbase = config ? .langbase ;
6666
6767 // Only initialize tracing if langbase is provided
6868 if ( this . langbase ) {
@@ -131,10 +131,11 @@ export class Workflow {
131131
132132 // Notify collector if traceId was found
133133 if ( traceId && _global . _activeTraceCollector ) {
134- if ( debug )
134+ if ( debug ) {
135135 console . log (
136136 `🔍 Trace ID extracted: ${ traceId } ` ,
137137 ) ;
138+ }
138139 _global . _activeTraceCollector ( traceId ) ;
139140 }
140141 }
@@ -391,7 +392,9 @@ export class Workflow {
391392 if ( ! this . langbase || ! this . traceManager || ! this . traceId ) return ;
392393 // Finalise and grab the trace
393394 this . traceManager . endTrace ( this . traceId ) ;
394- this . traceManager . printTrace ( this . traceId ) ;
395+ if ( this . debug ) {
396+ this . traceManager . printTrace ( this . traceId ) ;
397+ }
395398 const traceData = this . traceManager . getTrace ( this . traceId ) ;
396399
397400 // --- send to LB API v1/traces/create using SDK method ---
0 commit comments