MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / cronRoute

Function cronRoute

apps/vis/server/src/routes/cron.ts:8–32  ·  view source on GitHub ↗
(home: string = KIMI_CODE_HOME)

Source from the content-addressed store, hash-verified

6import { listCronTasks } from '../lib/cron-store';
7
8export function cronRoute(home: string = KIMI_CODE_HOME): Hono {
9 const r = new Hono();
10 r.get('/:id/cron', async (c) => {
11 const id = c.req.param('id');
12 const detail = await readSessionDetail(home, id);
13 if (!detail) {
14 return c.json({ error: 'session not found', code: 'NOT_FOUND' }, 404);
15 }
16 // Cron jobs are persisted under each (non-sub) agent's homedir at
17 // `<homedir>/cron`, not the session root. Aggregate across agents; sub
18 // agents have no cron directory and simply contribute nothing.
19 const cron: CronTask[] = [];
20 const seen = new Set<string>();
21 for (const agent of detail.agents) {
22 for (const job of await listCronTasks(agent.homedir)) {
23 if (seen.has(job.id)) continue;
24 seen.add(job.id);
25 cron.push(job);
26 }
27 }
28 cron.sort((a, b) => a.createdAt - b.createdAt);
29 return c.json({ sessionId: id, cron });
30 });
31 return r;
32}

Callers 2

cron.test.tsFile · 0.90
createAppFunction · 0.90

Calls 7

readSessionDetailFunction · 0.90
listCronTasksFunction · 0.90
jsonMethod · 0.80
getMethod · 0.65
hasMethod · 0.65
addMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected