import{stripLogicalPathExtension}from"#discover/filesystem.js";import{normalizeScheduleDefinition}from"#internal/authored-definition/core.js";import{loadModuleBackedDefinition}from"#compiler/normalize-helpers.js";async function compileScheduleDefinition(e,n){let r=n.sourceKind===`markdown`?normalizeScheduleDefinition(n.definition,`Expected the compiled schedule definition at "${n.logicalPath}" to match the public Eve shape.`):normalizeScheduleDefinition(await loadModuleBackedDefinition({agentRoot:e,kind:`schedule`,source:n}),`Expected the schedule export "${n.exportName??`default`}" from "${n.logicalPath}" to match the public Eve shape.`),i={cron:r.cron,hasRun:r.run!==void 0,logicalPath:n.logicalPath,name:deriveScheduleName(n.logicalPath),sourceId:n.sourceId,sourceKind:n.sourceKind};return r.markdown===void 0?i:{...i,markdown:r.markdown.trim()}}function deriveScheduleName(t){return stripLogicalPathExtension(t).replace(/^schedules\//,``)}export{compileScheduleDefinition};