snow-flow 1.3.1 → 1.3.3

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 (40) hide show
  1. package/.claude-flow/queen/queen-memory.db +0 -0
  2. package/.env.example +249 -14
  3. package/CLAUDE.md +185 -24
  4. package/README.md +55 -5
  5. package/dist/api/error-handling.js +898 -4
  6. package/dist/api/performance-optimizer.js +3 -2
  7. package/dist/cli.js +590 -200
  8. package/dist/config/snow-flow-config.js +436 -1
  9. package/dist/health/system-health.js +288 -21
  10. package/dist/mcp/http-transport-wrapper.js +65 -4
  11. package/dist/mcp/servicenow-automation-mcp-refactored.js +90 -9
  12. package/dist/mcp/servicenow-deployment-mcp-refactored.js +151 -2
  13. package/dist/mcp/servicenow-deployment-mcp.js +828 -15
  14. package/dist/mcp/servicenow-integration-mcp-refactored.js +100 -9
  15. package/dist/mcp/servicenow-intelligent-mcp.js +198 -7
  16. package/dist/mcp/servicenow-memory-mcp.js +2 -1
  17. package/dist/mcp/servicenow-operations-mcp-refactored.js +3 -2
  18. package/dist/mcp/servicenow-xml-flow-mcp.js +671 -0
  19. package/dist/mcp/shared/base-mcp-server.js +1356 -8
  20. package/dist/mcp/shared/mcp-resource-manager.js +304 -0
  21. package/dist/queen/parallel-agent-engine.js +26 -8
  22. package/dist/queen/servicenow-queen.js +47 -44
  23. package/dist/sparc/sparc-help.js +37 -26
  24. package/dist/sparc/team-sparc.js +60 -16
  25. package/dist/utils/action-type-cache.js +2 -1
  26. package/dist/utils/mcp-config-manager.js +7 -3
  27. package/dist/utils/mcp-server-manager.js +7 -3
  28. package/dist/utils/servicenow-client.js +134 -107
  29. package/dist/utils/servicenow-id-generator.js +171 -0
  30. package/dist/utils/snow-oauth.js +13 -8
  31. package/dist/utils/widget-template-generator.js +1690 -0
  32. package/dist/utils/xml-first-flow-generator.js +473 -0
  33. package/flow-update-sets/flow_build_automated_approval_flow_with_notifications_flow.xml +203 -0
  34. package/flow-update-sets/flow_create_approval_flow_for_equipment_requests_flow.xml +206 -0
  35. package/flow-update-sets/flow_create_equipment_approval_flow_with_manager_approv_flow.xml +254 -0
  36. package/flow-update-sets/iphone_15_pro_approval_flow.xml +203 -0
  37. package/flow-update-sets/test_iphone_approval_flow_flow.xml +303 -0
  38. package/package.json +2 -1
  39. package/test-config.js +55 -0
  40. 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
  }),
@@ -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(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,55 @@ 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
+ const value = parseInt(process.env.SNOW_REQUEST_TIMEOUT);
346
+ if (!isNaN(value)) {
347
+ env.servicenow.timeout = value;
348
+ }
349
+ }
350
+ if (process.env.SNOW_MAX_RETRIES) {
351
+ env.servicenow = env.servicenow || {};
352
+ env.servicenow.retryConfig = env.servicenow.retryConfig || {};
353
+ const value = parseInt(process.env.SNOW_MAX_RETRIES);
354
+ if (!isNaN(value)) {
355
+ env.servicenow.retryConfig.maxRetries = value;
356
+ }
357
+ }
358
+ if (process.env.SNOW_RETRY_DELAY) {
359
+ env.servicenow = env.servicenow || {};
360
+ env.servicenow.retryConfig = env.servicenow.retryConfig || {};
361
+ const value = parseInt(process.env.SNOW_RETRY_DELAY);
362
+ if (!isNaN(value)) {
363
+ env.servicenow.retryConfig.retryDelay = value;
364
+ }
365
+ }
366
+ if (process.env.SNOW_REDIRECT_HOST) {
367
+ env.servicenow = env.servicenow || {};
368
+ env.servicenow.oauth = env.servicenow.oauth || {};
369
+ env.servicenow.oauth.redirectHost = process.env.SNOW_REDIRECT_HOST;
370
+ }
371
+ if (process.env.SNOW_REDIRECT_PORT) {
372
+ env.servicenow = env.servicenow || {};
373
+ env.servicenow.oauth = env.servicenow.oauth || {};
374
+ const value = parseInt(process.env.SNOW_REDIRECT_PORT);
375
+ if (!isNaN(value)) {
376
+ env.servicenow.oauth.redirectPort = value;
377
+ }
378
+ }
379
+ if (process.env.SNOW_REDIRECT_PATH) {
380
+ env.servicenow = env.servicenow || {};
381
+ env.servicenow.oauth = env.servicenow.oauth || {};
382
+ env.servicenow.oauth.redirectPath = process.env.SNOW_REDIRECT_PATH;
383
+ }
330
384
  // System settings
331
385
  if (process.env.SNOW_FLOW_ENV) {
332
386
  env.system = env.system || {};
@@ -336,6 +390,387 @@ class SnowFlowConfig {
336
390
  env.system = env.system || {};
337
391
  env.system.logLevel = process.env.SNOW_FLOW_LOG_LEVEL;
338
392
  }
393
+ if (process.env.SNOW_FLOW_DATA_DIR) {
394
+ env.system = env.system || {};
395
+ env.system.dataDir = process.env.SNOW_FLOW_DATA_DIR;
396
+ }
397
+ if (process.env.SNOW_FLOW_MAX_CONCURRENT_OPS) {
398
+ env.system = env.system || {};
399
+ const value = parseInt(process.env.SNOW_FLOW_MAX_CONCURRENT_OPS);
400
+ if (!isNaN(value)) {
401
+ env.system.maxConcurrentOperations = value;
402
+ }
403
+ }
404
+ if (process.env.SNOW_FLOW_SESSION_TIMEOUT) {
405
+ env.system = env.system || {};
406
+ const value = parseInt(process.env.SNOW_FLOW_SESSION_TIMEOUT);
407
+ if (!isNaN(value)) {
408
+ env.system.sessionTimeout = value;
409
+ }
410
+ }
411
+ // Agent configuration
412
+ if (process.env.SNOW_FLOW_MAX_WORKER_AGENTS) {
413
+ env.agents = env.agents || {};
414
+ env.agents.queen = env.agents.queen || {};
415
+ const value = parseInt(process.env.SNOW_FLOW_MAX_WORKER_AGENTS);
416
+ if (!isNaN(value)) {
417
+ env.agents.queen.maxWorkerAgents = value;
418
+ }
419
+ }
420
+ if (process.env.SNOW_FLOW_SPAWN_TIMEOUT) {
421
+ env.agents = env.agents || {};
422
+ env.agents.queen = env.agents.queen || {};
423
+ const value = parseInt(process.env.SNOW_FLOW_SPAWN_TIMEOUT);
424
+ if (!isNaN(value)) {
425
+ env.agents.queen.spawnTimeout = value;
426
+ }
427
+ }
428
+ if (process.env.SNOW_FLOW_COORDINATION_INTERVAL) {
429
+ env.agents = env.agents || {};
430
+ env.agents.queen = env.agents.queen || {};
431
+ const value = parseInt(process.env.SNOW_FLOW_COORDINATION_INTERVAL);
432
+ if (!isNaN(value)) {
433
+ env.agents.queen.coordinationInterval = value;
434
+ }
435
+ }
436
+ if (process.env.SNOW_FLOW_RETRY_ATTEMPTS) {
437
+ env.agents = env.agents || {};
438
+ env.agents.queen = env.agents.queen || {};
439
+ const value = parseInt(process.env.SNOW_FLOW_RETRY_ATTEMPTS);
440
+ if (!isNaN(value)) {
441
+ env.agents.queen.retryAttempts = value;
442
+ }
443
+ }
444
+ if (process.env.SNOW_FLOW_HEARTBEAT_INTERVAL) {
445
+ env.agents = env.agents || {};
446
+ env.agents.worker = env.agents.worker || {};
447
+ const value = parseInt(process.env.SNOW_FLOW_HEARTBEAT_INTERVAL);
448
+ if (!isNaN(value)) {
449
+ env.agents.worker.heartbeatInterval = value;
450
+ }
451
+ }
452
+ if (process.env.SNOW_FLOW_TASK_TIMEOUT) {
453
+ env.agents = env.agents || {};
454
+ env.agents.worker = env.agents.worker || {};
455
+ const value = parseInt(process.env.SNOW_FLOW_TASK_TIMEOUT);
456
+ if (!isNaN(value)) {
457
+ env.agents.worker.taskTimeout = value;
458
+ }
459
+ }
460
+ if (process.env.SNOW_FLOW_MAX_MEMORY_USAGE) {
461
+ env.agents = env.agents || {};
462
+ env.agents.worker = env.agents.worker || {};
463
+ const value = parseInt(process.env.SNOW_FLOW_MAX_MEMORY_USAGE);
464
+ if (!isNaN(value)) {
465
+ env.agents.worker.maxMemoryUsage = value;
466
+ }
467
+ }
468
+ if (process.env.SNOW_FLOW_AUTO_SHUTDOWN_IDLE) {
469
+ env.agents = env.agents || {};
470
+ env.agents.worker = env.agents.worker || {};
471
+ const value = parseInt(process.env.SNOW_FLOW_AUTO_SHUTDOWN_IDLE);
472
+ if (!isNaN(value)) {
473
+ env.agents.worker.autoShutdownIdle = value;
474
+ }
475
+ }
476
+ // MCP server configuration
477
+ if (process.env.MCP_DEPLOYMENT_PORT) {
478
+ env.mcp = env.mcp || {};
479
+ env.mcp.servers = env.mcp.servers || {};
480
+ env.mcp.servers.deployment = env.mcp.servers.deployment || {};
481
+ const value = parseInt(process.env.MCP_DEPLOYMENT_PORT);
482
+ if (!isNaN(value)) {
483
+ env.mcp.servers.deployment.port = value;
484
+ }
485
+ }
486
+ if (process.env.MCP_INTELLIGENT_PORT) {
487
+ env.mcp = env.mcp || {};
488
+ env.mcp.servers = env.mcp.servers || {};
489
+ env.mcp.servers.intelligent = env.mcp.servers.intelligent || {};
490
+ const value = parseInt(process.env.MCP_INTELLIGENT_PORT);
491
+ if (!isNaN(value)) {
492
+ env.mcp.servers.intelligent.port = value;
493
+ }
494
+ }
495
+ if (process.env.MCP_OPERATIONS_PORT) {
496
+ env.mcp = env.mcp || {};
497
+ env.mcp.servers = env.mcp.servers || {};
498
+ env.mcp.servers.operations = env.mcp.servers.operations || {};
499
+ const value = parseInt(process.env.MCP_OPERATIONS_PORT);
500
+ if (!isNaN(value)) {
501
+ env.mcp.servers.operations.port = value;
502
+ }
503
+ }
504
+ if (process.env.MCP_FLOW_COMPOSER_PORT) {
505
+ env.mcp = env.mcp || {};
506
+ env.mcp.servers = env.mcp.servers || {};
507
+ env.mcp.servers.flowComposer = env.mcp.servers.flowComposer || {};
508
+ const value = parseInt(process.env.MCP_FLOW_COMPOSER_PORT);
509
+ if (!isNaN(value)) {
510
+ env.mcp.servers.flowComposer.port = value;
511
+ }
512
+ }
513
+ if (process.env.MCP_PLATFORM_DEV_PORT) {
514
+ env.mcp = env.mcp || {};
515
+ env.mcp.servers = env.mcp.servers || {};
516
+ env.mcp.servers.platformDevelopment = env.mcp.servers.platformDevelopment || {};
517
+ const value = parseInt(process.env.MCP_PLATFORM_DEV_PORT);
518
+ if (!isNaN(value)) {
519
+ env.mcp.servers.platformDevelopment.port = value;
520
+ }
521
+ }
522
+ if (process.env.MCP_HOST) {
523
+ env.mcp = env.mcp || {};
524
+ env.mcp.servers = env.mcp.servers || {};
525
+ // Apply to all servers
526
+ ['deployment', 'intelligent', 'operations', 'flowComposer', 'platformDevelopment'].forEach(server => {
527
+ env.mcp.servers[server] = env.mcp.servers[server] || {};
528
+ env.mcp.servers[server].host = process.env.MCP_HOST;
529
+ });
530
+ }
531
+ if (process.env.MCP_TIMEOUT) {
532
+ env.mcp = env.mcp || {};
533
+ env.mcp.transport = env.mcp.transport || {};
534
+ const value = parseInt(process.env.MCP_TIMEOUT);
535
+ if (!isNaN(value)) {
536
+ env.mcp.transport.timeout = value;
537
+ }
538
+ }
539
+ if (process.env.MCP_RETRY_ATTEMPTS) {
540
+ env.mcp = env.mcp || {};
541
+ env.mcp.transport = env.mcp.transport || {};
542
+ const value = parseInt(process.env.MCP_RETRY_ATTEMPTS);
543
+ if (!isNaN(value)) {
544
+ env.mcp.transport.retryAttempts = value;
545
+ }
546
+ }
547
+ if (process.env.MCP_RETRY_DELAY) {
548
+ env.mcp = env.mcp || {};
549
+ env.mcp.transport = env.mcp.transport || {};
550
+ const value = parseInt(process.env.MCP_RETRY_DELAY);
551
+ if (!isNaN(value)) {
552
+ env.mcp.transport.retryDelay = value;
553
+ }
554
+ }
555
+ if (process.env.MCP_AUTH_TOKEN_EXPIRY) {
556
+ env.mcp = env.mcp || {};
557
+ env.mcp.authentication = env.mcp.authentication || {};
558
+ const value = parseInt(process.env.MCP_AUTH_TOKEN_EXPIRY);
559
+ if (!isNaN(value)) {
560
+ env.mcp.authentication.tokenExpiry = value;
561
+ }
562
+ }
563
+ // Memory system configuration
564
+ if (process.env.SNOW_FLOW_DB_PATH) {
565
+ env.memory = env.memory || {};
566
+ env.memory.dbPath = process.env.SNOW_FLOW_DB_PATH;
567
+ }
568
+ if (process.env.SNOW_FLOW_CACHE_ENABLED) {
569
+ env.memory = env.memory || {};
570
+ env.memory.cache = env.memory.cache || {};
571
+ env.memory.cache.enabled = process.env.SNOW_FLOW_CACHE_ENABLED === 'true';
572
+ }
573
+ if (process.env.SNOW_FLOW_CACHE_MAX_SIZE) {
574
+ env.memory = env.memory || {};
575
+ env.memory.cache = env.memory.cache || {};
576
+ const value = parseInt(process.env.SNOW_FLOW_CACHE_MAX_SIZE);
577
+ if (!isNaN(value)) {
578
+ env.memory.cache.maxSize = value;
579
+ }
580
+ }
581
+ if (process.env.SNOW_FLOW_CACHE_TTL) {
582
+ env.memory = env.memory || {};
583
+ env.memory.cache = env.memory.cache || {};
584
+ const value = parseInt(process.env.SNOW_FLOW_CACHE_TTL);
585
+ if (!isNaN(value)) {
586
+ env.memory.cache.ttl = value;
587
+ }
588
+ }
589
+ if (process.env.SNOW_FLOW_DEFAULT_TTL) {
590
+ env.memory = env.memory || {};
591
+ env.memory.ttl = env.memory.ttl || {};
592
+ const value = parseInt(process.env.SNOW_FLOW_DEFAULT_TTL);
593
+ if (!isNaN(value)) {
594
+ env.memory.ttl.default = value;
595
+ }
596
+ }
597
+ if (process.env.SNOW_FLOW_SESSION_TTL) {
598
+ env.memory = env.memory || {};
599
+ env.memory.ttl = env.memory.ttl || {};
600
+ const value = parseInt(process.env.SNOW_FLOW_SESSION_TTL);
601
+ if (!isNaN(value)) {
602
+ env.memory.ttl.session = value;
603
+ }
604
+ }
605
+ if (process.env.SNOW_FLOW_ARTIFACT_TTL) {
606
+ env.memory = env.memory || {};
607
+ env.memory.ttl = env.memory.ttl || {};
608
+ const value = parseInt(process.env.SNOW_FLOW_ARTIFACT_TTL);
609
+ if (!isNaN(value)) {
610
+ env.memory.ttl.artifact = value;
611
+ }
612
+ }
613
+ if (process.env.SNOW_FLOW_METRIC_TTL) {
614
+ env.memory = env.memory || {};
615
+ env.memory.ttl = env.memory.ttl || {};
616
+ const value = parseInt(process.env.SNOW_FLOW_METRIC_TTL);
617
+ if (!isNaN(value)) {
618
+ env.memory.ttl.metric = value;
619
+ }
620
+ }
621
+ if (process.env.SNOW_FLOW_CLEANUP_INTERVAL) {
622
+ env.memory = env.memory || {};
623
+ env.memory.cleanup = env.memory.cleanup || {};
624
+ const value = parseInt(process.env.SNOW_FLOW_CLEANUP_INTERVAL);
625
+ if (!isNaN(value)) {
626
+ env.memory.cleanup.interval = value;
627
+ }
628
+ }
629
+ if (process.env.SNOW_FLOW_RETENTION_DAYS) {
630
+ env.memory = env.memory || {};
631
+ env.memory.cleanup = env.memory.cleanup || {};
632
+ const value = parseInt(process.env.SNOW_FLOW_RETENTION_DAYS);
633
+ if (!isNaN(value)) {
634
+ env.memory.cleanup.retentionDays = value;
635
+ }
636
+ }
637
+ // Monitoring configuration
638
+ if (process.env.SNOW_FLOW_PERFORMANCE_ENABLED) {
639
+ env.monitoring = env.monitoring || {};
640
+ env.monitoring.performance = env.monitoring.performance || {};
641
+ env.monitoring.performance.enabled = process.env.SNOW_FLOW_PERFORMANCE_ENABLED === 'true';
642
+ }
643
+ if (process.env.SNOW_FLOW_SAMPLE_RATE) {
644
+ env.monitoring = env.monitoring || {};
645
+ env.monitoring.performance = env.monitoring.performance || {};
646
+ const floatValue = parseFloat(process.env.SNOW_FLOW_SAMPLE_RATE);
647
+ if (!isNaN(floatValue)) {
648
+ env.monitoring.performance.sampleRate = floatValue;
649
+ }
650
+ }
651
+ if (process.env.SNOW_FLOW_METRICS_RETENTION) {
652
+ env.monitoring = env.monitoring || {};
653
+ env.monitoring.performance = env.monitoring.performance || {};
654
+ const value = parseInt(process.env.SNOW_FLOW_METRICS_RETENTION);
655
+ if (!isNaN(value)) {
656
+ env.monitoring.performance.metricsRetention = value;
657
+ }
658
+ }
659
+ if (process.env.SNOW_FLOW_AGGREGATION_INTERVAL) {
660
+ env.monitoring = env.monitoring || {};
661
+ env.monitoring.performance = env.monitoring.performance || {};
662
+ const value = parseInt(process.env.SNOW_FLOW_AGGREGATION_INTERVAL);
663
+ if (!isNaN(value)) {
664
+ env.monitoring.performance.aggregationInterval = value;
665
+ }
666
+ }
667
+ if (process.env.SNOW_FLOW_HEALTH_CHECK_INTERVAL) {
668
+ env.monitoring = env.monitoring || {};
669
+ env.monitoring.health = env.monitoring.health || {};
670
+ const value = parseInt(process.env.SNOW_FLOW_HEALTH_CHECK_INTERVAL);
671
+ if (!isNaN(value)) {
672
+ env.monitoring.health.checkInterval = value;
673
+ }
674
+ }
675
+ if (process.env.SNOW_FLOW_MEMORY_THRESHOLD) {
676
+ env.monitoring = env.monitoring || {};
677
+ env.monitoring.health = env.monitoring.health || {};
678
+ env.monitoring.health.thresholds = env.monitoring.health.thresholds || {};
679
+ const floatValue = parseFloat(process.env.SNOW_FLOW_MEMORY_THRESHOLD);
680
+ if (!isNaN(floatValue)) {
681
+ env.monitoring.health.thresholds.memoryUsage = floatValue;
682
+ }
683
+ }
684
+ if (process.env.SNOW_FLOW_CPU_THRESHOLD) {
685
+ env.monitoring = env.monitoring || {};
686
+ env.monitoring.health = env.monitoring.health || {};
687
+ env.monitoring.health.thresholds = env.monitoring.health.thresholds || {};
688
+ const floatValue = parseFloat(process.env.SNOW_FLOW_CPU_THRESHOLD);
689
+ if (!isNaN(floatValue)) {
690
+ env.monitoring.health.thresholds.cpuUsage = floatValue;
691
+ }
692
+ }
693
+ if (process.env.SNOW_FLOW_ERROR_RATE_THRESHOLD) {
694
+ env.monitoring = env.monitoring || {};
695
+ env.monitoring.health = env.monitoring.health || {};
696
+ env.monitoring.health.thresholds = env.monitoring.health.thresholds || {};
697
+ const floatValue = parseFloat(process.env.SNOW_FLOW_ERROR_RATE_THRESHOLD);
698
+ if (!isNaN(floatValue)) {
699
+ env.monitoring.health.thresholds.errorRate = floatValue;
700
+ }
701
+ }
702
+ if (process.env.SNOW_FLOW_WEBHOOK_URL) {
703
+ env.monitoring = env.monitoring || {};
704
+ env.monitoring.alerts = env.monitoring.alerts || {};
705
+ env.monitoring.alerts.webhookUrl = process.env.SNOW_FLOW_WEBHOOK_URL;
706
+ }
707
+ if (process.env.SNOW_FLOW_ALERT_SEVERITY) {
708
+ env.monitoring = env.monitoring || {};
709
+ env.monitoring.alerts = env.monitoring.alerts || {};
710
+ env.monitoring.alerts.severityThreshold = process.env.SNOW_FLOW_ALERT_SEVERITY;
711
+ }
712
+ // Health check thresholds
713
+ if (process.env.SNOW_FLOW_RESPONSE_TIME_THRESHOLD) {
714
+ env.health = env.health || {};
715
+ env.health.thresholds = env.health.thresholds || {};
716
+ const value = parseInt(process.env.SNOW_FLOW_RESPONSE_TIME_THRESHOLD);
717
+ if (!isNaN(value)) {
718
+ env.health.thresholds.responseTime = value;
719
+ }
720
+ }
721
+ if (process.env.SNOW_FLOW_HEALTH_MEMORY_THRESHOLD) {
722
+ env.health = env.health || {};
723
+ env.health.thresholds = env.health.thresholds || {};
724
+ const value = parseInt(process.env.SNOW_FLOW_HEALTH_MEMORY_THRESHOLD);
725
+ if (!isNaN(value)) {
726
+ env.health.thresholds.memoryUsage = value;
727
+ }
728
+ }
729
+ if (process.env.SNOW_FLOW_QUEUE_SIZE_THRESHOLD) {
730
+ env.health = env.health || {};
731
+ env.health.thresholds = env.health.thresholds || {};
732
+ const value = parseInt(process.env.SNOW_FLOW_QUEUE_SIZE_THRESHOLD);
733
+ if (!isNaN(value)) {
734
+ env.health.thresholds.queueSize = value;
735
+ }
736
+ }
737
+ // Feature flags
738
+ if (process.env.SNOW_FLOW_AUTO_PERMISSIONS) {
739
+ env.features = env.features || {};
740
+ env.features.autoPermissions = process.env.SNOW_FLOW_AUTO_PERMISSIONS === 'true';
741
+ }
742
+ if (process.env.SNOW_FLOW_SMART_DISCOVERY) {
743
+ env.features = env.features || {};
744
+ env.features.smartDiscovery = process.env.SNOW_FLOW_SMART_DISCOVERY === 'true';
745
+ }
746
+ if (process.env.SNOW_FLOW_LIVE_TESTING) {
747
+ env.features = env.features || {};
748
+ env.features.liveTesting = process.env.SNOW_FLOW_LIVE_TESTING === 'true';
749
+ }
750
+ if (process.env.SNOW_FLOW_AUTO_DEPLOY) {
751
+ env.features = env.features || {};
752
+ env.features.autoDeploy = process.env.SNOW_FLOW_AUTO_DEPLOY === 'true';
753
+ }
754
+ if (process.env.SNOW_FLOW_AUTO_ROLLBACK) {
755
+ env.features = env.features || {};
756
+ env.features.autoRollback = process.env.SNOW_FLOW_AUTO_ROLLBACK === 'true';
757
+ }
758
+ if (process.env.SNOW_FLOW_SHARED_MEMORY) {
759
+ env.features = env.features || {};
760
+ env.features.sharedMemory = process.env.SNOW_FLOW_SHARED_MEMORY === 'true';
761
+ }
762
+ if (process.env.SNOW_FLOW_PROGRESS_MONITORING) {
763
+ env.features = env.features || {};
764
+ env.features.progressMonitoring = process.env.SNOW_FLOW_PROGRESS_MONITORING === 'true';
765
+ }
766
+ if (process.env.SNOW_FLOW_NEURAL_PATTERNS) {
767
+ env.features = env.features || {};
768
+ env.features.neuralPatterns = process.env.SNOW_FLOW_NEURAL_PATTERNS === 'true';
769
+ }
770
+ if (process.env.SNOW_FLOW_COGNITIVE_ANALYSIS) {
771
+ env.features = env.features || {};
772
+ env.features.cognitiveAnalysis = process.env.SNOW_FLOW_COGNITIVE_ANALYSIS === 'true';
773
+ }
339
774
  return env;
340
775
  }
341
776
  /**