({ cron, prompt, recurring = true, durable = false })
| 115 | return { result: true } |
| 116 | }, |
| 117 | async call({ cron, prompt, recurring = true, durable = false }) { |
| 118 | // Kill switch forces session-only; schema stays stable so the model sees |
| 119 | // no validation errors when the gate flips mid-session. |
| 120 | const effectiveDurable = durable && isDurableCronEnabled() |
| 121 | const id = await addCronTask( |
| 122 | cron, |
| 123 | prompt, |
| 124 | recurring, |
| 125 | effectiveDurable, |
| 126 | getTeammateContext()?.agentId, |
| 127 | ) |
| 128 | // Enable the scheduler so the task fires in this session. The |
| 129 | // useScheduledTasks hook polls this flag and will start watching |
| 130 | // on the next tick. For durable: false tasks the file never changes |
| 131 | // — check() reads the session store directly — but the enable flag |
| 132 | // is still what starts the tick loop. |
| 133 | setScheduledTasksEnabled(true) |
| 134 | return { |
| 135 | data: { |
| 136 | id, |
| 137 | humanSchedule: cronToHuman(cron), |
| 138 | recurring, |
| 139 | durable: effectiveDurable, |
| 140 | }, |
| 141 | } |
| 142 | }, |
| 143 | mapToolResultToToolResultBlockParam(output, toolUseID) { |
| 144 | const where = output.durable |
| 145 | ? 'Persisted to .claude/scheduled_tasks.json' |
nothing calls this directly
no test coverage detected