| 116 | |
| 117 | |
| 118 | const emitProgress = (progress: ProgressEventInput | string) => { |
| 119 | const normalized: ProgressEventInput = |
| 120 | typeof progress === 'string' ? { message: progress, level: 'info' } : progress; |
| 121 | const level = normalized.level ?? 'info'; |
| 122 | const message = normalized.message; |
| 123 | |
| 124 | console.log(`[${componentRef}] progress [${level}]: ${message}`); |
| 125 | if (scopedTrace) { |
| 126 | scopedTrace.record({ |
| 127 | type: 'NODE_PROGRESS', |
| 128 | runId, |
| 129 | nodeRef: componentRef, |
| 130 | timestamp: new Date().toISOString(), |
| 131 | level, |
| 132 | message, |
| 133 | data: normalized.data, |
| 134 | }); |
| 135 | } |
| 136 | }; |
| 137 | |
| 138 | const context: ExecutionContext = { |
| 139 | runId, |