snow-flow 1.3.0 → 1.3.2
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/queen/queen-memory.db +0 -0
- package/.env.example +249 -14
- package/CLAUDE.md +185 -24
- package/README.md +55 -5
- package/dist/api/error-handling.js +898 -4
- package/dist/api/performance-optimizer.js +3 -2
- package/dist/cli.js +590 -200
- package/dist/config/snow-flow-config.js +320 -8
- package/dist/health/system-health.js +288 -21
- package/dist/mcp/base-mcp-server.js +2 -0
- package/dist/mcp/http-transport-wrapper.js +65 -4
- package/dist/mcp/servicenow-automation-mcp-refactored.js +90 -9
- package/dist/mcp/servicenow-deployment-mcp-refactored.js +151 -2
- package/dist/mcp/servicenow-deployment-mcp.js +828 -15
- package/dist/mcp/servicenow-integration-mcp-refactored.js +100 -9
- package/dist/mcp/servicenow-intelligent-mcp.js +198 -7
- package/dist/mcp/servicenow-memory-mcp.js +2 -1
- package/dist/mcp/servicenow-operations-mcp-refactored.js +3 -2
- package/dist/mcp/servicenow-xml-flow-mcp.js +671 -0
- package/dist/mcp/shared/base-mcp-server.js +1356 -8
- package/dist/mcp/shared/mcp-resource-manager.js +304 -0
- package/dist/queen/parallel-agent-engine.js +26 -8
- package/dist/queen/servicenow-queen.js +47 -44
- package/dist/sparc/sparc-help.js +37 -26
- package/dist/sparc/team-sparc.js +60 -16
- package/dist/utils/action-type-cache.js +2 -1
- package/dist/utils/mcp-config-manager.js +7 -3
- package/dist/utils/mcp-server-manager.js +7 -3
- package/dist/utils/servicenow-client.js +134 -107
- package/dist/utils/servicenow-id-generator.js +171 -0
- package/dist/utils/snow-oauth.js +13 -8
- package/dist/utils/widget-template-generator.js +1690 -0
- package/dist/utils/xml-first-flow-generator.js +473 -0
- package/dist/version.js +7 -1
- package/flow-update-sets/flow_build_automated_approval_flow_with_notifications_flow.xml +203 -0
- package/flow-update-sets/flow_create_approval_flow_for_equipment_requests_flow.xml +206 -0
- package/flow-update-sets/flow_create_equipment_approval_flow_with_manager_approv_flow.xml +254 -0
- package/flow-update-sets/iphone_15_pro_approval_flow.xml +203 -0
- package/flow-update-sets/test_iphone_approval_flow_flow.xml +303 -0
- package/package.json +2 -1
- package/test-config.js +55 -0
- package/test-real-monitoring.js +184 -0
|
@@ -18,7 +18,7 @@ const ConfigSchema = zod_1.z.object({
|
|
|
18
18
|
system: zod_1.z.object({
|
|
19
19
|
environment: zod_1.z.enum(['development', 'staging', 'production']).default('development'),
|
|
20
20
|
logLevel: zod_1.z.enum(['debug', 'info', 'warn', 'error']).default('info'),
|
|
21
|
-
dataDir: zod_1.z.string().default(path_1.default.join(os_1.default.homedir(), '.snow-flow')),
|
|
21
|
+
dataDir: zod_1.z.string().default(process.env.SNOW_FLOW_HOME || path_1.default.join(os_1.default.homedir(), '.snow-flow')),
|
|
22
22
|
maxConcurrentOperations: zod_1.z.number().min(1).max(100).default(10),
|
|
23
23
|
sessionTimeout: zod_1.z.number().min(300000).default(3600000), // 1 hour default
|
|
24
24
|
}),
|
|
@@ -26,7 +26,7 @@ const ConfigSchema = zod_1.z.object({
|
|
|
26
26
|
agents: zod_1.z.object({
|
|
27
27
|
queen: zod_1.z.object({
|
|
28
28
|
maxWorkerAgents: zod_1.z.number().min(1).max(50).default(10),
|
|
29
|
-
spawnTimeout: zod_1.z.number().min(5000).default(30000),
|
|
29
|
+
spawnTimeout: zod_1.z.number().min(5000).default(parseInt(process.env.SNOW_FLOW_SPAWN_TIMEOUT || '30000')),
|
|
30
30
|
coordinationInterval: zod_1.z.number().min(1000).default(5000),
|
|
31
31
|
decisionThreshold: zod_1.z.number().min(0).max(1).default(0.7),
|
|
32
32
|
retryAttempts: zod_1.z.number().min(1).max(10).default(3),
|
|
@@ -94,33 +94,33 @@ const ConfigSchema = zod_1.z.object({
|
|
|
94
94
|
servers: zod_1.z.object({
|
|
95
95
|
deployment: zod_1.z.object({
|
|
96
96
|
enabled: zod_1.z.boolean().default(true),
|
|
97
|
-
port: zod_1.z.number().min(3000).max(65535).default(3001),
|
|
97
|
+
port: zod_1.z.number().min(3000).max(65535).default(parseInt(process.env.MCP_DEPLOYMENT_PORT || '3001')),
|
|
98
98
|
host: zod_1.z.string().default('localhost'),
|
|
99
99
|
}),
|
|
100
100
|
intelligent: zod_1.z.object({
|
|
101
101
|
enabled: zod_1.z.boolean().default(true),
|
|
102
|
-
port: zod_1.z.number().min(3000).max(65535).default(3002),
|
|
102
|
+
port: zod_1.z.number().min(3000).max(65535).default(parseInt(process.env.MCP_INTELLIGENT_PORT || '3002')),
|
|
103
103
|
host: zod_1.z.string().default('localhost'),
|
|
104
104
|
}),
|
|
105
105
|
operations: zod_1.z.object({
|
|
106
106
|
enabled: zod_1.z.boolean().default(true),
|
|
107
|
-
port: zod_1.z.number().min(3000).max(65535).default(3003),
|
|
107
|
+
port: zod_1.z.number().min(3000).max(65535).default(parseInt(process.env.MCP_OPERATIONS_PORT || '3003')),
|
|
108
108
|
host: zod_1.z.string().default('localhost'),
|
|
109
109
|
}),
|
|
110
110
|
flowComposer: zod_1.z.object({
|
|
111
111
|
enabled: zod_1.z.boolean().default(true),
|
|
112
|
-
port: zod_1.z.number().min(3000).max(65535).default(3004),
|
|
112
|
+
port: zod_1.z.number().min(3000).max(65535).default(parseInt(process.env.MCP_FLOW_COMPOSER_PORT || '3004')),
|
|
113
113
|
host: zod_1.z.string().default('localhost'),
|
|
114
114
|
}),
|
|
115
115
|
platformDevelopment: zod_1.z.object({
|
|
116
116
|
enabled: zod_1.z.boolean().default(true),
|
|
117
|
-
port: zod_1.z.number().min(3000).max(65535).default(3005),
|
|
117
|
+
port: zod_1.z.number().min(3000).max(65535).default(parseInt(process.env.MCP_PLATFORM_DEV_PORT || '3005')),
|
|
118
118
|
host: zod_1.z.string().default('localhost'),
|
|
119
119
|
}),
|
|
120
120
|
}),
|
|
121
121
|
transport: zod_1.z.object({
|
|
122
122
|
type: zod_1.z.enum(['stdio', 'http', 'websocket']).default('stdio'),
|
|
123
|
-
timeout: zod_1.z.number().min(5000).default(30000),
|
|
123
|
+
timeout: zod_1.z.number().min(5000).default(parseInt(process.env.MCP_TIMEOUT || '30000')),
|
|
124
124
|
retryAttempts: zod_1.z.number().min(1).max(10).default(3),
|
|
125
125
|
retryDelay: zod_1.z.number().min(1000).default(5000),
|
|
126
126
|
}),
|
|
@@ -149,6 +149,11 @@ const ConfigSchema = zod_1.z.object({
|
|
|
149
149
|
ttl: zod_1.z.number().min(60000).default(300000), // 5 minutes
|
|
150
150
|
maxSize: zod_1.z.number().min(10).default(50), // MB
|
|
151
151
|
}),
|
|
152
|
+
oauth: zod_1.z.object({
|
|
153
|
+
redirectHost: zod_1.z.string().default('localhost'),
|
|
154
|
+
redirectPort: zod_1.z.number().min(3000).max(65535).default(parseInt(process.env.SNOW_REDIRECT_PORT || '3005')),
|
|
155
|
+
redirectPath: zod_1.z.string().default('/callback'),
|
|
156
|
+
}),
|
|
152
157
|
}),
|
|
153
158
|
// Monitoring configuration
|
|
154
159
|
monitoring: zod_1.z.object({
|
|
@@ -327,6 +332,43 @@ class SnowFlowConfig {
|
|
|
327
332
|
env.servicenow = env.servicenow || {};
|
|
328
333
|
env.servicenow.password = process.env.SNOW_PASSWORD;
|
|
329
334
|
}
|
|
335
|
+
if (process.env.SNOW_AUTH_TYPE) {
|
|
336
|
+
env.servicenow = env.servicenow || {};
|
|
337
|
+
env.servicenow.authType = process.env.SNOW_AUTH_TYPE;
|
|
338
|
+
}
|
|
339
|
+
if (process.env.SNOW_API_VERSION) {
|
|
340
|
+
env.servicenow = env.servicenow || {};
|
|
341
|
+
env.servicenow.apiVersion = process.env.SNOW_API_VERSION;
|
|
342
|
+
}
|
|
343
|
+
if (process.env.SNOW_REQUEST_TIMEOUT) {
|
|
344
|
+
env.servicenow = env.servicenow || {};
|
|
345
|
+
env.servicenow.timeout = parseInt(process.env.SNOW_REQUEST_TIMEOUT);
|
|
346
|
+
}
|
|
347
|
+
if (process.env.SNOW_MAX_RETRIES) {
|
|
348
|
+
env.servicenow = env.servicenow || {};
|
|
349
|
+
env.servicenow.retryConfig = env.servicenow.retryConfig || {};
|
|
350
|
+
env.servicenow.retryConfig.maxRetries = parseInt(process.env.SNOW_MAX_RETRIES);
|
|
351
|
+
}
|
|
352
|
+
if (process.env.SNOW_RETRY_DELAY) {
|
|
353
|
+
env.servicenow = env.servicenow || {};
|
|
354
|
+
env.servicenow.retryConfig = env.servicenow.retryConfig || {};
|
|
355
|
+
env.servicenow.retryConfig.retryDelay = parseInt(process.env.SNOW_RETRY_DELAY);
|
|
356
|
+
}
|
|
357
|
+
if (process.env.SNOW_REDIRECT_HOST) {
|
|
358
|
+
env.servicenow = env.servicenow || {};
|
|
359
|
+
env.servicenow.oauth = env.servicenow.oauth || {};
|
|
360
|
+
env.servicenow.oauth.redirectHost = process.env.SNOW_REDIRECT_HOST;
|
|
361
|
+
}
|
|
362
|
+
if (process.env.SNOW_REDIRECT_PORT) {
|
|
363
|
+
env.servicenow = env.servicenow || {};
|
|
364
|
+
env.servicenow.oauth = env.servicenow.oauth || {};
|
|
365
|
+
env.servicenow.oauth.redirectPort = parseInt(process.env.SNOW_REDIRECT_PORT);
|
|
366
|
+
}
|
|
367
|
+
if (process.env.SNOW_REDIRECT_PATH) {
|
|
368
|
+
env.servicenow = env.servicenow || {};
|
|
369
|
+
env.servicenow.oauth = env.servicenow.oauth || {};
|
|
370
|
+
env.servicenow.oauth.redirectPath = process.env.SNOW_REDIRECT_PATH;
|
|
371
|
+
}
|
|
330
372
|
// System settings
|
|
331
373
|
if (process.env.SNOW_FLOW_ENV) {
|
|
332
374
|
env.system = env.system || {};
|
|
@@ -336,6 +378,276 @@ class SnowFlowConfig {
|
|
|
336
378
|
env.system = env.system || {};
|
|
337
379
|
env.system.logLevel = process.env.SNOW_FLOW_LOG_LEVEL;
|
|
338
380
|
}
|
|
381
|
+
if (process.env.SNOW_FLOW_DATA_DIR) {
|
|
382
|
+
env.system = env.system || {};
|
|
383
|
+
env.system.dataDir = process.env.SNOW_FLOW_DATA_DIR;
|
|
384
|
+
}
|
|
385
|
+
if (process.env.SNOW_FLOW_MAX_CONCURRENT_OPS) {
|
|
386
|
+
env.system = env.system || {};
|
|
387
|
+
env.system.maxConcurrentOperations = parseInt(process.env.SNOW_FLOW_MAX_CONCURRENT_OPS);
|
|
388
|
+
}
|
|
389
|
+
if (process.env.SNOW_FLOW_SESSION_TIMEOUT) {
|
|
390
|
+
env.system = env.system || {};
|
|
391
|
+
env.system.sessionTimeout = parseInt(process.env.SNOW_FLOW_SESSION_TIMEOUT);
|
|
392
|
+
}
|
|
393
|
+
// Agent configuration
|
|
394
|
+
if (process.env.SNOW_FLOW_MAX_WORKER_AGENTS) {
|
|
395
|
+
env.agents = env.agents || {};
|
|
396
|
+
env.agents.queen = env.agents.queen || {};
|
|
397
|
+
env.agents.queen.maxWorkerAgents = parseInt(process.env.SNOW_FLOW_MAX_WORKER_AGENTS);
|
|
398
|
+
}
|
|
399
|
+
if (process.env.SNOW_FLOW_SPAWN_TIMEOUT) {
|
|
400
|
+
env.agents = env.agents || {};
|
|
401
|
+
env.agents.queen = env.agents.queen || {};
|
|
402
|
+
env.agents.queen.spawnTimeout = parseInt(process.env.SNOW_FLOW_SPAWN_TIMEOUT);
|
|
403
|
+
}
|
|
404
|
+
if (process.env.SNOW_FLOW_COORDINATION_INTERVAL) {
|
|
405
|
+
env.agents = env.agents || {};
|
|
406
|
+
env.agents.queen = env.agents.queen || {};
|
|
407
|
+
env.agents.queen.coordinationInterval = parseInt(process.env.SNOW_FLOW_COORDINATION_INTERVAL);
|
|
408
|
+
}
|
|
409
|
+
if (process.env.SNOW_FLOW_RETRY_ATTEMPTS) {
|
|
410
|
+
env.agents = env.agents || {};
|
|
411
|
+
env.agents.queen = env.agents.queen || {};
|
|
412
|
+
env.agents.queen.retryAttempts = parseInt(process.env.SNOW_FLOW_RETRY_ATTEMPTS);
|
|
413
|
+
}
|
|
414
|
+
if (process.env.SNOW_FLOW_HEARTBEAT_INTERVAL) {
|
|
415
|
+
env.agents = env.agents || {};
|
|
416
|
+
env.agents.worker = env.agents.worker || {};
|
|
417
|
+
env.agents.worker.heartbeatInterval = parseInt(process.env.SNOW_FLOW_HEARTBEAT_INTERVAL);
|
|
418
|
+
}
|
|
419
|
+
if (process.env.SNOW_FLOW_TASK_TIMEOUT) {
|
|
420
|
+
env.agents = env.agents || {};
|
|
421
|
+
env.agents.worker = env.agents.worker || {};
|
|
422
|
+
env.agents.worker.taskTimeout = parseInt(process.env.SNOW_FLOW_TASK_TIMEOUT);
|
|
423
|
+
}
|
|
424
|
+
if (process.env.SNOW_FLOW_MAX_MEMORY_USAGE) {
|
|
425
|
+
env.agents = env.agents || {};
|
|
426
|
+
env.agents.worker = env.agents.worker || {};
|
|
427
|
+
env.agents.worker.maxMemoryUsage = parseInt(process.env.SNOW_FLOW_MAX_MEMORY_USAGE);
|
|
428
|
+
}
|
|
429
|
+
if (process.env.SNOW_FLOW_AUTO_SHUTDOWN_IDLE) {
|
|
430
|
+
env.agents = env.agents || {};
|
|
431
|
+
env.agents.worker = env.agents.worker || {};
|
|
432
|
+
env.agents.worker.autoShutdownIdle = parseInt(process.env.SNOW_FLOW_AUTO_SHUTDOWN_IDLE);
|
|
433
|
+
}
|
|
434
|
+
// MCP server configuration
|
|
435
|
+
if (process.env.MCP_DEPLOYMENT_PORT) {
|
|
436
|
+
env.mcp = env.mcp || {};
|
|
437
|
+
env.mcp.servers = env.mcp.servers || {};
|
|
438
|
+
env.mcp.servers.deployment = env.mcp.servers.deployment || {};
|
|
439
|
+
env.mcp.servers.deployment.port = parseInt(process.env.MCP_DEPLOYMENT_PORT);
|
|
440
|
+
}
|
|
441
|
+
if (process.env.MCP_INTELLIGENT_PORT) {
|
|
442
|
+
env.mcp = env.mcp || {};
|
|
443
|
+
env.mcp.servers = env.mcp.servers || {};
|
|
444
|
+
env.mcp.servers.intelligent = env.mcp.servers.intelligent || {};
|
|
445
|
+
env.mcp.servers.intelligent.port = parseInt(process.env.MCP_INTELLIGENT_PORT);
|
|
446
|
+
}
|
|
447
|
+
if (process.env.MCP_OPERATIONS_PORT) {
|
|
448
|
+
env.mcp = env.mcp || {};
|
|
449
|
+
env.mcp.servers = env.mcp.servers || {};
|
|
450
|
+
env.mcp.servers.operations = env.mcp.servers.operations || {};
|
|
451
|
+
env.mcp.servers.operations.port = parseInt(process.env.MCP_OPERATIONS_PORT);
|
|
452
|
+
}
|
|
453
|
+
if (process.env.MCP_FLOW_COMPOSER_PORT) {
|
|
454
|
+
env.mcp = env.mcp || {};
|
|
455
|
+
env.mcp.servers = env.mcp.servers || {};
|
|
456
|
+
env.mcp.servers.flowComposer = env.mcp.servers.flowComposer || {};
|
|
457
|
+
env.mcp.servers.flowComposer.port = parseInt(process.env.MCP_FLOW_COMPOSER_PORT);
|
|
458
|
+
}
|
|
459
|
+
if (process.env.MCP_PLATFORM_DEV_PORT) {
|
|
460
|
+
env.mcp = env.mcp || {};
|
|
461
|
+
env.mcp.servers = env.mcp.servers || {};
|
|
462
|
+
env.mcp.servers.platformDevelopment = env.mcp.servers.platformDevelopment || {};
|
|
463
|
+
env.mcp.servers.platformDevelopment.port = parseInt(process.env.MCP_PLATFORM_DEV_PORT);
|
|
464
|
+
}
|
|
465
|
+
if (process.env.MCP_HOST) {
|
|
466
|
+
env.mcp = env.mcp || {};
|
|
467
|
+
env.mcp.servers = env.mcp.servers || {};
|
|
468
|
+
// Apply to all servers
|
|
469
|
+
['deployment', 'intelligent', 'operations', 'flowComposer', 'platformDevelopment'].forEach(server => {
|
|
470
|
+
env.mcp.servers[server] = env.mcp.servers[server] || {};
|
|
471
|
+
env.mcp.servers[server].host = process.env.MCP_HOST;
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
if (process.env.MCP_TIMEOUT) {
|
|
475
|
+
env.mcp = env.mcp || {};
|
|
476
|
+
env.mcp.transport = env.mcp.transport || {};
|
|
477
|
+
env.mcp.transport.timeout = parseInt(process.env.MCP_TIMEOUT);
|
|
478
|
+
}
|
|
479
|
+
if (process.env.MCP_RETRY_ATTEMPTS) {
|
|
480
|
+
env.mcp = env.mcp || {};
|
|
481
|
+
env.mcp.transport = env.mcp.transport || {};
|
|
482
|
+
env.mcp.transport.retryAttempts = parseInt(process.env.MCP_RETRY_ATTEMPTS);
|
|
483
|
+
}
|
|
484
|
+
if (process.env.MCP_RETRY_DELAY) {
|
|
485
|
+
env.mcp = env.mcp || {};
|
|
486
|
+
env.mcp.transport = env.mcp.transport || {};
|
|
487
|
+
env.mcp.transport.retryDelay = parseInt(process.env.MCP_RETRY_DELAY);
|
|
488
|
+
}
|
|
489
|
+
if (process.env.MCP_AUTH_TOKEN_EXPIRY) {
|
|
490
|
+
env.mcp = env.mcp || {};
|
|
491
|
+
env.mcp.authentication = env.mcp.authentication || {};
|
|
492
|
+
env.mcp.authentication.tokenExpiry = parseInt(process.env.MCP_AUTH_TOKEN_EXPIRY);
|
|
493
|
+
}
|
|
494
|
+
// Memory system configuration
|
|
495
|
+
if (process.env.SNOW_FLOW_DB_PATH) {
|
|
496
|
+
env.memory = env.memory || {};
|
|
497
|
+
env.memory.dbPath = process.env.SNOW_FLOW_DB_PATH;
|
|
498
|
+
}
|
|
499
|
+
if (process.env.SNOW_FLOW_CACHE_ENABLED) {
|
|
500
|
+
env.memory = env.memory || {};
|
|
501
|
+
env.memory.cache = env.memory.cache || {};
|
|
502
|
+
env.memory.cache.enabled = process.env.SNOW_FLOW_CACHE_ENABLED === 'true';
|
|
503
|
+
}
|
|
504
|
+
if (process.env.SNOW_FLOW_CACHE_MAX_SIZE) {
|
|
505
|
+
env.memory = env.memory || {};
|
|
506
|
+
env.memory.cache = env.memory.cache || {};
|
|
507
|
+
env.memory.cache.maxSize = parseInt(process.env.SNOW_FLOW_CACHE_MAX_SIZE);
|
|
508
|
+
}
|
|
509
|
+
if (process.env.SNOW_FLOW_CACHE_TTL) {
|
|
510
|
+
env.memory = env.memory || {};
|
|
511
|
+
env.memory.cache = env.memory.cache || {};
|
|
512
|
+
env.memory.cache.ttl = parseInt(process.env.SNOW_FLOW_CACHE_TTL);
|
|
513
|
+
}
|
|
514
|
+
if (process.env.SNOW_FLOW_DEFAULT_TTL) {
|
|
515
|
+
env.memory = env.memory || {};
|
|
516
|
+
env.memory.ttl = env.memory.ttl || {};
|
|
517
|
+
env.memory.ttl.default = parseInt(process.env.SNOW_FLOW_DEFAULT_TTL);
|
|
518
|
+
}
|
|
519
|
+
if (process.env.SNOW_FLOW_SESSION_TTL) {
|
|
520
|
+
env.memory = env.memory || {};
|
|
521
|
+
env.memory.ttl = env.memory.ttl || {};
|
|
522
|
+
env.memory.ttl.session = parseInt(process.env.SNOW_FLOW_SESSION_TTL);
|
|
523
|
+
}
|
|
524
|
+
if (process.env.SNOW_FLOW_ARTIFACT_TTL) {
|
|
525
|
+
env.memory = env.memory || {};
|
|
526
|
+
env.memory.ttl = env.memory.ttl || {};
|
|
527
|
+
env.memory.ttl.artifact = parseInt(process.env.SNOW_FLOW_ARTIFACT_TTL);
|
|
528
|
+
}
|
|
529
|
+
if (process.env.SNOW_FLOW_METRIC_TTL) {
|
|
530
|
+
env.memory = env.memory || {};
|
|
531
|
+
env.memory.ttl = env.memory.ttl || {};
|
|
532
|
+
env.memory.ttl.metric = parseInt(process.env.SNOW_FLOW_METRIC_TTL);
|
|
533
|
+
}
|
|
534
|
+
if (process.env.SNOW_FLOW_CLEANUP_INTERVAL) {
|
|
535
|
+
env.memory = env.memory || {};
|
|
536
|
+
env.memory.cleanup = env.memory.cleanup || {};
|
|
537
|
+
env.memory.cleanup.interval = parseInt(process.env.SNOW_FLOW_CLEANUP_INTERVAL);
|
|
538
|
+
}
|
|
539
|
+
if (process.env.SNOW_FLOW_RETENTION_DAYS) {
|
|
540
|
+
env.memory = env.memory || {};
|
|
541
|
+
env.memory.cleanup = env.memory.cleanup || {};
|
|
542
|
+
env.memory.cleanup.retentionDays = parseInt(process.env.SNOW_FLOW_RETENTION_DAYS);
|
|
543
|
+
}
|
|
544
|
+
// Monitoring configuration
|
|
545
|
+
if (process.env.SNOW_FLOW_PERFORMANCE_ENABLED) {
|
|
546
|
+
env.monitoring = env.monitoring || {};
|
|
547
|
+
env.monitoring.performance = env.monitoring.performance || {};
|
|
548
|
+
env.monitoring.performance.enabled = process.env.SNOW_FLOW_PERFORMANCE_ENABLED === 'true';
|
|
549
|
+
}
|
|
550
|
+
if (process.env.SNOW_FLOW_SAMPLE_RATE) {
|
|
551
|
+
env.monitoring = env.monitoring || {};
|
|
552
|
+
env.monitoring.performance = env.monitoring.performance || {};
|
|
553
|
+
env.monitoring.performance.sampleRate = parseFloat(process.env.SNOW_FLOW_SAMPLE_RATE);
|
|
554
|
+
}
|
|
555
|
+
if (process.env.SNOW_FLOW_METRICS_RETENTION) {
|
|
556
|
+
env.monitoring = env.monitoring || {};
|
|
557
|
+
env.monitoring.performance = env.monitoring.performance || {};
|
|
558
|
+
env.monitoring.performance.metricsRetention = parseInt(process.env.SNOW_FLOW_METRICS_RETENTION);
|
|
559
|
+
}
|
|
560
|
+
if (process.env.SNOW_FLOW_AGGREGATION_INTERVAL) {
|
|
561
|
+
env.monitoring = env.monitoring || {};
|
|
562
|
+
env.monitoring.performance = env.monitoring.performance || {};
|
|
563
|
+
env.monitoring.performance.aggregationInterval = parseInt(process.env.SNOW_FLOW_AGGREGATION_INTERVAL);
|
|
564
|
+
}
|
|
565
|
+
if (process.env.SNOW_FLOW_HEALTH_CHECK_INTERVAL) {
|
|
566
|
+
env.monitoring = env.monitoring || {};
|
|
567
|
+
env.monitoring.health = env.monitoring.health || {};
|
|
568
|
+
env.monitoring.health.checkInterval = parseInt(process.env.SNOW_FLOW_HEALTH_CHECK_INTERVAL);
|
|
569
|
+
}
|
|
570
|
+
if (process.env.SNOW_FLOW_MEMORY_THRESHOLD) {
|
|
571
|
+
env.monitoring = env.monitoring || {};
|
|
572
|
+
env.monitoring.health = env.monitoring.health || {};
|
|
573
|
+
env.monitoring.health.thresholds = env.monitoring.health.thresholds || {};
|
|
574
|
+
env.monitoring.health.thresholds.memoryUsage = parseFloat(process.env.SNOW_FLOW_MEMORY_THRESHOLD);
|
|
575
|
+
}
|
|
576
|
+
if (process.env.SNOW_FLOW_CPU_THRESHOLD) {
|
|
577
|
+
env.monitoring = env.monitoring || {};
|
|
578
|
+
env.monitoring.health = env.monitoring.health || {};
|
|
579
|
+
env.monitoring.health.thresholds = env.monitoring.health.thresholds || {};
|
|
580
|
+
env.monitoring.health.thresholds.cpuUsage = parseFloat(process.env.SNOW_FLOW_CPU_THRESHOLD);
|
|
581
|
+
}
|
|
582
|
+
if (process.env.SNOW_FLOW_ERROR_RATE_THRESHOLD) {
|
|
583
|
+
env.monitoring = env.monitoring || {};
|
|
584
|
+
env.monitoring.health = env.monitoring.health || {};
|
|
585
|
+
env.monitoring.health.thresholds = env.monitoring.health.thresholds || {};
|
|
586
|
+
env.monitoring.health.thresholds.errorRate = parseFloat(process.env.SNOW_FLOW_ERROR_RATE_THRESHOLD);
|
|
587
|
+
}
|
|
588
|
+
if (process.env.SNOW_FLOW_WEBHOOK_URL) {
|
|
589
|
+
env.monitoring = env.monitoring || {};
|
|
590
|
+
env.monitoring.alerts = env.monitoring.alerts || {};
|
|
591
|
+
env.monitoring.alerts.webhookUrl = process.env.SNOW_FLOW_WEBHOOK_URL;
|
|
592
|
+
}
|
|
593
|
+
if (process.env.SNOW_FLOW_ALERT_SEVERITY) {
|
|
594
|
+
env.monitoring = env.monitoring || {};
|
|
595
|
+
env.monitoring.alerts = env.monitoring.alerts || {};
|
|
596
|
+
env.monitoring.alerts.severityThreshold = process.env.SNOW_FLOW_ALERT_SEVERITY;
|
|
597
|
+
}
|
|
598
|
+
// Health check thresholds
|
|
599
|
+
if (process.env.SNOW_FLOW_RESPONSE_TIME_THRESHOLD) {
|
|
600
|
+
env.health = env.health || {};
|
|
601
|
+
env.health.thresholds = env.health.thresholds || {};
|
|
602
|
+
env.health.thresholds.responseTime = parseInt(process.env.SNOW_FLOW_RESPONSE_TIME_THRESHOLD);
|
|
603
|
+
}
|
|
604
|
+
if (process.env.SNOW_FLOW_HEALTH_MEMORY_THRESHOLD) {
|
|
605
|
+
env.health = env.health || {};
|
|
606
|
+
env.health.thresholds = env.health.thresholds || {};
|
|
607
|
+
env.health.thresholds.memoryUsage = parseInt(process.env.SNOW_FLOW_HEALTH_MEMORY_THRESHOLD);
|
|
608
|
+
}
|
|
609
|
+
if (process.env.SNOW_FLOW_QUEUE_SIZE_THRESHOLD) {
|
|
610
|
+
env.health = env.health || {};
|
|
611
|
+
env.health.thresholds = env.health.thresholds || {};
|
|
612
|
+
env.health.thresholds.queueSize = parseInt(process.env.SNOW_FLOW_QUEUE_SIZE_THRESHOLD);
|
|
613
|
+
}
|
|
614
|
+
// Feature flags
|
|
615
|
+
if (process.env.SNOW_FLOW_AUTO_PERMISSIONS) {
|
|
616
|
+
env.features = env.features || {};
|
|
617
|
+
env.features.autoPermissions = process.env.SNOW_FLOW_AUTO_PERMISSIONS === 'true';
|
|
618
|
+
}
|
|
619
|
+
if (process.env.SNOW_FLOW_SMART_DISCOVERY) {
|
|
620
|
+
env.features = env.features || {};
|
|
621
|
+
env.features.smartDiscovery = process.env.SNOW_FLOW_SMART_DISCOVERY === 'true';
|
|
622
|
+
}
|
|
623
|
+
if (process.env.SNOW_FLOW_LIVE_TESTING) {
|
|
624
|
+
env.features = env.features || {};
|
|
625
|
+
env.features.liveTesting = process.env.SNOW_FLOW_LIVE_TESTING === 'true';
|
|
626
|
+
}
|
|
627
|
+
if (process.env.SNOW_FLOW_AUTO_DEPLOY) {
|
|
628
|
+
env.features = env.features || {};
|
|
629
|
+
env.features.autoDeploy = process.env.SNOW_FLOW_AUTO_DEPLOY === 'true';
|
|
630
|
+
}
|
|
631
|
+
if (process.env.SNOW_FLOW_AUTO_ROLLBACK) {
|
|
632
|
+
env.features = env.features || {};
|
|
633
|
+
env.features.autoRollback = process.env.SNOW_FLOW_AUTO_ROLLBACK === 'true';
|
|
634
|
+
}
|
|
635
|
+
if (process.env.SNOW_FLOW_SHARED_MEMORY) {
|
|
636
|
+
env.features = env.features || {};
|
|
637
|
+
env.features.sharedMemory = process.env.SNOW_FLOW_SHARED_MEMORY === 'true';
|
|
638
|
+
}
|
|
639
|
+
if (process.env.SNOW_FLOW_PROGRESS_MONITORING) {
|
|
640
|
+
env.features = env.features || {};
|
|
641
|
+
env.features.progressMonitoring = process.env.SNOW_FLOW_PROGRESS_MONITORING === 'true';
|
|
642
|
+
}
|
|
643
|
+
if (process.env.SNOW_FLOW_NEURAL_PATTERNS) {
|
|
644
|
+
env.features = env.features || {};
|
|
645
|
+
env.features.neuralPatterns = process.env.SNOW_FLOW_NEURAL_PATTERNS === 'true';
|
|
646
|
+
}
|
|
647
|
+
if (process.env.SNOW_FLOW_COGNITIVE_ANALYSIS) {
|
|
648
|
+
env.features = env.features || {};
|
|
649
|
+
env.features.cognitiveAnalysis = process.env.SNOW_FLOW_COGNITIVE_ANALYSIS === 'true';
|
|
650
|
+
}
|
|
339
651
|
return env;
|
|
340
652
|
}
|
|
341
653
|
/**
|