snow-flow 4.6.0 → 4.6.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/dist/cli.js CHANGED
@@ -93,6 +93,76 @@ function checkFlowDeprecation(command, objective) {
93
93
  process.exit(1);
94
94
  }
95
95
  }
96
+
97
+ // Claude Code version management - ensure 1.0.95 is installed
98
+ async function ensureClaudeCodeVersion() {
99
+ try {
100
+ cliLogger.info('🔧 Checking Claude Code version compatibility...');
101
+
102
+ // Check if Claude Code is installed and get version
103
+ const checkVersionResult = (0, child_process_1.execSync)('claude --version 2>/dev/null || echo "not_installed"', {
104
+ encoding: 'utf8',
105
+ timeout: 10000
106
+ }).trim();
107
+
108
+ const currentVersion = checkVersionResult.includes('not_installed') ? null :
109
+ checkVersionResult.match(/(\d+\.\d+\.\d+)/)?.[1];
110
+
111
+ cliLogger.info(`🔍 Current Claude Code version: ${currentVersion || 'not installed'}`);
112
+
113
+ // Target version that works correctly
114
+ const targetVersion = '1.0.95';
115
+
116
+ if (currentVersion !== targetVersion) {
117
+ cliLogger.info(`⚠️ Version mismatch detected. Installing Claude Code ${targetVersion}...`);
118
+ cliLogger.info('📥 This prevents bugs in newer versions that cause hanging operations');
119
+
120
+ try {
121
+ // Install the specific version
122
+ cliLogger.info('🔄 Running: npm install -g @anthropic-ai/claude-code@1.0.95');
123
+ (0, child_process_1.execSync)('npm install -g @anthropic-ai/claude-code@1.0.95', {
124
+ stdio: 'inherit',
125
+ timeout: 120000 // 2 minutes timeout
126
+ });
127
+
128
+ // Verify installation
129
+ const verifyResult = (0, child_process_1.execSync)('claude --version', {
130
+ encoding: 'utf8',
131
+ timeout: 10000
132
+ }).trim();
133
+
134
+ const installedVersion = verifyResult.match(/(\d+\.\d+\.\d+)/)?.[1];
135
+
136
+ if (installedVersion === targetVersion) {
137
+ cliLogger.info(`✅ Claude Code ${targetVersion} installed successfully!`);
138
+ } else {
139
+ cliLogger.warn(`⚠️ Installation completed but version verification shows: ${installedVersion}`);
140
+ }
141
+ } catch (installError) {
142
+ cliLogger.error('❌ Failed to install Claude Code 1.0.95');
143
+ cliLogger.error('Please install manually: npm install -g @anthropic-ai/claude-code@1.0.95');
144
+ throw new Error(`Claude Code installation failed: ${installError.message}`);
145
+ }
146
+ } else {
147
+ cliLogger.info(`✅ Claude Code ${targetVersion} is already installed`);
148
+ }
149
+
150
+ cliLogger.info('🚀 Claude Code version check completed successfully');
151
+
152
+ } catch (error) {
153
+ cliLogger.error('❌ Claude Code version check failed:', error.message);
154
+
155
+ // Provide fallback guidance
156
+ cliLogger.info('');
157
+ cliLogger.info('🔧 Manual installation instructions:');
158
+ cliLogger.info(' npm install -g @anthropic-ai/claude-code@1.0.95');
159
+ cliLogger.info('');
160
+ cliLogger.info('⚠️ Note: Version 1.0.95 is required to avoid hanging operations in swarm mode');
161
+
162
+ // Don't fail completely, but warn user
163
+ cliLogger.warn('⚠️ Continuing with potentially incompatible Claude Code version');
164
+ }
165
+ }
96
166
  // Swarm command - the main orchestration command with EVERYTHING
97
167
  program
98
168
  .command('swarm <objective>')
@@ -152,6 +222,10 @@ program
152
222
  .action(async (objective, options) => {
153
223
  // Check for flow deprecation first
154
224
  checkFlowDeprecation('swarm', objective);
225
+
226
+ // Ensure Claude Code version 1.0.95 is installed before proceeding
227
+ await ensureClaudeCodeVersion();
228
+
155
229
  // Set debug levels based on options
156
230
  if (options.debugAll) {
157
231
  process.env.DEBUG = '*';
@@ -16,18 +16,13 @@ class MCPProcessManager {
16
16
  // INCREASED LIMITS TO PREVENT AGGRESSIVE CLEANUP
17
17
  this.MAX_MCP_SERVERS = parseInt(process.env.SNOW_MAX_MCP_SERVERS || '30'); // Increased from 10
18
18
  this.MAX_MEMORY_MB = parseInt(process.env.SNOW_MCP_MEMORY_LIMIT || '3000'); // Increased from 1500
19
- // DISABLED AUTOMATIC CLEANUP BY DEFAULT
20
- this.CLEANUP_ENABLED = process.env.SNOW_MCP_CLEANUP_ENABLED === 'true'; // Off by default
21
- this.CLEANUP_INTERVAL = parseInt(process.env.SNOW_MCP_CLEANUP_INTERVAL || '300000'); // 5 minutes instead of 1
19
+ // PERMANENTLY DISABLED AUTOMATIC CLEANUP FOR PERSISTENT SERVERS
20
+ this.CLEANUP_ENABLED = false; // Permanently disabled - servers should run forever
21
+ this.CLEANUP_INTERVAL = Infinity; // Never cleanup
22
22
  this.isCleaningUp = false;
23
- // Only start cleanup if explicitly enabled
24
- if (this.CLEANUP_ENABLED) {
25
- logger.warn('⚠️ MCP cleanup is ENABLED - monitor for memory issues');
26
- this.startPeriodicCleanup();
27
- }
28
- else {
29
- logger.info('✅ MCP cleanup is DISABLED for stability');
30
- }
23
+ // Never start cleanup - servers should be persistent
24
+ logger.info('✅ MCP cleanup is PERMANENTLY DISABLED - servers will run forever');
25
+ logger.info('🔄 MCP servers are now persistent and will not auto-shutdown');
31
26
  }
32
27
  static getInstance() {
33
28
  if (!MCPProcessManager.instance) {
@@ -16,18 +16,13 @@ class MCPProcessManager {
16
16
  // INCREASED LIMITS TO PREVENT AGGRESSIVE CLEANUP
17
17
  this.MAX_MCP_SERVERS = parseInt(process.env.SNOW_MAX_MCP_SERVERS || '30'); // Increased from 10
18
18
  this.MAX_MEMORY_MB = parseInt(process.env.SNOW_MCP_MEMORY_LIMIT || '3000'); // Increased from 1500
19
- // DISABLED AUTOMATIC CLEANUP BY DEFAULT
20
- this.CLEANUP_ENABLED = process.env.SNOW_MCP_CLEANUP_ENABLED === 'true'; // Off by default
21
- this.CLEANUP_INTERVAL = parseInt(process.env.SNOW_MCP_CLEANUP_INTERVAL || '300000'); // 5 minutes instead of 1
19
+ // PERMANENTLY DISABLED AUTOMATIC CLEANUP FOR PERSISTENT SERVERS
20
+ this.CLEANUP_ENABLED = false; // Permanently disabled - servers should run forever
21
+ this.CLEANUP_INTERVAL = Infinity; // Never cleanup
22
22
  this.isCleaningUp = false;
23
- // Only start cleanup if explicitly enabled
24
- if (this.CLEANUP_ENABLED) {
25
- logger.warn('⚠️ MCP cleanup is ENABLED - monitor for memory issues');
26
- this.startPeriodicCleanup();
27
- }
28
- else {
29
- logger.info('✅ MCP cleanup is DISABLED for stability');
30
- }
23
+ // Never start cleanup - servers should be persistent
24
+ logger.info('✅ MCP cleanup is PERMANENTLY DISABLED - servers will run forever');
25
+ logger.info('🔄 MCP servers are now persistent and will not auto-shutdown');
31
26
  }
32
27
  static getInstance() {
33
28
  if (!MCPProcessManager.instance) {
@@ -286,22 +286,11 @@ class MCPServerManager extends events_1.EventEmitter {
286
286
  return true; // Already stopped
287
287
  }
288
288
  try {
289
- // Try graceful shutdown first
290
- server.process.kill('SIGTERM');
291
- // Wait for graceful shutdown with shorter timeout to prevent hanging
292
- await new Promise((resolve) => {
293
- const timeout = setTimeout(() => {
294
- // Force kill if graceful shutdown fails
295
- if (server.process) {
296
- try {
297
- server.process.kill('SIGKILL');
298
- }
299
- catch (e) {
300
- // Process might already be dead
301
- }
302
- }
303
- resolve(undefined);
304
- }, 2000); // Reduced from 5000ms to 2000ms to prevent hanging
289
+ // DISABLED AUTOMATIC SHUTDOWN - Servers should run forever
290
+ logger.warn('⚠️ Server shutdown requested but auto-shutdown is DISABLED for persistence');
291
+ logger.info('🔄 MCP servers are configured to run indefinitely');
292
+ // Don't kill the server - let it run forever
293
+ return true;
305
294
  server.process?.on('exit', () => {
306
295
  clearTimeout(timeout);
307
296
  resolve(undefined);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "snow-flow",
3
- "version": "4.6.0",
4
- "description": "Conversational ServiceNow development platform using Claude Code. Multi-agent orchestration with 20+ MCP servers providing 245+ ServiceNow tools including complete UX + Agent Workspace creation with official APIs.",
3
+ "version": "4.6.2",
4
+ "description": "PERSISTENT MCP SERVERS - v4.6.2 disables automatic MCP server shutdown for persistent operation. Servers now run indefinitely instead of auto-terminating after timeout periods. Fixes MCP server stability issues with permanent server lifecycle.",
5
5
  "main": "dist/index.js",
6
6
  "type": "commonjs",
7
7
  "bin": {