claude-flow 2.0.0-alpha.75 → 2.0.0-alpha.77

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/bin/claude-flow CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/bin/sh
2
2
  # Claude-Flow Smart Dispatcher - Detects and uses the best available runtime
3
3
 
4
- VERSION="2.0.0-alpha.75"
4
+ VERSION="2.0.0-alpha.77"
5
5
 
6
6
  # Determine the correct path based on how the script is invoked
7
7
  if [ -L "$0" ]; then
@@ -11,7 +11,7 @@ import { existsSync } from 'fs';
11
11
  import { spawn } from 'child_process';
12
12
  import process from 'process';
13
13
 
14
- const VERSION = "2.0.0-alpha.75";
14
+ const VERSION = "2.0.0-alpha.77";
15
15
 
16
16
  // Get script directory and root directory
17
17
  const __filename = fileURLToPath(import.meta.url);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-flow",
3
- "version": "2.0.0-alpha.75",
3
+ "version": "2.0.0-alpha.77",
4
4
  "description": "Enterprise-grade AI agent orchestration with ruv-swarm integration (Alpha Release)",
5
5
  "main": "cli.mjs",
6
6
  "bin": {
@@ -5,14 +5,14 @@
5
5
 
6
6
  import { HelpFormatter } from './help-formatter.js';
7
7
 
8
- export const VERSION = '2.0.0-alpha.75';
8
+ export const VERSION = '2.0.0-alpha.77';
9
9
 
10
10
  export const MAIN_HELP = `
11
11
  🌊 Claude-Flow v${VERSION} - Enterprise-Grade AI Agent Orchestration Platform
12
12
 
13
13
  šŸŽÆ ENTERPRISE FEATURES: Complete ruv-swarm integration with 87 MCP tools, neural networking, and production-ready infrastructure
14
14
  šŸ NEW: Advanced Hive Mind System with Queen-led coordination, collective intelligence, and unlimited scaling
15
- ⚔ ALPHA 75: Windows compatibility overhaul with cross-platform Node.js dispatcher
15
+ ⚔ ALPHA 77: Enhanced hooks pre-task exit handling with timeout protection
16
16
 
17
17
  USAGE:
18
18
  claude-flow <command> [options]
@@ -137,34 +137,65 @@ async function preTaskCommand(subArgs, flags) {
137
137
 
138
138
  console.log(` šŸ’¾ Saved to .swarm/memory.db`);
139
139
 
140
- // Execute ruv-swarm hook if available
141
- const isAvailable = await checkRuvSwarmAvailable();
142
- if (isAvailable) {
143
- console.log(`\nšŸ”„ Executing ruv-swarm pre-task hook...`);
144
- const hookResult = await execRuvSwarmHook('pre-task', {
145
- description,
146
- 'task-id': taskId,
147
- 'auto-spawn-agents': autoSpawnAgents,
148
- ...(agentId ? { 'agent-id': agentId } : {}),
149
- });
150
-
151
- if (hookResult.success) {
152
- await store.store(
153
- `task:${taskId}:ruv-output`,
154
- {
155
- output: hookResult.output,
156
- timestamp: new Date().toISOString(),
157
- },
158
- { namespace: 'hooks:ruv-swarm' },
159
- );
160
-
161
- printSuccess(`āœ… Pre-task hook completed successfully`);
140
+ // Execute ruv-swarm hook if available (with timeout for npx scenarios)
141
+ try {
142
+ const checkPromise = checkRuvSwarmAvailable();
143
+ const timeoutPromise = new Promise((_, reject) =>
144
+ setTimeout(() => reject(new Error('Timeout')), 3000)
145
+ );
146
+
147
+ const isAvailable = await Promise.race([checkPromise, timeoutPromise]);
148
+
149
+ if (isAvailable) {
150
+ console.log(`\nšŸ”„ Executing ruv-swarm pre-task hook...`);
151
+ const hookResult = await execRuvSwarmHook('pre-task', {
152
+ description,
153
+ 'task-id': taskId,
154
+ 'auto-spawn-agents': autoSpawnAgents,
155
+ ...(agentId ? { 'agent-id': agentId } : {}),
156
+ });
157
+
158
+ if (hookResult.success) {
159
+ await store.store(
160
+ `task:${taskId}:ruv-output`,
161
+ {
162
+ output: hookResult.output,
163
+ timestamp: new Date().toISOString(),
164
+ },
165
+ { namespace: 'hooks:ruv-swarm' },
166
+ );
167
+
168
+ printSuccess(`āœ… Pre-task hook completed successfully`);
169
+ }
162
170
  }
171
+ } catch (err) {
172
+ // Skip ruv-swarm hook if it times out or fails
173
+ console.log(`\nāš ļø Skipping ruv-swarm hook (${err.message})`);
163
174
  }
164
175
 
165
176
  console.log(`\nšŸŽÆ TASK PREPARATION COMPLETE`);
177
+
178
+ // Close the memory store to prevent hanging
179
+ if (memoryStore && memoryStore.close) {
180
+ memoryStore.close();
181
+ }
182
+
183
+ // Force exit after a short delay to ensure cleanup
184
+ setTimeout(() => {
185
+ process.exit(0);
186
+ }, 100);
166
187
  } catch (err) {
167
188
  printError(`Pre-task hook failed: ${err.message}`);
189
+
190
+ // Close the memory store on error too
191
+ if (memoryStore && memoryStore.close) {
192
+ memoryStore.close();
193
+ }
194
+
195
+ // Force exit after a short delay to ensure cleanup
196
+ setTimeout(() => {
197
+ process.exit(1);
198
+ }, 100);
168
199
  }
169
200
  }
170
201