monkeybrain-cerebellum 1.0.0__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.
Files changed (65) hide show
  1. monkeybrain_cerebellum-1.0.0/PKG-INFO +77 -0
  2. monkeybrain_cerebellum-1.0.0/README.md +44 -0
  3. monkeybrain_cerebellum-1.0.0/cerebellum/__init__.py +35 -0
  4. monkeybrain_cerebellum-1.0.0/cerebellum/adapter.py +84 -0
  5. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/__init__.py +0 -0
  6. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/agent/__init__.py +0 -0
  7. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/agent/agents.py +65 -0
  8. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/ai/__init__.py +0 -0
  9. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/ai/providers.py +106 -0
  10. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/api/__init__.py +0 -0
  11. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/api/graphql.py +35 -0
  12. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/api/rest_api.py +45 -0
  13. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/api/webhook.py +30 -0
  14. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/browser/__init__.py +0 -0
  15. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/browser/browsers.py +27 -0
  16. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/cloud/__init__.py +0 -0
  17. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/cloud/cloud.py +46 -0
  18. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/communication/__init__.py +0 -0
  19. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/communication/communication.py +62 -0
  20. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/database/__init__.py +0 -0
  21. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/database/elasticsearch.py +40 -0
  22. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/database/influxdb.py +37 -0
  23. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/database/mongodb.py +50 -0
  24. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/database/neo4j.py +32 -0
  25. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/database/redis.py +44 -0
  26. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/enterprise/__init__.py +0 -0
  27. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/enterprise/opensource.py +180 -0
  28. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/enterprise/proprietary.py +313 -0
  29. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/event_streaming/__init__.py +0 -0
  30. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/event_streaming/streaming.py +38 -0
  31. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/infrastructure/__init__.py +0 -0
  32. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/infrastructure/infrastructure.py +30 -0
  33. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/productivity/__init__.py +0 -0
  34. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/productivity/productivity.py +158 -0
  35. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/robotics/__init__.py +0 -0
  36. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/robotics/robotics.py +124 -0
  37. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/runtime/__init__.py +0 -0
  38. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/runtime/runtimes.py +92 -0
  39. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/search/__init__.py +0 -0
  40. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/search/search.py +63 -0
  41. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/source_control/__init__.py +0 -0
  42. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/source_control/source_control.py +113 -0
  43. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/storage/__init__.py +0 -0
  44. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/storage/storage.py +94 -0
  45. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/workflow/__init__.py +0 -0
  46. monkeybrain_cerebellum-1.0.0/cerebellum/capabilities/workflow/workflows.py +49 -0
  47. monkeybrain_cerebellum-1.0.0/cerebellum/capability.py +108 -0
  48. monkeybrain_cerebellum-1.0.0/cerebellum/config.py +157 -0
  49. monkeybrain_cerebellum-1.0.0/cerebellum/fallback.py +147 -0
  50. monkeybrain_cerebellum-1.0.0/cerebellum/fallback_engine.py +128 -0
  51. monkeybrain_cerebellum-1.0.0/cerebellum/key_manager.py +129 -0
  52. monkeybrain_cerebellum-1.0.0/cerebellum/keystore.py +179 -0
  53. monkeybrain_cerebellum-1.0.0/cerebellum/lifecycle.py +54 -0
  54. monkeybrain_cerebellum-1.0.0/cerebellum/metadata.py +61 -0
  55. monkeybrain_cerebellum-1.0.0/cerebellum/operator/base.py +28 -0
  56. monkeybrain_cerebellum-1.0.0/cerebellum/peripheral.py +92 -0
  57. monkeybrain_cerebellum-1.0.0/cerebellum/registry.py +98 -0
  58. monkeybrain_cerebellum-1.0.0/cerebellum/resolve_entity_capability.py +264 -0
  59. monkeybrain_cerebellum-1.0.0/monkeybrain_cerebellum.egg-info/PKG-INFO +77 -0
  60. monkeybrain_cerebellum-1.0.0/monkeybrain_cerebellum.egg-info/SOURCES.txt +63 -0
  61. monkeybrain_cerebellum-1.0.0/monkeybrain_cerebellum.egg-info/dependency_links.txt +1 -0
  62. monkeybrain_cerebellum-1.0.0/monkeybrain_cerebellum.egg-info/requires.txt +19 -0
  63. monkeybrain_cerebellum-1.0.0/monkeybrain_cerebellum.egg-info/top_level.txt +1 -0
  64. monkeybrain_cerebellum-1.0.0/pyproject.toml +46 -0
  65. monkeybrain_cerebellum-1.0.0/setup.cfg +4 -0
@@ -0,0 +1,77 @@
1
+ Metadata-Version: 2.4
2
+ Name: monkeybrain-cerebellum
3
+ Version: 1.0.0
4
+ Summary: MonkeyBrain Cerebellum — Capability framework for the Cognitive Operating System
5
+ Author: Prashun Javeri
6
+ License: Proprietary
7
+ Keywords: ai,capabilities,cognitive-os,agent,framework
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Classifier: Programming Language :: Python :: 3.14
15
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
16
+ Requires-Python: >=3.11
17
+ Description-Content-Type: text/markdown
18
+ Requires-Dist: pydantic
19
+ Requires-Dist: httpx
20
+ Provides-Extra: ai
21
+ Requires-Dist: openai; extra == "ai"
22
+ Requires-Dist: anthropic; extra == "ai"
23
+ Provides-Extra: databases
24
+ Requires-Dist: motor; extra == "databases"
25
+ Requires-Dist: pymongo; extra == "databases"
26
+ Requires-Dist: redis[asyncio]; extra == "databases"
27
+ Requires-Dist: neo4j; extra == "databases"
28
+ Requires-Dist: influxdb-client; extra == "databases"
29
+ Provides-Extra: enterprise
30
+ Requires-Dist: elasticsearch[async]; extra == "enterprise"
31
+ Provides-Extra: all
32
+ Requires-Dist: monkeybrain-cerebellum[ai,databases,enterprise]; extra == "all"
33
+
34
+ # MonkeyBrain Cerebellum
35
+
36
+ Capability framework for the MonkeyBrain Cognitive Operating System.
37
+
38
+ ## Features
39
+
40
+ - **Capability** base class for execution primitives
41
+ - **CapabilityRegistry** for discovery and management
42
+ - **Peripheral** abstraction for I/O
43
+ - **Lifecycle** management
44
+ - **FallbackEngine** for graceful degradation
45
+ - **SecureKeystore** for API keys
46
+ - **24 capability categories** across AI, databases, enterprise, and more
47
+
48
+ ## Installation
49
+
50
+ ```bash
51
+ pip install monkeybrain-cerebellum
52
+
53
+ # With optional dependencies
54
+ pip install monkeybrain-cerebellum[ai] # AI providers
55
+ pip install monkeybrain-cerebellum[databases] # Database drivers
56
+ pip install monkeybrain-cerebellum[enterprise] # Elasticsearch
57
+ pip install monkeybrain-cerebellum[all] # Everything
58
+ ```
59
+
60
+ ## Quick Start
61
+
62
+ ```python
63
+ from cerebellum import Capability, CapabilityRegistry
64
+
65
+ class MyCapability(Capability):
66
+ name = "my-capability"
67
+
68
+ async def execute(self, state, inputs):
69
+ return {"result": "done"}
70
+
71
+ registry = CapabilityRegistry()
72
+ registry.register(MyCapability())
73
+ ```
74
+
75
+ ## License
76
+
77
+ Proprietary
@@ -0,0 +1,44 @@
1
+ # MonkeyBrain Cerebellum
2
+
3
+ Capability framework for the MonkeyBrain Cognitive Operating System.
4
+
5
+ ## Features
6
+
7
+ - **Capability** base class for execution primitives
8
+ - **CapabilityRegistry** for discovery and management
9
+ - **Peripheral** abstraction for I/O
10
+ - **Lifecycle** management
11
+ - **FallbackEngine** for graceful degradation
12
+ - **SecureKeystore** for API keys
13
+ - **24 capability categories** across AI, databases, enterprise, and more
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ pip install monkeybrain-cerebellum
19
+
20
+ # With optional dependencies
21
+ pip install monkeybrain-cerebellum[ai] # AI providers
22
+ pip install monkeybrain-cerebellum[databases] # Database drivers
23
+ pip install monkeybrain-cerebellum[enterprise] # Elasticsearch
24
+ pip install monkeybrain-cerebellum[all] # Everything
25
+ ```
26
+
27
+ ## Quick Start
28
+
29
+ ```python
30
+ from cerebellum import Capability, CapabilityRegistry
31
+
32
+ class MyCapability(Capability):
33
+ name = "my-capability"
34
+
35
+ async def execute(self, state, inputs):
36
+ return {"result": "done"}
37
+
38
+ registry = CapabilityRegistry()
39
+ registry.register(MyCapability())
40
+ ```
41
+
42
+ ## License
43
+
44
+ Proprietary
@@ -0,0 +1,35 @@
1
+ """MonkeyBrain Cerebellum — Capability framework.
2
+
3
+ The Cerebellum provides:
4
+ - Capability base class and manifest
5
+ - Capability registry for discovery and management
6
+ - Peripheral abstraction for I/O
7
+ - Lifecycle management
8
+ - Fallback engine for graceful degradation
9
+ - Secure keystore for API keys
10
+ """
11
+
12
+ from cerebellum.capability import Capability, CapabilityManifest
13
+ from cerebellum.registry import CapabilityRegistry
14
+ from cerebellum.peripheral import Peripheral
15
+ from cerebellum.lifecycle import CapabilityLifecycle
16
+ from cerebellum.metadata import CapabilityMetadata
17
+ from cerebellum.config import CerebellumConfig
18
+ from cerebellum.fallback_engine import FallbackEngine
19
+ from cerebellum.keystore import SecureKeystore
20
+ from cerebellum.key_manager import KeyManager
21
+
22
+ __version__ = "1.0.0"
23
+
24
+ __all__ = [
25
+ "Capability",
26
+ "CapabilityManifest",
27
+ "CapabilityRegistry",
28
+ "Peripheral",
29
+ "CapabilityLifecycle",
30
+ "CapabilityMetadata",
31
+ "CerebellumConfig",
32
+ "FallbackEngine",
33
+ "SecureKeystore",
34
+ "KeyManager",
35
+ ]
@@ -0,0 +1,84 @@
1
+ """Adapter — transforms data between capability and peripheral.
2
+
3
+ Adapters handle:
4
+ - Data format conversion
5
+ - Protocol translation
6
+ - Schema mapping
7
+ - Error transformation
8
+ """
9
+
10
+ from __future__ import annotations
11
+
12
+ from dataclasses import dataclass, field
13
+ from typing import Any
14
+ from uuid import uuid4
15
+
16
+ from cerebellum.peripheral import Peripheral
17
+
18
+
19
+ @dataclass
20
+ class AdapterSchema:
21
+ """Schema for adapter data transformation."""
22
+
23
+ name: str = ""
24
+ fields: list[dict[str, Any]] = field(default_factory=list)
25
+ metadata: dict[str, Any] = field(default_factory=dict)
26
+
27
+
28
+ class Adapter:
29
+ """Transforms data between capability and peripheral.
30
+
31
+ Responsibilities:
32
+ - Read from peripheral and transform
33
+ - Transform and write to peripheral
34
+ - Map data schemas
35
+
36
+ The Adapter never:
37
+ - Makes execution decisions
38
+ - Manages connections
39
+ - Owns execution policy
40
+ """
41
+
42
+ def __init__(
43
+ self,
44
+ name: str,
45
+ peripheral: Peripheral,
46
+ schema: AdapterSchema | None = None,
47
+ ):
48
+ self.name = name
49
+ self.peripheral = peripheral
50
+ self.schema = schema or AdapterSchema()
51
+ self._id = f"adapter-{uuid4().hex[:8]}"
52
+
53
+ @property
54
+ def id(self) -> str:
55
+ return self._id
56
+
57
+ async def read(self, query: dict[str, Any]) -> dict[str, Any]:
58
+ """Read from peripheral and transform.
59
+
60
+ Override this method to implement read logic.
61
+ """
62
+ raise NotImplementedError(f"Adapter '{self.name}' must implement read()")
63
+
64
+ async def write(self, data: dict[str, Any]) -> dict[str, Any]:
65
+ """Transform and write to peripheral.
66
+
67
+ Override this method to implement write logic.
68
+ """
69
+ raise NotImplementedError(f"Adapter '{self.name}' must implement write()")
70
+
71
+ async def transform(self, data: dict[str, Any]) -> dict[str, Any]:
72
+ """Transform data without I/O.
73
+
74
+ Override this method to implement transformation logic.
75
+ """
76
+ return data
77
+
78
+ def to_dict(self) -> dict[str, Any]:
79
+ return {
80
+ "id": self._id,
81
+ "name": self.name,
82
+ "peripheral": self.peripheral.name,
83
+ "schema": self.schema.name,
84
+ }
@@ -0,0 +1,65 @@
1
+ """Agent Capabilities — agent-to-agent communication."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any
6
+ from cerebellum.capability import Capability
7
+
8
+
9
+ class OpenClawCapability(Capability):
10
+ def __init__(self, api_url: str = ""):
11
+ super().__init__(name='openclaw')
12
+ self._api_url = api_url
13
+ async def execute(self, state, **kwargs):
14
+ return {"status": "configured", "agent": "openclaw"}
15
+
16
+
17
+ class ExternalAgentCapability(Capability):
18
+ def __init__(self, agent_url: str = ""):
19
+ super().__init__(name='external_agent')
20
+ self._agent_url = agent_url
21
+ async def execute(self, state, **kwargs):
22
+ import httpx
23
+ async with httpx.AsyncClient() as client:
24
+ response = await client.post(self._agent_url, json=state)
25
+ return response.json()
26
+
27
+
28
+ class AgentToAgentCapability(Capability):
29
+ def __init__(self):
30
+ super().__init__(name='agent_to_agent')
31
+ async def execute(self, state, **kwargs):
32
+ return {"status": "configured", "communication": "agent_to_agent"}
33
+
34
+
35
+ class RemoteAgentExecutionCapability(Capability):
36
+ def __init__(self, remote_url: str = ""):
37
+ super().__init__(name='remote_agent_execution')
38
+ self._remote_url = remote_url
39
+ async def execute(self, state, **kwargs):
40
+ import httpx
41
+ async with httpx.AsyncClient() as client:
42
+ response = await client.post(f"{self._remote_url}/execute", json=state)
43
+ return response.json()
44
+
45
+
46
+ class AgentDiscoveryCapability(Capability):
47
+ def __init__(self, registry_url: str = ""):
48
+ super().__init__(name='agent_discovery')
49
+ self._registry_url = registry_url
50
+ async def execute(self, state, **kwargs):
51
+ import httpx
52
+ async with httpx.AsyncClient() as client:
53
+ response = await client.get(f"{self._registry_url}/agents")
54
+ return response.json()
55
+
56
+
57
+ class AgentRegistryCapability(Capability):
58
+ def __init__(self, registry_url: str = ""):
59
+ super().__init__(name='agent_registry')
60
+ self._registry_url = registry_url
61
+ async def execute(self, state, **kwargs):
62
+ import httpx
63
+ async with httpx.AsyncClient() as client:
64
+ response = await client.post(f"{self._registry_url}/register", json=state)
65
+ return response.json()
@@ -0,0 +1,106 @@
1
+ """AI Provider Capabilities — LLM and AI integrations."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any
6
+ from cerebellum.capability import Capability
7
+
8
+
9
+ class OpenAICapability(Capability):
10
+ def __init__(self, api_key: str = ""):
11
+ super().__init__(name='openai')
12
+ self._api_key = api_key
13
+ async def execute(self, state, **kwargs):
14
+ import httpx
15
+ async with httpx.AsyncClient() as client:
16
+ response = await client.post(
17
+ "https://api.openai.com/v1/chat/completions",
18
+ headers={"Authorization": f"Bearer {self._api_key}"},
19
+ json={"model": state.get("model", "gpt-4"), "messages": [{"role": "user", "content": state.get("prompt", "")}]}
20
+ )
21
+ return response.json()
22
+
23
+
24
+ class AnthropicCapability(Capability):
25
+ def __init__(self, api_key: str = ""):
26
+ super().__init__(name='anthropic')
27
+ self._api_key = api_key
28
+ async def execute(self, state, **kwargs):
29
+ import httpx
30
+ async with httpx.AsyncClient() as client:
31
+ response = await client.post(
32
+ "https://api.anthropic.com/v1/messages",
33
+ headers={"x-api-key": self._api_key, "anthropic-version": "2023-06-01"},
34
+ json={"model": state.get("model", "claude-3"), "messages": [{"role": "user", "content": state.get("prompt", "")}]}
35
+ )
36
+ return response.json()
37
+
38
+
39
+ class GeminiCapability(Capability):
40
+ def __init__(self, api_key: str = ""):
41
+ super().__init__(name='gemini')
42
+ self._api_key = api_key
43
+ async def execute(self, state, **kwargs):
44
+ return {"status": "configured", "provider": "google_gemini"}
45
+
46
+
47
+ class AzureOpenAICapability(Capability):
48
+ def __init__(self, endpoint: str = "", api_key: str = ""):
49
+ super().__init__(name='azure_openai')
50
+ self._endpoint = endpoint
51
+ self._api_key = api_key
52
+ async def execute(self, state, **kwargs):
53
+ return {"status": "configured", "provider": "azure_openai"}
54
+
55
+
56
+ class AWSBedrockCapability(Capability):
57
+ def __init__(self, region: str = "us-east-1"):
58
+ super().__init__(name='aws_bedrock')
59
+ self._region = region
60
+ async def execute(self, state, **kwargs):
61
+ return {"status": "configured", "provider": "aws_bedrock"}
62
+
63
+
64
+ class OllamaCapability(Capability):
65
+ def __init__(self, url: str = "http://localhost:11434"):
66
+ super().__init__(name='ollama')
67
+ self._url = url
68
+ async def execute(self, state, **kwargs):
69
+ import httpx
70
+ async with httpx.AsyncClient() as client:
71
+ response = await client.post(
72
+ f"{self._url}/api/chat",
73
+ json={"model": state.get("model", "gemma3:latest"), "messages": [{"role": "user", "content": state.get("prompt", "")}]}
74
+ )
75
+ return response.json()
76
+
77
+
78
+ class HuggingFaceCapability(Capability):
79
+ def __init__(self, api_key: str = ""):
80
+ super().__init__(name='huggingface')
81
+ self._api_key = api_key
82
+ async def execute(self, state, **kwargs):
83
+ return {"status": "configured", "provider": "huggingface"}
84
+
85
+
86
+ class OpenRouterCapability(Capability):
87
+ def __init__(self, api_key: str = ""):
88
+ super().__init__(name='openrouter')
89
+ self._api_key = api_key
90
+ async def execute(self, state, **kwargs):
91
+ import httpx
92
+ async with httpx.AsyncClient() as client:
93
+ response = await client.post(
94
+ "https://openrouter.ai/api/v1/chat/completions",
95
+ headers={"Authorization": f"Bearer {self._api_key}"},
96
+ json={"model": state.get("model", "openai/gpt-4o-mini"), "messages": [{"role": "user", "content": state.get("prompt", "")}]}
97
+ )
98
+ return response.json()
99
+
100
+
101
+ class LocalModelCapability(Capability):
102
+ def __init__(self, model_path: str = ""):
103
+ super().__init__(name='local_model')
104
+ self._model_path = model_path
105
+ async def execute(self, state, **kwargs):
106
+ return {"status": "configured", "provider": "local_model"}
@@ -0,0 +1,35 @@
1
+ """GraphQL API Capability — GraphQL integration."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any
6
+ from cerebellum.capability import Capability
7
+
8
+
9
+ class GraphQLCapability(Capability):
10
+ """GraphQL API integration capability."""
11
+
12
+ def __init__(self, endpoint: str = "", api_key: str = ""):
13
+ super().__init__(name='graphql')
14
+ self._endpoint = endpoint
15
+ self._api_key = api_key
16
+
17
+ async def execute(self, state: dict[str, Any], **kwargs) -> dict[str, Any]:
18
+ """Execute GraphQL query."""
19
+ import httpx
20
+
21
+ endpoint = state.get('endpoint', self._endpoint)
22
+ query = state.get('query', '')
23
+ variables = state.get('variables', {})
24
+
25
+ headers = {'Content-Type': 'application/json'}
26
+ if self._api_key:
27
+ headers['Authorization'] = f'Bearer {self._api_key}'
28
+
29
+ async with httpx.AsyncClient() as client:
30
+ response = await client.post(
31
+ endpoint,
32
+ headers=headers,
33
+ json={'query': query, 'variables': variables}
34
+ )
35
+ return response.json()
@@ -0,0 +1,45 @@
1
+ """REST API Capability — HTTP REST integration."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any
6
+ from cerebellum.capability import Capability
7
+
8
+
9
+ class RestAPICapability(Capability):
10
+ """REST API integration capability."""
11
+
12
+ def __init__(self, base_url: str = "", api_key: str = ""):
13
+ super().__init__(name='rest_api')
14
+ self._base_url = base_url
15
+ self._api_key = api_key
16
+
17
+ async def execute(self, state: dict[str, Any], **kwargs) -> dict[str, Any]:
18
+ """Execute REST API call."""
19
+ import httpx
20
+
21
+ url = state.get('url', self._base_url)
22
+ method = state.get('method', 'GET')
23
+ headers = state.get('headers', {})
24
+ data = state.get('data')
25
+
26
+ if self._api_key:
27
+ headers['Authorization'] = f'Bearer {self._api_key}'
28
+
29
+ async with httpx.AsyncClient() as client:
30
+ if method.upper() == 'GET':
31
+ response = await client.get(url, headers=headers)
32
+ elif method.upper() == 'POST':
33
+ response = await client.post(url, headers=headers, json=data)
34
+ elif method.upper() == 'PUT':
35
+ response = await client.put(url, headers=headers, json=data)
36
+ elif method.upper() == 'DELETE':
37
+ response = await client.delete(url, headers=headers)
38
+ else:
39
+ return {'status': 'error', 'error': f'Unsupported method: {method}'}
40
+
41
+ return {
42
+ 'status_code': response.status_code,
43
+ 'data': response.json() if response.headers.get('content-type', '').startswith('application/json') else response.text,
44
+ 'headers': dict(response.headers),
45
+ }
@@ -0,0 +1,30 @@
1
+ """Webhook Capability — webhook integration."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any
6
+ from cerebellum.capability import Capability
7
+
8
+
9
+ class WebhookCapability(Capability):
10
+ """Webhook integration capability."""
11
+
12
+ def __init__(self, url: str = "", secret: str = ""):
13
+ super().__init__(name='webhook')
14
+ self._url = url
15
+ self._secret = secret
16
+
17
+ async def execute(self, state: dict[str, Any], **kwargs) -> dict[str, Any]:
18
+ """Send webhook."""
19
+ import httpx
20
+
21
+ url = state.get('url', self._url)
22
+ payload = state.get('payload', {})
23
+ headers = state.get('headers', {'Content-Type': 'application/json'})
24
+
25
+ async with httpx.AsyncClient() as client:
26
+ response = await client.post(url, json=payload, headers=headers)
27
+ return {
28
+ 'status_code': response.status_code,
29
+ 'success': 200 <= response.status_code < 300,
30
+ }
@@ -0,0 +1,27 @@
1
+ """Browser Capabilities — web browser integrations."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any
6
+ from cerebellum.capability import Capability
7
+
8
+
9
+ class PlaywrightCapability(Capability):
10
+ def __init__(self):
11
+ super().__init__(name='playwright')
12
+ async def execute(self, state, **kwargs):
13
+ return {"status": "configured", "browser": "playwright"}
14
+
15
+
16
+ class SeleniumCapability(Capability):
17
+ def __init__(self):
18
+ super().__init__(name='selenium')
19
+ async def execute(self, state, **kwargs):
20
+ return {"status": "configured", "browser": "selenium"}
21
+
22
+
23
+ class PuppeteerCapability(Capability):
24
+ def __init__(self):
25
+ super().__init__(name='puppeteer')
26
+ async def execute(self, state, **kwargs):
27
+ return {"status": "configured", "browser": "puppeteer"}
@@ -0,0 +1,46 @@
1
+ """Cloud Capabilities — cloud provider integrations."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any
6
+ from cerebellum.capability import Capability
7
+
8
+
9
+ class AWSCapability(Capability):
10
+ def __init__(self, region: str = "us-east-1"):
11
+ super().__init__(name='aws')
12
+ self._region = region
13
+ async def execute(self, state, **kwargs):
14
+ return {"status": "configured", "cloud": "aws", "region": self._region}
15
+
16
+
17
+ class AzureCapability(Capability):
18
+ def __init__(self, subscription_id: str = ""):
19
+ super().__init__(name='azure')
20
+ self._subscription_id = subscription_id
21
+ async def execute(self, state, **kwargs):
22
+ return {"status": "configured", "cloud": "azure"}
23
+
24
+
25
+ class GoogleCloudCapability(Capability):
26
+ def __init__(self, project_id: str = ""):
27
+ super().__init__(name='google_cloud')
28
+ self._project_id = project_id
29
+ async def execute(self, state, **kwargs):
30
+ return {"status": "configured", "cloud": "google_cloud"}
31
+
32
+
33
+ class CloudflareCapability(Capability):
34
+ def __init__(self, api_token: str = ""):
35
+ super().__init__(name='cloudflare')
36
+ self._api_token = api_token
37
+ async def execute(self, state, **kwargs):
38
+ return {"status": "configured", "cloud": "cloudflare"}
39
+
40
+
41
+ class DigitalOceanCapability(Capability):
42
+ def __init__(self, api_token: str = ""):
43
+ super().__init__(name='digitalocean')
44
+ self._api_token = api_token
45
+ async def execute(self, state, **kwargs):
46
+ return {"status": "configured", "cloud": "digitalocean"}
@@ -0,0 +1,62 @@
1
+ """Communication Capabilities — messaging integrations."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any
6
+ from cerebellum.capability import Capability
7
+
8
+
9
+ class EmailCapability(Capability):
10
+ def __init__(self, smtp_host: str = "", smtp_port: int = 587):
11
+ super().__init__(name='email')
12
+ self._smtp_host = smtp_host
13
+ self._smtp_port = smtp_port
14
+ async def execute(self, state, **kwargs):
15
+ return {"status": "configured", "communication": "email"}
16
+
17
+
18
+ class SlackCapability(Capability):
19
+ def __init__(self, webhook_url: str = ""):
20
+ super().__init__(name='slack')
21
+ self._webhook_url = webhook_url
22
+ async def execute(self, state, **kwargs):
23
+ import httpx
24
+ async with httpx.AsyncClient() as client:
25
+ response = await client.post(self._webhook_url, json={"text": state.get("message", "")})
26
+ return {"status": "sent" if response.status_code == 200 else "failed"}
27
+
28
+
29
+ class DiscordCapability(Capability):
30
+ def __init__(self, webhook_url: str = ""):
31
+ super().__init__(name='discord')
32
+ self._webhook_url = webhook_url
33
+ async def execute(self, state, **kwargs):
34
+ import httpx
35
+ async with httpx.AsyncClient() as client:
36
+ response = await client.post(self._webhook_url, json={"content": state.get("message", "")})
37
+ return {"status": "sent" if response.status_code == 204 else "failed"}
38
+
39
+
40
+ class TelegramCapability(Capability):
41
+ def __init__(self, bot_token: str = ""):
42
+ super().__init__(name='telegram')
43
+ self._bot_token = bot_token
44
+ async def execute(self, state, **kwargs):
45
+ import httpx
46
+ async with httpx.AsyncClient() as client:
47
+ response = await client.post(
48
+ f"https://api.telegram.org/bot{self._bot_token}/sendMessage",
49
+ json={"chat_id": state.get("chat_id", ""), "text": state.get("message", "")}
50
+ )
51
+ return response.json()
52
+
53
+
54
+ class MicrosoftTeamsCapability(Capability):
55
+ def __init__(self, webhook_url: str = ""):
56
+ super().__init__(name='microsoft_teams')
57
+ self._webhook_url = webhook_url
58
+ async def execute(self, state, **kwargs):
59
+ import httpx
60
+ async with httpx.AsyncClient() as client:
61
+ response = await client.post(self._webhook_url, json={"text": state.get("message", "")})
62
+ return {"status": "sent" if response.status_code == 200 else "failed"}