From 350cb767c3b741da2124fb8d4a9632a79e8b3dba Mon Sep 17 00:00:00 2001 From: bymyself Date: Tue, 17 Jun 2025 13:06:14 -0700 Subject: [PATCH] [feat] Regenerate data models with enhanced ComfyUISystemState MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add SecurityLevel and RiskLevel enums to generated models - Enhance ComfyUISystemState with additional system information fields: - comfyui_root_path: ComfyUI installation directory - model_paths: Map of model types to configured paths - manager_version: ComfyUI Manager version - security_level: Current security configuration - network_mode: Network mode (online/offline/private) - cli_args: Selected CLI arguments - custom_nodes_count: Total number of custom nodes - failed_imports: List of failed imports - pip_packages: Installed pip packages 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- comfyui_manager/data_models/__init__.py | 4 + .../data_models/generated_models.py | 122 +++++++++--------- 2 files changed, 63 insertions(+), 63 deletions(-) diff --git a/comfyui_manager/data_models/__init__.py b/comfyui_manager/data_models/__init__.py index ad27d7c5..be99fd36 100644 --- a/comfyui_manager/data_models/__init__.py +++ b/comfyui_manager/data_models/__init__.py @@ -59,6 +59,8 @@ from .generated_models import ( HistoryResponse, HistoryListResponse, InstallType, + SecurityLevel, + RiskLevel, ) __all__ = [ @@ -112,4 +114,6 @@ __all__ = [ "HistoryResponse", "HistoryListResponse", "InstallType", + "SecurityLevel", + "RiskLevel", ] \ No newline at end of file diff --git a/comfyui_manager/data_models/generated_models.py b/comfyui_manager/data_models/generated_models.py index bd582290..4cef0ba7 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-17T17:32:47+00:00 +# timestamp: 2025-06-17T19:50:44+00:00 from __future__ import annotations @@ -8,14 +8,10 @@ from datetime import datetime from enum import Enum from typing import Any, Dict, List, Optional, Union -from pydantic import BaseModel, Field +from pydantic import BaseModel, Field, RootModel, conint class OperationType(Enum): - """ - Type of operation or task being performed - """ - install = 'install' uninstall = 'uninstall' update = 'update' @@ -28,10 +24,6 @@ class OperationType(Enum): class OperationResult(Enum): - """ - Result status of an operation (failed/error and skipped/skip are aliases) - """ - success = 'success' failed = 'failed' skipped = 'skipped' @@ -46,10 +38,6 @@ 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' @@ -80,19 +68,11 @@ 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' @@ -102,20 +82,12 @@ 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' @@ -124,20 +96,25 @@ class ManagerPackState(Enum): class ManagerPackInstallType(Enum): - """ - Type of installation used for the pack - """ - git_clone = 'git-clone' copy = 'copy' cnr = 'cnr' -class UpdateState(Enum): - """ - Update availability status - """ +class SecurityLevel(Enum): + strong = 'strong' + normal = 'normal' + normal_ = 'normal-' + weak = 'weak' + +class RiskLevel(Enum): + block = 'block' + high = 'high' + middle = 'middle' + + +class UpdateState(Enum): false = 'false' true = 'true' @@ -251,8 +228,10 @@ class ManagerMappings1(BaseModel): title_aux: Optional[str] = Field(None, description='The display name of the pack') -class ManagerMappings(BaseModel): - __root__: Optional[Dict[str, List[Union[List[str], ManagerMappings1]]]] = Field( +class ManagerMappings( + RootModel[Optional[Dict[str, List[Union[List[str], ManagerMappings1]]]]] +): + root: Optional[Dict[str, List[Union[List[str], ManagerMappings1]]]] = Field( None, description='Tuple of [node_names, metadata]' ) @@ -268,10 +247,6 @@ class ModelMetadata(BaseModel): class InstallType(Enum): - """ - Installation method - """ - git = 'git' copy = 'copy' pip = 'pip' @@ -294,20 +269,16 @@ class NodePackageMetadata(BaseModel): mode: Optional[str] = Field(None, description='Source mode') -class SnapshotItem(BaseModel): - __root__: str = Field(..., description='Name of the snapshot') +class SnapshotItem(RootModel[str]): + root: str = Field(..., description='Name of the snapshot') class Error(BaseModel): error: str = Field(..., description='Error message') -class InstalledPacksResponse(BaseModel): - """ - Map of pack names to their installation info - """ - - __root__: Optional[Dict[str, ManagerPackInstalled]] = None +class InstalledPacksResponse(RootModel[Optional[Dict[str, ManagerPackInstalled]]]): + root: Optional[Dict[str, ManagerPackInstalled]] = None class HistoryListResponse(BaseModel): @@ -335,7 +306,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[int] = Field(None, description='File size in bytes', ge=0) + size_bytes: Optional[conint(ge=0)] = Field(None, description='File size in bytes') hash: Optional[str] = Field(None, description='Model file hash for verification') install_date: Optional[datetime] = Field( None, description='ISO timestamp when added' @@ -399,6 +370,29 @@ class ComfyUISystemState(BaseModel): manager_config: Optional[Dict[str, Any]] = Field( None, description='ComfyUI Manager configuration settings' ) + comfyui_root_path: Optional[str] = Field( + None, description='ComfyUI root installation directory' + ) + model_paths: Optional[Dict[str, List[str]]] = Field( + None, description='Map of model types to their configured paths' + ) + manager_version: Optional[str] = Field(None, description='ComfyUI Manager version') + security_level: Optional[SecurityLevel] = None + network_mode: Optional[str] = Field( + None, description='Network mode (online, offline, private)' + ) + 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' + ) + failed_imports: Optional[List[str]] = Field( + None, description='List of custom nodes that failed to import' + ) + pip_packages: Optional[Dict[str, str]] = Field( + None, description='Map of installed pip packages to their versions' + ) class BatchExecutionRecord(BaseModel): @@ -414,17 +408,17 @@ class BatchExecutionRecord(BaseModel): operations: Optional[List[BatchOperation]] = Field( None, description='List of operations performed in this batch' ) - total_operations: Optional[int] = Field( - 0, description='Total number of operations in batch', ge=0 + total_operations: Optional[conint(ge=0)] = Field( + 0, description='Total number of operations in batch' ) - successful_operations: Optional[int] = Field( - 0, description='Number of successful operations', ge=0 + successful_operations: Optional[conint(ge=0)] = Field( + 0, description='Number of successful operations' ) - failed_operations: Optional[int] = Field( - 0, description='Number of failed operations', ge=0 + failed_operations: Optional[conint(ge=0)] = Field( + 0, description='Number of failed operations' ) - skipped_operations: Optional[int] = Field( - 0, description='Number of skipped operations', ge=0 + skipped_operations: Optional[conint(ge=0)] = Field( + 0, description='Number of skipped operations' ) @@ -493,8 +487,10 @@ class MessageTaskFailed(BaseModel): state: TaskStateMessage -class MessageUpdate(BaseModel): - __root__: Union[MessageTaskDone, MessageTaskStarted, MessageTaskFailed] = Field( +class MessageUpdate( + RootModel[Union[MessageTaskDone, MessageTaskStarted, MessageTaskFailed]] +): + root: Union[MessageTaskDone, MessageTaskStarted, MessageTaskFailed] = Field( ..., description='Union type for all possible WebSocket message updates' )