Signed-off-by: -LAN- <laipz8200@outlook.com>tags/2.0.0-beta.1
| @@ -9,7 +9,7 @@ from typing import final | |||
| from core.workflow.graph_events import GraphEngineEvent | |||
| from ..layers.base import Layer | |||
| from ..layers.base import GraphEngineLayer | |||
| @final | |||
| @@ -104,10 +104,10 @@ class EventManager: | |||
| """Initialize the event manager.""" | |||
| self._events: list[GraphEngineEvent] = [] | |||
| self._lock = ReadWriteLock() | |||
| self._layers: list[Layer] = [] | |||
| self._layers: list[GraphEngineLayer] = [] | |||
| self._execution_complete = threading.Event() | |||
| def set_layers(self, layers: list[Layer]) -> None: | |||
| def set_layers(self, layers: list[GraphEngineLayer]) -> None: | |||
| """ | |||
| Set the layers to notify on event collection. | |||
| @@ -33,7 +33,7 @@ from .entities.commands import AbortCommand | |||
| from .error_handling import ErrorHandler | |||
| from .event_management import EventHandler, EventManager | |||
| from .graph_traversal import EdgeProcessor, SkipPropagator | |||
| from .layers.base import Layer | |||
| from .layers.base import GraphEngineLayer | |||
| from .orchestration import Dispatcher, ExecutionCoordinator | |||
| from .protocols.command_channel import CommandChannel | |||
| from .response_coordinator import ResponseStreamCoordinator | |||
| @@ -221,7 +221,7 @@ class GraphEngine: | |||
| # === Extensibility === | |||
| # Layers allow plugins to extend engine functionality | |||
| self._layers: list[Layer] = [] | |||
| self._layers: list[GraphEngineLayer] = [] | |||
| # === Validation === | |||
| # Ensure all nodes share the same GraphRuntimeState instance | |||
| @@ -234,7 +234,7 @@ class GraphEngine: | |||
| if id(node.graph_runtime_state) != expected_state_id: | |||
| raise ValueError(f"GraphRuntimeState consistency violation: Node '{node.id}' has a different instance") | |||
| def layer(self, layer: Layer) -> "GraphEngine": | |||
| def layer(self, layer: GraphEngineLayer) -> "GraphEngine": | |||
| """Add a layer for extending functionality.""" | |||
| self._layers.append(layer) | |||
| return self | |||
| @@ -5,12 +5,12 @@ This module provides the layer infrastructure for extending GraphEngine function | |||
| with middleware-like components that can observe events and interact with execution. | |||
| """ | |||
| from .base import Layer | |||
| from .base import GraphEngineLayer | |||
| from .debug_logging import DebugLoggingLayer | |||
| from .execution_limits import ExecutionLimitsLayer | |||
| __all__ = [ | |||
| "DebugLoggingLayer", | |||
| "ExecutionLimitsLayer", | |||
| "Layer", | |||
| "GraphEngineLayer", | |||
| ] | |||
| @@ -12,7 +12,7 @@ from core.workflow.graph_engine.protocols.command_channel import CommandChannel | |||
| from core.workflow.graph_events import GraphEngineEvent | |||
| class Layer(ABC): | |||
| class GraphEngineLayer(ABC): | |||
| """ | |||
| Abstract base class for GraphEngine layers. | |||
| @@ -33,11 +33,11 @@ from core.workflow.graph_events import ( | |||
| NodeRunSucceededEvent, | |||
| ) | |||
| from .base import Layer | |||
| from .base import GraphEngineLayer | |||
| @final | |||
| class DebugLoggingLayer(Layer): | |||
| class DebugLoggingLayer(GraphEngineLayer): | |||
| """ | |||
| A layer that provides comprehensive logging of GraphEngine execution. | |||
| @@ -16,7 +16,7 @@ from typing import final | |||
| from typing_extensions import override | |||
| from core.workflow.graph_engine.entities.commands import AbortCommand, CommandType | |||
| from core.workflow.graph_engine.layers import Layer | |||
| from core.workflow.graph_engine.layers import GraphEngineLayer | |||
| from core.workflow.graph_events import ( | |||
| GraphEngineEvent, | |||
| NodeRunStartedEvent, | |||
| @@ -32,7 +32,7 @@ class LimitType(Enum): | |||
| @final | |||
| class ExecutionLimitsLayer(Layer): | |||
| class ExecutionLimitsLayer(GraphEngineLayer): | |||
| """ | |||
| Layer that enforces execution limits for workflows. | |||