campfirevalley 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.
- campfirevalley-1.0.0/PKG-INFO +704 -0
- campfirevalley-1.0.0/README.md +643 -0
- campfirevalley-1.0.0/campfirevalley/__init__.py +257 -0
- campfirevalley-1.0.0/campfirevalley/auditor_workflow.py +666 -0
- campfirevalley-1.0.0/campfirevalley/campfire.py +321 -0
- campfirevalley-1.0.0/campfirevalley/campfires/__init__.py +16 -0
- campfirevalley-1.0.0/campfirevalley/campfires/dockmaster.py +467 -0
- campfirevalley-1.0.0/campfirevalley/cli.py +153 -0
- campfirevalley-1.0.0/campfirevalley/config.py +241 -0
- campfirevalley-1.0.0/campfirevalley/config_manager.py +539 -0
- campfirevalley-1.0.0/campfirevalley/developer_campfires.py +501 -0
- campfirevalley-1.0.0/campfirevalley/dock.py +277 -0
- campfirevalley-1.0.0/campfirevalley/hierarchical_storage.py +1207 -0
- campfirevalley-1.0.0/campfirevalley/interfaces.py +254 -0
- campfirevalley-1.0.0/campfirevalley/justice.py +613 -0
- campfirevalley-1.0.0/campfirevalley/key_manager.py +353 -0
- campfirevalley-1.0.0/campfirevalley/llm_campfire.py +339 -0
- campfirevalley-1.0.0/campfirevalley/mcp.py +241 -0
- campfirevalley-1.0.0/campfirevalley/models.py +337 -0
- campfirevalley-1.0.0/campfirevalley/monitoring.py +436 -0
- campfirevalley-1.0.0/campfirevalley/party_box.py +545 -0
- campfirevalley-1.0.0/campfirevalley/routing.py +557 -0
- campfirevalley-1.0.0/campfirevalley/security_scanner.py +518 -0
- campfirevalley-1.0.0/campfirevalley/specialist_campfires.py +876 -0
- campfirevalley-1.0.0/campfirevalley/vali.py +446 -0
- campfirevalley-1.0.0/campfirevalley/valley.py +428 -0
- campfirevalley-1.0.0/campfirevalley.egg-info/PKG-INFO +704 -0
- campfirevalley-1.0.0/campfirevalley.egg-info/SOURCES.txt +38 -0
- campfirevalley-1.0.0/campfirevalley.egg-info/dependency_links.txt +1 -0
- campfirevalley-1.0.0/campfirevalley.egg-info/entry_points.txt +2 -0
- campfirevalley-1.0.0/campfirevalley.egg-info/not-zip-safe +1 -0
- campfirevalley-1.0.0/campfirevalley.egg-info/requires.txt +31 -0
- campfirevalley-1.0.0/campfirevalley.egg-info/top_level.txt +1 -0
- campfirevalley-1.0.0/setup.cfg +4 -0
- campfirevalley-1.0.0/setup.py +64 -0
- campfirevalley-1.0.0/tests/test_config_manager.py +826 -0
- campfirevalley-1.0.0/tests/test_hierarchical_storage.py +598 -0
- campfirevalley-1.0.0/tests/test_justice_system.py +468 -0
- campfirevalley-1.0.0/tests/test_monitoring.py +703 -0
- campfirevalley-1.0.0/tests/test_routing.py +606 -0
|
@@ -0,0 +1,704 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: campfirevalley
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A sophisticated multi-agent AI system for collaborative problem-solving through specialized AI campfires
|
|
5
|
+
Home-page: https://github.com/MikeHibbert/pyCamperValley
|
|
6
|
+
Author: Mike Hibbert
|
|
7
|
+
Author-email: mike@hibbertitsolutions.co.uk
|
|
8
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
19
|
+
Classifier: Topic :: System :: Distributed Computing
|
|
20
|
+
Requires-Python: >=3.8
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
Requires-Dist: campfires>=0.4.0
|
|
23
|
+
Requires-Dist: pydantic>=2.0.0
|
|
24
|
+
Requires-Dist: PyYAML>=6.0
|
|
25
|
+
Requires-Dist: redis>=4.5.0
|
|
26
|
+
Requires-Dist: cryptography>=41.0.0
|
|
27
|
+
Requires-Dist: aiofiles>=23.0.0
|
|
28
|
+
Requires-Dist: prometheus-client>=0.17.0
|
|
29
|
+
Requires-Dist: structlog>=23.0.0
|
|
30
|
+
Requires-Dist: jsonschema>=4.17.0
|
|
31
|
+
Requires-Dist: click>=8.1.0
|
|
32
|
+
Requires-Dist: asyncio-mqtt>=0.13.0
|
|
33
|
+
Requires-Dist: psycopg2-binary>=2.9.0
|
|
34
|
+
Requires-Dist: elasticsearch>=8.0.0
|
|
35
|
+
Requires-Dist: grafana-api>=1.0.3
|
|
36
|
+
Requires-Dist: pytest>=7.0.0
|
|
37
|
+
Requires-Dist: pytest-asyncio>=0.21.0
|
|
38
|
+
Requires-Dist: pytest-cov>=4.0.0
|
|
39
|
+
Requires-Dist: black>=23.0.0
|
|
40
|
+
Requires-Dist: flake8>=6.0.0
|
|
41
|
+
Requires-Dist: mypy>=1.0.0
|
|
42
|
+
Provides-Extra: dev
|
|
43
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
44
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
45
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
46
|
+
Requires-Dist: flake8>=6.0.0; extra == "dev"
|
|
47
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
48
|
+
Provides-Extra: docs
|
|
49
|
+
Requires-Dist: sphinx>=6.0.0; extra == "docs"
|
|
50
|
+
Requires-Dist: sphinx-rtd-theme>=1.2.0; extra == "docs"
|
|
51
|
+
Dynamic: author
|
|
52
|
+
Dynamic: author-email
|
|
53
|
+
Dynamic: classifier
|
|
54
|
+
Dynamic: description
|
|
55
|
+
Dynamic: description-content-type
|
|
56
|
+
Dynamic: home-page
|
|
57
|
+
Dynamic: provides-extra
|
|
58
|
+
Dynamic: requires-dist
|
|
59
|
+
Dynamic: requires-python
|
|
60
|
+
Dynamic: summary
|
|
61
|
+
|
|
62
|
+
# CampfireValley
|
|
63
|
+
|
|
64
|
+
A Python library that extends the Campfires framework by introducing the concept of "valleys" as interconnected, secure communities of campfires. The library manages docks as gateways for inter-valley communication, handles riverboat (torch) exchanges via MCP, and provides default campfires for loading/offloading, security sanitization, and justice enforcement.
|
|
65
|
+
|
|
66
|
+
## 🚀 Project Status
|
|
67
|
+
|
|
68
|
+
**Phase 2 Implementation: COMPLETED** ✅
|
|
69
|
+
|
|
70
|
+
CampfireValley is now **~95% complete** with comprehensive enterprise-grade features implemented and tested. The system provides a complete distributed torch processing framework.
|
|
71
|
+
|
|
72
|
+
### ✅ Phase 1 Components (Core Infrastructure)
|
|
73
|
+
|
|
74
|
+
- **🔐 Key Manager**: Complete AES-256 and RSA key management system
|
|
75
|
+
- **🔄 Redis MCP Broker**: Full pub/sub messaging with connection management
|
|
76
|
+
- **📦 Torch Serialization**: Enhanced with Redis transport and MCP communication
|
|
77
|
+
- **🏭 Dockmaster Campfire**: Complete with Loader, Router, and Packer campers
|
|
78
|
+
- **🏗️ Core Architecture**: Interfaces, models, and base classes
|
|
79
|
+
|
|
80
|
+
### ✅ Phase 2 Components (Enterprise Features)
|
|
81
|
+
|
|
82
|
+
- **🛡️ VALI Services**: Complete security scanning and validation framework
|
|
83
|
+
- **⚖️ Justice System**: Advanced policy enforcement and violation handling
|
|
84
|
+
- **🔧 Specialist Campfires**: Domain-specific processing units (Sanitizer, Validator, Router)
|
|
85
|
+
- **🌐 Advanced Routing**: Multi-hop routing with load balancing and failover
|
|
86
|
+
- **📊 Monitoring & Logging**: Comprehensive metrics, alerts, and structured logging
|
|
87
|
+
- **⚙️ Configuration Management**: Multi-environment config with validation and encryption
|
|
88
|
+
- **💾 Hierarchical Storage**: Multi-tier storage with compression and deduplication
|
|
89
|
+
|
|
90
|
+
### 🔄 Future Enhancements
|
|
91
|
+
|
|
92
|
+
- **Web Interface**: Management dashboard and monitoring UI
|
|
93
|
+
- **Distributed Consensus**: Multi-valley coordination protocols
|
|
94
|
+
- **Machine Learning**: Intelligent routing and threat detection
|
|
95
|
+
|
|
96
|
+
## Features
|
|
97
|
+
|
|
98
|
+
### Core Infrastructure (Phase 1)
|
|
99
|
+
- **Valley Management**: Self-contained instances hosting multiple campfires
|
|
100
|
+
- **Dock Gateways**: Secure entry points for inter-valley communication
|
|
101
|
+
- **MCP Integration**: Redis-based message communication protocol
|
|
102
|
+
- **Key Management**: AES-256 encryption and RSA digital signatures
|
|
103
|
+
- **GitHub Actions-style Configuration**: Familiar YAML configuration format
|
|
104
|
+
|
|
105
|
+
### Enterprise Features (Phase 2)
|
|
106
|
+
- **🛡️ VALI Security Services**:
|
|
107
|
+
- Content validation and signature verification
|
|
108
|
+
- Enhanced security scanning with threat detection
|
|
109
|
+
- Service registry and coordination
|
|
110
|
+
- **⚖️ Justice System**:
|
|
111
|
+
- Policy-based access control and enforcement
|
|
112
|
+
- Violation detection and automated responses
|
|
113
|
+
- Rate limiting and abuse prevention
|
|
114
|
+
- **🔧 Specialist Campfires**:
|
|
115
|
+
- Sanitizer: Content cleaning and threat removal
|
|
116
|
+
- Validator: Data integrity and format validation
|
|
117
|
+
- Router: Intelligent routing decisions
|
|
118
|
+
- **🌐 Advanced Routing**:
|
|
119
|
+
- Multi-hop routing with path optimization
|
|
120
|
+
- Smart load balancing algorithms
|
|
121
|
+
- Automatic failover and health checking
|
|
122
|
+
- **📊 Monitoring & Logging**:
|
|
123
|
+
- Real-time metrics collection and alerting
|
|
124
|
+
- Structured logging with multiple handlers
|
|
125
|
+
- Performance monitoring and health checks
|
|
126
|
+
- **⚙️ Configuration Management**:
|
|
127
|
+
- Multi-environment configuration (dev/prod)
|
|
128
|
+
- Schema validation and encryption
|
|
129
|
+
- Hot-reload and change tracking
|
|
130
|
+
- **💾 Hierarchical Storage**:
|
|
131
|
+
- Multi-tier storage (hot/warm/cold/archive)
|
|
132
|
+
- Data deduplication and compression
|
|
133
|
+
- Intelligent lifecycle management
|
|
134
|
+
|
|
135
|
+
## 🎯 Demos & Examples
|
|
136
|
+
|
|
137
|
+
CampfireValley includes comprehensive demos showcasing real-world AI agent collaboration workflows. These demos demonstrate the complete system capabilities from idea generation to technical implementation.
|
|
138
|
+
|
|
139
|
+
### 🚀 Marketing Team Demo
|
|
140
|
+
|
|
141
|
+
The marketing team demo showcases a complete AI-driven workflow where marketing strategists generate innovative ideas and collaborate with development teams to create technical implementations.
|
|
142
|
+
|
|
143
|
+
#### Demo Architecture
|
|
144
|
+
|
|
145
|
+
```
|
|
146
|
+
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
|
|
147
|
+
│ Marketing │ │ Development │ │ Generated │
|
|
148
|
+
│ Strategist │───▶│ Team API │───▶│ Report │
|
|
149
|
+
│ (AI Agent) │ │ (Dockerized) │ │ (JSON/HTML) │
|
|
150
|
+
└─────────────────┘ └──────────────────┘ └─────────────────┘
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
#### Quick Demo Execution
|
|
154
|
+
|
|
155
|
+
**Option 1: Simplified Demo (Recommended)**
|
|
156
|
+
```bash
|
|
157
|
+
# Start Docker containers
|
|
158
|
+
docker-compose up -d
|
|
159
|
+
|
|
160
|
+
# Run the simplified marketing demo
|
|
161
|
+
python simple_marketing_demo.py
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
**Option 2: Full Valley Demo**
|
|
165
|
+
```bash
|
|
166
|
+
# Start Docker containers
|
|
167
|
+
docker-compose up -d
|
|
168
|
+
|
|
169
|
+
# Run the complete valley demo
|
|
170
|
+
python demo_marketing_team.py
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
#### Demo Workflow
|
|
174
|
+
|
|
175
|
+
1. **Idea Generation**: Marketing strategist AI generates innovative business ideas
|
|
176
|
+
2. **Strategic Analysis**: Each idea is analyzed for market potential and feasibility
|
|
177
|
+
3. **Development Requests**: Ideas are formatted and sent to the development team API
|
|
178
|
+
4. **Technical Analysis**: Development team provides detailed technical requirements
|
|
179
|
+
5. **Report Generation**: Complete workflow results are compiled into comprehensive reports
|
|
180
|
+
|
|
181
|
+
#### Expected Output
|
|
182
|
+
|
|
183
|
+
The demo generates:
|
|
184
|
+
- **3 Marketing Ideas**: E-commerce Innovation, SaaS Solution, Mobile App Concept
|
|
185
|
+
- **Strategic Analysis**: Market research, target audience, competitive analysis
|
|
186
|
+
- **Technical Requirements**: Architecture, features, UX considerations
|
|
187
|
+
- **Development Analysis**: Detailed technical implementation plans
|
|
188
|
+
- **Comprehensive Report**: JSON and HTML formats with complete workflow results
|
|
189
|
+
|
|
190
|
+
#### Demo Files
|
|
191
|
+
|
|
192
|
+
- `simple_marketing_demo.py`: Streamlined demo bypassing MCP complexities
|
|
193
|
+
- `demo_marketing_team.py`: Full valley implementation with MCP integration
|
|
194
|
+
- `development_team_server.py`: Dockerized development team API service
|
|
195
|
+
- `docker-compose.yml`: Container orchestration for demo services
|
|
196
|
+
|
|
197
|
+
### 🐳 Docker Container Services
|
|
198
|
+
|
|
199
|
+
The demo utilizes several containerized services:
|
|
200
|
+
|
|
201
|
+
| Service | Container | Port | Purpose |
|
|
202
|
+
|---------|-----------|------|---------|
|
|
203
|
+
| Development Team | `campfire-development-team` | 8080 | Technical analysis API |
|
|
204
|
+
| Redis MCP Broker | `campfire-redis` | 6379 | Message communication |
|
|
205
|
+
| Ollama LLM | `campfire-ollama` | 11434 | Local AI model serving |
|
|
206
|
+
| Prometheus | `campfire-prometheus` | 9090 | Monitoring and metrics |
|
|
207
|
+
|
|
208
|
+
#### Container Status Check
|
|
209
|
+
```bash
|
|
210
|
+
# View running containers
|
|
211
|
+
docker ps
|
|
212
|
+
|
|
213
|
+
# Check container logs
|
|
214
|
+
docker logs campfire-development-team
|
|
215
|
+
docker logs campfire-redis
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### 🔧 Troubleshooting
|
|
219
|
+
|
|
220
|
+
#### Common Issues and Solutions
|
|
221
|
+
|
|
222
|
+
**1. MCP Broker Connection Issues**
|
|
223
|
+
```bash
|
|
224
|
+
# Symptom: Demo hangs at "Subscribing to MCP channels"
|
|
225
|
+
# Solution: Use simplified demo
|
|
226
|
+
python simple_marketing_demo.py
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
**2. Docker Container Issues**
|
|
230
|
+
```bash
|
|
231
|
+
# Restart all containers
|
|
232
|
+
docker-compose down
|
|
233
|
+
docker-compose up -d
|
|
234
|
+
|
|
235
|
+
# Check container health
|
|
236
|
+
docker ps
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
**3. Development Team API 404 Errors**
|
|
240
|
+
```bash
|
|
241
|
+
# Verify development team container is running
|
|
242
|
+
docker logs campfire-development-team
|
|
243
|
+
|
|
244
|
+
# Check API endpoint
|
|
245
|
+
curl http://localhost:8080/api/develop_website
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
**4. Port Conflicts**
|
|
249
|
+
```bash
|
|
250
|
+
# Check port usage
|
|
251
|
+
netstat -an | findstr :8080
|
|
252
|
+
netstat -an | findstr :6379
|
|
253
|
+
|
|
254
|
+
# Modify ports in docker-compose.yml if needed
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
#### Demo Variations
|
|
258
|
+
|
|
259
|
+
**Simplified Workflow (No MCP)**
|
|
260
|
+
- Bypasses MCP broker subscription issues
|
|
261
|
+
- Direct API communication
|
|
262
|
+
- Faster execution
|
|
263
|
+
- Recommended for demonstrations
|
|
264
|
+
|
|
265
|
+
**Full Valley Workflow (With MCP)**
|
|
266
|
+
- Complete CampfireValley architecture
|
|
267
|
+
- MCP broker integration
|
|
268
|
+
- Inter-valley communication
|
|
269
|
+
- Production-like environment
|
|
270
|
+
|
|
271
|
+
### 📊 Demo Reports
|
|
272
|
+
|
|
273
|
+
Demo execution generates detailed reports:
|
|
274
|
+
|
|
275
|
+
**JSON Report Structure**:
|
|
276
|
+
```json
|
|
277
|
+
{
|
|
278
|
+
"execution_summary": {
|
|
279
|
+
"ideas_generated": 3,
|
|
280
|
+
"dev_requests_sent": 3,
|
|
281
|
+
"successful_responses": 3,
|
|
282
|
+
"execution_time": "45.2 seconds"
|
|
283
|
+
},
|
|
284
|
+
"marketing_ideas": [...],
|
|
285
|
+
"development_analysis": [...],
|
|
286
|
+
"workflow_metrics": {...}
|
|
287
|
+
}
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
**Report Locations**:
|
|
291
|
+
- `simplified_marketing_report_YYYYMMDD_HHMMSS.json`
|
|
292
|
+
- `marketing_team_report.html` (if HTML generation enabled)
|
|
293
|
+
|
|
294
|
+
## Quick Start
|
|
295
|
+
|
|
296
|
+
### Installation
|
|
297
|
+
|
|
298
|
+
```bash
|
|
299
|
+
pip install campfirevalley
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
### Basic Usage
|
|
303
|
+
|
|
304
|
+
1. **Create a valley configuration**:
|
|
305
|
+
```bash
|
|
306
|
+
campfirevalley create-config MyValley --output manifest.yaml
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
2. **Start a valley**:
|
|
310
|
+
```bash
|
|
311
|
+
campfirevalley start MyValley --manifest manifest.yaml
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
3. **Programmatic usage**:
|
|
315
|
+
```python
|
|
316
|
+
import asyncio
|
|
317
|
+
from campfirevalley import Valley
|
|
318
|
+
|
|
319
|
+
async def main():
|
|
320
|
+
# Create and start a valley
|
|
321
|
+
valley = Valley("MyValley", "./manifest.yaml")
|
|
322
|
+
await valley.start()
|
|
323
|
+
|
|
324
|
+
# Valley is now running and can communicate with other valleys
|
|
325
|
+
print(f"Valley '{valley.name}' is running")
|
|
326
|
+
|
|
327
|
+
# Stop the valley
|
|
328
|
+
await valley.stop()
|
|
329
|
+
|
|
330
|
+
asyncio.run(main())
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
## 🏗️ Phase 1 Implementation Details
|
|
334
|
+
|
|
335
|
+
### Key Manager (`campfirevalley.key_manager`)
|
|
336
|
+
- **AES-256 Encryption**: Secure payload encryption/decryption
|
|
337
|
+
- **RSA Digital Signatures**: Torch signing and verification
|
|
338
|
+
- **Key Rotation**: Community-based key management
|
|
339
|
+
- **Secure Storage**: Encrypted key storage in `.secrets/`
|
|
340
|
+
|
|
341
|
+
### Redis MCP Broker (`campfirevalley.mcp`)
|
|
342
|
+
- **Pub/Sub Messaging**: Redis-based inter-valley communication
|
|
343
|
+
- **Connection Management**: Robust connection pooling and error handling
|
|
344
|
+
- **Message Routing**: Channel-based message distribution
|
|
345
|
+
- **Async Support**: Full asyncio compatibility
|
|
346
|
+
|
|
347
|
+
### Enhanced Torch Model (`campfirevalley.models`)
|
|
348
|
+
- **Redis Serialization**: Optimized for Redis transport
|
|
349
|
+
- **MCP Envelopes**: Structured message format
|
|
350
|
+
- **Compression**: Automatic compression for large payloads
|
|
351
|
+
- **Routing Channels**: Smart channel determination
|
|
352
|
+
|
|
353
|
+
### Dockmaster Campfire (`campfirevalley.campfires.dockmaster`)
|
|
354
|
+
- **LoaderCamper**: Torch validation and unpacking
|
|
355
|
+
- **RouterCamper**: Intelligent routing decisions
|
|
356
|
+
- **PackerCamper**: Transport preparation and packaging
|
|
357
|
+
- **Pipeline Processing**: Complete torch processing workflow
|
|
358
|
+
|
|
359
|
+
## 🏗️ Phase 2 Implementation Details
|
|
360
|
+
|
|
361
|
+
### VALI Services (`campfirevalley.vali`)
|
|
362
|
+
- **Service Registry**: Centralized service discovery and management
|
|
363
|
+
- **Content Validator**: Deep content analysis and validation
|
|
364
|
+
- **Signature Verifier**: Cryptographic signature verification
|
|
365
|
+
- **Security Scanner**: Advanced threat detection with multiple engines
|
|
366
|
+
- **Coordinator**: Service orchestration and lifecycle management
|
|
367
|
+
|
|
368
|
+
### Justice System (`campfirevalley.justice`)
|
|
369
|
+
- **Policy Engine**: Rule-based access control and enforcement
|
|
370
|
+
- **Enforcement Engine**: Automated violation response and remediation
|
|
371
|
+
- **Violation Detection**: Real-time monitoring and threat identification
|
|
372
|
+
- **Rate Limiting**: Configurable rate limiting and abuse prevention
|
|
373
|
+
- **Audit Trail**: Complete violation and enforcement logging
|
|
374
|
+
|
|
375
|
+
### Specialist Campfires (`campfirevalley.specialist_campfires`)
|
|
376
|
+
- **SanitizerCampfire**: Content sanitization with multiple levels
|
|
377
|
+
- **ValidatorCampfire**: Data validation with custom rules
|
|
378
|
+
- **RouterCampfire**: Intelligent routing with strategy selection
|
|
379
|
+
- **Configurable Rules**: Custom sanitization, validation, and routing rules
|
|
380
|
+
- **Pipeline Integration**: Seamless integration with torch processing
|
|
381
|
+
|
|
382
|
+
### Advanced Routing (`campfirevalley.routing`)
|
|
383
|
+
- **Route Optimization**: Intelligent path selection and optimization
|
|
384
|
+
- **Load Balancing**: Multiple algorithms (round-robin, weighted, least-connections)
|
|
385
|
+
- **Health Checking**: Continuous endpoint health monitoring
|
|
386
|
+
- **Failover Strategies**: Automatic failover with multiple strategies
|
|
387
|
+
- **Metrics Collection**: Real-time routing performance metrics
|
|
388
|
+
|
|
389
|
+
### Monitoring & Logging (`campfirevalley.monitoring`)
|
|
390
|
+
- **Metrics System**: Comprehensive metrics collection and aggregation
|
|
391
|
+
- **Alert Management**: Configurable alerts with multiple severity levels
|
|
392
|
+
- **Structured Logging**: JSON-based logging with multiple handlers
|
|
393
|
+
- **Performance Monitoring**: Real-time performance tracking
|
|
394
|
+
- **Health Checking**: System-wide health monitoring
|
|
395
|
+
|
|
396
|
+
### Configuration Management (`campfirevalley.config_manager`)
|
|
397
|
+
- **Multi-Environment**: Separate configs for development, production, etc.
|
|
398
|
+
- **Schema Validation**: JSON Schema-based configuration validation
|
|
399
|
+
- **Encryption Support**: Sensitive configuration data encryption
|
|
400
|
+
- **Hot Reload**: Runtime configuration updates without restart
|
|
401
|
+
- **Change Tracking**: Complete configuration change history
|
|
402
|
+
|
|
403
|
+
### Hierarchical Storage (`campfirevalley.hierarchical_storage`)
|
|
404
|
+
- **Multi-Tier Storage**: Hot, warm, cold, and archive tiers
|
|
405
|
+
- **Data Lifecycle**: Intelligent data movement between tiers
|
|
406
|
+
- **Deduplication**: Content-based deduplication to save space
|
|
407
|
+
- **Compression**: Configurable compression algorithms
|
|
408
|
+
- **Storage Optimization**: Automated storage optimization and cleanup
|
|
409
|
+
|
|
410
|
+
### Usage Example
|
|
411
|
+
|
|
412
|
+
```python
|
|
413
|
+
import asyncio
|
|
414
|
+
from campfirevalley import Valley, CampfireKeyManager, RedisMCPBroker
|
|
415
|
+
from campfirevalley.campfires import DockmasterCampfire
|
|
416
|
+
from campfirevalley.models import Torch
|
|
417
|
+
|
|
418
|
+
async def main():
|
|
419
|
+
# Initialize components
|
|
420
|
+
key_manager = CampfireKeyManager("MyValley")
|
|
421
|
+
mcp_broker = RedisMCPBroker("redis://localhost:6379")
|
|
422
|
+
dockmaster = DockmasterCampfire(mcp_broker)
|
|
423
|
+
|
|
424
|
+
# Start services
|
|
425
|
+
await mcp_broker.connect()
|
|
426
|
+
await dockmaster.start()
|
|
427
|
+
|
|
428
|
+
# Create and process a torch
|
|
429
|
+
torch = Torch(
|
|
430
|
+
id="example_001",
|
|
431
|
+
sender_valley="MyValley",
|
|
432
|
+
target_address="TargetValley:dockmaster/loader",
|
|
433
|
+
payload={"message": "Hello from CampfireValley!"},
|
|
434
|
+
signature="example_signature"
|
|
435
|
+
)
|
|
436
|
+
|
|
437
|
+
# Process through Dockmaster pipeline
|
|
438
|
+
response = await dockmaster.process_torch(torch)
|
|
439
|
+
print(f"Processed torch: {response}")
|
|
440
|
+
|
|
441
|
+
# Cleanup
|
|
442
|
+
await dockmaster.stop()
|
|
443
|
+
await mcp_broker.disconnect()
|
|
444
|
+
|
|
445
|
+
asyncio.run(main())
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
## 🔧 Configuration-Driven Architecture
|
|
449
|
+
|
|
450
|
+
CampfireValley implements a comprehensive configuration-driven approach that enables flexible, maintainable, and environment-specific deployments without code changes.
|
|
451
|
+
|
|
452
|
+
### Core Configuration Philosophy
|
|
453
|
+
|
|
454
|
+
The system follows these key principles:
|
|
455
|
+
- **Declarative Configuration**: Define what you want, not how to achieve it
|
|
456
|
+
- **Environment Separation**: Clean separation between dev, staging, and production
|
|
457
|
+
- **Schema Validation**: All configurations are validated against JSON schemas
|
|
458
|
+
- **Hot Reload**: Runtime configuration updates without service restart
|
|
459
|
+
- **Encryption Support**: Sensitive data is automatically encrypted
|
|
460
|
+
|
|
461
|
+
### Configuration Hierarchy
|
|
462
|
+
|
|
463
|
+
CampfireValley uses a multi-layered configuration system:
|
|
464
|
+
|
|
465
|
+
1. **Base Configuration**: Core system defaults
|
|
466
|
+
2. **Environment Configuration**: Environment-specific overrides (dev/prod)
|
|
467
|
+
3. **Valley Configuration**: Valley-specific settings
|
|
468
|
+
4. **Runtime Configuration**: Dynamic updates during operation
|
|
469
|
+
|
|
470
|
+
### GitHub Actions-Style YAML Format
|
|
471
|
+
|
|
472
|
+
CampfireValley uses familiar GitHub Actions-style YAML configuration:
|
|
473
|
+
|
|
474
|
+
```yaml
|
|
475
|
+
name: "MyValley"
|
|
476
|
+
version: "1.0"
|
|
477
|
+
|
|
478
|
+
env:
|
|
479
|
+
dock_mode: "public"
|
|
480
|
+
security_level: "standard"
|
|
481
|
+
auto_create_dock: true
|
|
482
|
+
|
|
483
|
+
campfires:
|
|
484
|
+
visible: ["helper", "processor"]
|
|
485
|
+
hidden: ["internal"]
|
|
486
|
+
|
|
487
|
+
community:
|
|
488
|
+
discovery: true
|
|
489
|
+
trusted_valleys: ["FriendValley"]
|
|
490
|
+
|
|
491
|
+
# Advanced configuration sections
|
|
492
|
+
security:
|
|
493
|
+
vali:
|
|
494
|
+
enabled: true
|
|
495
|
+
scan_level: "comprehensive"
|
|
496
|
+
threat_detection: true
|
|
497
|
+
|
|
498
|
+
justice:
|
|
499
|
+
enabled: true
|
|
500
|
+
policy_enforcement: "strict"
|
|
501
|
+
rate_limiting:
|
|
502
|
+
requests_per_minute: 100
|
|
503
|
+
burst_limit: 20
|
|
504
|
+
|
|
505
|
+
routing:
|
|
506
|
+
strategy: "intelligent"
|
|
507
|
+
load_balancing: "weighted_round_robin"
|
|
508
|
+
health_checks:
|
|
509
|
+
enabled: true
|
|
510
|
+
interval: 30
|
|
511
|
+
timeout: 5
|
|
512
|
+
|
|
513
|
+
storage:
|
|
514
|
+
hierarchical:
|
|
515
|
+
enabled: true
|
|
516
|
+
tiers:
|
|
517
|
+
hot: { retention: "7d", compression: false }
|
|
518
|
+
warm: { retention: "30d", compression: "lz4" }
|
|
519
|
+
cold: { retention: "1y", compression: "gzip" }
|
|
520
|
+
archive: { retention: "7y", compression: "bzip2" }
|
|
521
|
+
|
|
522
|
+
monitoring:
|
|
523
|
+
metrics:
|
|
524
|
+
enabled: true
|
|
525
|
+
collection_interval: 10
|
|
526
|
+
|
|
527
|
+
logging:
|
|
528
|
+
level: "INFO"
|
|
529
|
+
format: "json"
|
|
530
|
+
handlers: ["console", "file", "redis"]
|
|
531
|
+
|
|
532
|
+
alerts:
|
|
533
|
+
enabled: true
|
|
534
|
+
channels: ["email", "slack"]
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
### Environment-Specific Configuration
|
|
538
|
+
|
|
539
|
+
Create separate configuration files for different environments:
|
|
540
|
+
|
|
541
|
+
**config/dev.yaml**:
|
|
542
|
+
```yaml
|
|
543
|
+
extends: "base.yaml"
|
|
544
|
+
|
|
545
|
+
env:
|
|
546
|
+
security_level: "development"
|
|
547
|
+
debug: true
|
|
548
|
+
|
|
549
|
+
monitoring:
|
|
550
|
+
logging:
|
|
551
|
+
level: "DEBUG"
|
|
552
|
+
|
|
553
|
+
security:
|
|
554
|
+
vali:
|
|
555
|
+
scan_level: "basic"
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
**config/prod.yaml**:
|
|
559
|
+
```yaml
|
|
560
|
+
extends: "base.yaml"
|
|
561
|
+
|
|
562
|
+
env:
|
|
563
|
+
security_level: "maximum"
|
|
564
|
+
debug: false
|
|
565
|
+
|
|
566
|
+
security:
|
|
567
|
+
vali:
|
|
568
|
+
scan_level: "comprehensive"
|
|
569
|
+
threat_detection: true
|
|
570
|
+
|
|
571
|
+
justice:
|
|
572
|
+
policy_enforcement: "strict"
|
|
573
|
+
|
|
574
|
+
monitoring:
|
|
575
|
+
alerts:
|
|
576
|
+
enabled: true
|
|
577
|
+
severity_threshold: "warning"
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
### Configuration Management Features
|
|
581
|
+
|
|
582
|
+
#### 1. Schema Validation
|
|
583
|
+
All configurations are validated against JSON schemas:
|
|
584
|
+
|
|
585
|
+
```python
|
|
586
|
+
from campfirevalley.config_manager import ConfigManager
|
|
587
|
+
|
|
588
|
+
# Load and validate configuration
|
|
589
|
+
config_manager = ConfigManager()
|
|
590
|
+
config = config_manager.load_config("config/prod.yaml")
|
|
591
|
+
# Automatically validates against schema
|
|
592
|
+
```
|
|
593
|
+
|
|
594
|
+
#### 2. Encryption Support
|
|
595
|
+
Sensitive configuration data is automatically encrypted:
|
|
596
|
+
|
|
597
|
+
```yaml
|
|
598
|
+
database:
|
|
599
|
+
host: "db.example.com"
|
|
600
|
+
username: "admin"
|
|
601
|
+
password: "!encrypted:AES256:base64encodeddata" # Auto-encrypted
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
#### 3. Hot Reload
|
|
605
|
+
Update configurations without restarting services:
|
|
606
|
+
|
|
607
|
+
```python
|
|
608
|
+
# Configuration changes are automatically detected and applied
|
|
609
|
+
config_manager.watch_for_changes()
|
|
610
|
+
```
|
|
611
|
+
|
|
612
|
+
#### 4. Environment Variables
|
|
613
|
+
Override any configuration value with environment variables:
|
|
614
|
+
|
|
615
|
+
```bash
|
|
616
|
+
export CAMPFIREVALLEY_SECURITY_LEVEL="maximum"
|
|
617
|
+
export CAMPFIREVALLEY_MONITORING_LOGGING_LEVEL="ERROR"
|
|
618
|
+
```
|
|
619
|
+
|
|
620
|
+
### Configuration Sections Reference
|
|
621
|
+
|
|
622
|
+
#### Core Settings
|
|
623
|
+
- `name`: Valley identifier
|
|
624
|
+
- `version`: Configuration version
|
|
625
|
+
- `env`: Environment variables and basic settings
|
|
626
|
+
|
|
627
|
+
#### Security Configuration
|
|
628
|
+
- `security.vali`: VALI security services settings
|
|
629
|
+
- `security.justice`: Justice system and policy enforcement
|
|
630
|
+
- `security.encryption`: Encryption and key management
|
|
631
|
+
|
|
632
|
+
#### Routing Configuration
|
|
633
|
+
- `routing.strategy`: Routing algorithm selection
|
|
634
|
+
- `routing.load_balancing`: Load balancing configuration
|
|
635
|
+
- `routing.health_checks`: Health monitoring settings
|
|
636
|
+
|
|
637
|
+
#### Storage Configuration
|
|
638
|
+
- `storage.hierarchical`: Multi-tier storage settings
|
|
639
|
+
- `storage.compression`: Compression algorithms
|
|
640
|
+
- `storage.retention`: Data retention policies
|
|
641
|
+
|
|
642
|
+
#### Monitoring Configuration
|
|
643
|
+
- `monitoring.metrics`: Metrics collection settings
|
|
644
|
+
- `monitoring.logging`: Logging configuration
|
|
645
|
+
- `monitoring.alerts`: Alert management
|
|
646
|
+
|
|
647
|
+
### Best Practices
|
|
648
|
+
|
|
649
|
+
1. **Use Environment Inheritance**: Extend base configurations for environments
|
|
650
|
+
2. **Validate Early**: Always validate configurations during startup
|
|
651
|
+
3. **Encrypt Secrets**: Use the built-in encryption for sensitive data
|
|
652
|
+
4. **Monitor Changes**: Enable configuration change tracking
|
|
653
|
+
5. **Test Configurations**: Validate configurations in CI/CD pipelines
|
|
654
|
+
|
|
655
|
+
### Configuration Examples
|
|
656
|
+
|
|
657
|
+
See the `examples/` directory for complete configuration examples:
|
|
658
|
+
- `examples/basic_valley.yaml`: Simple valley setup
|
|
659
|
+
- `examples/enterprise_valley.yaml`: Full enterprise configuration
|
|
660
|
+
- `examples/development.yaml`: Development environment setup
|
|
661
|
+
- `examples/production.yaml`: Production-ready configuration
|
|
662
|
+
|
|
663
|
+
## Architecture
|
|
664
|
+
|
|
665
|
+
- **Valley**: Main container managing campfires and infrastructure
|
|
666
|
+
- **Dock**: Gateway for inter-valley communication
|
|
667
|
+
- **Campfire**: Individual AI agent containers
|
|
668
|
+
- **Torch**: Message format for inter-valley communication
|
|
669
|
+
- **Party Box**: Storage system for attachments and payloads
|
|
670
|
+
- **MCP Broker**: Redis-based message routing
|
|
671
|
+
|
|
672
|
+
## Development
|
|
673
|
+
|
|
674
|
+
### Requirements
|
|
675
|
+
|
|
676
|
+
- Python 3.8+
|
|
677
|
+
- Redis server (for MCP broker)
|
|
678
|
+
- PyYAML, Pydantic, cryptography
|
|
679
|
+
|
|
680
|
+
### Running Tests
|
|
681
|
+
|
|
682
|
+
```bash
|
|
683
|
+
pip install -e ".[dev]"
|
|
684
|
+
pytest
|
|
685
|
+
```
|
|
686
|
+
|
|
687
|
+
## Additional Documentation
|
|
688
|
+
|
|
689
|
+
- **[Demo Guide](DEMO_GUIDE.md)**: Comprehensive guide for executing demos and examples
|
|
690
|
+
- **[Deployment Guide](DEPLOYMENT.md)**: Detailed deployment instructions and Docker setup
|
|
691
|
+
- **[Troubleshooting Guide](TROUBLESHOOTING.md)**: Solutions for common issues and MCP broker problems
|
|
692
|
+
|
|
693
|
+
## Support
|
|
694
|
+
|
|
695
|
+
If you encounter issues:
|
|
696
|
+
|
|
697
|
+
1. Check the [Troubleshooting Guide](TROUBLESHOOTING.md) for common problems
|
|
698
|
+
2. Review the [Demo Guide](DEMO_GUIDE.md) for step-by-step execution instructions
|
|
699
|
+
3. Use the simplified demo (`simple_marketing_demo.py`) to bypass MCP broker issues
|
|
700
|
+
4. Check Docker container logs: `docker-compose logs [service-name]`
|
|
701
|
+
|
|
702
|
+
## License
|
|
703
|
+
|
|
704
|
+
MIT License - see LICENSE file for details.
|