MCPcopy Create free account
hub / github.com/claude-code-best/claude-code / buildAutonomyRunRecord

Function buildAutonomyRunRecord

src/utils/autonomyRuns.ts:364–395  ·  view source on GitHub ↗
(
  params: CreateAutonomyRunParams,
  rootDir: string,
  currentDir: string,
)

Source from the content-addressed store, hash-verified

362}
363
364function buildAutonomyRunRecord(
365 params: CreateAutonomyRunParams,
366 rootDir: string,
367 currentDir: string,
368): AutonomyRunRecord {
369 const createdAt = params.nowMs ?? Date.now()
370 return {
371 runId: randomUUID(),
372 runtime: params.runtime ?? (params.flow ? 'flow_step' : 'automatic'),
373 trigger: params.trigger,
374 status: 'queued',
375 rootDir,
376 currentDir,
377 ownerKey:
378 params.flow?.ownerKey ?? params.ownerKey ?? DEFAULT_AUTONOMY_OWNER_KEY,
379 ...(params.sourceId ? { sourceId: params.sourceId } : {}),
380 ...(params.sourceLabel ? { sourceLabel: params.sourceLabel } : {}),
381 ...(params.flow
382 ? {
383 parentFlowId: params.flow.flowId,
384 parentFlowKey: params.flow.flowKey,
385 parentFlowSyncMode: params.flow.syncMode,
386 flowStepId: params.flow.stepId,
387 flowStepName: params.flow.stepName,
388 }
389 : {}),
390 promptPreview: truncatePromptPreview(params.prompt),
391 createdAt,
392 ownerProcessId: process.pid,
393 ownerSessionId: getSessionId(),
394 }
395}
396
397async function persistAutonomyRunRecord(
398 record: AutonomyRunRecord,

Callers 1

createAutonomyRunCoreFunction · 0.85

Calls 3

truncatePromptPreviewFunction · 0.85
getSessionIdFunction · 0.85
nowMethod · 0.80

Tested by

no test coverage detected