{ "openapi": "3.1.0", "info": { "title": "TaskPilot API", "description": "Local task scheduling and process management API.", "license": { "name": "" }, "version": "0.1.0" }, "paths": { "/api/v1/cron/preview": { "post": { "tags": [ "system" ], "operationId": "preview_cron", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CronPreviewRequest" } } }, "required": true }, "responses": { "200": { "description": "Upcoming cron occurrences", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CronPreviewResponse" } } } }, "400": { "description": "Invalid cron preview request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/v1/events": { "get": { "tags": [ "runs" ], "operationId": "execution_events", "responses": { "200": { "description": "Run status and log events", "content": { "text/event-stream": { "schema": { "type": "string" } } } } } } }, "/api/v1/health": { "get": { "tags": [ "system" ], "operationId": "health", "responses": { "200": { "description": "TaskPilot API is healthy", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HealthResponse" } } } } } } }, "/api/v1/python/mirrors": { "get": { "tags": [ "python-mirrors" ], "operationId": "list_python_mirrors", "responses": { "200": { "description": "Python package mirrors", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/PythonMirrorResponse" } } } } } } }, "post": { "tags": [ "python-mirrors" ], "operationId": "create_python_mirror", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreatePythonMirrorRequest" } } }, "required": true }, "responses": { "201": { "description": "Mirror created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PythonMirrorResponse" } } } }, "400": { "description": "Validation failed", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "Mirror URL already exists", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/v1/python/mirrors/{id}": { "get": { "tags": [ "python-mirrors" ], "operationId": "get_python_mirror", "parameters": [ { "name": "id", "in": "path", "description": "Mirror identifier", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Mirror detail", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PythonMirrorResponse" } } } }, "404": { "description": "Mirror not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "put": { "tags": [ "python-mirrors" ], "operationId": "update_python_mirror", "parameters": [ { "name": "id", "in": "path", "description": "Mirror identifier", "required": true, "schema": { "type": "string" } } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdatePythonMirrorRequest" } } }, "required": true }, "responses": { "200": { "description": "Mirror updated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PythonMirrorResponse" } } } }, "400": { "description": "Validation failed", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Mirror not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "Mirror URL already exists", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "delete": { "tags": [ "python-mirrors" ], "operationId": "delete_python_mirror", "parameters": [ { "name": "id", "in": "path", "description": "Mirror identifier", "required": true, "schema": { "type": "string" } } ], "responses": { "204": { "description": "Mirror deleted" }, "404": { "description": "Mirror not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/v1/python/mirrors/{id}/default": { "post": { "tags": [ "python-mirrors" ], "operationId": "set_default_python_mirror", "parameters": [ { "name": "id", "in": "path", "description": "Mirror identifier", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Default mirror updated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PythonMirrorResponse" } } } }, "404": { "description": "Mirror not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/v1/python/venv": { "post": { "tags": [ "system" ], "operationId": "probe_python_venv", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/VenvProbeRequest" } } }, "required": true }, "responses": { "200": { "description": "Detected Python virtual environment", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/VenvProbeResponse" } } } }, "400": { "description": "Invalid venv probe request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/v1/python/venv/create": { "post": { "tags": [ "system" ], "operationId": "create_python_venv", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreatePythonVenvRequest" } } }, "required": true }, "responses": { "200": { "description": "Created or reused project virtual environment", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/VenvProbeResponse" } } } }, "400": { "description": "Project cannot create a virtual environment", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/v1/runs/{run_id}": { "get": { "tags": [ "runs" ], "operationId": "get_run", "parameters": [ { "name": "run_id", "in": "path", "description": "Run identifier", "required": true, "schema": { "type": "integer", "format": "int64" } } ], "responses": { "200": { "description": "Task run detail", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TaskRunResponse" } } } }, "404": { "description": "Run not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/v1/runs/{run_id}/cancel": { "post": { "tags": [ "runs" ], "operationId": "cancel_run", "parameters": [ { "name": "run_id", "in": "path", "description": "Run identifier", "required": true, "schema": { "type": "integer", "format": "int64" } } ], "responses": { "202": { "description": "Cancellation requested", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TaskRunResponse" } } } }, "404": { "description": "Run not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "Run is not cancellable", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/v1/runs/{run_id}/logs": { "get": { "tags": [ "runs" ], "operationId": "get_run_logs", "parameters": [ { "name": "run_id", "in": "path", "description": "Run identifier", "required": true, "schema": { "type": "integer", "format": "int64" } }, { "name": "offset", "in": "query", "required": false, "schema": { "type": "integer", "format": "int64", "minimum": 0 } } ], "responses": { "200": { "description": "Incremental task run log", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LogChunkResponse" } } } }, "404": { "description": "Run not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/v1/runs/{run_id}/logs/download": { "get": { "tags": [ "runs" ], "operationId": "download_run_logs", "parameters": [ { "name": "run_id", "in": "path", "description": "Run identifier", "required": true, "schema": { "type": "integer", "format": "int64" } } ], "responses": { "200": { "description": "Plain text task log", "content": { "text/plain": { "schema": { "type": "string" } } } }, "404": { "description": "Run or log not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/v1/schedule": { "get": { "tags": [ "tasks" ], "operationId": "list_schedule", "responses": { "200": { "description": "Next trigger time per enabled task", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/ScheduledTaskResponse" } } } } } } } }, "/api/v1/session": { "get": { "tags": [ "system" ], "operationId": "session", "responses": { "200": { "description": "Local API session token", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SessionResponse" } } } } } } }, "/api/v1/stats": { "get": { "tags": [ "tasks" ], "operationId": "task_stats", "responses": { "200": { "description": "Dashboard counters", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TaskStatsResponse" } } } } } } }, "/api/v1/system/directories": { "get": { "tags": [ "system" ], "operationId": "list_directories", "parameters": [ { "name": "path", "in": "query", "description": "绝对目录路径;留空表示列出盘符", "required": false, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Subdirectories of the requested path, or the drive list", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DirectoryListingResponse" } } } }, "400": { "description": "The path is not an existing absolute directory", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/v1/tasks": { "get": { "tags": [ "tasks" ], "operationId": "list_tasks", "parameters": [ { "name": "q", "in": "query", "required": false, "schema": { "type": "string" } }, { "name": "enabled", "in": "query", "required": false, "schema": { "type": "boolean" } }, { "name": "action_type", "in": "query", "required": false, "schema": { "$ref": "#/components/schemas/TaskActionType" } }, { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "format": "int32", "minimum": 0 } }, { "name": "page_size", "in": "query", "required": false, "schema": { "type": "integer", "format": "int32", "minimum": 0 } } ], "responses": { "200": { "description": "Paginated task list", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TaskListResponse" } } } } } }, "post": { "tags": [ "tasks" ], "operationId": "create_task", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateTaskRequest" } } }, "required": true }, "responses": { "201": { "description": "Task created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TaskResponse" } } } }, "400": { "description": "Validation failed", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "Task ID already exists", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/v1/tasks/{id}": { "get": { "tags": [ "tasks" ], "operationId": "get_task", "parameters": [ { "name": "id", "in": "path", "description": "Stable task identifier", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Task detail", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TaskResponse" } } } }, "404": { "description": "Task not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "put": { "tags": [ "tasks" ], "operationId": "update_task", "parameters": [ { "name": "id", "in": "path", "description": "Stable task identifier", "required": true, "schema": { "type": "string" } } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateTaskRequest" } } }, "required": true }, "responses": { "200": { "description": "Task updated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TaskResponse" } } } }, "400": { "description": "Validation failed", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Task not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "delete": { "tags": [ "tasks" ], "operationId": "delete_task", "parameters": [ { "name": "id", "in": "path", "description": "Stable task identifier", "required": true, "schema": { "type": "string" } } ], "responses": { "204": { "description": "Task deleted" }, "404": { "description": "Task not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/v1/tasks/{id}/disable": { "post": { "tags": [ "tasks" ], "operationId": "disable_task", "parameters": [ { "name": "id", "in": "path", "description": "Stable task identifier", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Task disabled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TaskResponse" } } } }, "404": { "description": "Task not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/v1/tasks/{id}/enable": { "post": { "tags": [ "tasks" ], "operationId": "enable_task", "parameters": [ { "name": "id", "in": "path", "description": "Stable task identifier", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Task enabled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TaskResponse" } } } }, "404": { "description": "Task not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/v1/tasks/{id}/run": { "post": { "tags": [ "runs" ], "operationId": "run_task", "parameters": [ { "name": "id", "in": "path", "description": "Stable task identifier", "required": true, "schema": { "type": "string" } } ], "responses": { "202": { "description": "Manual run accepted", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TaskRunResponse" } } } }, "404": { "description": "Task not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "Action executor not implemented", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/v1/tasks/{id}/runs": { "get": { "tags": [ "runs" ], "operationId": "list_task_runs", "parameters": [ { "name": "id", "in": "path", "description": "Stable task identifier", "required": true, "schema": { "type": "string" } }, { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "format": "int32", "minimum": 0 } }, { "name": "page_size", "in": "query", "required": false, "schema": { "type": "integer", "format": "int32", "minimum": 0 } }, { "name": "status", "in": "query", "required": false, "schema": { "$ref": "#/components/schemas/RunStatus" } }, { "name": "trigger", "in": "query", "required": false, "schema": { "$ref": "#/components/schemas/RunTrigger" } } ], "responses": { "200": { "description": "Task run history", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TaskRunListResponse" } } } } } } } }, "components": { "schemas": { "ConcurrencyPolicy": { "type": "string", "enum": [ "skip" ] }, "CreatePythonMirrorRequest": { "type": "object", "required": [ "name", "index_url" ], "properties": { "enabled": { "type": "boolean" }, "index_url": { "type": "string" }, "name": { "type": "string" }, "trusted_host": { "type": [ "string", "null" ] } }, "additionalProperties": false }, "CreatePythonVenvRequest": { "type": "object", "description": "用 uv 为项目创建 `.venv`(pyproject 用 uv sync,requirements 用 uv venv + uv pip install)。", "required": [ "working_dir" ], "properties": { "working_dir": { "type": "string" } }, "additionalProperties": false }, "CreateTaskRequest": { "type": "object", "required": [ "id", "name", "cron", "action" ], "properties": { "action": { "$ref": "#/components/schemas/TaskAction" }, "concurrency_policy": { "$ref": "#/components/schemas/ConcurrencyPolicy" }, "cron": { "type": "string" }, "enabled": { "type": "boolean" }, "id": { "type": "string" }, "name": { "type": "string" }, "retry_policy": { "$ref": "#/components/schemas/RetryPolicy" }, "timeout_secs": { "type": "integer", "format": "int64", "minimum": 0 }, "timezone": { "type": "string" } }, "additionalProperties": false }, "CronPreviewRequest": { "type": "object", "required": [ "expression", "timezone", "count" ], "properties": { "count": { "type": "integer", "minimum": 0 }, "expression": { "type": "string" }, "timezone": { "type": "string" } }, "additionalProperties": false }, "CronPreviewResponse": { "type": "object", "required": [ "timezone", "runs" ], "properties": { "runs": { "type": "array", "items": { "type": "string" } }, "timezone": { "type": "string" } } }, "DirectoryEntry": { "type": "object", "required": [ "name", "path" ], "properties": { "name": { "type": "string", "description": "用于展示的名称" }, "path": { "type": "string", "description": "绝对路径,选中后回填到表单" } } }, "DirectoryListingResponse": { "type": "object", "required": [ "entries", "truncated" ], "properties": { "entries": { "type": "array", "items": { "$ref": "#/components/schemas/DirectoryEntry" } }, "parent": { "type": [ "string", "null" ], "description": "上一级目录;盘符根目录和盘符列表为 null" }, "path": { "type": [ "string", "null" ], "description": "当前目录;为 null 表示正在列出盘符" }, "truncated": { "type": "boolean", "description": "条目超过上限被截断时为 true" } } }, "ErrorResponse": { "type": "object", "required": [ "code", "message", "details" ], "properties": { "code": { "type": "string" }, "details": { "type": "object", "additionalProperties": { "type": "string" }, "propertyNames": { "type": "string" } }, "field": { "type": [ "string", "null" ] }, "message": { "type": "string" } } }, "HealthResponse": { "type": "object", "required": [ "status", "service", "version" ], "properties": { "service": { "type": "string", "description": "Stable service identifier." }, "status": { "type": "string", "description": "Current service status." }, "version": { "type": "string", "description": "Backend package version." } } }, "HttpMethod": { "type": "string", "enum": [ "GET", "POST" ] }, "InterpreterKind": { "type": "string", "enum": [ "python", "node", "other" ] }, "LogChunkResponse": { "type": "object", "required": [ "content", "next_offset", "complete" ], "properties": { "complete": { "type": "boolean" }, "content": { "type": "string" }, "next_offset": { "type": "integer", "format": "int64", "minimum": 0 } } }, "PythonMirrorResponse": { "type": "object", "description": "一个 Python 包索引镜像(pip / uv)。", "required": [ "id", "name", "index_url", "enabled", "is_default", "created_at", "updated_at" ], "properties": { "created_at": { "type": "string", "format": "date-time" }, "enabled": { "type": "boolean" }, "id": { "type": "string" }, "index_url": { "type": "string", "description": "pip 的 `--index-url`,运行时注入 `PIP_INDEX_URL`" }, "is_default": { "type": "boolean", "description": "当前默认镜像;同一时间最多一个" }, "name": { "type": "string" }, "trusted_host": { "type": [ "string", "null" ], "description": "pip 的 `--trusted-host`;https 源通常为空" }, "updated_at": { "type": "string", "format": "date-time" } } }, "RetryPolicy": { "type": "object", "properties": { "delay_secs": { "type": "integer", "format": "int64", "minimum": 0 }, "max_attempts": { "type": "integer", "format": "int32", "minimum": 0 } }, "additionalProperties": false }, "RunStatus": { "type": "string", "enum": [ "queued", "running", "succeeded", "failed", "timed_out", "cancelled", "skipped" ] }, "RunTrigger": { "type": "string", "enum": [ "schedule", "manual", "retry" ] }, "ScheduledTaskResponse": { "type": "object", "description": "已注册调度的任务及其下次触发时间。", "required": [ "task_id" ], "properties": { "next_run_at": { "type": [ "string", "null" ], "format": "date-time", "description": "下次触发时间;调度正在重建时可能为空" }, "task_id": { "type": "string" } } }, "ScriptLanguage": { "type": "string", "enum": [ "python", "shell", "node", "lua" ] }, "SessionResponse": { "type": "object", "required": [ "token" ], "properties": { "token": { "type": "string", "description": "Random per-process token required for mutating browser requests." } } }, "TaskAction": { "oneOf": [ { "type": "object", "required": [ "working_dir", "interpreter", "script", "type" ], "properties": { "args": { "type": "array", "items": { "type": "string" } }, "env": { "type": "object", "additionalProperties": { "type": "string" }, "propertyNames": { "type": "string" } }, "interpreter": { "type": "string" }, "language": { "oneOf": [ { "$ref": "#/components/schemas/ScriptLanguage" }, { "type": "null" } ] }, "script": { "type": "string" }, "type": { "type": "string", "enum": [ "script" ] }, "venv": { "type": [ "string", "null" ] }, "working_dir": { "type": "string" } } }, { "type": "object", "required": [ "url", "method", "type" ], "properties": { "body": { "type": [ "string", "null" ] }, "expected_status": { "type": "array", "items": { "type": "integer", "format": "int32", "minimum": 0 } }, "headers": { "type": "object", "additionalProperties": { "type": "string" }, "propertyNames": { "type": "string" } }, "method": { "$ref": "#/components/schemas/HttpMethod" }, "type": { "type": "string", "enum": [ "http" ] }, "url": { "type": "string" } } }, { "type": "object", "required": [ "executable", "type" ], "properties": { "args": { "type": "array", "items": { "type": "string" } }, "env": { "type": "object", "additionalProperties": { "type": "string" }, "propertyNames": { "type": "string" } }, "executable": { "type": "string" }, "type": { "type": "string", "enum": [ "process" ] }, "working_dir": { "type": [ "string", "null" ] } } } ] }, "TaskActionType": { "type": "string", "enum": [ "script", "http", "process" ] }, "TaskListResponse": { "type": "object", "required": [ "items", "page", "page_size", "total" ], "properties": { "items": { "type": "array", "items": { "$ref": "#/components/schemas/TaskResponse" } }, "page": { "type": "integer", "format": "int32", "minimum": 0 }, "page_size": { "type": "integer", "format": "int32", "minimum": 0 }, "total": { "type": "integer", "format": "int64", "minimum": 0 } } }, "TaskResponse": { "type": "object", "required": [ "id", "name", "cron", "timezone", "enabled", "timeout_secs", "concurrency_policy", "retry_policy", "action", "created_at", "updated_at" ], "properties": { "action": { "$ref": "#/components/schemas/TaskAction" }, "concurrency_policy": { "$ref": "#/components/schemas/ConcurrencyPolicy" }, "created_at": { "type": "string", "format": "date-time" }, "cron": { "type": "string" }, "enabled": { "type": "boolean" }, "id": { "type": "string" }, "name": { "type": "string" }, "retry_policy": { "$ref": "#/components/schemas/RetryPolicy" }, "timeout_secs": { "type": "integer", "format": "int64", "minimum": 0 }, "timezone": { "type": "string" }, "updated_at": { "type": "string", "format": "date-time" } } }, "TaskRunListResponse": { "type": "object", "required": [ "items", "page", "page_size", "total" ], "properties": { "items": { "type": "array", "items": { "$ref": "#/components/schemas/TaskRunResponse" } }, "page": { "type": "integer", "format": "int32", "minimum": 0 }, "page_size": { "type": "integer", "format": "int32", "minimum": 0 }, "total": { "type": "integer", "format": "int64", "minimum": 0 } } }, "TaskRunResponse": { "type": "object", "required": [ "id", "task_id", "trigger", "status", "created_at" ], "properties": { "created_at": { "type": "string", "format": "date-time" }, "duration_ms": { "type": [ "integer", "null" ], "format": "int64", "minimum": 0 }, "error_message": { "type": [ "string", "null" ] }, "exit_code": { "type": [ "integer", "null" ], "format": "int32" }, "finished_at": { "type": [ "string", "null" ], "format": "date-time" }, "id": { "type": "integer", "format": "int64" }, "started_at": { "type": [ "string", "null" ], "format": "date-time" }, "status": { "$ref": "#/components/schemas/RunStatus" }, "task_id": { "type": "string" }, "trigger": { "$ref": "#/components/schemas/RunTrigger" } } }, "TaskStatsResponse": { "type": "object", "description": "仪表盘指标:一次请求拿到全部计数,避免为每个指标各发一次列表查询。", "required": [ "total", "enabled", "running", "script", "http", "process" ], "properties": { "enabled": { "type": "integer", "format": "int64", "description": "已启用任务数", "minimum": 0 }, "http": { "type": "integer", "format": "int64", "description": "HTTP 类任务数", "minimum": 0 }, "process": { "type": "integer", "format": "int64", "description": "进程类任务数", "minimum": 0 }, "running": { "type": "integer", "format": "int64", "description": "当前正在执行的任务数", "minimum": 0 }, "script": { "type": "integer", "format": "int64", "description": "脚本类任务数", "minimum": 0 }, "total": { "type": "integer", "format": "int64", "description": "任务总数", "minimum": 0 } } }, "UpdatePythonMirrorRequest": { "type": "object", "required": [ "name", "index_url", "enabled" ], "properties": { "enabled": { "type": "boolean" }, "index_url": { "type": "string" }, "name": { "type": "string" }, "trusted_host": { "type": [ "string", "null" ] } }, "additionalProperties": false }, "UpdateTaskRequest": { "type": "object", "required": [ "name", "cron", "action" ], "properties": { "action": { "$ref": "#/components/schemas/TaskAction" }, "concurrency_policy": { "$ref": "#/components/schemas/ConcurrencyPolicy" }, "cron": { "type": "string" }, "enabled": { "type": "boolean" }, "name": { "type": "string" }, "retry_policy": { "$ref": "#/components/schemas/RetryPolicy" }, "timeout_secs": { "type": "integer", "format": "int64", "minimum": 0 }, "timezone": { "type": "string" } }, "additionalProperties": false }, "VenvProbeRequest": { "type": "object", "description": "编辑器在用户填写工作目录时发起的探测请求。", "required": [ "working_dir", "interpreter" ], "properties": { "interpreter": { "type": "string", "description": "解释器或可执行程序,对应 `action.interpreter`" }, "venv": { "type": [ "string", "null" ], "description": "手动填写的虚拟环境目录,对应 `action.venv`" }, "working_dir": { "type": "string", "description": "任务工作目录,对应 `action.working_dir`" } }, "additionalProperties": false }, "VenvProbeResponse": { "type": "object", "required": [ "status", "interpreter_kind", "message", "uv_available", "has_pyproject", "has_requirements", "requirements_files", "can_create" ], "properties": { "can_create": { "type": "boolean", "description": "没有虚拟环境时,是否具备用 uv 创建的条件" }, "display_path": { "type": [ "string", "null" ], "description": "供界面展示的解释器路径;位于工作目录内时使用相对路径" }, "has_pyproject": { "type": "boolean", "description": "工作目录根部是否存在 pyproject.toml" }, "has_requirements": { "type": "boolean", "description": "工作目录根部是否存在 requirements*.txt" }, "interpreter_kind": { "$ref": "#/components/schemas/InterpreterKind" }, "message": { "type": "string" }, "requirements_files": { "type": "array", "items": { "type": "string" }, "description": "探测到的 requirements 文件名(仅根目录)" }, "source": { "oneOf": [ { "$ref": "#/components/schemas/VenvSource" }, { "type": "null" } ] }, "status": { "$ref": "#/components/schemas/VenvProbeStatus" }, "uv_available": { "type": "boolean", "description": "本机 PATH 中是否能找到 uv" }, "venv_path": { "type": [ "string", "null" ], "description": "虚拟环境根目录的绝对路径" } } }, "VenvProbeStatus": { "type": "string", "enum": [ "linked", "invalid", "missing", "not_applicable", "incomplete" ] }, "VenvSource": { "type": "string", "description": "虚拟环境的来源,用于在界面上说明\"为什么\"关联到了这个环境。", "enum": [ "configured", "interpreter", "working_directory" ] } } } }