Add scheduled tasks with a Project tab section and lead tools

This commit is contained in:
Ian Gulliver
2026-10-21 15:15:20 -07:00
parent 4b4763779d
commit f445e1cac3
21 changed files with 1689 additions and 347 deletions
+100
View File
@@ -366,6 +366,66 @@ paths:
"400": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/projects/{projectId}/schedules:
parameters:
- { name: projectId, in: path, required: true, schema: { type: string } }
get:
operationId: listSchedules
description: >
The project's schedules, soonest next run first. schedule.saved and schedule.deleted events tell clients of changes.
responses:
"200":
description: The schedules.
content:
application/json:
schema:
type: array
items: { $ref: "#/components/schemas/Schedule" }
"404": { $ref: "#/components/responses/Error" }
post:
operationId: createSchedule
description: Creates a schedule run as the calling user, who needs a git identity. Records schedule.saved.
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/ScheduleSave" }
responses:
"201":
description: The new schedule.
content:
application/json:
schema: { $ref: "#/components/schemas/Schedule" }
"400": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/schedules/{scheduleId}:
parameters:
- { name: scheduleId, in: path, required: true, schema: { type: string } }
put:
operationId: updateSchedule
description: Replaces a schedule's settings and recomputes its next run. Records schedule.saved.
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/ScheduleSave" }
responses:
"200":
description: The schedule.
content:
application/json:
schema: { $ref: "#/components/schemas/Schedule" }
"400": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
delete:
operationId: deleteSchedule
description: Deletes a schedule; tasks it created stay. Records schedule.deleted.
responses:
"204":
description: Deleted.
"404": { $ref: "#/components/responses/Error" }
/api/projects/{projectId}/todo:
parameters:
- { name: projectId, in: path, required: true, schema: { type: string } }
@@ -2124,6 +2184,46 @@ components:
name: { type: string, minLength: 1 }
command: { type: string, minLength: 1 }
ScheduleEvery:
type: string
enum: [hour, day, week, month]
Weekday:
type: string
enum: [mon, tue, wed, thu, fri, sat, sun]
Schedule:
type: object
required: [id, project_id, owner, title, every, weekdays, hour, minute, day_of_month, prompt, model, workflow, next_run]
properties:
id: { type: string }
project_id: { type: string }
owner: { type: string, description: "The login each run's task is created as." }
title: { type: string, description: "The title of each task it creates." }
every: { $ref: "#/components/schemas/ScheduleEvery" }
weekdays: { type: array, items: { $ref: "#/components/schemas/Weekday" }, description: "The days a weekly schedule runs on, Monday first; empty otherwise." }
hour: { type: integer, description: "0 to 23, in the server's local time; 0 for an hourly schedule." }
minute: { type: integer, description: "0 to 59; for an hourly schedule, the minute past each hour." }
day_of_month: { type: integer, description: "1 to 31 for a monthly schedule, which runs on the month's last day in shorter months; 0 otherwise." }
prompt: { type: string, description: "The task's first message, or with workflow, the run's brief." }
model: { type: string, description: "The task's agent's model; empty with workflow." }
workflow: { type: string, description: "The workflow each run starts, by name; empty for a single agent." }
next_run: { type: string, format: date-time }
ScheduleSave:
type: object
required: [title, every, hour, minute]
properties:
title: { type: string, minLength: 1 }
every: { $ref: "#/components/schemas/ScheduleEvery" }
weekdays: { type: array, items: { $ref: "#/components/schemas/Weekday" }, description: "Required, and only allowed, for a weekly schedule." }
hour: { type: integer, minimum: 0, maximum: 23 }
minute: { type: integer, minimum: 0, maximum: 59 }
day_of_month: { type: integer, minimum: 1, maximum: 31, description: "Required, and only allowed, for a monthly schedule." }
prompt: { type: string, description: "Required without workflow." }
model: { type: string, description: "Required without workflow, refused with it." }
workflow: { type: string }
Permission:
type: object
required: [name, status, detail, settings]