claude-flow-novice 1.6.5 → 1.6.6
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.
- package/.claude-flow-novice/dist/mcp/mcp-server-sdk.js +45 -0
- package/config/.env.example +178 -0
- package/config/DEPLOYMENT_GUIDE.md +692 -0
- package/config/README-CONFIG.md +331 -0
- package/config/coordination-config.sh +327 -0
- package/config/docker/env.development +53 -0
- package/config/docker/env.production +83 -0
- package/config/docker/env.staging +70 -0
- package/config/k8s/configmap-development.yaml +60 -0
- package/config/k8s/configmap-production.yaml +85 -0
- package/config/k8s/configmap-staging.yaml +76 -0
- package/config/k8s/secret-production.yaml +62 -0
- package/config/k8s/secret-staging.yaml +36 -0
- package/package.json +1 -1
- package/scripts/monitoring/dashboards/rate-limiting-dashboard.json +211 -0
- package/scripts/monitoring/quick-test-alerting.sh +118 -0
- package/scripts/monitoring/quick-test-rate-limiting.sh +206 -0
- package/scripts/monitoring/rate-limiting-monitor.sh +380 -0
|
@@ -13,6 +13,48 @@ import {
|
|
|
13
13
|
ReadResourceRequestSchema,
|
|
14
14
|
} from '@modelcontextprotocol/sdk/types.js';
|
|
15
15
|
|
|
16
|
+
// Session timeout prevention - keep connection alive for long CFN loops
|
|
17
|
+
let lastActivity = Date.now();
|
|
18
|
+
const SESSION_TIMEOUT = 8 * 60 * 60 * 1000; // 8 hours
|
|
19
|
+
|
|
20
|
+
// Update activity on every tool call
|
|
21
|
+
function updateActivity() {
|
|
22
|
+
lastActivity = Date.now();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Heartbeat to prevent timeout
|
|
26
|
+
const heartbeat = setInterval(() => {
|
|
27
|
+
const inactiveTime = Date.now() - lastActivity;
|
|
28
|
+
if (inactiveTime < SESSION_TIMEOUT) {
|
|
29
|
+
// Session still active
|
|
30
|
+
console.error(`[${new Date().toISOString()}] DEBUG Session active (${Math.floor(inactiveTime/1000/60)} minutes inactive)`);
|
|
31
|
+
}
|
|
32
|
+
}, 5 * 60 * 1000); // Check every 5 minutes
|
|
33
|
+
|
|
34
|
+
// Graceful shutdown handlers
|
|
35
|
+
process.stdin.on('end', () => {
|
|
36
|
+
console.error(`[${new Date().toISOString()}] WARN MCP SDK server received stdin close, attempting graceful shutdown...`);
|
|
37
|
+
|
|
38
|
+
// Grace period for pending operations (30 seconds)
|
|
39
|
+
setTimeout(() => {
|
|
40
|
+
clearInterval(heartbeat);
|
|
41
|
+
console.error(`[${new Date().toISOString()}] INFO MCP SDK server shutdown complete`);
|
|
42
|
+
process.exit(0);
|
|
43
|
+
}, 30000);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
process.on('SIGINT', () => {
|
|
47
|
+
console.error(`[${new Date().toISOString()}] INFO Received SIGINT, shutting down gracefully...`);
|
|
48
|
+
clearInterval(heartbeat);
|
|
49
|
+
process.exit(0);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
process.on('SIGTERM', () => {
|
|
53
|
+
console.error(`[${new Date().toISOString()}] INFO Received SIGTERM, shutting down gracefully...`);
|
|
54
|
+
clearInterval(heartbeat);
|
|
55
|
+
process.exit(0);
|
|
56
|
+
});
|
|
57
|
+
|
|
16
58
|
class ClaudeFlowNoviceServer {
|
|
17
59
|
constructor() {
|
|
18
60
|
this.version = '2.0.0-novice-sdk';
|
|
@@ -347,6 +389,9 @@ class ClaudeFlowNoviceServer {
|
|
|
347
389
|
this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
348
390
|
const { name, arguments: args } = request.params;
|
|
349
391
|
|
|
392
|
+
// Track activity on every tool call to prevent session timeout
|
|
393
|
+
updateActivity();
|
|
394
|
+
|
|
350
395
|
console.error(`[${new Date().toISOString()}] INFO [claude-flow-novice-mcp] (${this.sessionId}) Executing tool: ${name}`);
|
|
351
396
|
|
|
352
397
|
// Helper function to create standard responses
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# Claude Flow Novice - Environment Configuration Template
|
|
2
|
+
# Copy this file to .env and configure for your environment
|
|
3
|
+
|
|
4
|
+
# =============================================================================
|
|
5
|
+
# DEPLOYMENT ENVIRONMENT
|
|
6
|
+
# =============================================================================
|
|
7
|
+
# Options: development, staging, production
|
|
8
|
+
NODE_ENV=development
|
|
9
|
+
|
|
10
|
+
# =============================================================================
|
|
11
|
+
# AGENT COORDINATION CONFIGURATION
|
|
12
|
+
# =============================================================================
|
|
13
|
+
|
|
14
|
+
# --- Development Environment (10 agents, verbose logging) ---
|
|
15
|
+
CFN_MAX_AGENTS=10
|
|
16
|
+
CFN_SHARD_COUNT=4
|
|
17
|
+
CFN_METRICS_ENABLED=true
|
|
18
|
+
CFN_ALERTING_ENABLED=false
|
|
19
|
+
CFN_LOG_LEVEL=debug
|
|
20
|
+
CFN_CONSENSUS_THRESHOLD=0.90
|
|
21
|
+
CFN_ALERT_COORD_TIME_MS=3000
|
|
22
|
+
|
|
23
|
+
# --- Staging Environment (100 agents, moderate logging) ---
|
|
24
|
+
# Uncomment for staging deployment
|
|
25
|
+
# CFN_MAX_AGENTS=100
|
|
26
|
+
# CFN_SHARD_COUNT=16
|
|
27
|
+
# CFN_METRICS_ENABLED=true
|
|
28
|
+
# CFN_ALERTING_ENABLED=true
|
|
29
|
+
# CFN_LOG_LEVEL=info
|
|
30
|
+
# CFN_CONSENSUS_THRESHOLD=0.90
|
|
31
|
+
# CFN_ALERT_COORD_TIME_MS=5000
|
|
32
|
+
|
|
33
|
+
# --- Production Environment (500 agents, minimal logging) ---
|
|
34
|
+
# Uncomment for production deployment
|
|
35
|
+
# CFN_MAX_AGENTS=500
|
|
36
|
+
# CFN_SHARD_COUNT=32
|
|
37
|
+
# CFN_METRICS_ENABLED=true
|
|
38
|
+
# CFN_ALERTING_ENABLED=true
|
|
39
|
+
# CFN_LOG_LEVEL=warn
|
|
40
|
+
# CFN_CONSENSUS_THRESHOLD=0.95
|
|
41
|
+
# CFN_ALERT_COORD_TIME_MS=8000
|
|
42
|
+
|
|
43
|
+
# =============================================================================
|
|
44
|
+
# MEMORY AND STORAGE CONFIGURATION
|
|
45
|
+
# =============================================================================
|
|
46
|
+
|
|
47
|
+
# Base directory for memory coordination (tmpfs recommended for production)
|
|
48
|
+
CFN_BASE_DIR=/tmp/cfn
|
|
49
|
+
# CFN_BASE_DIR=/dev/shm/cfn # Use tmpfs for production (faster, memory-backed)
|
|
50
|
+
|
|
51
|
+
# Memory limits per agent (MB)
|
|
52
|
+
CFN_AGENT_MEMORY_LIMIT_MB=100
|
|
53
|
+
|
|
54
|
+
# Total memory pool (MB)
|
|
55
|
+
CFN_TOTAL_MEMORY_LIMIT_MB=2048
|
|
56
|
+
# CFN_TOTAL_MEMORY_LIMIT_MB=10240 # Staging: 10GB
|
|
57
|
+
# CFN_TOTAL_MEMORY_LIMIT_MB=51200 # Production: 50GB
|
|
58
|
+
|
|
59
|
+
# =============================================================================
|
|
60
|
+
# PERFORMANCE AND OPTIMIZATION
|
|
61
|
+
# =============================================================================
|
|
62
|
+
|
|
63
|
+
# Coordination timeouts
|
|
64
|
+
CFN_AGENT_TIMEOUT_MS=30000
|
|
65
|
+
CFN_CONSENSUS_TIMEOUT_MS=60000
|
|
66
|
+
CFN_SWARM_INIT_TIMEOUT_MS=10000
|
|
67
|
+
|
|
68
|
+
# Performance tuning
|
|
69
|
+
CFN_ENABLE_CACHING=true
|
|
70
|
+
CFN_CACHE_TTL_SECONDS=300
|
|
71
|
+
CFN_MAX_CONCURRENT_OPERATIONS=10
|
|
72
|
+
# CFN_MAX_CONCURRENT_OPERATIONS=50 # Staging
|
|
73
|
+
# CFN_MAX_CONCURRENT_OPERATIONS=100 # Production
|
|
74
|
+
|
|
75
|
+
# Resource cleanup
|
|
76
|
+
CFN_CLEANUP_INTERVAL_MS=60000
|
|
77
|
+
CFN_CLEANUP_STALE_AGENTS_ENABLED=true
|
|
78
|
+
|
|
79
|
+
# =============================================================================
|
|
80
|
+
# MONITORING AND OBSERVABILITY
|
|
81
|
+
# =============================================================================
|
|
82
|
+
|
|
83
|
+
# Metrics collection
|
|
84
|
+
CFN_METRICS_COLLECTION_INTERVAL_MS=5000
|
|
85
|
+
CFN_METRICS_RETENTION_HOURS=24
|
|
86
|
+
# CFN_METRICS_RETENTION_HOURS=168 # Production: 7 days
|
|
87
|
+
|
|
88
|
+
# Performance metrics
|
|
89
|
+
CFN_TRACK_COORDINATION_TIME=true
|
|
90
|
+
CFN_TRACK_MEMORY_USAGE=true
|
|
91
|
+
CFN_TRACK_AGENT_LIFECYCLE=true
|
|
92
|
+
|
|
93
|
+
# Alerting thresholds
|
|
94
|
+
CFN_ALERT_MEMORY_THRESHOLD_PERCENT=80
|
|
95
|
+
CFN_ALERT_AGENT_FAILURE_COUNT=3
|
|
96
|
+
CFN_ALERT_CONSENSUS_FAILURE_THRESHOLD=0.70
|
|
97
|
+
|
|
98
|
+
# =============================================================================
|
|
99
|
+
# SECURITY CONFIGURATION
|
|
100
|
+
# =============================================================================
|
|
101
|
+
|
|
102
|
+
# Agent authentication
|
|
103
|
+
CFN_ENABLE_AGENT_AUTH=false
|
|
104
|
+
# CFN_ENABLE_AGENT_AUTH=true # Enable for staging/production
|
|
105
|
+
# CFN_AGENT_AUTH_TOKEN=your-secret-token-here
|
|
106
|
+
|
|
107
|
+
# Network security
|
|
108
|
+
CFN_ENABLE_TLS=false
|
|
109
|
+
# CFN_ENABLE_TLS=true # Enable for production
|
|
110
|
+
# CFN_TLS_CERT_PATH=/path/to/cert.pem
|
|
111
|
+
# CFN_TLS_KEY_PATH=/path/to/key.pem
|
|
112
|
+
|
|
113
|
+
# Rate limiting
|
|
114
|
+
CFN_ENABLE_RATE_LIMITING=false
|
|
115
|
+
# CFN_ENABLE_RATE_LIMITING=true # Enable for production
|
|
116
|
+
CFN_RATE_LIMIT_REQUESTS_PER_MINUTE=100
|
|
117
|
+
# CFN_RATE_LIMIT_REQUESTS_PER_MINUTE=1000 # Production
|
|
118
|
+
|
|
119
|
+
# =============================================================================
|
|
120
|
+
# INTEGRATION CONFIGURATION
|
|
121
|
+
# =============================================================================
|
|
122
|
+
|
|
123
|
+
# MCP Server
|
|
124
|
+
CFN_MCP_SERVER_ENABLED=true
|
|
125
|
+
CFN_MCP_SERVER_PORT=3000
|
|
126
|
+
|
|
127
|
+
# GitHub Integration (optional)
|
|
128
|
+
CFN_GITHUB_ENABLED=false
|
|
129
|
+
# CFN_GITHUB_TOKEN=your-github-token
|
|
130
|
+
# CFN_GITHUB_REPO=your-org/your-repo
|
|
131
|
+
|
|
132
|
+
# Database (optional - for persistent metrics)
|
|
133
|
+
CFN_DB_ENABLED=false
|
|
134
|
+
# CFN_DB_TYPE=sqlite
|
|
135
|
+
# CFN_DB_PATH=/var/lib/cfn/metrics.db
|
|
136
|
+
# CFN_DB_TYPE=postgresql
|
|
137
|
+
# CFN_DB_HOST=localhost
|
|
138
|
+
# CFN_DB_PORT=5432
|
|
139
|
+
# CFN_DB_NAME=cfn_metrics
|
|
140
|
+
# CFN_DB_USER=cfn_user
|
|
141
|
+
# CFN_DB_PASSWORD=your-db-password
|
|
142
|
+
|
|
143
|
+
# =============================================================================
|
|
144
|
+
# TESTING AND DEBUGGING
|
|
145
|
+
# =============================================================================
|
|
146
|
+
|
|
147
|
+
# Test mode (disables production safety checks)
|
|
148
|
+
CFN_TEST_MODE=false
|
|
149
|
+
|
|
150
|
+
# Debug options
|
|
151
|
+
CFN_DEBUG_AGENT_SPAWN=false
|
|
152
|
+
CFN_DEBUG_CONSENSUS=false
|
|
153
|
+
CFN_DEBUG_MEMORY=false
|
|
154
|
+
CFN_VERBOSE_LOGGING=false
|
|
155
|
+
|
|
156
|
+
# Chaos engineering (staging only)
|
|
157
|
+
CFN_CHAOS_ENABLED=false
|
|
158
|
+
# CFN_CHAOS_FAILURE_RATE=0.05
|
|
159
|
+
# CFN_CHAOS_LATENCY_MS=100
|
|
160
|
+
|
|
161
|
+
# =============================================================================
|
|
162
|
+
# EXPERIMENTAL FEATURES
|
|
163
|
+
# =============================================================================
|
|
164
|
+
|
|
165
|
+
# Neural coordination (experimental)
|
|
166
|
+
CFN_NEURAL_ENABLED=false
|
|
167
|
+
# CFN_NEURAL_MODEL=gpt-4
|
|
168
|
+
# CFN_NEURAL_API_KEY=your-api-key
|
|
169
|
+
|
|
170
|
+
# Advanced consensus algorithms
|
|
171
|
+
CFN_CONSENSUS_ALGORITHM=byzantine
|
|
172
|
+
# CFN_CONSENSUS_ALGORITHM=raft
|
|
173
|
+
# CFN_CONSENSUS_ALGORITHM=gossip
|
|
174
|
+
|
|
175
|
+
# Distributed tracing
|
|
176
|
+
CFN_TRACING_ENABLED=false
|
|
177
|
+
# CFN_TRACING_ENDPOINT=http://localhost:9411
|
|
178
|
+
# CFN_TRACING_SERVICE_NAME=claude-flow-novice
|