diff --git a/comfyui_manager/data_models/generated_models.py b/comfyui_manager/data_models/generated_models.py index 4cef0ba7..76e2bf13 100644 --- a/comfyui_manager/data_models/generated_models.py +++ b/comfyui_manager/data_models/generated_models.py @@ -1,6 +1,6 @@ # generated by datamodel-codegen: # filename: openapi.yaml -# timestamp: 2025-06-17T19:50:44+00:00 +# timestamp: 2025-06-17T20:27:16+00:00 from __future__ import annotations @@ -8,14 +8,17 @@ from datetime import datetime from enum import Enum from typing import Any, Dict, List, Optional, Union -from pydantic import BaseModel, Field, RootModel, conint +from pydantic import BaseModel, Field class OperationType(Enum): + """ + Type of operation or task being performed + """ + install = 'install' uninstall = 'uninstall' update = 'update' - update_all = 'update-all' update_comfyui = 'update-comfyui' fix = 'fix' disable = 'disable' @@ -24,6 +27,10 @@ class OperationType(Enum): class OperationResult(Enum): + """ + Result status of an operation (failed/error and skipped/skip are aliases) + """ + success = 'success' failed = 'failed' skipped = 'skipped' @@ -38,6 +45,10 @@ class TaskExecutionStatus(BaseModel): class ManagerMessageName(Enum): + """ + WebSocket message type constants for manager events + """ + cm_task_completed = 'cm-task-completed' cm_task_started = 'cm-task-started' cm_queue_status = 'cm-queue-status' @@ -68,11 +79,19 @@ class ManagerPackInstalled(BaseModel): class SelectedVersion(Enum): + """ + Version selection for pack installation + """ + latest = 'latest' nightly = 'nightly' class ManagerChannel(Enum): + """ + Channel for pack sources + """ + default = 'default' recent = 'recent' legacy = 'legacy' @@ -82,12 +101,20 @@ class ManagerChannel(Enum): class ManagerDatabaseSource(Enum): + """ + Source for pack information + """ + remote = 'remote' local = 'local' cache = 'cache' class ManagerPackState(Enum): + """ + Current state of a pack + """ + installed = 'installed' disabled = 'disabled' not_installed = 'not_installed' @@ -96,12 +123,20 @@ class ManagerPackState(Enum): class ManagerPackInstallType(Enum): + """ + Type of installation used for the pack + """ + git_clone = 'git-clone' copy = 'copy' cnr = 'cnr' class SecurityLevel(Enum): + """ + Security level configuration (from most to least restrictive) + """ + strong = 'strong' normal = 'normal' normal_ = 'normal-' @@ -109,12 +144,20 @@ class SecurityLevel(Enum): class RiskLevel(Enum): + """ + Risk classification for operations + """ + block = 'block' high = 'high' middle = 'middle' class UpdateState(Enum): + """ + Update availability status + """ + false = 'false' true = 'true' @@ -228,10 +271,8 @@ class ManagerMappings1(BaseModel): title_aux: Optional[str] = Field(None, description='The display name of the pack') -class ManagerMappings( - RootModel[Optional[Dict[str, List[Union[List[str], ManagerMappings1]]]]] -): - root: Optional[Dict[str, List[Union[List[str], ManagerMappings1]]]] = Field( +class ManagerMappings(BaseModel): + __root__: Optional[Dict[str, List[Union[List[str], ManagerMappings1]]]] = Field( None, description='Tuple of [node_names, metadata]' ) @@ -247,6 +288,10 @@ class ModelMetadata(BaseModel): class InstallType(Enum): + """ + Installation method + """ + git = 'git' copy = 'copy' pip = 'pip' @@ -269,16 +314,20 @@ class NodePackageMetadata(BaseModel): mode: Optional[str] = Field(None, description='Source mode') -class SnapshotItem(RootModel[str]): - root: str = Field(..., description='Name of the snapshot') +class SnapshotItem(BaseModel): + __root__: str = Field(..., description='Name of the snapshot') class Error(BaseModel): error: str = Field(..., description='Error message') -class InstalledPacksResponse(RootModel[Optional[Dict[str, ManagerPackInstalled]]]): - root: Optional[Dict[str, ManagerPackInstalled]] = None +class InstalledPacksResponse(BaseModel): + """ + Map of pack names to their installation info + """ + + __root__: Optional[Dict[str, ManagerPackInstalled]] = None class HistoryListResponse(BaseModel): @@ -306,7 +355,7 @@ class InstalledModelInfo(BaseModel): name: str = Field(..., description='Model filename') path: str = Field(..., description='Full path to model file') type: str = Field(..., description='Model type (checkpoint, lora, vae, etc.)') - size_bytes: Optional[conint(ge=0)] = Field(None, description='File size in bytes') + size_bytes: Optional[int] = Field(None, description='File size in bytes', ge=0) hash: Optional[str] = Field(None, description='Model file hash for verification') install_date: Optional[datetime] = Field( None, description='ISO timestamp when added' @@ -384,8 +433,8 @@ class ComfyUISystemState(BaseModel): cli_args: Optional[Dict[str, Any]] = Field( None, description='Selected ComfyUI CLI arguments' ) - custom_nodes_count: Optional[conint(ge=0)] = Field( - None, description='Total number of custom node packages' + custom_nodes_count: Optional[int] = Field( + None, description='Total number of custom node packages', ge=0 ) failed_imports: Optional[List[str]] = Field( None, description='List of custom nodes that failed to import' @@ -408,17 +457,17 @@ class BatchExecutionRecord(BaseModel): operations: Optional[List[BatchOperation]] = Field( None, description='List of operations performed in this batch' ) - total_operations: Optional[conint(ge=0)] = Field( - 0, description='Total number of operations in batch' + total_operations: Optional[int] = Field( + 0, description='Total number of operations in batch', ge=0 ) - successful_operations: Optional[conint(ge=0)] = Field( - 0, description='Number of successful operations' + successful_operations: Optional[int] = Field( + 0, description='Number of successful operations', ge=0 ) - failed_operations: Optional[conint(ge=0)] = Field( - 0, description='Number of failed operations' + failed_operations: Optional[int] = Field( + 0, description='Number of failed operations', ge=0 ) - skipped_operations: Optional[conint(ge=0)] = Field( - 0, description='Number of skipped operations' + skipped_operations: Optional[int] = Field( + 0, description='Number of skipped operations', ge=0 ) @@ -487,10 +536,8 @@ class MessageTaskFailed(BaseModel): state: TaskStateMessage -class MessageUpdate( - RootModel[Union[MessageTaskDone, MessageTaskStarted, MessageTaskFailed]] -): - root: Union[MessageTaskDone, MessageTaskStarted, MessageTaskFailed] = Field( +class MessageUpdate(BaseModel): + __root__: Union[MessageTaskDone, MessageTaskStarted, MessageTaskFailed] = Field( ..., description='Union type for all possible WebSocket message updates' ) diff --git a/comfyui_manager/glob/manager_server.py b/comfyui_manager/glob/manager_server.py index 9a2dccb1..4f192d44 100644 --- a/comfyui_manager/glob/manager_server.py +++ b/comfyui_manager/glob/manager_server.py @@ -992,12 +992,6 @@ async def task_worker(): return f"Model installation error: {model_url}" - - async def do_update_all(params: UpdateAllPacksParams): - # For update-all tasks, we need client info from the original task - # This should not be called anymore since update_all now creates individual tasks - return "error: update_all should create individual tasks, not use task worker" - while True: timeout = 4096 task = task_queue.get(timeout) diff --git a/openapi.yaml b/openapi.yaml index 5cf094c8..991d29af 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -20,7 +20,7 @@ components: schemas: OperationType: type: string - enum: [install, uninstall, update, update-all, update-comfyui, fix, disable, enable, install-model] + enum: [install, uninstall, update, update-comfyui, fix, disable, enable, install-model] description: Type of operation or task being performed OperationResult: type: string