Add basic cron scheduler to goose-server (#2621)

This commit is contained in:
Max Novich
2025-05-27 10:36:27 -07:00
committed by GitHub
parent c8e3f6ac69
commit c272b5df95
39 changed files with 3554 additions and 352 deletions
+319 -7
View File
@@ -10,7 +10,7 @@
"license": {
"name": "Apache-2.0"
},
"version": "1.0.23"
"version": "1.0.24"
},
"paths": {
"/agent/tools": {
@@ -453,6 +453,176 @@
]
}
},
"/schedule/create": {
"post": {
"tags": [
"schedule"
],
"operationId": "create_schedule",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateScheduleRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Scheduled job created successfully",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ScheduledJob"
}
}
}
},
"500": {
"description": "Internal server error"
}
}
}
},
"/schedule/delete/{id}": {
"delete": {
"tags": [
"schedule"
],
"operationId": "delete_schedule",
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of the schedule to delete",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"204": {
"description": "Scheduled job deleted successfully"
},
"404": {
"description": "Scheduled job not found"
},
"500": {
"description": "Internal server error"
}
}
}
},
"/schedule/list": {
"get": {
"tags": [
"schedule"
],
"operationId": "list_schedules",
"responses": {
"200": {
"description": "A list of scheduled jobs",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ListSchedulesResponse"
}
}
}
},
"500": {
"description": "Internal server error"
}
}
}
},
"/schedule/{id}/run_now": {
"post": {
"tags": [
"schedule"
],
"operationId": "run_now_handler",
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of the schedule to run",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Scheduled job triggered successfully, returns new session ID",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RunNowResponse"
}
}
}
},
"404": {
"description": "Scheduled job not found"
},
"500": {
"description": "Internal server error when trying to run the job"
}
}
}
},
"/schedule/{id}/sessions": {
"get": {
"tags": [
"schedule"
],
"operationId": "sessions_handler",
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of the schedule",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "limit",
"in": "query",
"required": false,
"schema": {
"type": "integer",
"format": "int32",
"minimum": 0
}
}
],
"responses": {
"200": {
"description": "A list of session display info",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/SessionDisplayInfo"
}
}
}
}
},
"500": {
"description": "Internal server error"
}
}
}
},
"/sessions": {
"get": {
"tags": [
@@ -731,6 +901,25 @@
}
}
},
"CreateScheduleRequest": {
"type": "object",
"required": [
"id",
"recipe_source",
"cron"
],
"properties": {
"cron": {
"type": "string"
},
"id": {
"type": "string"
},
"recipe_source": {
"type": "string"
}
}
},
"EmbeddedResource": {
"type": "object",
"required": [
@@ -1030,6 +1219,20 @@
}
}
},
"ListSchedulesResponse": {
"type": "object",
"required": [
"jobs"
],
"properties": {
"jobs": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ScheduledJob"
}
}
}
},
"Message": {
"type": "object",
"description": "A message to or from an LLM",
@@ -1334,15 +1537,13 @@
],
"properties": {
"is_configured": {
"type": "boolean",
"description": "Indicates whether the provider is fully configured"
"type": "boolean"
},
"metadata": {
"$ref": "#/components/schemas/ProviderMetadata"
},
"name": {
"type": "string",
"description": "Unique identifier and name of the provider"
"type": "string"
}
}
},
@@ -1469,6 +1670,103 @@
"assistant"
]
},
"RunNowResponse": {
"type": "object",
"required": [
"session_id"
],
"properties": {
"session_id": {
"type": "string"
}
}
},
"ScheduledJob": {
"type": "object",
"required": [
"id",
"source",
"cron"
],
"properties": {
"cron": {
"type": "string"
},
"id": {
"type": "string"
},
"last_run": {
"type": "string",
"format": "date-time",
"nullable": true
},
"source": {
"type": "string"
}
}
},
"SessionDisplayInfo": {
"type": "object",
"required": [
"id",
"name",
"createdAt",
"workingDir",
"messageCount"
],
"properties": {
"accumulatedInputTokens": {
"type": "integer",
"format": "int32",
"nullable": true
},
"accumulatedOutputTokens": {
"type": "integer",
"format": "int32",
"nullable": true
},
"accumulatedTotalTokens": {
"type": "integer",
"format": "int32",
"nullable": true
},
"createdAt": {
"type": "string"
},
"id": {
"type": "string"
},
"inputTokens": {
"type": "integer",
"format": "int32",
"nullable": true
},
"messageCount": {
"type": "integer",
"minimum": 0
},
"name": {
"type": "string"
},
"outputTokens": {
"type": "integer",
"format": "int32",
"nullable": true
},
"scheduleId": {
"type": "string",
"nullable": true
},
"totalTokens": {
"type": "integer",
"format": "int32",
"nullable": true
},
"workingDir": {
"type": "string"
}
}
},
"SessionHistoryResponse": {
"type": "object",
"required": [
@@ -1579,6 +1877,11 @@
"description": "The number of output tokens used in the session. Retrieved from the provider's last usage.",
"nullable": true
},
"schedule_id": {
"type": "string",
"description": "ID of the schedule that triggered this session, if any",
"nullable": true
},
"total_tokens": {
"type": "integer",
"format": "int32",
@@ -1592,6 +1895,16 @@
}
}
},
"SessionsQuery": {
"type": "object",
"properties": {
"limit": {
"type": "integer",
"format": "int32",
"minimum": 0
}
}
},
"SummarizationRequested": {
"type": "object",
"required": [
@@ -1757,8 +2070,7 @@
"$ref": "#/components/schemas/PermissionLevel"
},
"tool_name": {
"type": "string",
"description": "Unique identifier and name of the tool, format <extension_name>__<tool_name>"
"type": "string"
}
}
},