mirror of
https://gitee.com/zhangsken/opencode.git
synced 2026-10-16 10:30:01 +08:00
705c3ab746
Adds schedule_create, schedule_list and schedule_cancel tools in the opencode namespace so the agent can schedule prompts back into its own session. schedule_create accepts `every` (30s/15m/2h/1d), `at` (ISO 8601 with offset) for a single run, or both (`at` sets the first run). SessionSchedule now stores multiple schedules per session, keyed by a new `sch_` ID, and persists the absolute next fire time instead of only the interval. This replaces the one-schedule-per-session model and fixes restarts resetting the countdown: one-shots fire at their original time after a restart, and overdue recurring schedules fire once then resume their cadence rather than bursting. `/schedule off` now cancels every schedule in the session. Past `at` times, missing timing and invalid intervals return tool errors. Verified with an isolated managed-mode server and a scripted OpenAI-compatible mock model driving `execute`: create every 5s fired every 5s; `at` fired at 15:55:42.013 for a 15:55:42 target; a one-shot created before a restart fired on time after it (15:56:23.013); list returned both schedules with server time; cancel stopped firing; invalid inputs returned the three expected errors. core and server typecheck.
@opencode/core
Core runtime services for OpenCode.