MCPcopy Create free account
hub / github.com/AI45Lab/Code / load_schedules

Function load_schedules

core/src/config/agent_dir.rs:206–229  ·  view source on GitHub ↗
(dir: &Path)

Source from the content-addressed store, hash-verified

204}
205
206fn load_schedules(dir: &Path) -> Result<Vec<ScheduleSpec>> {
207 let mut out = Vec::new();
208 for path in md_files(dir, &["md"])? {
209 let content = std::fs::read_to_string(&path)
210 .map_err(|e| CodeError::Context(format!("read {}: {e}", path.display())))?;
211 let (front, body) = split_frontmatter(&content);
212 let front = front.ok_or_else(|| {
213 CodeError::Context(format!(
214 "schedule {} has no YAML frontmatter (need `cron:`)",
215 path.display()
216 ))
217 })?;
218 let meta: ScheduleFront = serde_yaml::from_str(&front).map_err(|e| {
219 CodeError::Context(format!("schedule {} frontmatter: {e}", path.display()))
220 })?;
221 out.push(ScheduleSpec {
222 name: meta.name.unwrap_or_else(|| file_stem(&path)),
223 cron: meta.cron,
224 prompt: body.trim().to_string(),
225 enabled: meta.enabled.unwrap_or(true),
226 });
227 }
228 Ok(out)
229}
230
231/// Upper bounds for a `kind = "script"` tool's sandbox limits. A `tools/` file is
232/// semi-trusted (the whole point of the guardrail), so an author cannot set an

Callers 1

loadMethod · 0.85

Calls 3

md_filesFunction · 0.85
split_frontmatterFunction · 0.85
file_stemFunction · 0.85

Tested by

no test coverage detected