| 73 | |
| 74 | @dataclass |
| 75 | class SubgraphInlineConfig(BaseConfig): |
| 76 | graph: Dict[str, Any] |
| 77 | |
| 78 | @classmethod |
| 79 | def from_dict(cls, data: Mapping[str, Any], *, path: str) -> "SubgraphInlineConfig": |
| 80 | mapping = require_mapping(data, path) |
| 81 | return cls(graph=dict(mapping), path=path) |
| 82 | |
| 83 | def validate(self) -> None: |
| 84 | if "nodes" not in self.graph: |
| 85 | raise ConfigError("subgraph config must define nodes", extend_path(self.path, "nodes")) |
| 86 | if "edges" not in self.graph: |
| 87 | raise ConfigError("subgraph config must define edges", extend_path(self.path, "edges")) |
| 88 | |
| 89 | FIELD_SPECS = { |
| 90 | "id": ConfigFieldSpec( |
| 91 | name="id", |
| 92 | display_name="Subgraph ID", |
| 93 | type_hint="str", |
| 94 | required=True, |
| 95 | description="Subgraph identifier", |
| 96 | ), |
| 97 | "description": ConfigFieldSpec( |
| 98 | name="description", |
| 99 | display_name="Subgraph Description", |
| 100 | type_hint="str", |
| 101 | required=False, |
| 102 | description="Describe the subgraph's responsibility, trigger conditions, and success criteria so reviewers know when to call it.", |
| 103 | ), |
| 104 | "log_level": ConfigFieldSpec( |
| 105 | name="log_level", |
| 106 | display_name="Log Level", |
| 107 | type_hint="enum:LogLevel", |
| 108 | required=False, |
| 109 | default=LogLevel.INFO.value, |
| 110 | enum=[lvl.value for lvl in LogLevel], |
| 111 | description="Subgraph runtime log level", |
| 112 | enum_options=enum_options_for(LogLevel), |
| 113 | ), |
| 114 | "is_majority_voting": ConfigFieldSpec( |
| 115 | name="is_majority_voting", |
| 116 | display_name="Majority Voting", |
| 117 | type_hint="bool", |
| 118 | required=False, |
| 119 | default=False, |
| 120 | description="Whether to perform majority voting on node results", |
| 121 | ), |
| 122 | "nodes": ConfigFieldSpec( |
| 123 | name="nodes", |
| 124 | display_name="Node List", |
| 125 | type_hint="list[Node]", |
| 126 | required=True, |
| 127 | description="Subgraph node list, must contain at least one node", |
| 128 | ), |
| 129 | "edges": ConfigFieldSpec( |
| 130 | name="edges", |
| 131 | display_name="Edge List", |
| 132 | type_hint="list[EdgeConfig]", |
nothing calls this directly
no test coverage detected