From 35951a7defbdf377e71ce245d3def780a7d47680 Mon Sep 17 00:00:00 2001 From: Junyan Qin Date: Thu, 17 Jul 2025 16:29:43 +0800 Subject: [PATCH] feat: update plugin declaration for deprecation fields --- api/core/plugin/entities/marketplace.py | 10 ++++++++++ api/services/plugin/plugin_service.py | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/api/core/plugin/entities/marketplace.py b/api/core/plugin/entities/marketplace.py index a19a44aa3c..a1782cdd68 100644 --- a/api/core/plugin/entities/marketplace.py +++ b/api/core/plugin/entities/marketplace.py @@ -32,6 +32,16 @@ class MarketplacePluginDeclaration(BaseModel): latest_package_identifier: str = Field( ..., description="Unique identifier for the latest package release of the plugin" ) + status: str = Field( + ..., description="Indicate the status of marketplace plugin, enum from `active` `deleted`" + ) + deprecated_reason: str = Field( + ..., description="Not empty when status='deleted', indicates the reason why this plugin is deleted(deprecated)" + ) + alternative_plugin_id: str = Field( + ..., description="Optional, indicates the alternative plugin for user to switch to" + ) + @model_validator(mode="before") @classmethod diff --git a/api/services/plugin/plugin_service.py b/api/services/plugin/plugin_service.py index 0a5bc44b64..9005f0669b 100644 --- a/api/services/plugin/plugin_service.py +++ b/api/services/plugin/plugin_service.py @@ -38,6 +38,9 @@ class PluginService: plugin_id: str version: str unique_identifier: str + status: str + deprecated_reason: str + alternative_plugin_id: str REDIS_KEY_PREFIX = "plugin_service:latest_plugin:" REDIS_TTL = 60 * 5 # 5 minutes @@ -71,6 +74,9 @@ class PluginService: plugin_id=plugin_id, version=manifest.latest_version, unique_identifier=manifest.latest_package_identifier, + status=manifest.status, + deprecated_reason=manifest.deprecated_reason, + alternative_plugin_id=manifest.alternative_plugin_id, ) # Store in Redis