File size: 659 Bytes
14c1acb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from __future__ import annotations
from dataclasses import dataclass, field
from typing import Any, Protocol

@dataclass(frozen=True)
class SectionSpec:
    name: str
    kind: str
    version: str = "1"
    secret_names: tuple[str, ...] = ()
    capabilities: tuple[str, ...] = ("ingest", "process", "publish")
    metadata: dict[str, Any] = field(default_factory=dict)

class SectionAdapter(Protocol):
    spec: SectionSpec
    def ingest(self, item: dict[str, Any]) -> dict[str, Any]: ...
    def process(self, item: dict[str, Any], ai_gateway: Any) -> dict[str, Any]: ...
    def publish(self, item: dict[str, Any], publisher: Any) -> dict[str, Any]: ...