Protocol definitions for worker communication and plugin manager integration.
Request and Response Types
These enums define the message types used for communication between the parent process and worker processes. The parent sends requests and the worker responds with various response types.
These dataclasses define the structure of messages passed through multiprocessing queues. They provide to_dict() and from_dict() methods for serialization since objects passed through queues need to be picklable.
# Test WorkerStreamChunkchunk = WorkerStreamChunk( job_id='test-456', chunk='This is a streaming chunk', is_final=False, metadata={'index': 1})chunk.to_dict()
{'type': 'stream_chunk',
'job_id': 'test-456',
'chunk': 'This is a streaming chunk',
'is_final': False,
'metadata': {'index': 1}}
The PluginManagerAdapter is a Protocol class that uses structural subtyping (duck typing). Any class that implements these methods will satisfy the protocol, even without explicit inheritance.
This protocol defines the interface that plugin managers must implement to work with the worker system. It handles: - Plugin discovery and loading - Plugin execution (both standard and streaming) - Plugin lifecycle management (reload/unload) - Streaming capability detection