MCPcopy Index your code
hub / github.com/coder/mux / createStep

Function createStep

src/node/services/devToolsMiddleware.ts:301–332  ·  view source on GitHub ↗
(
    stepType: DevToolsStep["type"],
    params: LanguageModelV3CallOptions,
    model: LanguageModelV3
  )

Source from the content-addressed store, hash-verified

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");

Callers 1

createDevToolsMiddlewareFunction · 0.85

Calls 5

extractRunMetadataIdFunction · 0.85
ensureRunFunction · 0.85
extractInputFunction · 0.85
createEmptyStepFunction · 0.85
createStepMethod · 0.80

Tested by

no test coverage detected