semantics: complete DEF-to-region migration, fix regressions

- Convert legacy [DEF🆔Type] anchors to #region/#endregion across 329 files
- Reinstate _normalize_timestamp_value in sql_generator.py
- Fix MarkerLogger→logger migration in events.py (molecular CoT markers)
- Fix dataset_review orchestrator dependencies (_build_execution_snapshot)
- Fix config_manager stale-record deletion (moved to save path only)
- Add 77 missing [/DEF:] closers in 5 unbalanced test files
- Update assistant_chat.integration.test.js for #region format
- Apply molecular-cot-logging markers (REASON/REFLECT/EXPLORE) via logger.* methods
This commit is contained in:
2026-05-12 23:54:55 +03:00
parent fe8978f716
commit 306c5ae742
331 changed files with 9630 additions and 10312 deletions

View File

@@ -6,9 +6,9 @@ from pydantic import BaseModel, Field
# #region PluginBase [TYPE Class] [SEMANTICS plugin, interface, base, abstract]
# @BRIEF Defines the abstract base class that all plugins must implement to be recognized by the system. It enforces a common structure for plugin metadata and execution.
# @LAYER Core
# @INVARIANT All plugins MUST inherit from this class.
# @LAYER: Core
# @RELATION Used by PluginLoader to identify valid plugins.
# @INVARIANT: All plugins MUST inherit from this class.
class PluginBase(ABC):
"""
Base class for all plugins.
@@ -17,74 +17,74 @@ class PluginBase(ABC):
@property
@abstractmethod
# #region id [TYPE Function]
# @BRIEF Returns the unique identifier for the plugin.
# @PRE Plugin instance exists.
# @POST Returns string ID.
# @RETURN str - Plugin ID.
# [DEF:id:Function]
# @PURPOSE: Returns the unique identifier for the plugin.
# @PRE: Plugin instance exists.
# @POST: Returns string ID.
# @RETURN: str - Plugin ID.
def id(self) -> str:
"""A unique identifier for the plugin."""
with belief_scope("id"):
pass
# #endregion id
# [/DEF:id:Function]
@property
@abstractmethod
# #region name [TYPE Function]
# @BRIEF Returns the human-readable name of the plugin.
# @PRE Plugin instance exists.
# @POST Returns string name.
# @RETURN str - Plugin name.
# [DEF:name:Function]
# @PURPOSE: Returns the human-readable name of the plugin.
# @PRE: Plugin instance exists.
# @POST: Returns string name.
# @RETURN: str - Plugin name.
def name(self) -> str:
"""A human-readable name for the plugin."""
with belief_scope("name"):
pass
# #endregion name
# [/DEF:name:Function]
@property
@abstractmethod
# #region description [TYPE Function]
# @BRIEF Returns a brief description of the plugin.
# @PRE Plugin instance exists.
# @POST Returns string description.
# @RETURN str - Plugin description.
# [DEF:description:Function]
# @PURPOSE: Returns a brief description of the plugin.
# @PRE: Plugin instance exists.
# @POST: Returns string description.
# @RETURN: str - Plugin description.
def description(self) -> str:
"""A brief description of what the plugin does."""
with belief_scope("description"):
pass
# #endregion description
# [/DEF:description:Function]
@property
@abstractmethod
# #region version [TYPE Function]
# @BRIEF Returns the version of the plugin.
# @PRE Plugin instance exists.
# @POST Returns string version.
# @RETURN str - Plugin version.
# [DEF:version:Function]
# @PURPOSE: Returns the version of the plugin.
# @PRE: Plugin instance exists.
# @POST: Returns string version.
# @RETURN: str - Plugin version.
def version(self) -> str:
"""The version of the plugin."""
with belief_scope("version"):
pass
# #endregion version
# [/DEF:version:Function]
@property
# #region required_permission [TYPE Function]
# @BRIEF Returns the required permission string to execute this plugin.
# @PRE Plugin instance exists.
# @POST Returns string permission.
# @RETURN str - Required permission (e.g., "plugin:backup:execute").
# [DEF:required_permission:Function]
# @PURPOSE: Returns the required permission string to execute this plugin.
# @PRE: Plugin instance exists.
# @POST: Returns string permission.
# @RETURN: str - Required permission (e.g., "plugin:backup:execute").
def required_permission(self) -> str:
"""The permission string required to execute this plugin."""
with belief_scope("required_permission"):
return f"plugin:{self.id}:execute"
# #endregion required_permission
# [/DEF:required_permission:Function]
@property
# #region ui_route [TYPE Function]
# @BRIEF Returns the frontend route for the plugin's UI, if applicable.
# @PRE Plugin instance exists.
# @POST Returns string route or None.
# @RETURN Optional[str] - Frontend route.
# [DEF:ui_route:Function]
# @PURPOSE: Returns the frontend route for the plugin's UI, if applicable.
# @PRE: Plugin instance exists.
# @POST: Returns string route or None.
# @RETURN: Optional[str] - Frontend route.
def ui_route(self) -> Optional[str]:
"""
The frontend route for the plugin's UI.
@@ -92,14 +92,14 @@ class PluginBase(ABC):
"""
with belief_scope("ui_route"):
return None
# #endregion ui_route
# [/DEF:ui_route:Function]
@abstractmethod
# #region get_schema [TYPE Function]
# @BRIEF Returns the JSON schema for the plugin's input parameters.
# @PRE Plugin instance exists.
# @POST Returns dict schema.
# @RETURN Dict[str, Any] - JSON schema.
# [DEF:get_schema:Function]
# @PURPOSE: Returns the JSON schema for the plugin's input parameters.
# @PRE: Plugin instance exists.
# @POST: Returns dict schema.
# @RETURN: Dict[str, Any] - JSON schema.
def get_schema(self) -> Dict[str, Any]:
"""
Returns the JSON schema for the plugin's input parameters.
@@ -107,11 +107,11 @@ class PluginBase(ABC):
"""
with belief_scope("get_schema"):
pass
# #endregion get_schema
# [/DEF:get_schema:Function]
@abstractmethod
# #region execute [TYPE Function]
# @BRIEF Executes the plugin's core logic.
# [DEF:execute:Function]
# @PURPOSE: Executes the plugin's core logic.
# @PARAM: params (Dict[str, Any]) - Validated input parameters.
# @PRE: params must be a dictionary.
# @POST: Plugin execution is completed.
@@ -123,12 +123,12 @@ class PluginBase(ABC):
The `params` argument will be validated against the schema returned by `get_schema()`.
"""
pass
# #endregion execute
# [/DEF:execute:Function]
# #endregion PluginBase
# #region PluginConfig [TYPE Class] [SEMANTICS plugin, config, schema, pydantic]
# @BRIEF A Pydantic model used to represent the validated configuration and metadata of a loaded plugin. This object is what gets exposed to the API layer.
# @LAYER Core
# @LAYER: Core
# @RELATION Instantiated by PluginLoader after validating a PluginBase instance.
class PluginConfig(BaseModel):
"""Pydantic model for plugin configuration."""
@@ -138,4 +138,4 @@ class PluginConfig(BaseModel):
version: str = Field(..., description="Version of the plugin")
ui_route: Optional[str] = Field(None, description="Frontend route for the plugin UI")
input_schema: Dict[str, Any] = Field(..., description="JSON schema for input parameters", alias="schema")
# #endregion PluginConfig
# #endregion PluginConfig