swarmauri 0.11.0.dev1__tar.gz → 0.11.0.dev6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {swarmauri-0.11.0.dev1 → swarmauri-0.11.0.dev6}/PKG-INFO +12 -5
- {swarmauri-0.11.0.dev1 → swarmauri-0.11.0.dev6}/README.md +4 -1
- {swarmauri-0.11.0.dev1 → swarmauri-0.11.0.dev6}/pyproject.toml +26 -4
- {swarmauri-0.11.0.dev1 → swarmauri-0.11.0.dev6}/swarmauri/__init__.py +2 -1
- {swarmauri-0.11.0.dev1 → swarmauri-0.11.0.dev6}/swarmauri/cli.py +2 -1
- {swarmauri-0.11.0.dev1 → swarmauri-0.11.0.dev6}/swarmauri/importer.py +10 -12
- {swarmauri-0.11.0.dev1 → swarmauri-0.11.0.dev6}/swarmauri/interface_registry.py +24 -11
- {swarmauri-0.11.0.dev1 → swarmauri-0.11.0.dev6}/swarmauri/plugin_citizenship_registry.py +224 -39
- {swarmauri-0.11.0.dev1 → swarmauri-0.11.0.dev6}/swarmauri/plugin_manager.py +88 -51
- {swarmauri-0.11.0.dev1 → swarmauri-0.11.0.dev6}/LICENSE +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: swarmauri
|
|
3
|
-
Version: 0.11.0.
|
|
3
|
+
Version: 0.11.0.dev6
|
|
4
4
|
Summary: Swarmauri namespace microkernel for registry-backed imports, plugin discovery, and composable intelligence infrastructure components.
|
|
5
5
|
License-Expression: Apache-2.0
|
|
6
6
|
License-File: LICENSE
|
|
@@ -29,15 +29,17 @@ Provides-Extra: full
|
|
|
29
29
|
Provides-Extra: llms
|
|
30
30
|
Requires-Dist: httpx (>=0.27.0)
|
|
31
31
|
Requires-Dist: pydantic (>=2.9.2)
|
|
32
|
-
Requires-Dist: swarmauri_base
|
|
33
|
-
Requires-Dist: swarmauri_core
|
|
32
|
+
Requires-Dist: swarmauri_base (>=0.11.0.dev6,<0.12)
|
|
33
|
+
Requires-Dist: swarmauri_core (>=0.11.0.dev6,<0.12)
|
|
34
34
|
Requires-Dist: swarmauri_embedding_doc2vec ; extra == "default"
|
|
35
35
|
Requires-Dist: swarmauri_embedding_doc2vec ; extra == "full"
|
|
36
36
|
Requires-Dist: swarmauri_embedding_nmf ; extra == "default"
|
|
37
37
|
Requires-Dist: swarmauri_embedding_nmf ; extra == "full"
|
|
38
38
|
Requires-Dist: swarmauri_llm_ai21 ; extra == "llms"
|
|
39
39
|
Requires-Dist: swarmauri_llm_anthropic ; extra == "llms"
|
|
40
|
+
Requires-Dist: swarmauri_llm_azureopenai ; extra == "llms"
|
|
40
41
|
Requires-Dist: swarmauri_llm_cerebras ; extra == "llms"
|
|
42
|
+
Requires-Dist: swarmauri_llm_cloudflare ; extra == "llms"
|
|
41
43
|
Requires-Dist: swarmauri_llm_cohere ; extra == "llms"
|
|
42
44
|
Requires-Dist: swarmauri_llm_deepinfra ; extra == "llms"
|
|
43
45
|
Requires-Dist: swarmauri_llm_deepseek ; extra == "llms"
|
|
@@ -48,17 +50,19 @@ Requires-Dist: swarmauri_llm_hyperbolic ; extra == "llms"
|
|
|
48
50
|
Requires-Dist: swarmauri_llm_leptonai ; extra == "llms"
|
|
49
51
|
Requires-Dist: swarmauri_llm_llamacpp ; extra == "llms"
|
|
50
52
|
Requires-Dist: swarmauri_llm_mistral ; extra == "llms"
|
|
53
|
+
Requires-Dist: swarmauri_llm_nvidia_nim ; extra == "llms"
|
|
51
54
|
Requires-Dist: swarmauri_llm_openai ; extra == "llms"
|
|
52
55
|
Requires-Dist: swarmauri_llm_perplexity ; extra == "llms"
|
|
53
56
|
Requires-Dist: swarmauri_llm_playht ; extra == "llms"
|
|
54
57
|
Requires-Dist: swarmauri_llm_whisper ; extra == "llms"
|
|
58
|
+
Requires-Dist: swarmauri_llm_xai ; extra == "llms"
|
|
55
59
|
Requires-Dist: swarmauri_parser_beautifulsoupelement ; extra == "default"
|
|
56
60
|
Requires-Dist: swarmauri_parser_beautifulsoupelement ; extra == "full"
|
|
57
61
|
Requires-Dist: swarmauri_parser_keywordextractor ; extra == "default"
|
|
58
62
|
Requires-Dist: swarmauri_parser_keywordextractor ; extra == "full"
|
|
59
63
|
Requires-Dist: swarmauri_signing_ed25519 ; extra == "default"
|
|
60
64
|
Requires-Dist: swarmauri_signing_ed25519 ; extra == "full"
|
|
61
|
-
Requires-Dist: swarmauri_standard
|
|
65
|
+
Requires-Dist: swarmauri_standard (>=0.11.0.dev8,<0.12)
|
|
62
66
|
Requires-Dist: swarmauri_tool_matplotlib ; extra == "default"
|
|
63
67
|
Requires-Dist: swarmauri_tool_matplotlib ; extra == "full"
|
|
64
68
|
Requires-Dist: swarmauri_vectorstore_doc2vec ; extra == "default"
|
|
@@ -217,7 +221,10 @@ Inspect registered first-party and discovered component paths:
|
|
|
217
221
|
```python
|
|
218
222
|
from swarmauri.plugin_citizenship_registry import PluginCitizenshipRegistry
|
|
219
223
|
|
|
220
|
-
for
|
|
224
|
+
for (
|
|
225
|
+
public_path,
|
|
226
|
+
module_path,
|
|
227
|
+
) in PluginCitizenshipRegistry.total_registry().items():
|
|
221
228
|
print(public_path, "->", module_path)
|
|
222
229
|
```
|
|
223
230
|
|
|
@@ -148,7 +148,10 @@ Inspect registered first-party and discovered component paths:
|
|
|
148
148
|
```python
|
|
149
149
|
from swarmauri.plugin_citizenship_registry import PluginCitizenshipRegistry
|
|
150
150
|
|
|
151
|
-
for
|
|
151
|
+
for (
|
|
152
|
+
public_path,
|
|
153
|
+
module_path,
|
|
154
|
+
) in PluginCitizenshipRegistry.total_registry().items():
|
|
152
155
|
print(public_path, "->", module_path)
|
|
153
156
|
```
|
|
154
157
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "swarmauri"
|
|
3
|
-
version = "0.11.0.
|
|
3
|
+
version = "0.11.0.dev6"
|
|
4
4
|
description = "Swarmauri namespace microkernel for registry-backed imports, plugin discovery, and composable intelligence infrastructure components."
|
|
5
5
|
keywords = [
|
|
6
6
|
"swarmauri",
|
|
@@ -49,9 +49,9 @@ dependencies = [
|
|
|
49
49
|
"httpx>=0.27.0",
|
|
50
50
|
"pydantic>=2.9.2",
|
|
51
51
|
"typing_extensions",
|
|
52
|
-
"swarmauri_core",
|
|
53
|
-
"swarmauri_base",
|
|
54
|
-
"swarmauri_standard",
|
|
52
|
+
"swarmauri_core>=0.11.0.dev6,<0.12",
|
|
53
|
+
"swarmauri_base>=0.11.0.dev6,<0.12",
|
|
54
|
+
"swarmauri_standard>=0.11.0.dev8,<0.12",
|
|
55
55
|
]
|
|
56
56
|
|
|
57
57
|
[project.optional-dependencies]
|
|
@@ -82,7 +82,9 @@ full = [
|
|
|
82
82
|
llms = [
|
|
83
83
|
"swarmauri_llm_ai21",
|
|
84
84
|
"swarmauri_llm_anthropic",
|
|
85
|
+
"swarmauri_llm_azureopenai",
|
|
85
86
|
"swarmauri_llm_cerebras",
|
|
87
|
+
"swarmauri_llm_cloudflare",
|
|
86
88
|
"swarmauri_llm_cohere",
|
|
87
89
|
"swarmauri_llm_deepinfra",
|
|
88
90
|
"swarmauri_llm_deepseek",
|
|
@@ -93,10 +95,12 @@ llms = [
|
|
|
93
95
|
"swarmauri_llm_leptonai",
|
|
94
96
|
"swarmauri_llm_llamacpp",
|
|
95
97
|
"swarmauri_llm_mistral",
|
|
98
|
+
"swarmauri_llm_nvidia_nim",
|
|
96
99
|
"swarmauri_llm_openai",
|
|
97
100
|
"swarmauri_llm_perplexity",
|
|
98
101
|
"swarmauri_llm_playht",
|
|
99
102
|
"swarmauri_llm_whisper",
|
|
103
|
+
"swarmauri_llm_xai",
|
|
100
104
|
]
|
|
101
105
|
|
|
102
106
|
[tool.uv.sources]
|
|
@@ -105,7 +109,9 @@ swarmauri_base = { workspace = true }
|
|
|
105
109
|
swarmauri_standard = { workspace = true }
|
|
106
110
|
swarmauri_llm_ai21 = { workspace = true }
|
|
107
111
|
swarmauri_llm_anthropic = { workspace = true }
|
|
112
|
+
swarmauri_llm_azureopenai = { workspace = true }
|
|
108
113
|
swarmauri_llm_cerebras = { workspace = true }
|
|
114
|
+
swarmauri_llm_cloudflare = { workspace = true }
|
|
109
115
|
swarmauri_llm_cohere = { workspace = true }
|
|
110
116
|
swarmauri_llm_deepinfra = { workspace = true }
|
|
111
117
|
swarmauri_llm_deepseek = { workspace = true }
|
|
@@ -116,10 +122,12 @@ swarmauri_llm_hyperbolic = { workspace = true }
|
|
|
116
122
|
swarmauri_llm_leptonai = { workspace = true }
|
|
117
123
|
swarmauri_llm_llamacpp = { workspace = true }
|
|
118
124
|
swarmauri_llm_mistral = { workspace = true }
|
|
125
|
+
swarmauri_llm_nvidia_nim = { workspace = true }
|
|
119
126
|
swarmauri_llm_openai = { workspace = true }
|
|
120
127
|
swarmauri_llm_perplexity = { workspace = true }
|
|
121
128
|
swarmauri_llm_playht = { workspace = true }
|
|
122
129
|
swarmauri_llm_whisper = { workspace = true }
|
|
130
|
+
swarmauri_llm_xai = { workspace = true }
|
|
123
131
|
swarmauri_vectorstore_doc2vec = { workspace = true }
|
|
124
132
|
swarmauri_embedding_doc2vec = { workspace = true }
|
|
125
133
|
#swarmauri_embedding_tfidf = { workspace = true }
|
|
@@ -173,3 +181,17 @@ dev = [
|
|
|
173
181
|
"ruff>=0.9.9",
|
|
174
182
|
"pytest-benchmark>=4.0.0",
|
|
175
183
|
]
|
|
184
|
+
|
|
185
|
+
[tool.ruff]
|
|
186
|
+
extend = "../pyproject.toml"
|
|
187
|
+
|
|
188
|
+
[tool.ruff.lint]
|
|
189
|
+
ignore = [
|
|
190
|
+
"BLE001",
|
|
191
|
+
"E501",
|
|
192
|
+
"RUF012",
|
|
193
|
+
"S110",
|
|
194
|
+
"SIM118",
|
|
195
|
+
"TRY004",
|
|
196
|
+
"TRY401",
|
|
197
|
+
]
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import argparse
|
|
2
2
|
import logging
|
|
3
3
|
import subprocess
|
|
4
|
+
|
|
5
|
+
from swarmauri.plugin_manager import determine_plugin_manager, get_entry_points
|
|
4
6
|
from swarmauri.registry import list_registry
|
|
5
|
-
from swarmauri.plugin_manager import get_entry_points, determine_plugin_manager
|
|
6
7
|
|
|
7
8
|
logging.basicConfig(level=logging.INFO)
|
|
8
9
|
logger = logging.getLogger(__name__)
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# importer.py
|
|
2
2
|
|
|
3
|
-
import sys
|
|
4
3
|
import importlib
|
|
5
4
|
import logging
|
|
5
|
+
import sys
|
|
6
6
|
from importlib.machinery import ModuleSpec
|
|
7
7
|
from types import ModuleType
|
|
8
8
|
|
|
9
|
-
from .plugin_citizenship_registry import PluginCitizenshipRegistry
|
|
10
9
|
from .interface_registry import InterfaceRegistry
|
|
10
|
+
from .plugin_citizenship_registry import PluginCitizenshipRegistry
|
|
11
11
|
|
|
12
12
|
logger = logging.getLogger(__name__)
|
|
13
13
|
|
|
@@ -48,10 +48,8 @@ class SwarmauriImporter:
|
|
|
48
48
|
)
|
|
49
49
|
if external_module_path:
|
|
50
50
|
logger.debug(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
f"{external_module_path}"
|
|
54
|
-
)
|
|
51
|
+
f"Found external module mapping: {fullname} -> "
|
|
52
|
+
f"{external_module_path}"
|
|
55
53
|
)
|
|
56
54
|
return ModuleSpec(fullname, self)
|
|
57
55
|
|
|
@@ -62,10 +60,8 @@ class SwarmauriImporter:
|
|
|
62
60
|
if external_module_path:
|
|
63
61
|
# If we detect lazy strategy, then we utilize LazyLoader
|
|
64
62
|
logger.debug(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
f"{external_module_path}"
|
|
68
|
-
)
|
|
63
|
+
f"Found external module mapping: {fullname} -> "
|
|
64
|
+
f"{external_module_path}"
|
|
69
65
|
)
|
|
70
66
|
return ModuleSpec(fullname, importlib.util.LazyLoader(self))
|
|
71
67
|
|
|
@@ -80,7 +76,8 @@ class SwarmauriImporter:
|
|
|
80
76
|
|
|
81
77
|
if spec.name in sys.modules:
|
|
82
78
|
logger.debug(
|
|
83
|
-
f"Module '{spec.name}' already in sys.modules. Returning
|
|
79
|
+
f"Module '{spec.name}' already in sys.modules. Returning "
|
|
80
|
+
f"cached module."
|
|
84
81
|
)
|
|
85
82
|
return sys.modules[spec.name]
|
|
86
83
|
|
|
@@ -89,7 +86,8 @@ class SwarmauriImporter:
|
|
|
89
86
|
)
|
|
90
87
|
if external_module_path:
|
|
91
88
|
logger.debug(
|
|
92
|
-
f"Importing external module '{spec.name}' from
|
|
89
|
+
f"Importing external module '{spec.name}' from "
|
|
90
|
+
f"'{external_module_path}'"
|
|
93
91
|
)
|
|
94
92
|
module = importlib.import_module(external_module_path)
|
|
95
93
|
sys.modules[spec.name] = module
|
|
@@ -8,10 +8,9 @@ Provides mechanisms to retrieve and manage interface classes based on resource
|
|
|
8
8
|
namespaces.
|
|
9
9
|
"""
|
|
10
10
|
|
|
11
|
-
from typing import Optional, Type, Dict, Any, List
|
|
12
11
|
import importlib
|
|
13
12
|
import logging
|
|
14
|
-
|
|
13
|
+
from typing import Any
|
|
15
14
|
|
|
16
15
|
# Configure logging
|
|
17
16
|
logger = logging.getLogger(__name__)
|
|
@@ -27,7 +26,7 @@ class InterfaceRegistry:
|
|
|
27
26
|
namespaces.
|
|
28
27
|
"""
|
|
29
28
|
|
|
30
|
-
INTERFACE_IMPORT_PATHS:
|
|
29
|
+
INTERFACE_IMPORT_PATHS: dict[str, str | None] = {
|
|
31
30
|
"swarmauri.agents": "swarmauri_base.agents.AgentBase",
|
|
32
31
|
"swarmauri.chains": "swarmauri_base.chains.ChainBase",
|
|
33
32
|
"swarmauri.chunkers": "swarmauri_base.chunkers.ChunkerBase",
|
|
@@ -49,8 +48,15 @@ class InterfaceRegistry:
|
|
|
49
48
|
"swarmauri.factories": "swarmauri_base.factories.FactoryBase",
|
|
50
49
|
"swarmauri.image_gens": "swarmauri_base.image_gens.ImageGenBase",
|
|
51
50
|
"swarmauri.llms": "swarmauri_base.llms.LLMBase",
|
|
51
|
+
"swarmauri.live_models": ("swarmauri_base.live_models.LiveModelBase"),
|
|
52
|
+
"swarmauri.model_providers": (
|
|
53
|
+
"swarmauri_base.model_providers.ModelProviderBase"
|
|
54
|
+
),
|
|
52
55
|
"swarmauri.tool_llms": "swarmauri_base.tool_llms.ToolLLMBase",
|
|
53
56
|
"swarmauri.tts": "swarmauri_base.tts.TTSBase",
|
|
57
|
+
"swarmauri.video_lipsync": (
|
|
58
|
+
"swarmauri_base.video_lipsync.LipSyncBase"
|
|
59
|
+
),
|
|
54
60
|
"swarmauri.ocrs": "swarmauri_base.ocrs.OCRBase",
|
|
55
61
|
"swarmauri.stt": "swarmauri_base.stt.STTBase",
|
|
56
62
|
"swarmauri.storage_adapters": (
|
|
@@ -72,7 +78,11 @@ class InterfaceRegistry:
|
|
|
72
78
|
"swarmauri.schema_converters": (
|
|
73
79
|
"swarmauri_base.schema_converters.SchemaConverterBase"
|
|
74
80
|
),
|
|
81
|
+
"swarmauri.retrievers": ("swarmauri_base.retrievers.RetrieverBase"),
|
|
75
82
|
"swarmauri.skills": "swarmauri_base.skills.SkillBase",
|
|
83
|
+
"swarmauri.similarities": (
|
|
84
|
+
"swarmauri_base.similarities.SimilarityBase"
|
|
85
|
+
),
|
|
76
86
|
"swarmauri.service_registries": (
|
|
77
87
|
"swarmauri_base.service_registries.ServiceRegistryBase"
|
|
78
88
|
),
|
|
@@ -111,14 +121,14 @@ class InterfaceRegistry:
|
|
|
111
121
|
"swarmauri.tokens": "swarmauri_base.tokens.TokenServiceBase",
|
|
112
122
|
}
|
|
113
123
|
|
|
114
|
-
INTERFACE_REGISTRY:
|
|
124
|
+
INTERFACE_REGISTRY: dict[str, type[Any] | None] = {
|
|
115
125
|
key: None for key in INTERFACE_IMPORT_PATHS
|
|
116
126
|
}
|
|
117
127
|
|
|
118
128
|
@classmethod
|
|
119
129
|
def get_interface_for_resource(
|
|
120
130
|
cls, resource_kind: str
|
|
121
|
-
) ->
|
|
131
|
+
) -> type[Any] | None:
|
|
122
132
|
"""
|
|
123
133
|
Retrieve the interface class for a given resource kind.
|
|
124
134
|
|
|
@@ -149,14 +159,15 @@ class InterfaceRegistry:
|
|
|
149
159
|
)
|
|
150
160
|
else:
|
|
151
161
|
logger.debug(
|
|
152
|
-
f"Retrieved interface '{interface.__name__}' for resource
|
|
162
|
+
f"Retrieved interface '{interface.__name__}' for resource "
|
|
163
|
+
f"kind '{resource_kind}'."
|
|
153
164
|
)
|
|
154
165
|
|
|
155
166
|
return interface
|
|
156
167
|
|
|
157
168
|
@classmethod
|
|
158
169
|
def register_interface(
|
|
159
|
-
cls, resource_kind: str, interface_class:
|
|
170
|
+
cls, resource_kind: str, interface_class: type[Any] | None
|
|
160
171
|
) -> None:
|
|
161
172
|
"""
|
|
162
173
|
Register or update the interface class for a given resource kind.
|
|
@@ -177,12 +188,14 @@ class InterfaceRegistry:
|
|
|
177
188
|
f"{interface_class.__module__}.{interface_class.__name__}"
|
|
178
189
|
)
|
|
179
190
|
logger.info(
|
|
180
|
-
f"Registered interface '{interface_class.__name__}' for
|
|
191
|
+
f"Registered interface '{interface_class.__name__}' for "
|
|
192
|
+
f"resource kind '{resource_kind}'."
|
|
181
193
|
)
|
|
182
194
|
else:
|
|
183
195
|
cls.INTERFACE_IMPORT_PATHS[resource_kind] = None
|
|
184
196
|
logger.info(
|
|
185
|
-
f"Removed interface association for resource kind
|
|
197
|
+
f"Removed interface association for resource kind "
|
|
198
|
+
f"'{resource_kind}'."
|
|
186
199
|
)
|
|
187
200
|
|
|
188
201
|
@classmethod
|
|
@@ -195,7 +208,7 @@ class InterfaceRegistry:
|
|
|
195
208
|
cls.register_interface(resource_kind, None)
|
|
196
209
|
|
|
197
210
|
@classmethod
|
|
198
|
-
def list_registered_interfaces(cls) ->
|
|
211
|
+
def list_registered_interfaces(cls) -> dict[str, type[Any] | None]:
|
|
199
212
|
"""
|
|
200
213
|
List all registered resource kinds and their corresponding interfaces.
|
|
201
214
|
|
|
@@ -205,7 +218,7 @@ class InterfaceRegistry:
|
|
|
205
218
|
return cls.INTERFACE_REGISTRY.copy()
|
|
206
219
|
|
|
207
220
|
@classmethod
|
|
208
|
-
def list_registered_namespaces(cls) ->
|
|
221
|
+
def list_registered_namespaces(cls) -> list[str]:
|
|
209
222
|
"""
|
|
210
223
|
Lists all registered interface namespaces.
|
|
211
224
|
|
|
@@ -10,7 +10,6 @@ first, second, and third-class citizens within the swarmauri framework.
|
|
|
10
10
|
|
|
11
11
|
import logging
|
|
12
12
|
from importlib.metadata import EntryPoint
|
|
13
|
-
from typing import Dict, Optional
|
|
14
13
|
|
|
15
14
|
# Configure logger
|
|
16
15
|
logger = logging.getLogger(__name__)
|
|
@@ -50,7 +49,63 @@ class PluginCitizenshipRegistry:
|
|
|
50
49
|
"""
|
|
51
50
|
|
|
52
51
|
# Class variables for registries
|
|
53
|
-
FIRST_CLASS_REGISTRY:
|
|
52
|
+
FIRST_CLASS_REGISTRY: dict[str, str] = {
|
|
53
|
+
"swarmauri.agents.PackageMaintenanceAgent": (
|
|
54
|
+
"swarmauri_agent_package_maintenance.PackageMaintenanceAgent"
|
|
55
|
+
),
|
|
56
|
+
"swarmauri.tools.RunPackageChecks": (
|
|
57
|
+
"swarmauri_tool_runpackagechecks.RunPackageChecks"
|
|
58
|
+
),
|
|
59
|
+
"swarmauri.tools.UnregisterRuntimeTool": (
|
|
60
|
+
"swarmauri_tool_unregisterruntimetool.UnregisterRuntimeTool"
|
|
61
|
+
),
|
|
62
|
+
"swarmauri.tools.ReplaceRuntimeTool": (
|
|
63
|
+
"swarmauri_tool_replaceruntimetool.ReplaceRuntimeTool"
|
|
64
|
+
),
|
|
65
|
+
"swarmauri.tools.ListRuntimeTools": (
|
|
66
|
+
"swarmauri_tool_listruntimetools.ListRuntimeTools"
|
|
67
|
+
),
|
|
68
|
+
"swarmauri.tools.InspectRuntimeTool": (
|
|
69
|
+
"swarmauri_tool_inspectruntimetool.InspectRuntimeTool"
|
|
70
|
+
),
|
|
71
|
+
"swarmauri.tools.RegisterRuntimeTool": (
|
|
72
|
+
"swarmauri_tool_registerruntimetool.RegisterRuntimeTool"
|
|
73
|
+
),
|
|
74
|
+
"swarmauri.toolkits.SkillsetToolkit": (
|
|
75
|
+
"swarmauri_toolkit_skillset.SkillsetToolkit"
|
|
76
|
+
),
|
|
77
|
+
"swarmauri.tools.ReadSkillResource": (
|
|
78
|
+
"swarmauri_tool_readskillresource.ReadSkillResource"
|
|
79
|
+
),
|
|
80
|
+
"swarmauri.tools.ActivateSkill": (
|
|
81
|
+
"swarmauri_tool_activateskill.ActivateSkill"
|
|
82
|
+
),
|
|
83
|
+
"swarmauri.tools.InspectSkill": (
|
|
84
|
+
"swarmauri_tool_inspectskill.InspectSkill"
|
|
85
|
+
),
|
|
86
|
+
"swarmauri.tools.ListSkills": "swarmauri_tool_listskills.ListSkills",
|
|
87
|
+
"swarmauri.tools.CancelProcessTool": (
|
|
88
|
+
"swarmauri_tool_cancelprocess.CancelProcessTool"
|
|
89
|
+
),
|
|
90
|
+
"swarmauri.tools.WriteStdinTool": (
|
|
91
|
+
"swarmauri_tool_writestdin.WriteStdinTool"
|
|
92
|
+
),
|
|
93
|
+
"swarmauri.tools.ReadProcessOutputTool": (
|
|
94
|
+
"swarmauri_tool_readprocessoutput.ReadProcessOutputTool"
|
|
95
|
+
),
|
|
96
|
+
"swarmauri.tools.RunBashScriptTool": (
|
|
97
|
+
"swarmauri_tool_runbashscript.RunBashScriptTool"
|
|
98
|
+
),
|
|
99
|
+
"swarmauri.tools.RunCommandTool": (
|
|
100
|
+
"swarmauri_tool_runcommand.RunCommandTool"
|
|
101
|
+
),
|
|
102
|
+
"swarmauri.messages.AnswerMessage": (
|
|
103
|
+
"swarmauri_standard.messages.AnswerMessage"
|
|
104
|
+
),
|
|
105
|
+
"swarmauri.messages.QuestionMessage": (
|
|
106
|
+
"swarmauri_standard.messages.QuestionMessage"
|
|
107
|
+
),
|
|
108
|
+
"swarmauri.tools.AskUserTool": "swarmauri_tool_askuser.AskUserTool",
|
|
54
109
|
"swarmauri.skills.DummyFileSystemSkill": (
|
|
55
110
|
"swarmauri_skill_dummy_filesystem.DummyFileSystemSkill"
|
|
56
111
|
),
|
|
@@ -85,6 +140,9 @@ class PluginCitizenshipRegistry:
|
|
|
85
140
|
"swarmauri.signings.JwsSignerVerifier": (
|
|
86
141
|
"swarmauri_signing_jws.JwsSignerVerifier"
|
|
87
142
|
),
|
|
143
|
+
"swarmauri.similarities.GzipSimilarity": (
|
|
144
|
+
"swarmauri_similarity_gzip.GzipSimilarity"
|
|
145
|
+
),
|
|
88
146
|
"swarmauri.cipher_suites.JwaCipherSuite": (
|
|
89
147
|
"swarmauri_cipher_suite_jwa.JwaCipherSuite"
|
|
90
148
|
),
|
|
@@ -193,10 +251,16 @@ class PluginCitizenshipRegistry:
|
|
|
193
251
|
"swarmauri.storage_adapters.S3StorageAdapter": (
|
|
194
252
|
"swarmauri_storage_s3.S3StorageAdapter"
|
|
195
253
|
),
|
|
254
|
+
"swarmauri.storage_adapters.WebDAVStorageAdapter": (
|
|
255
|
+
"swarmauri_storage_webdav.WebDAVStorageAdapter"
|
|
256
|
+
),
|
|
196
257
|
"swarmauri.agents.ExampleAgent": "swm_example_package.ExampleAgent",
|
|
197
258
|
"swarmauri.agents.QAAgent": "swarmauri_standard.agents.QAAgent",
|
|
198
259
|
"swarmauri.agents.RagAgent": "swarmauri_standard.agents.RagAgent",
|
|
199
260
|
"swarmauri.agents.SkillAgent": "swarmauri_agent_skill.SkillAgent",
|
|
261
|
+
"swarmauri.agents.TextToSpeechAgent": (
|
|
262
|
+
"swarmauri_agent_texttospeech.TextToSpeechAgent"
|
|
263
|
+
),
|
|
200
264
|
"swarmauri.agents.SimpleConversationAgent": (
|
|
201
265
|
"swarmauri_standard.agents.SimpleConversationAgent"
|
|
202
266
|
),
|
|
@@ -353,11 +417,16 @@ class PluginCitizenshipRegistry:
|
|
|
353
417
|
"swarmauri.stt.OpenaiSTT": "swarmauri_standard.stt.OpenaiSTT",
|
|
354
418
|
"swarmauri.tts.HyperbolicTTS": "swarmauri_standard.tts.HyperbolicTTS",
|
|
355
419
|
"swarmauri.tts.OpenaiTTS": "swarmauri_standard.tts.OpenaiTTS",
|
|
420
|
+
"swarmauri.tts.PlayHTModel": "swarmauri_tts_playht.PlayHTModel",
|
|
356
421
|
"swarmauri.tts.PlayhtTTS": "swarmauri_standard.tts.PlayhtTTS",
|
|
357
|
-
"swarmauri.vlms.
|
|
358
|
-
"swarmauri.vlms.
|
|
422
|
+
"swarmauri.vlms.OpenAIVLM": "swarmauri_llm_openai.OpenAIVLM",
|
|
423
|
+
"swarmauri.vlms.GeminiVLM": "swarmauri_llm_gemini.GeminiVLM",
|
|
424
|
+
"swarmauri.vlms.AnthropicVLM": "swarmauri_llm_anthropic.AnthropicVLM",
|
|
425
|
+
"swarmauri.vlms.MistralVLM": "swarmauri_llm_mistral.MistralVLM",
|
|
426
|
+
"swarmauri.vlms.FalVLM": "swarmauri_llm_falai.FalVLM",
|
|
427
|
+
"swarmauri.vlms.GroqVLM": "swarmauri_llm_groq.GroqVLM",
|
|
359
428
|
"swarmauri.vlms.HyperbolicVLM": (
|
|
360
|
-
"
|
|
429
|
+
"swarmauri_llm_hyperbolic.HyperbolicVLM"
|
|
361
430
|
),
|
|
362
431
|
"swarmauri.measurements.CompletenessMeasurement": (
|
|
363
432
|
"swarmauri_standard.measurements.CompletenessMeasurement"
|
|
@@ -514,6 +583,9 @@ class PluginCitizenshipRegistry:
|
|
|
514
583
|
# "swarmauri_standard.tools.MatplotlibCsvTool",
|
|
515
584
|
# "swarmauri.tools.MatplotlibTool":
|
|
516
585
|
# "swarmauri_standard.tools.MatplotlibTool",
|
|
586
|
+
"swarmauri.tools.SubprocessTool": (
|
|
587
|
+
"swarmauri_tool_subprocess.SubprocessTool"
|
|
588
|
+
),
|
|
517
589
|
"swarmauri.tools.Parameter": "swarmauri_standard.tools.Parameter",
|
|
518
590
|
"swarmauri.tools.RequestsTool": (
|
|
519
591
|
"swarmauri_standard.tools.RequestsTool"
|
|
@@ -547,6 +619,9 @@ class PluginCitizenshipRegistry:
|
|
|
547
619
|
"swarmauri.transports.HttpsUnicastTransport": (
|
|
548
620
|
"swarmauri_transport_https_unicast.HttpsUnicastTransport"
|
|
549
621
|
),
|
|
622
|
+
"swarmauri.transports.RetryingHttpClient": (
|
|
623
|
+
"swarmauri_transport_retry.RetryingHttpClient"
|
|
624
|
+
),
|
|
550
625
|
"swarmauri.transports.PubSubTransport": (
|
|
551
626
|
"swarmauri_standard.transports.PubSubTransport"
|
|
552
627
|
),
|
|
@@ -677,9 +752,6 @@ class PluginCitizenshipRegistry:
|
|
|
677
752
|
"swarmauri.logger_formatters.LoggerFormatter": (
|
|
678
753
|
"swarmauri_standard.logger_formatters.LoggerFormatter"
|
|
679
754
|
),
|
|
680
|
-
"swarmauri.middlewares.AuthMiddleware": (
|
|
681
|
-
"swarmauri_middleware_auth.AuthMiddleware"
|
|
682
|
-
),
|
|
683
755
|
"swarmauri.middlewares.BulkheadMiddleware": (
|
|
684
756
|
"swarmauri_middleware_bulkhead.BulkheadMiddleware"
|
|
685
757
|
),
|
|
@@ -695,6 +767,9 @@ class PluginCitizenshipRegistry:
|
|
|
695
767
|
"swarmauri.middlewares.GzipCompressionMiddleware": (
|
|
696
768
|
"swarmauri_middleware_gzipcompression.GzipCompressionMiddleware"
|
|
697
769
|
),
|
|
770
|
+
"swarmauri.middlewares.JWTMiddleware": (
|
|
771
|
+
"swarmauri_middleware_jwt.JWTMiddleware"
|
|
772
|
+
),
|
|
698
773
|
"swarmauri.middlewares.LlamaGuardMiddleware": (
|
|
699
774
|
"swarmauri_middleware_llamaguard.LlamaGuardMiddleware"
|
|
700
775
|
),
|
|
@@ -737,18 +812,90 @@ class PluginCitizenshipRegistry:
|
|
|
737
812
|
),
|
|
738
813
|
}
|
|
739
814
|
_KNOWN_GROUPS_CACHE: set[str] | None = None
|
|
740
|
-
SECOND_CLASS_REGISTRY:
|
|
815
|
+
SECOND_CLASS_REGISTRY: dict[str, str] = {
|
|
816
|
+
"swarmauri.video_lipsync.SyncLabsLipSync": (
|
|
817
|
+
"swarmauri_video_lipsync_synclabs.SyncLabsLipSync"
|
|
818
|
+
),
|
|
819
|
+
"swarmauri.model_providers.GeminiProvider": (
|
|
820
|
+
"swarmauri_provider_gemini.GeminiProvider"
|
|
821
|
+
),
|
|
822
|
+
"swarmauri.model_providers.OpenAIProvider": (
|
|
823
|
+
"swarmauri_provider_openai.OpenAIProvider"
|
|
824
|
+
),
|
|
825
|
+
"swarmauri.model_providers.OpenRouterProvider": (
|
|
826
|
+
"swarmauri_provider_openrouter.OpenRouterProvider"
|
|
827
|
+
),
|
|
828
|
+
"swarmauri.model_providers.XAIProvider": (
|
|
829
|
+
"swarmauri_provider_xai.XAIProvider"
|
|
830
|
+
),
|
|
831
|
+
"swarmauri.model_providers.QwenProvider": (
|
|
832
|
+
"swarmauri_provider_qwen.QwenProvider"
|
|
833
|
+
),
|
|
834
|
+
"swarmauri.model_providers.AmazonNovaProvider": (
|
|
835
|
+
"swarmauri_provider_amazon_nova.AmazonNovaProvider"
|
|
836
|
+
),
|
|
837
|
+
"swarmauri.live_models.GeminiLiveModel": (
|
|
838
|
+
"swarmauri_live_model_gemini.GeminiLiveModel"
|
|
839
|
+
),
|
|
840
|
+
"swarmauri.live_models.OpenAIRealtimeModel": (
|
|
841
|
+
"swarmauri_live_model_openai.OpenAIRealtimeModel"
|
|
842
|
+
),
|
|
843
|
+
"swarmauri.live_models.OpenAIResponsesWSModel": (
|
|
844
|
+
"swarmauri_live_model_openai.OpenAIResponsesWSModel"
|
|
845
|
+
),
|
|
846
|
+
"swarmauri.live_models.XAIRealtimeModel": (
|
|
847
|
+
"swarmauri_live_model_xai.XAIRealtimeModel"
|
|
848
|
+
),
|
|
849
|
+
"swarmauri.live_models.QwenOmniRealtimeModel": (
|
|
850
|
+
"swarmauri_live_model_qwen.QwenOmniRealtimeModel"
|
|
851
|
+
),
|
|
852
|
+
"swarmauri.live_models.NovaSonicLiveModel": (
|
|
853
|
+
"swarmauri_live_model_amazon_nova.NovaSonicLiveModel"
|
|
854
|
+
),
|
|
855
|
+
"swarmauri.agents.RealtimeAgent": (
|
|
856
|
+
"swarmauri_agent_realtime.RealtimeAgent"
|
|
857
|
+
),
|
|
858
|
+
"swarmauri.transports.HttpxClient": (
|
|
859
|
+
"swarmauri_transport_httpx.HttpxClient"
|
|
860
|
+
),
|
|
861
|
+
"swarmauri.transports.WebSocketClient": (
|
|
862
|
+
"swarmauri_transport_websocket.WebSocketClient"
|
|
863
|
+
),
|
|
864
|
+
"swarmauri.transports.AwsEventStreamClient": (
|
|
865
|
+
"swarmauri_transport_aws_eventstream.AwsEventStreamClient"
|
|
866
|
+
),
|
|
867
|
+
"swarmauri.tools.QueryImageVectorStoreTool": (
|
|
868
|
+
"swarmauri_tool_queryimagevectorstore.QueryImageVectorStoreTool"
|
|
869
|
+
),
|
|
870
|
+
"swarmauri.tools.QueryKnowledgeBaseTool": (
|
|
871
|
+
"swarmauri_tool_queryknowledgebase.QueryKnowledgeBaseTool"
|
|
872
|
+
),
|
|
741
873
|
"swarmauri.image_gens.LeptonAIImgGenModel": (
|
|
742
874
|
"swarmauri_llm_leptonai.LeptonAIImgGenModel"
|
|
743
875
|
),
|
|
744
876
|
"swarmauri.llms.AI21StudioModel": "swarmauri_llm_ai21.AI21StudioModel",
|
|
877
|
+
"swarmauri.image_gens.OpenRouterImgGenModel": (
|
|
878
|
+
"swarmauri_llm_openrouter.OpenRouterImgGenModel"
|
|
879
|
+
),
|
|
745
880
|
"swarmauri.llms.AnthropicModel": (
|
|
746
881
|
"swarmauri_llm_anthropic.AnthropicModel"
|
|
747
882
|
),
|
|
748
883
|
"swarmauri.llms.AnthropicToolModel": (
|
|
749
884
|
"swarmauri_llm_anthropic.AnthropicToolModel"
|
|
750
885
|
),
|
|
886
|
+
"swarmauri.llms.AzureOpenAIModel": (
|
|
887
|
+
"swarmauri_llm_azureopenai.AzureOpenAIModel"
|
|
888
|
+
),
|
|
889
|
+
"swarmauri.llms.AzureOpenAIToolModel": (
|
|
890
|
+
"swarmauri_llm_azureopenai.AzureOpenAIToolModel"
|
|
891
|
+
),
|
|
751
892
|
"swarmauri.llms.CerebrasModel": "swarmauri_llm_cerebras.CerebrasModel",
|
|
893
|
+
"swarmauri.llms.CloudflareWorkersAIModel": (
|
|
894
|
+
"swarmauri_llm_cloudflare.CloudflareWorkersAIModel"
|
|
895
|
+
),
|
|
896
|
+
"swarmauri.llms.CloudflareWorkersAIToolModel": (
|
|
897
|
+
"swarmauri_llm_cloudflare.CloudflareWorkersAIToolModel"
|
|
898
|
+
),
|
|
752
899
|
"swarmauri.llms.CohereModel": "swarmauri_llm_cohere.CohereModel",
|
|
753
900
|
"swarmauri.llms.CohereToolModel": (
|
|
754
901
|
"swarmauri_llm_cohere.CohereToolModel"
|
|
@@ -783,25 +930,41 @@ class PluginCitizenshipRegistry:
|
|
|
783
930
|
"swarmauri.llms.MistralToolModel": (
|
|
784
931
|
"swarmauri_llm_mistral.MistralToolModel"
|
|
785
932
|
),
|
|
933
|
+
"swarmauri.llms.NvidiaNIMModel": (
|
|
934
|
+
"swarmauri_llm_nvidia_nim.NvidiaNIMModel"
|
|
935
|
+
),
|
|
936
|
+
"swarmauri.llms.NvidiaNIMToolModel": (
|
|
937
|
+
"swarmauri_llm_nvidia_nim.NvidiaNIMToolModel"
|
|
938
|
+
),
|
|
786
939
|
"swarmauri.llms.OpenAIAudio": "swarmauri_llm_openai.OpenAIAudio",
|
|
787
940
|
"swarmauri.llms.OpenAIAudioTTS": "swarmauri_llm_openai.OpenAIAudioTTS",
|
|
788
941
|
"swarmauri.llms.OpenAIModel": "swarmauri_llm_openai.OpenAIModel",
|
|
942
|
+
"swarmauri.llms.OpenRouterModel": (
|
|
943
|
+
"swarmauri_llm_openrouter.OpenRouterModel"
|
|
944
|
+
),
|
|
789
945
|
"swarmauri.llms.OpenAIToolModel": (
|
|
790
946
|
"swarmauri_llm_openai.OpenAIToolModel"
|
|
791
947
|
),
|
|
792
948
|
"swarmauri.llms.PerplexityModel": (
|
|
793
949
|
"swarmauri_llm_perplexity.PerplexityModel"
|
|
794
950
|
),
|
|
795
|
-
"swarmauri.llms.PlayHTModel": "swarmauri_llm_playht.PlayHTModel",
|
|
796
951
|
"swarmauri.llms.WhisperLargeModel": (
|
|
797
952
|
"swarmauri_llm_whisper.WhisperLargeModel"
|
|
798
953
|
),
|
|
954
|
+
"swarmauri.llms.XAIModel": "swarmauri_llm_xai.XAIModel",
|
|
955
|
+
"swarmauri.llms.XAIToolModel": "swarmauri_llm_xai.XAIToolModel",
|
|
799
956
|
"swarmauri.tool_llms.OpenAIToolModel": (
|
|
800
957
|
"swarmauri_llm_openai.OpenAIToolModel"
|
|
801
958
|
),
|
|
959
|
+
"swarmauri.tool_llms.OpenRouterToolModel": (
|
|
960
|
+
"swarmauri_llm_openrouter.OpenRouterToolModel"
|
|
961
|
+
),
|
|
802
962
|
"swarmauri.tool_llms.AnthropicToolModel": (
|
|
803
963
|
"swarmauri_llm_anthropic.AnthropicToolModel"
|
|
804
964
|
),
|
|
965
|
+
"swarmauri.tool_llms.AzureOpenAIToolModel": (
|
|
966
|
+
"swarmauri_llm_azureopenai.AzureOpenAIToolModel"
|
|
967
|
+
),
|
|
805
968
|
"swarmauri.tool_llms.CohereToolModel": (
|
|
806
969
|
"swarmauri_llm_cohere.CohereToolModel"
|
|
807
970
|
),
|
|
@@ -814,11 +977,21 @@ class PluginCitizenshipRegistry:
|
|
|
814
977
|
"swarmauri.tool_llms.MistralToolModel": (
|
|
815
978
|
"swarmauri_llm_mistral.MistralToolModel"
|
|
816
979
|
),
|
|
980
|
+
"swarmauri.tool_llms.CloudflareWorkersAIToolModel": (
|
|
981
|
+
"swarmauri_llm_cloudflare.CloudflareWorkersAIToolModel"
|
|
982
|
+
),
|
|
983
|
+
"swarmauri.tool_llms.NvidiaNIMToolModel": (
|
|
984
|
+
"swarmauri_llm_nvidia_nim.NvidiaNIMToolModel"
|
|
985
|
+
),
|
|
986
|
+
"swarmauri.tool_llms.XAIToolModel": "swarmauri_llm_xai.XAIToolModel",
|
|
987
|
+
"swarmauri.vlms.OpenRouterVLM": (
|
|
988
|
+
"swarmauri_llm_openrouter.OpenRouterVLM"
|
|
989
|
+
),
|
|
817
990
|
}
|
|
818
|
-
THIRD_CLASS_REGISTRY:
|
|
991
|
+
THIRD_CLASS_REGISTRY: dict[str, str] = {}
|
|
819
992
|
|
|
820
993
|
@classmethod
|
|
821
|
-
def total_registry(cls) ->
|
|
994
|
+
def total_registry(cls) -> dict[str, str]:
|
|
822
995
|
"""
|
|
823
996
|
Property: total_registry
|
|
824
997
|
|
|
@@ -860,17 +1033,20 @@ class PluginCitizenshipRegistry:
|
|
|
860
1033
|
|
|
861
1034
|
if class_type not in registry_map:
|
|
862
1035
|
logger.error(
|
|
863
|
-
f"Invalid class type '{class_type}'. Must be 'first',
|
|
1036
|
+
f"Invalid class type '{class_type}'. Must be 'first', "
|
|
1037
|
+
f"'second', or 'third'."
|
|
864
1038
|
)
|
|
865
1039
|
raise ValueError(
|
|
866
|
-
f"Invalid class type '{class_type}'. Must be 'first',
|
|
1040
|
+
f"Invalid class type '{class_type}'. Must be 'first', "
|
|
1041
|
+
f"'second', or 'third'."
|
|
867
1042
|
)
|
|
868
1043
|
|
|
869
1044
|
registry = registry_map[class_type]
|
|
870
1045
|
|
|
871
1046
|
if resource_path in registry:
|
|
872
1047
|
logger.debug(
|
|
873
|
-
f"Resource path '{resource_path}' already exists in the
|
|
1048
|
+
f"Resource path '{resource_path}' already exists in the "
|
|
1049
|
+
f"{class_type}-class registry. Skipping registration."
|
|
874
1050
|
)
|
|
875
1051
|
return
|
|
876
1052
|
|
|
@@ -878,10 +1054,8 @@ class PluginCitizenshipRegistry:
|
|
|
878
1054
|
registry[resource_path] = module_path
|
|
879
1055
|
cls._KNOWN_GROUPS_CACHE = None
|
|
880
1056
|
logger.info(
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
f"{module_path}"
|
|
884
|
-
)
|
|
1057
|
+
f"Added to {class_type}-class registry: {resource_path} -> "
|
|
1058
|
+
f"{module_path}"
|
|
885
1059
|
)
|
|
886
1060
|
|
|
887
1061
|
@classmethod
|
|
@@ -903,20 +1077,24 @@ class PluginCitizenshipRegistry:
|
|
|
903
1077
|
|
|
904
1078
|
if class_type not in registry_map:
|
|
905
1079
|
logger.error(
|
|
906
|
-
f"Invalid class type '{class_type}'. Must be 'first',
|
|
1080
|
+
f"Invalid class type '{class_type}'. Must be 'first', "
|
|
1081
|
+
f"'second', or 'third'."
|
|
907
1082
|
)
|
|
908
1083
|
raise ValueError(
|
|
909
|
-
f"Invalid class type '{class_type}'. Must be 'first',
|
|
1084
|
+
f"Invalid class type '{class_type}'. Must be 'first', "
|
|
1085
|
+
f"'second', or 'third'."
|
|
910
1086
|
)
|
|
911
1087
|
|
|
912
1088
|
registry = registry_map[class_type]
|
|
913
1089
|
|
|
914
1090
|
if resource_path not in registry:
|
|
915
1091
|
logger.error(
|
|
916
|
-
f"Resource path '{resource_path}' does not exist in the
|
|
1092
|
+
f"Resource path '{resource_path}' does not exist in the "
|
|
1093
|
+
f"{class_type}-class registry."
|
|
917
1094
|
)
|
|
918
1095
|
raise KeyError(
|
|
919
|
-
f"Resource path '{resource_path}' does not exist in the
|
|
1096
|
+
f"Resource path '{resource_path}' does not exist in the "
|
|
1097
|
+
f"{class_type}-class registry."
|
|
920
1098
|
)
|
|
921
1099
|
|
|
922
1100
|
# Remove from the specific registry
|
|
@@ -927,7 +1105,7 @@ class PluginCitizenshipRegistry:
|
|
|
927
1105
|
)
|
|
928
1106
|
|
|
929
1107
|
@classmethod
|
|
930
|
-
def list_registry(cls, class_type:
|
|
1108
|
+
def list_registry(cls, class_type: str | None = None) -> dict[str, str]:
|
|
931
1109
|
"""
|
|
932
1110
|
List all entries in a specific registry or the total registry.
|
|
933
1111
|
|
|
@@ -949,17 +1127,19 @@ class PluginCitizenshipRegistry:
|
|
|
949
1127
|
|
|
950
1128
|
if class_type not in registry_map:
|
|
951
1129
|
logger.error(
|
|
952
|
-
f"Invalid class type '{class_type}'. Must be 'first',
|
|
1130
|
+
f"Invalid class type '{class_type}'. Must be 'first', "
|
|
1131
|
+
f"'second', or 'third'."
|
|
953
1132
|
)
|
|
954
1133
|
raise ValueError(
|
|
955
|
-
f"Invalid class type '{class_type}'. Must be 'first',
|
|
1134
|
+
f"Invalid class type '{class_type}'. Must be 'first', "
|
|
1135
|
+
f"'second', or 'third'."
|
|
956
1136
|
)
|
|
957
1137
|
|
|
958
1138
|
logger.debug(f"Listing {class_type}-class registry.")
|
|
959
1139
|
return dict(registry_map[class_type])
|
|
960
1140
|
|
|
961
1141
|
@classmethod
|
|
962
|
-
def get_external_module_path(cls, resource_path: str) ->
|
|
1142
|
+
def get_external_module_path(cls, resource_path: str) -> str | None:
|
|
963
1143
|
"""
|
|
964
1144
|
Get the external module path for a given resource path.
|
|
965
1145
|
|
|
@@ -970,7 +1150,8 @@ class PluginCitizenshipRegistry:
|
|
|
970
1150
|
module_path = cls.total_registry().get(resource_path)
|
|
971
1151
|
if module_path:
|
|
972
1152
|
logger.debug(
|
|
973
|
-
f"Retrieved module path '{module_path}' for resource path
|
|
1153
|
+
f"Retrieved module path '{module_path}' for resource path "
|
|
1154
|
+
f"'{resource_path}'."
|
|
974
1155
|
)
|
|
975
1156
|
else:
|
|
976
1157
|
logger.debug(
|
|
@@ -1021,29 +1202,31 @@ class PluginCitizenshipRegistry:
|
|
|
1021
1202
|
|
|
1022
1203
|
if class_type not in registry_map:
|
|
1023
1204
|
logger.error(
|
|
1024
|
-
f"Invalid class type '{class_type}'. Must be 'first',
|
|
1205
|
+
f"Invalid class type '{class_type}'. Must be 'first', "
|
|
1206
|
+
f"'second', or 'third'."
|
|
1025
1207
|
)
|
|
1026
1208
|
raise ValueError(
|
|
1027
|
-
f"Invalid class type '{class_type}'. Must be 'first',
|
|
1209
|
+
f"Invalid class type '{class_type}'. Must be 'first', "
|
|
1210
|
+
f"'second', or 'third'."
|
|
1028
1211
|
)
|
|
1029
1212
|
|
|
1030
1213
|
registry = registry_map[class_type]
|
|
1031
1214
|
|
|
1032
1215
|
if resource_path not in registry:
|
|
1033
1216
|
logger.error(
|
|
1034
|
-
f"Resource path '{resource_path}' does not exist in the
|
|
1217
|
+
f"Resource path '{resource_path}' does not exist in the "
|
|
1218
|
+
f"{class_type}-class registry."
|
|
1035
1219
|
)
|
|
1036
1220
|
raise KeyError(
|
|
1037
|
-
f"Resource path '{resource_path}' does not exist in the
|
|
1221
|
+
f"Resource path '{resource_path}' does not exist in the "
|
|
1222
|
+
f"{class_type}-class registry."
|
|
1038
1223
|
)
|
|
1039
1224
|
|
|
1040
1225
|
old_module_path = registry[resource_path]
|
|
1041
1226
|
registry[resource_path] = new_module_path
|
|
1042
1227
|
logger.info(
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
f"-> {new_module_path} (was: {old_module_path})"
|
|
1046
|
-
)
|
|
1228
|
+
f"Updated {class_type}-class registry entry: {resource_path} "
|
|
1229
|
+
f"-> {new_module_path} (was: {old_module_path})"
|
|
1047
1230
|
)
|
|
1048
1231
|
|
|
1049
1232
|
@classmethod
|
|
@@ -1060,7 +1243,7 @@ class PluginCitizenshipRegistry:
|
|
|
1060
1243
|
cls.remove_from_registry(class_type, resource_path)
|
|
1061
1244
|
|
|
1062
1245
|
@classmethod
|
|
1063
|
-
def list_all_registries(cls) ->
|
|
1246
|
+
def list_all_registries(cls) -> dict[str, dict[str, str]]:
|
|
1064
1247
|
"""
|
|
1065
1248
|
Lists all registries: first, second, third, and total.
|
|
1066
1249
|
|
|
@@ -1085,7 +1268,8 @@ class PluginCitizenshipRegistry:
|
|
|
1085
1268
|
resource_path = f"{entry_point.group}.{entry_point.name}"
|
|
1086
1269
|
is_first = resource_path in cls.FIRST_CLASS_REGISTRY
|
|
1087
1270
|
logger.debug(
|
|
1088
|
-
f"Plugin '{entry_point.name}' is
|
|
1271
|
+
f"Plugin '{entry_point.name}' is "
|
|
1272
|
+
f"{'first-class' if is_first else 'not first-class'}."
|
|
1089
1273
|
)
|
|
1090
1274
|
return is_first
|
|
1091
1275
|
|
|
@@ -1100,7 +1284,8 @@ class PluginCitizenshipRegistry:
|
|
|
1100
1284
|
resource_path = f"{entry_point.group}.{entry_point.name}"
|
|
1101
1285
|
is_second = resource_path in cls.SECOND_CLASS_REGISTRY
|
|
1102
1286
|
logger.debug(
|
|
1103
|
-
f"Plugin '{entry_point.name}' is
|
|
1287
|
+
f"Plugin '{entry_point.name}' is "
|
|
1288
|
+
f"{'second-class' if is_second else 'not second-class'}."
|
|
1104
1289
|
)
|
|
1105
1290
|
return is_second
|
|
1106
1291
|
|
|
@@ -7,10 +7,9 @@ import json
|
|
|
7
7
|
import logging
|
|
8
8
|
import sys
|
|
9
9
|
from importlib.metadata import EntryPoint
|
|
10
|
-
from typing import Any
|
|
10
|
+
from typing import Any
|
|
11
11
|
|
|
12
12
|
# from swarmauri_base.ComponentBase import ComponentBase
|
|
13
|
-
|
|
14
13
|
from .interface_registry import InterfaceRegistry
|
|
15
14
|
from .plugin_citizenship_registry import PluginCitizenshipRegistry
|
|
16
15
|
|
|
@@ -19,12 +18,12 @@ logger = logging.getLogger(__name__)
|
|
|
19
18
|
# -----------------------------------------------------------------------------
|
|
20
19
|
# 1. GLOBAL CACHE FOR ENTRY POINTS
|
|
21
20
|
# -----------------------------------------------------------------------------
|
|
22
|
-
_cached_entry_points:
|
|
21
|
+
_cached_entry_points: dict[str, list[EntryPoint]] | None = None
|
|
23
22
|
|
|
24
23
|
|
|
25
24
|
def _fetch_and_group_entry_points(
|
|
26
25
|
group_prefix: str = "swarmauri.",
|
|
27
|
-
) ->
|
|
26
|
+
) -> dict[str, list[EntryPoint]]:
|
|
28
27
|
"""Scan environment for relevant entry points grouped by namespace.
|
|
29
28
|
|
|
30
29
|
The previous implementation skipped scanning once the
|
|
@@ -34,7 +33,7 @@ def _fetch_and_group_entry_points(
|
|
|
34
33
|
overhead compared to scanning all entry points.
|
|
35
34
|
"""
|
|
36
35
|
|
|
37
|
-
grouped_entry_points:
|
|
36
|
+
grouped_entry_points: dict[str, list[EntryPoint]] = {}
|
|
38
37
|
try:
|
|
39
38
|
if PluginCitizenshipRegistry.known_groups():
|
|
40
39
|
target_groups = [
|
|
@@ -133,7 +132,8 @@ def process_plugin(entry_point: EntryPoint) -> bool:
|
|
|
133
132
|
preliminary_path = f"swarmauri.{resource_kind}.{entry_point.name}"
|
|
134
133
|
if PluginCitizenshipRegistry.resource_exists(preliminary_path):
|
|
135
134
|
logger.debug(
|
|
136
|
-
f"Resource path '{preliminary_path}' already registered;
|
|
135
|
+
f"Resource path '{preliminary_path}' already registered; "
|
|
136
|
+
f"skipping."
|
|
137
137
|
)
|
|
138
138
|
return True
|
|
139
139
|
|
|
@@ -162,7 +162,8 @@ def process_plugin(entry_point: EntryPoint) -> bool:
|
|
|
162
162
|
# Eager loading: load the plugin module
|
|
163
163
|
plugin_object = entry_point.load()
|
|
164
164
|
logger.debug(
|
|
165
|
-
f"Eagerly loaded plugin '{entry_point.name}' as
|
|
165
|
+
f"Eagerly loaded plugin '{entry_point.name}' as "
|
|
166
|
+
f"{type(plugin_object)}"
|
|
166
167
|
)
|
|
167
168
|
|
|
168
169
|
# Determine plugin type based on entry point's object reference
|
|
@@ -181,7 +182,8 @@ def process_plugin(entry_point: EntryPoint) -> bool:
|
|
|
181
182
|
|
|
182
183
|
except (ImportError, ModuleNotFoundError) as e:
|
|
183
184
|
msg = (
|
|
184
|
-
f"Failed to import plugin '{entry_point.name}' from
|
|
185
|
+
f"Failed to import plugin '{entry_point.name}' from "
|
|
186
|
+
f"'{entry_point.value}'. "
|
|
185
187
|
f"Check that it is installed and imports correctly. Error: {e}"
|
|
186
188
|
)
|
|
187
189
|
logger.error(msg)
|
|
@@ -196,7 +198,7 @@ def process_plugin(entry_point: EntryPoint) -> bool:
|
|
|
196
198
|
return False
|
|
197
199
|
|
|
198
200
|
|
|
199
|
-
def _load_plugin_metadata(entry_point: EntryPoint) ->
|
|
201
|
+
def _load_plugin_metadata(entry_point: EntryPoint) -> dict[str, Any] | None:
|
|
200
202
|
"""
|
|
201
203
|
Attempts to load metadata.json from the plugin's distribution without
|
|
202
204
|
loading the module.
|
|
@@ -244,7 +246,8 @@ def _load_plugin_metadata(entry_point: EntryPoint) -> Optional[Dict[str, Any]]:
|
|
|
244
246
|
) as f:
|
|
245
247
|
metadata = json.load(f)
|
|
246
248
|
logger.debug(
|
|
247
|
-
f"Loaded metadata for plugin '{entry_point.name}':
|
|
249
|
+
f"Loaded metadata for plugin '{entry_point.name}': "
|
|
250
|
+
f"{metadata}"
|
|
248
251
|
)
|
|
249
252
|
return metadata
|
|
250
253
|
else:
|
|
@@ -261,7 +264,8 @@ def _load_plugin_metadata(entry_point: EntryPoint) -> Optional[Dict[str, Any]]:
|
|
|
261
264
|
)
|
|
262
265
|
except json.JSONDecodeError as e:
|
|
263
266
|
logger.error(
|
|
264
|
-
f"Invalid JSON in metadata.json for plugin '{entry_point.name}':
|
|
267
|
+
f"Invalid JSON in metadata.json for plugin '{entry_point.name}': "
|
|
268
|
+
f"{e}"
|
|
265
269
|
)
|
|
266
270
|
except Exception as e:
|
|
267
271
|
logger.exception(
|
|
@@ -271,7 +275,7 @@ def _load_plugin_metadata(entry_point: EntryPoint) -> Optional[Dict[str, Any]]:
|
|
|
271
275
|
|
|
272
276
|
|
|
273
277
|
def _register_lazy_plugin_from_metadata(
|
|
274
|
-
entry_point: EntryPoint, metadata:
|
|
278
|
+
entry_point: EntryPoint, metadata: dict[str, Any]
|
|
275
279
|
) -> None:
|
|
276
280
|
"""
|
|
277
281
|
Registers a lazy-loaded plugin's type and module in the registries based on
|
|
@@ -292,7 +296,8 @@ def _register_lazy_plugin_from_metadata(
|
|
|
292
296
|
module_path, _, attr_path = entry_point.value.partition(":")
|
|
293
297
|
if not module_path or not attr_path:
|
|
294
298
|
msg = (
|
|
295
|
-
f"Invalid entry point value '{entry_point.value}' for plugin
|
|
299
|
+
f"Invalid entry point value '{entry_point.value}' for plugin "
|
|
300
|
+
f"'{entry_point.name}'. "
|
|
296
301
|
f"Expected format 'module_path:attribute_path'."
|
|
297
302
|
)
|
|
298
303
|
logger.error(msg)
|
|
@@ -328,7 +333,8 @@ def _register_lazy_plugin_from_metadata(
|
|
|
328
333
|
citizenship, resource_path, module_path
|
|
329
334
|
)
|
|
330
335
|
logger.info(
|
|
331
|
-
f"Registered {citizenship}-class plugin '{type_name}' at
|
|
336
|
+
f"Registered {citizenship}-class plugin '{type_name}' at "
|
|
337
|
+
f"'{resource_path}' [lazy]"
|
|
332
338
|
)
|
|
333
339
|
|
|
334
340
|
# Import Spec
|
|
@@ -353,17 +359,20 @@ def _register_lazy_plugin_from_metadata(
|
|
|
353
359
|
|
|
354
360
|
except KeyError as e:
|
|
355
361
|
logger.error(
|
|
356
|
-
f"Missing required metadata field: {e} in plugin
|
|
362
|
+
f"Missing required metadata field: {e} in plugin "
|
|
363
|
+
f"'{entry_point.name}'"
|
|
357
364
|
)
|
|
358
365
|
raise PluginValidationError(
|
|
359
366
|
f"Missing required metadata field: {e}"
|
|
360
367
|
) from e
|
|
361
368
|
except Exception as e:
|
|
362
369
|
logger.exception(
|
|
363
|
-
f"Failed to register lazy plugin '{entry_point.name}' from
|
|
370
|
+
f"Failed to register lazy plugin '{entry_point.name}' from "
|
|
371
|
+
f"metadata: {e}"
|
|
364
372
|
)
|
|
365
373
|
raise PluginValidationError(
|
|
366
|
-
f"Failed to register lazy plugin '{entry_point.name}' from
|
|
374
|
+
f"Failed to register lazy plugin '{entry_point.name}' from "
|
|
375
|
+
f"metadata: {e}"
|
|
367
376
|
) from e
|
|
368
377
|
|
|
369
378
|
|
|
@@ -412,7 +421,7 @@ def _process_class_plugin(
|
|
|
412
421
|
entry_point: EntryPoint,
|
|
413
422
|
resource_path: str,
|
|
414
423
|
plugin_class: Any,
|
|
415
|
-
metadata:
|
|
424
|
+
metadata: dict[str, Any] | None = None,
|
|
416
425
|
) -> bool:
|
|
417
426
|
"""
|
|
418
427
|
Processes and registers a class-based plugin.
|
|
@@ -434,18 +443,21 @@ def _process_class_plugin(
|
|
|
434
443
|
try:
|
|
435
444
|
# Step 1: Plugin class already loaded
|
|
436
445
|
logger.debug(
|
|
437
|
-
f"Loaded plugin class '{plugin_class.__name__}' from
|
|
446
|
+
f"Loaded plugin class '{plugin_class.__name__}' from "
|
|
447
|
+
f"'{entry_point.name}'"
|
|
438
448
|
)
|
|
439
449
|
|
|
440
450
|
# Step 2: Determine citizenship classification
|
|
441
451
|
citizenship = determine_plugin_citizenship(entry_point)
|
|
442
452
|
if citizenship:
|
|
443
453
|
logger.info(
|
|
444
|
-
f"Plugin '{entry_point.name}' is classified as
|
|
454
|
+
f"Plugin '{entry_point.name}' is classified as "
|
|
455
|
+
f"{citizenship}-class."
|
|
445
456
|
)
|
|
446
457
|
else:
|
|
447
458
|
logger.warning(
|
|
448
|
-
f"Plugin '{entry_point.name}' has unrecognized citizenship
|
|
459
|
+
f"Plugin '{entry_point.name}' has unrecognized citizenship "
|
|
460
|
+
f"and will not be registered."
|
|
449
461
|
)
|
|
450
462
|
return False
|
|
451
463
|
|
|
@@ -459,12 +471,16 @@ def _process_class_plugin(
|
|
|
459
471
|
)
|
|
460
472
|
|
|
461
473
|
if not issubclass(plugin_class, interface_class):
|
|
462
|
-
msg =
|
|
474
|
+
msg = (
|
|
475
|
+
f"Plugin '{entry_point.name}' must subclass "
|
|
476
|
+
f"'{interface_class.__name__}'."
|
|
477
|
+
)
|
|
463
478
|
logger.error(msg)
|
|
464
479
|
raise PluginValidationError(msg)
|
|
465
480
|
|
|
466
481
|
logger.info(
|
|
467
|
-
f"Validated class-based plugin '{plugin_class.__name__}'
|
|
482
|
+
f"Validated class-based plugin '{plugin_class.__name__}' "
|
|
483
|
+
f"against interface '{interface_class.__name__}'"
|
|
468
484
|
)
|
|
469
485
|
|
|
470
486
|
# Step 4: Register the plugin in PluginCitizenshipRegistry
|
|
@@ -479,7 +495,8 @@ def _process_class_plugin(
|
|
|
479
495
|
citizenship, resource_path, module_path
|
|
480
496
|
)
|
|
481
497
|
logger.info(
|
|
482
|
-
f"Registered {citizenship}-class plugin '{plugin_class.__name__}'
|
|
498
|
+
f"Registered {citizenship}-class plugin '{plugin_class.__name__}' "
|
|
499
|
+
f"at '{resource_path}' in PluginCitizenshipRegistry"
|
|
483
500
|
)
|
|
484
501
|
|
|
485
502
|
# Step 5: Register the plugin class in ComponentBase.TYPE_REGISTRY
|
|
@@ -499,7 +516,8 @@ def _process_class_plugin(
|
|
|
499
516
|
|
|
500
517
|
except PluginValidationError as e:
|
|
501
518
|
logger.error(
|
|
502
|
-
f"Validation failed for class-based plugin '{entry_point.name}':
|
|
519
|
+
f"Validation failed for class-based plugin '{entry_point.name}': "
|
|
520
|
+
f"{e}"
|
|
503
521
|
)
|
|
504
522
|
raise
|
|
505
523
|
except Exception as e:
|
|
@@ -515,7 +533,7 @@ def _process_module_plugin(
|
|
|
515
533
|
entry_point: EntryPoint,
|
|
516
534
|
resource_path: str,
|
|
517
535
|
plugin_module: Any,
|
|
518
|
-
metadata:
|
|
536
|
+
metadata: dict[str, Any] | None = None,
|
|
519
537
|
) -> bool:
|
|
520
538
|
"""
|
|
521
539
|
Processes and registers a module-based plugin.
|
|
@@ -528,14 +546,16 @@ def _process_module_plugin(
|
|
|
528
546
|
try:
|
|
529
547
|
# Module already loaded
|
|
530
548
|
logger.debug(
|
|
531
|
-
f"Loaded plugin module '{plugin_module.__name__}' from
|
|
549
|
+
f"Loaded plugin module '{plugin_module.__name__}' from "
|
|
550
|
+
f"'{entry_point.name}'"
|
|
532
551
|
)
|
|
533
552
|
|
|
534
553
|
# Iterate through __all__ to process each attribute
|
|
535
554
|
module_all = getattr(plugin_module, "__all__", [])
|
|
536
555
|
if not module_all:
|
|
537
556
|
logger.warning(
|
|
538
|
-
f"Module '{plugin_module.__name__}' does not define __all__;
|
|
557
|
+
f"Module '{plugin_module.__name__}' does not define __all__; "
|
|
558
|
+
f"skipping."
|
|
539
559
|
)
|
|
540
560
|
return False
|
|
541
561
|
|
|
@@ -543,7 +563,8 @@ def _process_module_plugin(
|
|
|
543
563
|
try:
|
|
544
564
|
attr = getattr(plugin_module, attr_name)
|
|
545
565
|
logger.debug(
|
|
546
|
-
f"Processing attribute '{attr_name}' in module
|
|
566
|
+
f"Processing attribute '{attr_name}' in module "
|
|
567
|
+
f"'{plugin_module.__name__}'"
|
|
547
568
|
)
|
|
548
569
|
|
|
549
570
|
if inspect.isclass(attr):
|
|
@@ -570,7 +591,10 @@ def _process_module_plugin(
|
|
|
570
591
|
)
|
|
571
592
|
)
|
|
572
593
|
if not issubclass(attr, interface_class):
|
|
573
|
-
msg =
|
|
594
|
+
msg = (
|
|
595
|
+
f"Plugin class '{attr_name}' must subclass "
|
|
596
|
+
f"'{interface_class.__name__}'."
|
|
597
|
+
)
|
|
574
598
|
logger.error(msg)
|
|
575
599
|
raise PluginValidationError(msg)
|
|
576
600
|
|
|
@@ -581,7 +605,8 @@ def _process_module_plugin(
|
|
|
581
605
|
plugin_module.__name__,
|
|
582
606
|
)
|
|
583
607
|
logger.info(
|
|
584
|
-
f"Registered {citizenship}-class plugin
|
|
608
|
+
f"Registered {citizenship}-class plugin "
|
|
609
|
+
f"'{attr_name}' at '{class_resource_path}'"
|
|
585
610
|
)
|
|
586
611
|
|
|
587
612
|
# Register in TYPE_REGISTRY
|
|
@@ -596,7 +621,8 @@ def _process_module_plugin(
|
|
|
596
621
|
|
|
597
622
|
elif citizenship is None:
|
|
598
623
|
logger.warning(
|
|
599
|
-
f"Plugin class '{attr_name}' has unrecognized
|
|
624
|
+
f"Plugin class '{attr_name}' has unrecognized "
|
|
625
|
+
f"citizenship and will not be registered."
|
|
600
626
|
)
|
|
601
627
|
|
|
602
628
|
elif inspect.ismodule(attr):
|
|
@@ -630,26 +656,29 @@ def _process_module_plugin(
|
|
|
630
656
|
plugin_module.__name__,
|
|
631
657
|
)
|
|
632
658
|
logger.info(
|
|
633
|
-
f"Registered third-class generic plugin
|
|
659
|
+
f"Registered third-class generic plugin "
|
|
660
|
+
f"'{attr_name}' at '{generic_resource_path}'"
|
|
634
661
|
)
|
|
635
662
|
else:
|
|
636
663
|
logger.warning(
|
|
637
|
-
f"Generic plugin '{attr_name}' in module
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
664
|
+
f"Generic plugin '{attr_name}' in module "
|
|
665
|
+
f"'{plugin_module.__name__}' "
|
|
666
|
+
"is not classified as third-class citizen and "
|
|
667
|
+
"cannot be "
|
|
668
|
+
"registered."
|
|
642
669
|
)
|
|
643
670
|
continue
|
|
644
671
|
|
|
645
672
|
except PluginValidationError as ve:
|
|
646
673
|
logger.error(
|
|
647
|
-
f"Validation failed for attribute '{attr_name}' in module
|
|
674
|
+
f"Validation failed for attribute '{attr_name}' in module "
|
|
675
|
+
f"'{plugin_module.__name__}': {ve}"
|
|
648
676
|
)
|
|
649
677
|
continue
|
|
650
678
|
except Exception as e:
|
|
651
679
|
logger.exception(
|
|
652
|
-
f"Failed to process attribute '{attr_name}' in module
|
|
680
|
+
f"Failed to process attribute '{attr_name}' in module "
|
|
681
|
+
f"'{plugin_module.__name__}': {e}"
|
|
653
682
|
)
|
|
654
683
|
continue
|
|
655
684
|
|
|
@@ -668,7 +697,7 @@ def _process_generic_plugin(
|
|
|
668
697
|
entry_point: EntryPoint,
|
|
669
698
|
resource_path: str,
|
|
670
699
|
_plugin_object: Any,
|
|
671
|
-
metadata:
|
|
700
|
+
metadata: dict[str, Any] | None = None,
|
|
672
701
|
) -> bool:
|
|
673
702
|
"""
|
|
674
703
|
Processes and registers a generic plugin.
|
|
@@ -683,7 +712,9 @@ def _process_generic_plugin(
|
|
|
683
712
|
citizenship = determine_plugin_citizenship(entry_point)
|
|
684
713
|
if citizenship != "third":
|
|
685
714
|
logger.warning(
|
|
686
|
-
f"Generic plugin '{entry_point.name}' is not classified as
|
|
715
|
+
f"Generic plugin '{entry_point.name}' is not classified as "
|
|
716
|
+
f"third-class citizen and cannot be registered under "
|
|
717
|
+
f"protected namespaces."
|
|
687
718
|
)
|
|
688
719
|
return False
|
|
689
720
|
|
|
@@ -692,7 +723,8 @@ def _process_generic_plugin(
|
|
|
692
723
|
"third", resource_path, entry_point.value.split(":")[0]
|
|
693
724
|
)
|
|
694
725
|
logger.info(
|
|
695
|
-
f"Registered generic plugin '{entry_point.name}' under
|
|
726
|
+
f"Registered generic plugin '{entry_point.name}' under "
|
|
727
|
+
f"'{resource_path}' for lazy loading."
|
|
696
728
|
)
|
|
697
729
|
|
|
698
730
|
# Register in TYPE_REGISTRY
|
|
@@ -715,7 +747,7 @@ def _process_generic_plugin(
|
|
|
715
747
|
# -----------------------------------------------------------------------------
|
|
716
748
|
# 4. HELPER FUNCTIONS
|
|
717
749
|
# -----------------------------------------------------------------------------
|
|
718
|
-
def determine_plugin_citizenship(entry_point: EntryPoint) ->
|
|
750
|
+
def determine_plugin_citizenship(entry_point: EntryPoint) -> str | None:
|
|
719
751
|
"""
|
|
720
752
|
Determines the citizenship classification of a plugin based on its entry
|
|
721
753
|
point.
|
|
@@ -777,7 +809,8 @@ def determine_plugin_citizenship(entry_point: EntryPoint) -> Optional[str]:
|
|
|
777
809
|
# Check for Third-Class Plugins
|
|
778
810
|
if group == "swarmauri.plugins":
|
|
779
811
|
logger.debug(
|
|
780
|
-
f"Plugin '{name}' classified as third-class (mapped under
|
|
812
|
+
f"Plugin '{name}' classified as third-class (mapped under "
|
|
813
|
+
f"'swarmauri.plugins')."
|
|
781
814
|
)
|
|
782
815
|
return "third"
|
|
783
816
|
|
|
@@ -792,23 +825,26 @@ def determine_plugin_citizenship(entry_point: EntryPoint) -> Optional[str]:
|
|
|
792
825
|
# Use PluginCitizenshipRegistry to check if it's first-class
|
|
793
826
|
if PluginCitizenshipRegistry.is_first_class(entry_point):
|
|
794
827
|
logger.debug(
|
|
795
|
-
f"Plugin '{name}' classified as first-class
|
|
828
|
+
f"Plugin '{name}' classified as first-class "
|
|
829
|
+
f"(pre-registered)."
|
|
796
830
|
)
|
|
797
831
|
return "first"
|
|
798
832
|
else:
|
|
799
833
|
logger.debug(
|
|
800
|
-
f"Plugin '{name}' classified as second-class
|
|
834
|
+
f"Plugin '{name}' classified as second-class "
|
|
835
|
+
f"(community-contributed)."
|
|
801
836
|
)
|
|
802
837
|
return "second"
|
|
803
838
|
|
|
804
839
|
# If none of the conditions match, the plugin is unrecognized
|
|
805
840
|
logger.warning(
|
|
806
|
-
f"Plugin '{name}' does not match any recognized citizenship
|
|
841
|
+
f"Plugin '{name}' does not match any recognized citizenship "
|
|
842
|
+
f"classification."
|
|
807
843
|
)
|
|
808
844
|
return None
|
|
809
845
|
|
|
810
846
|
|
|
811
|
-
def _extract_resource_kind_from_group(group: str) ->
|
|
847
|
+
def _extract_resource_kind_from_group(group: str) -> str | None:
|
|
812
848
|
"""
|
|
813
849
|
Extract the resource kind from something like 'swarmauri.chunkers'
|
|
814
850
|
or 'swarmauri.utils'. E.g. 'swarmauri.utils' => 'utils'.
|
|
@@ -840,7 +876,8 @@ def discover_and_register_plugins(group_prefix="swarmauri."):
|
|
|
840
876
|
)
|
|
841
877
|
except PluginValidationError as e:
|
|
842
878
|
logger.error(
|
|
843
|
-
f"Skipping plugin '{ep.name}' due to validation
|
|
879
|
+
f"Skipping plugin '{ep.name}' due to validation "
|
|
880
|
+
f"error: {e}"
|
|
844
881
|
)
|
|
845
882
|
except Exception as e:
|
|
846
883
|
logger.exception(
|
|
@@ -848,7 +885,7 @@ def discover_and_register_plugins(group_prefix="swarmauri."):
|
|
|
848
885
|
)
|
|
849
886
|
|
|
850
887
|
|
|
851
|
-
def get_plugin_type_info(resource_path: str) ->
|
|
888
|
+
def get_plugin_type_info(resource_path: str) -> dict[str, Any] | None:
|
|
852
889
|
"""
|
|
853
890
|
Retrieves the plugin's type information from the registries without loading
|
|
854
891
|
the module.
|
|
File without changes
|