UNPKG

eve

Version:

Filesystem-first framework for durable backend AI agents that run anywhere.

1 lines 1.03 kB
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,r={}){let i=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,externalDependencies:r.externalDependencies,kind:`schedule`,source:n}),`Expected the schedule export "${n.exportName??`default`}" from "${n.logicalPath}" to match the public eve shape.`),a={cron:i.cron,hasRun:i.run!==void 0,logicalPath:n.logicalPath,name:deriveScheduleName(n.logicalPath),sourceId:n.sourceId,sourceKind:n.sourceKind};return i.markdown===void 0?a:{...a,markdown:i.markdown.trim()}}function deriveScheduleName(t){return stripLogicalPathExtension(t).replace(/^schedules\//,``)}export{compileScheduleDefinition};