agentic-flow 1.8.11 β†’ 1.8.14

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 (36) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/dist/agents/claudeAgentDirect.js +168 -0
  3. package/dist/cli/federation-cli.d.ts +53 -0
  4. package/dist/cli/federation-cli.js +431 -0
  5. package/dist/cli-proxy.js +32 -4
  6. package/dist/federation/EphemeralAgent.js +258 -0
  7. package/dist/federation/FederationHub.js +283 -0
  8. package/dist/federation/FederationHubClient.js +212 -0
  9. package/dist/federation/FederationHubServer.js +436 -0
  10. package/dist/federation/SecurityManager.js +191 -0
  11. package/dist/federation/debug/agent-debug-stream.js +474 -0
  12. package/dist/federation/debug/debug-stream.js +419 -0
  13. package/dist/federation/index.js +12 -0
  14. package/dist/federation/integrations/realtime-federation.js +404 -0
  15. package/dist/federation/integrations/supabase-adapter-debug.js +400 -0
  16. package/dist/federation/integrations/supabase-adapter.js +258 -0
  17. package/dist/utils/cli.js +5 -0
  18. package/docs/architecture/FEDERATION-DATA-LIFECYCLE.md +520 -0
  19. package/docs/federation/AGENT-DEBUG-STREAMING.md +403 -0
  20. package/docs/federation/DEBUG-STREAMING-COMPLETE.md +432 -0
  21. package/docs/federation/DEBUG-STREAMING.md +537 -0
  22. package/docs/federation/DEPLOYMENT-VALIDATION-SUCCESS.md +394 -0
  23. package/docs/federation/DOCKER-FEDERATION-DEEP-REVIEW.md +478 -0
  24. package/docs/issues/ISSUE-SUPABASE-INTEGRATION.md +536 -0
  25. package/docs/releases/RELEASE-v1.8.13.md +426 -0
  26. package/docs/supabase/IMPLEMENTATION-SUMMARY.md +498 -0
  27. package/docs/supabase/INDEX.md +358 -0
  28. package/docs/supabase/QUICKSTART.md +365 -0
  29. package/docs/supabase/README.md +318 -0
  30. package/docs/supabase/SUPABASE-REALTIME-FEDERATION.md +575 -0
  31. package/docs/supabase/TEST-REPORT.md +446 -0
  32. package/docs/supabase/migrations/001_create_federation_tables.sql +339 -0
  33. package/docs/validation/reports/REGRESSION-TEST-V1.8.11.md +456 -0
  34. package/package.json +4 -1
  35. package/wasm/reasoningbank/reasoningbank_wasm_bg.js +2 -2
  36. package/wasm/reasoningbank/reasoningbank_wasm_bg.wasm +0 -0
@@ -0,0 +1,431 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Federation Hub CLI - Manage ephemeral agent federation
4
+ * Supports hub server, agent lifecycle, stats, and monitoring
5
+ */
6
+ import { existsSync } from 'fs';
7
+ import { resolve, dirname } from 'path';
8
+ import { fileURLToPath } from 'url';
9
+ import { spawn } from 'child_process';
10
+ const __filename = fileURLToPath(import.meta.url);
11
+ const __dirname = dirname(__filename);
12
+ /**
13
+ * Federation Hub CLI Manager
14
+ */
15
+ export class FederationCLI {
16
+ hubProcess = null;
17
+ /**
18
+ * Start federation hub server
19
+ */
20
+ async startHub(config = {}) {
21
+ const port = config.port || parseInt(process.env.FEDERATION_HUB_PORT || '8443');
22
+ const dbPath = config.dbPath || process.env.FEDERATION_DB_PATH || ':memory:';
23
+ const maxAgents = config.maxAgents || parseInt(process.env.FEDERATION_MAX_AGENTS || '1000');
24
+ console.log('\n🌐 Starting Federation Hub Server...');
25
+ console.log('═'.repeat(60));
26
+ console.log(`πŸ“ Port: ${port}`);
27
+ console.log(`πŸ’Ύ Database: ${dbPath === ':memory:' ? 'In-Memory' : dbPath}`);
28
+ console.log(`πŸ‘₯ Max Agents: ${maxAgents}`);
29
+ console.log(`πŸ”’ Protocol: WebSocket (QUIC support planned)`);
30
+ console.log('');
31
+ // Start hub server
32
+ const hubPath = resolve(__dirname, '../federation/run-hub.js');
33
+ // Check if compiled hub exists
34
+ if (!existsSync(hubPath)) {
35
+ console.error(`❌ Error: Hub server not found at ${hubPath}`);
36
+ console.error(' Please build the project first: npm run build');
37
+ process.exit(1);
38
+ }
39
+ this.hubProcess = spawn('node', [hubPath], {
40
+ stdio: 'inherit',
41
+ env: {
42
+ ...process.env,
43
+ FEDERATION_HUB_PORT: port.toString(),
44
+ FEDERATION_DB_PATH: dbPath,
45
+ FEDERATION_MAX_AGENTS: maxAgents.toString(),
46
+ DEBUG: config.verbose ? 'federation:*' : undefined
47
+ }
48
+ });
49
+ this.hubProcess.on('exit', (code) => {
50
+ console.log(`\nπŸ‘‹ Hub server stopped (exit code: ${code})`);
51
+ process.exit(code || 0);
52
+ });
53
+ // Handle signals
54
+ process.on('SIGINT', () => {
55
+ console.log('\n\n⏸️ Shutting down hub server...');
56
+ if (this.hubProcess) {
57
+ this.hubProcess.kill('SIGINT');
58
+ }
59
+ });
60
+ process.on('SIGTERM', () => {
61
+ if (this.hubProcess) {
62
+ this.hubProcess.kill('SIGTERM');
63
+ }
64
+ });
65
+ console.log('βœ… Hub server started successfully!');
66
+ console.log('\nAgent Connection:');
67
+ console.log(` Endpoint: ws://localhost:${port}`);
68
+ console.log(` Protocol: WebSocket (HTTP/2 upgrade)`);
69
+ console.log('\nUse Ctrl+C to stop the server\n');
70
+ // Keep alive
71
+ await new Promise(() => { });
72
+ }
73
+ /**
74
+ * Spawn ephemeral agent
75
+ */
76
+ async spawnAgent(config = {}) {
77
+ const agentId = config.agentId || `agent-${Date.now()}`;
78
+ const tenantId = config.tenantId || process.env.FEDERATION_TENANT_ID || 'default';
79
+ const lifetime = config.lifetime || parseInt(process.env.AGENT_LIFETIME || '300'); // 5 minutes default
80
+ const hubEndpoint = config.hubEndpoint || process.env.FEDERATION_HUB_ENDPOINT || 'ws://localhost:8443';
81
+ const agentType = config.agentType || 'worker';
82
+ console.log('\nπŸ€– Spawning Ephemeral Agent...');
83
+ console.log('═'.repeat(60));
84
+ console.log(`πŸ†” Agent ID: ${agentId}`);
85
+ console.log(`🏒 Tenant: ${tenantId}`);
86
+ console.log(`⏱️ Lifetime: ${lifetime}s`);
87
+ console.log(`πŸ”— Hub: ${hubEndpoint}`);
88
+ console.log(`πŸ“‹ Type: ${agentType}`);
89
+ console.log('');
90
+ // Spawn agent process
91
+ const agentPath = resolve(__dirname, '../federation/run-agent.js');
92
+ if (!existsSync(agentPath)) {
93
+ console.error(`❌ Error: Agent runtime not found at ${agentPath}`);
94
+ console.error(' Please build the project first: npm run build');
95
+ process.exit(1);
96
+ }
97
+ const agentProcess = spawn('node', [agentPath], {
98
+ stdio: 'inherit',
99
+ env: {
100
+ ...process.env,
101
+ AGENT_ID: agentId,
102
+ TENANT_ID: tenantId,
103
+ AGENT_LIFETIME: lifetime.toString(),
104
+ HUB_ENDPOINT: hubEndpoint,
105
+ AGENT_TYPE: agentType
106
+ }
107
+ });
108
+ agentProcess.on('exit', (code) => {
109
+ console.log(`\nπŸ“Š Agent lifecycle complete (exit code: ${code})`);
110
+ process.exit(code || 0);
111
+ });
112
+ process.on('SIGINT', () => {
113
+ console.log('\n\n⏸️ Terminating agent...');
114
+ agentProcess.kill('SIGINT');
115
+ });
116
+ process.on('SIGTERM', () => {
117
+ agentProcess.kill('SIGTERM');
118
+ });
119
+ }
120
+ /**
121
+ * Show hub statistics
122
+ */
123
+ async stats(hubEndpoint) {
124
+ const endpoint = hubEndpoint || process.env.FEDERATION_HUB_ENDPOINT || 'ws://localhost:8443';
125
+ console.log('\nπŸ“Š Federation Hub Statistics');
126
+ console.log('═'.repeat(60));
127
+ console.log(`πŸ”— Hub: ${endpoint}`);
128
+ console.log('');
129
+ try {
130
+ // TODO: Implement WebSocket stats query
131
+ // For now, show placeholder
132
+ console.log('⏳ Querying hub statistics...\n');
133
+ console.log('Note: Stats API not yet implemented.');
134
+ console.log('The hub server logs real-time statistics to stdout.');
135
+ console.log('\nExpected stats:');
136
+ console.log(' β€’ Connected agents count');
137
+ console.log(' β€’ Total episodes stored');
138
+ console.log(' β€’ Active tenants');
139
+ console.log(' β€’ Uptime and performance metrics');
140
+ console.log('');
141
+ }
142
+ catch (error) {
143
+ console.error(`❌ Failed to query stats: ${error.message}`);
144
+ process.exit(1);
145
+ }
146
+ }
147
+ /**
148
+ * Show federation status
149
+ */
150
+ async status() {
151
+ console.log('\nπŸ” Federation System Status');
152
+ console.log('═'.repeat(60));
153
+ console.log('');
154
+ console.log('Components:');
155
+ console.log(' βœ… FederationHubServer - WebSocket hub for agent sync');
156
+ console.log(' βœ… FederationHubClient - WebSocket client for agents');
157
+ console.log(' βœ… EphemeralAgent - Short-lived agent lifecycle');
158
+ console.log(' βœ… SecurityManager - JWT authentication & encryption');
159
+ console.log(' βœ… AgentDB Integration - Vector memory storage (150x faster)');
160
+ console.log('');
161
+ console.log('Features:');
162
+ console.log(' βœ… Tenant Isolation - Multi-tenant memory separation');
163
+ console.log(' βœ… Persistent Hub - SQLite + AgentDB storage');
164
+ console.log(' βœ… Ephemeral Agents - :memory: databases (5s-15min lifetime)');
165
+ console.log(' βœ… Semantic Search - HNSW vector indexing');
166
+ console.log(' βœ… Multi-Generation - Agents learn from past agents');
167
+ console.log(' ⏳ QUIC Transport - Native QUIC planned (WebSocket fallback)');
168
+ console.log('');
169
+ console.log('Architecture:');
170
+ console.log(' β€’ Hub: Persistent central database (disk)');
171
+ console.log(' β€’ Agents: Ephemeral local databases (RAM)');
172
+ console.log(' β€’ Sync: Real-time via WebSocket');
173
+ console.log(' β€’ Memory: Outlives agent lifecycle');
174
+ console.log('');
175
+ console.log('Documentation:');
176
+ console.log(' πŸ“– Architecture: docs/architecture/FEDERATED-AGENTDB-EPHEMERAL-AGENTS.md');
177
+ console.log(' πŸ“– Data Lifecycle: docs/architecture/FEDERATION-DATA-LIFECYCLE.md');
178
+ console.log(' πŸ“– Test Report: docs/architecture/FEDERATION-TEST-REPORT.md');
179
+ console.log(' πŸ“– Integration: docs/architecture/AGENTDB-INTEGRATION-COMPLETE.md');
180
+ console.log('');
181
+ }
182
+ /**
183
+ * Run multi-agent collaboration test
184
+ */
185
+ async testCollaboration() {
186
+ console.log('\nπŸ§ͺ Running Multi-Agent Collaboration Test...');
187
+ console.log('═'.repeat(60));
188
+ console.log('');
189
+ const testPath = resolve(__dirname, '../../tests/federation/test-agentdb-collaboration.js');
190
+ if (!existsSync(testPath)) {
191
+ console.error(`❌ Error: Test not found at ${testPath}`);
192
+ console.error(' Please build the project first: npm run build');
193
+ process.exit(1);
194
+ }
195
+ console.log('πŸ“‹ Test Scenario:');
196
+ console.log(' β€’ 5 collaborative agents (researcher, coder, tester, reviewer, isolated)');
197
+ console.log(' β€’ Real AgentDB integration');
198
+ console.log(' β€’ Cross-agent memory sharing');
199
+ console.log(' β€’ Tenant isolation validation');
200
+ console.log('');
201
+ const testProcess = spawn('node', [testPath], {
202
+ stdio: 'inherit'
203
+ });
204
+ testProcess.on('exit', (code) => {
205
+ if (code === 0) {
206
+ console.log('\nβœ… Collaboration test passed!');
207
+ }
208
+ else {
209
+ console.log(`\n❌ Collaboration test failed (exit code: ${code})`);
210
+ }
211
+ process.exit(code || 0);
212
+ });
213
+ process.on('SIGINT', () => {
214
+ console.log('\n\n⏸️ Terminating test...');
215
+ testProcess.kill('SIGINT');
216
+ });
217
+ process.on('SIGTERM', () => {
218
+ testProcess.kill('SIGTERM');
219
+ });
220
+ }
221
+ /**
222
+ * Print help message
223
+ */
224
+ printHelp() {
225
+ console.log(`
226
+ 🌐 Federation Hub CLI - Ephemeral Agent Management
227
+
228
+ USAGE:
229
+ npx agentic-flow federation <command> [options]
230
+
231
+ COMMANDS:
232
+ start Start federation hub server
233
+ spawn Spawn ephemeral agent
234
+ stats Show hub statistics
235
+ status Show federation system status
236
+ test Run multi-agent collaboration test
237
+ help Show this help message
238
+
239
+ HUB SERVER OPTIONS:
240
+ --port, -p <port> Hub server port [default: 8443]
241
+ --db-path <path> Database path [default: :memory:]
242
+ --max-agents <number> Maximum concurrent agents [default: 1000]
243
+ --verbose, -v Enable verbose logging
244
+
245
+ AGENT OPTIONS:
246
+ --agent-id <id> Custom agent ID [default: auto-generated]
247
+ --tenant <id> Tenant ID [default: 'default']
248
+ --lifetime <seconds> Agent lifetime [default: 300]
249
+ --hub <endpoint> Hub WebSocket endpoint [default: ws://localhost:8443]
250
+ --type <type> Agent type [default: 'worker']
251
+
252
+ ENVIRONMENT VARIABLES:
253
+ FEDERATION_HUB_PORT Hub server port (default: 8443)
254
+ FEDERATION_DB_PATH Database path (default: :memory:)
255
+ FEDERATION_MAX_AGENTS Max concurrent agents (default: 1000)
256
+ FEDERATION_TENANT_ID Default tenant ID
257
+ FEDERATION_HUB_ENDPOINT Hub WebSocket endpoint
258
+ AGENT_LIFETIME Agent lifetime in seconds (default: 300)
259
+
260
+ DEBUG OPTIONS (for detailed operation visibility):
261
+ DEBUG_LEVEL Debug verbosity level
262
+ β€’ SILENT (0) - No output
263
+ β€’ BASIC (1) - Major events only [default]
264
+ β€’ DETAILED (2) - Include all operations with timing
265
+ β€’ VERBOSE (3) - All events + realtime + tasks
266
+ β€’ TRACE (4) - Everything + internal state changes
267
+ DEBUG_FORMAT Output format (human | json | compact) [default: human]
268
+ DEBUG_OUTPUT Output destination (console | file | both) [default: console]
269
+ DEBUG_OUTPUT_FILE File path for debug output [default: none]
270
+
271
+ DEBUG EXAMPLES:
272
+ # Enable detailed debug with timing
273
+ DEBUG_LEVEL=DETAILED npx agentic-flow federation start
274
+
275
+ # Maximum verbosity for troubleshooting
276
+ DEBUG_LEVEL=TRACE DEBUG_FORMAT=human npx agentic-flow federation spawn
277
+
278
+ # Production monitoring with JSON output to file
279
+ DEBUG_LEVEL=BASIC DEBUG_FORMAT=json DEBUG_OUTPUT=file \\
280
+ DEBUG_OUTPUT_FILE=/var/log/federation.log npx agentic-flow federation start
281
+
282
+ # Compact format for log aggregation
283
+ DEBUG_LEVEL=DETAILED DEBUG_FORMAT=compact DEBUG_OUTPUT=both \\
284
+ DEBUG_OUTPUT_FILE=debug.log npx agentic-flow federation start
285
+
286
+ EXAMPLES:
287
+ # Start hub server (in-memory)
288
+ npx agentic-flow federation start
289
+
290
+ # Start hub with persistent storage
291
+ npx agentic-flow federation start --db-path ./data/hub.db
292
+
293
+ # Start hub on custom port
294
+ npx agentic-flow federation start --port 9443 --verbose
295
+
296
+ # Spawn ephemeral agent (5 minute lifetime)
297
+ npx agentic-flow federation spawn --tenant acme-corp
298
+
299
+ # Spawn agent with custom lifetime
300
+ npx agentic-flow federation spawn --tenant acme-corp --lifetime 600 --type researcher
301
+
302
+ # Show hub statistics
303
+ npx agentic-flow federation stats
304
+
305
+ # Show system status
306
+ npx agentic-flow federation status
307
+
308
+ # Run collaboration test
309
+ npx agentic-flow federation test
310
+
311
+ ARCHITECTURE:
312
+ Hub: Persistent central database (SQLite + AgentDB)
313
+ β€’ Episode metadata storage
314
+ β€’ Vector memory with HNSW indexing (150x faster)
315
+ β€’ Tenant isolation via sessionId prefixes
316
+ β€’ Change log for synchronization
317
+
318
+ Agents: Ephemeral local databases (:memory:)
319
+ β€’ Short-lived (5 seconds to 15 minutes)
320
+ β€’ Pull memories from hub on spawn
321
+ β€’ Push new memories to hub during work
322
+ β€’ Destroyed on cleanup (memory persists in hub)
323
+
324
+ Memory Persistence:
325
+ β€’ Hub database outlives all agents
326
+ β€’ New agents can access memories from dead agents
327
+ β€’ Multi-generation learning enabled
328
+ β€’ Semantic search for pattern discovery
329
+
330
+ BENEFITS:
331
+ βœ… Memory outlives agents - Persistent learning across generations
332
+ βœ… Tenant isolation - Multi-tenant with zero data leakage
333
+ βœ… Semantic search - Find similar patterns via vector similarity
334
+ βœ… 150x faster search - HNSW indexing vs brute force
335
+ βœ… Scalable architecture - Ready for 100+ concurrent agents
336
+ βœ… WebSocket protocol - Real-time synchronization
337
+ βœ… Zero-trust security - JWT auth + AES-256 encryption
338
+
339
+ DOCUMENTATION:
340
+ πŸ“– Complete Architecture:
341
+ docs/architecture/FEDERATED-AGENTDB-EPHEMERAL-AGENTS.md
342
+
343
+ πŸ“– Data Lifecycle Explanation:
344
+ docs/architecture/FEDERATION-DATA-LIFECYCLE.md
345
+
346
+ πŸ“– Multi-Agent Test Report:
347
+ docs/architecture/FEDERATION-TEST-REPORT.md
348
+
349
+ πŸ“– AgentDB Integration:
350
+ docs/architecture/AGENTDB-INTEGRATION-COMPLETE.md
351
+
352
+ πŸ“– GitHub: https://github.com/ruvnet/agentic-flow
353
+ `);
354
+ }
355
+ }
356
+ /**
357
+ * CLI command handler
358
+ */
359
+ export async function handleFederationCommand(args) {
360
+ const command = args[0];
361
+ const cli = new FederationCLI();
362
+ // Parse options
363
+ const parseOptions = (args) => {
364
+ const options = {};
365
+ for (let i = 0; i < args.length; i++) {
366
+ if ((args[i] === '--port' || args[i] === '-p') && args[i + 1]) {
367
+ options.port = parseInt(args[++i]);
368
+ }
369
+ else if (args[i] === '--db-path' && args[i + 1]) {
370
+ options.dbPath = args[++i];
371
+ }
372
+ else if (args[i] === '--max-agents' && args[i + 1]) {
373
+ options.maxAgents = parseInt(args[++i]);
374
+ }
375
+ else if (args[i] === '--verbose' || args[i] === '-v') {
376
+ options.verbose = true;
377
+ }
378
+ else if (args[i] === '--agent-id' && args[i + 1]) {
379
+ options.agentId = args[++i];
380
+ }
381
+ else if (args[i] === '--tenant' && args[i + 1]) {
382
+ options.tenantId = args[++i];
383
+ }
384
+ else if (args[i] === '--lifetime' && args[i + 1]) {
385
+ options.lifetime = parseInt(args[++i]);
386
+ }
387
+ else if (args[i] === '--hub' && args[i + 1]) {
388
+ options.hubEndpoint = args[++i];
389
+ }
390
+ else if (args[i] === '--type' && args[i + 1]) {
391
+ options.agentType = args[++i];
392
+ }
393
+ }
394
+ return options;
395
+ };
396
+ const options = parseOptions(args.slice(1));
397
+ switch (command) {
398
+ case undefined:
399
+ case 'help':
400
+ cli.printHelp();
401
+ break;
402
+ case 'start':
403
+ await cli.startHub(options);
404
+ break;
405
+ case 'spawn':
406
+ await cli.spawnAgent(options);
407
+ break;
408
+ case 'stats':
409
+ await cli.stats(options.hubEndpoint);
410
+ break;
411
+ case 'status':
412
+ await cli.status();
413
+ break;
414
+ case 'test':
415
+ await cli.testCollaboration();
416
+ break;
417
+ default:
418
+ console.log(`\n❌ Unknown command: ${command}\n`);
419
+ console.log('Use "npx agentic-flow federation help" for usage information\n');
420
+ process.exit(1);
421
+ }
422
+ }
423
+ // If run directly
424
+ if (import.meta.url === `file://${process.argv[1]}`) {
425
+ const args = process.argv.slice(2);
426
+ handleFederationCommand(args).catch((error) => {
427
+ console.error('\n❌ Error:', error.message);
428
+ console.error(error.stack);
429
+ process.exit(1);
430
+ });
431
+ }
package/dist/cli-proxy.js CHANGED
@@ -29,10 +29,11 @@ import { AnthropicToRequestyProxy } from "./proxy/anthropic-to-requesty.js";
29
29
  import { logger } from "./utils/logger.js";
30
30
  import { parseArgs } from "./utils/cli.js";
31
31
  import { getAgent, listAgents } from "./utils/agentLoader.js";
32
- import { claudeAgent } from "./agents/claudeAgent.js";
32
+ import { claudeAgentDirect } from "./agents/claudeAgentDirect.js";
33
33
  import { handleReasoningBankCommand } from "./utils/reasoningbankCommands.js";
34
34
  import { handleConfigCommand } from "./cli/config-wizard.js";
35
35
  import { handleAgentCommand } from "./cli/agent-manager.js";
36
+ import { handleFederationCommand } from "./cli/federation-cli.js";
36
37
  import { ModelOptimizer } from "./utils/modelOptimizer.js";
37
38
  import { detectModelCapabilities } from "./utils/modelCapabilities.js";
38
39
  import { AgentBoosterPreprocessor } from "./utils/agentBoosterPreprocessor.js";
@@ -54,7 +55,7 @@ class AgenticFlowCLI {
54
55
  process.exit(0);
55
56
  }
56
57
  // If no mode and no agent specified, show help
57
- if (!options.agent && options.mode !== 'list' && !['config', 'agent-manager', 'mcp-manager', 'proxy', 'quic', 'claude-code', 'mcp', 'reasoningbank'].includes(options.mode)) {
58
+ if (!options.agent && options.mode !== 'list' && !['config', 'agent-manager', 'mcp-manager', 'proxy', 'quic', 'claude-code', 'mcp', 'reasoningbank', 'federation'].includes(options.mode)) {
58
59
  this.printHelp();
59
60
  process.exit(0);
60
61
  }
@@ -144,6 +145,12 @@ class AgenticFlowCLI {
144
145
  await handleReasoningBankCommand(subcommand);
145
146
  process.exit(0);
146
147
  }
148
+ if (options.mode === 'federation') {
149
+ // Handle Federation commands
150
+ const federationArgs = process.argv.slice(3); // Skip 'node', 'cli-proxy.js', 'federation'
151
+ await handleFederationCommand(federationArgs);
152
+ process.exit(0);
153
+ }
147
154
  // Apply model optimization if requested
148
155
  if (options.optimize && options.agent && options.task) {
149
156
  const recommendation = ModelOptimizer.optimize({
@@ -844,8 +851,9 @@ PERFORMANCE:
844
851
  }
845
852
  }
846
853
  const streamHandler = options.stream ? (chunk) => process.stdout.write(chunk) : undefined;
847
- // Use claudeAgent with Claude Agent SDK - handles multi-provider routing
848
- const result = await claudeAgent(agent, task, streamHandler);
854
+ // FIXED: Use claudeAgentDirect (no Claude Code dependency) instead of claudeAgent
855
+ // This allows agentic-flow to work standalone in Docker/CI/CD without Claude Code
856
+ const result = await claudeAgentDirect(agent, task, streamHandler);
849
857
  if (!options.stream) {
850
858
  console.log('\nβœ… Completed!\n');
851
859
  console.log('═══════════════════════════════════════\n');
@@ -892,6 +900,7 @@ COMMANDS:
892
900
  config [subcommand] Manage environment configuration (interactive wizard)
893
901
  mcp <command> [server] Manage MCP servers (start, stop, status, list)
894
902
  agent <command> Agent management (list, create, info, conflicts)
903
+ federation <command> Federation hub management (start, spawn, stats, test)
895
904
  proxy [options] Run standalone proxy server for Claude Code/Cursor
896
905
  quic [options] Run QUIC transport proxy for ultra-low latency (50-70% faster)
897
906
  claude-code [options] Spawn Claude Code with auto-configured proxy
@@ -920,6 +929,17 @@ AGENT COMMANDS:
920
929
  npx agentic-flow agent info <name> Show detailed agent information
921
930
  npx agentic-flow agent conflicts Check for package/local conflicts
922
931
 
932
+ FEDERATION COMMANDS:
933
+ npx agentic-flow federation start Start federation hub server
934
+ npx agentic-flow federation spawn Spawn ephemeral agent
935
+ npx agentic-flow federation stats Show hub statistics
936
+ npx agentic-flow federation status Show federation system status
937
+ npx agentic-flow federation test Run multi-agent collaboration test
938
+ npx agentic-flow federation help Show federation help
939
+
940
+ Federation enables ephemeral agents (5s-15min lifetime) with persistent memory.
941
+ Hub stores memories permanently; agents access past learnings from dead agents.
942
+
923
943
  OPTIONS:
924
944
  --task, -t <task> Task description for agent mode
925
945
  --model, -m <model> Model to use (triggers OpenRouter if contains "/")
@@ -968,6 +988,14 @@ EXAMPLES:
968
988
  npx agentic-flow mcp list # List all 203+ MCP tools
969
989
  npx agentic-flow mcp status # Check server status
970
990
 
991
+ # Federation Hub Management
992
+ npx agentic-flow federation start # Start hub server (WebSocket)
993
+ npx agentic-flow federation start --port 9443 --db-path ./data/hub.db
994
+ npx agentic-flow federation spawn # Spawn ephemeral agent
995
+ npx agentic-flow federation spawn --tenant acme-corp --lifetime 600
996
+ npx agentic-flow federation stats # Show hub statistics
997
+ npx agentic-flow federation test # Run multi-agent test
998
+
971
999
  # Proxy Server for Claude Code/Cursor
972
1000
  npx agentic-flow proxy --provider openrouter --port 3000
973
1001
  npx agentic-flow proxy --provider gemini --port 3001