(
stepType: DevToolsStep["type"],
params: LanguageModelV3CallOptions,
model: LanguageModelV3
)
| 299 | } |
| 300 | |
| 301 | async function createStep( |
| 302 | stepType: DevToolsStep["type"], |
| 303 | params: LanguageModelV3CallOptions, |
| 304 | model: LanguageModelV3 |
| 305 | ): Promise<{ stepId: string; startedAtMs: number } | null> { |
| 306 | try { |
| 307 | const runMetadataId = extractRunMetadataId(params); |
| 308 | await ensureRun(runMetadataId); |
| 309 | |
| 310 | const stepId = randomUUID(); |
| 311 | const stepNumber = (stepCounter += 1); |
| 312 | const input = extractInput(params); |
| 313 | |
| 314 | await service.createStep( |
| 315 | workspaceId, |
| 316 | createEmptyStep(stepId, runId, stepNumber, stepType, model, input) |
| 317 | ); |
| 318 | |
| 319 | return { |
| 320 | stepId, |
| 321 | startedAtMs: Date.now(), |
| 322 | }; |
| 323 | } catch (error) { |
| 324 | log.warn("DevTools: failed to create step", { |
| 325 | workspaceId, |
| 326 | runId, |
| 327 | stepType, |
| 328 | error, |
| 329 | }); |
| 330 | return null; |
| 331 | } |
| 332 | } |
| 333 | |
| 334 | function injectStepIdHeader(params: LanguageModelV3CallOptions, stepId: string): void { |
| 335 | assert(stepId.trim().length > 0, "injectStepIdHeader requires a non-empty stepId"); |
no test coverage detected