agentic-flow 1.0.0 → 1.0.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-proxy.js +25 -4
- package/dist/mcp/standalone-stdio.js +83 -0
- package/dist/utils/agentLoader.js +15 -5
- package/package.json +7 -5
package/dist/cli-proxy.js
CHANGED
|
@@ -9,7 +9,13 @@ import { logger } from "./utils/logger.js";
|
|
|
9
9
|
import { parseArgs } from "./utils/cli.js";
|
|
10
10
|
import { getAgent, listAgents } from "./utils/agentLoader.js";
|
|
11
11
|
import { claudeAgent } from "./agents/claudeAgent.js";
|
|
12
|
-
import {
|
|
12
|
+
import { readFileSync } from 'fs';
|
|
13
|
+
import { resolve, dirname } from 'path';
|
|
14
|
+
import { fileURLToPath } from 'url';
|
|
15
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
16
|
+
const __dirname = dirname(__filename);
|
|
17
|
+
const packageJson = JSON.parse(readFileSync(resolve(__dirname, '../package.json'), 'utf-8'));
|
|
18
|
+
const VERSION = packageJson.version;
|
|
13
19
|
class AgenticFlowCLI {
|
|
14
20
|
proxyServer = null;
|
|
15
21
|
proxyPort = 3000;
|
|
@@ -24,8 +30,23 @@ class AgenticFlowCLI {
|
|
|
24
30
|
process.exit(0);
|
|
25
31
|
}
|
|
26
32
|
if (options.mode === 'mcp') {
|
|
27
|
-
|
|
28
|
-
|
|
33
|
+
// Run standalone MCP server directly
|
|
34
|
+
const { spawn } = await import('child_process');
|
|
35
|
+
const { resolve, dirname } = await import('path');
|
|
36
|
+
const { fileURLToPath } = await import('url');
|
|
37
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
38
|
+
const __dirname = dirname(__filename);
|
|
39
|
+
const serverPath = resolve(__dirname, './mcp/standalone-stdio.js');
|
|
40
|
+
const proc = spawn('node', [serverPath], {
|
|
41
|
+
stdio: 'inherit'
|
|
42
|
+
});
|
|
43
|
+
proc.on('exit', (code) => {
|
|
44
|
+
process.exit(code || 0);
|
|
45
|
+
});
|
|
46
|
+
// Handle termination signals
|
|
47
|
+
process.on('SIGINT', () => proc.kill('SIGINT'));
|
|
48
|
+
process.on('SIGTERM', () => proc.kill('SIGTERM'));
|
|
49
|
+
return;
|
|
29
50
|
}
|
|
30
51
|
// Determine if we should use OpenRouter
|
|
31
52
|
const useOpenRouter = this.shouldUseOpenRouter(options);
|
|
@@ -179,7 +200,7 @@ class AgenticFlowCLI {
|
|
|
179
200
|
}
|
|
180
201
|
printHelp() {
|
|
181
202
|
console.log(`
|
|
182
|
-
🤖 Agentic Flow - AI Agent Orchestration with OpenRouter Support
|
|
203
|
+
🤖 Agentic Flow v${VERSION} - AI Agent Orchestration with OpenRouter Support
|
|
183
204
|
|
|
184
205
|
USAGE:
|
|
185
206
|
npx agentic-flow [COMMAND] [OPTIONS]
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Standalone agentic-flow MCP server - runs directly via stdio without spawning subprocesses
|
|
3
|
+
import { FastMCP } from 'fastmcp';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { execSync } from 'child_process';
|
|
6
|
+
import { resolve, dirname } from 'path';
|
|
7
|
+
import { fileURLToPath } from 'url';
|
|
8
|
+
|
|
9
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
+
const __dirname = dirname(__filename);
|
|
11
|
+
|
|
12
|
+
console.error('🚀 Starting Agentic-Flow MCP Server (stdio)...');
|
|
13
|
+
console.error('📦 Local agentic-flow tools available');
|
|
14
|
+
|
|
15
|
+
const server = new FastMCP({
|
|
16
|
+
name: 'agentic-flow',
|
|
17
|
+
version: '1.0.0'
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// Tool: Run agentic-flow agent
|
|
21
|
+
server.addTool({
|
|
22
|
+
name: 'agentic_flow_agent',
|
|
23
|
+
description: 'Execute an agentic-flow agent with a specific task',
|
|
24
|
+
parameters: z.object({
|
|
25
|
+
agent: z.string().describe('Agent type (coder, researcher, etc.)'),
|
|
26
|
+
task: z.string().describe('Task description for the agent'),
|
|
27
|
+
stream: z.boolean().optional().default(false).describe('Enable streaming output')
|
|
28
|
+
}),
|
|
29
|
+
execute: async ({ agent, task, stream }) => {
|
|
30
|
+
try {
|
|
31
|
+
const cliPath = resolve(__dirname, '../../cli-proxy.js');
|
|
32
|
+
const cmd = `node "${cliPath}" --agent "${agent}" --task "${task}"${stream ? ' --stream' : ''}`;
|
|
33
|
+
const result = execSync(cmd, {
|
|
34
|
+
encoding: 'utf-8',
|
|
35
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
36
|
+
cwd: resolve(__dirname, '../..')
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
return JSON.stringify({
|
|
40
|
+
success: true,
|
|
41
|
+
agent,
|
|
42
|
+
task,
|
|
43
|
+
output: result.trim()
|
|
44
|
+
}, null, 2);
|
|
45
|
+
} catch (error) {
|
|
46
|
+
throw new Error(`Failed to execute agent: ${error.message}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// Tool: List available agents
|
|
52
|
+
server.addTool({
|
|
53
|
+
name: 'agentic_flow_list_agents',
|
|
54
|
+
description: 'List all available agentic-flow agents',
|
|
55
|
+
parameters: z.object({}),
|
|
56
|
+
execute: async () => {
|
|
57
|
+
try {
|
|
58
|
+
const cliPath = resolve(__dirname, '../../cli-proxy.js');
|
|
59
|
+
const cmd = `node "${cliPath}" --mode list`;
|
|
60
|
+
const result = execSync(cmd, {
|
|
61
|
+
encoding: 'utf-8',
|
|
62
|
+
cwd: resolve(__dirname, '../..')
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
return JSON.stringify({
|
|
66
|
+
success: true,
|
|
67
|
+
agents: result.trim()
|
|
68
|
+
}, null, 2);
|
|
69
|
+
} catch (error) {
|
|
70
|
+
throw new Error(`Failed to list agents: ${error.message}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
console.error('✅ Registered 2 tools: agentic_flow_agent, agentic_flow_list_agents');
|
|
76
|
+
console.error('🔌 Starting stdio transport...');
|
|
77
|
+
|
|
78
|
+
server.start({ transportType: 'stdio' }).then(() => {
|
|
79
|
+
console.error('✅ Agentic-Flow MCP server running on stdio');
|
|
80
|
+
}).catch((error) => {
|
|
81
|
+
console.error('❌ Failed to start server:', error);
|
|
82
|
+
process.exit(1);
|
|
83
|
+
});
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
// Agent loader for .claude/agents integration
|
|
2
|
-
import { readFileSync, readdirSync, statSync } from 'fs';
|
|
3
|
-
import { join, extname } from 'path';
|
|
2
|
+
import { readFileSync, readdirSync, statSync, existsSync } from 'fs';
|
|
3
|
+
import { join, extname, dirname } from 'path';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
4
5
|
import { logger } from './logger.js';
|
|
6
|
+
// Get the package root directory
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = dirname(__filename);
|
|
9
|
+
const packageRoot = join(__dirname, '../..');
|
|
10
|
+
const defaultAgentsDir = join(packageRoot, '.claude/agents');
|
|
5
11
|
/**
|
|
6
12
|
* Parse agent markdown file with frontmatter
|
|
7
13
|
*/
|
|
@@ -75,10 +81,14 @@ function findAgentFiles(dir) {
|
|
|
75
81
|
/**
|
|
76
82
|
* Load all agents from .claude/agents directory
|
|
77
83
|
*/
|
|
78
|
-
export function loadAgents(agentsDir
|
|
84
|
+
export function loadAgents(agentsDir) {
|
|
79
85
|
const agents = new Map();
|
|
80
|
-
|
|
81
|
-
const
|
|
86
|
+
// Priority: explicit parameter > env var > package default > current working directory
|
|
87
|
+
const targetDir = agentsDir
|
|
88
|
+
|| process.env.AGENTS_DIR
|
|
89
|
+
|| (existsSync(defaultAgentsDir) ? defaultAgentsDir : join(process.cwd(), '.claude/agents'));
|
|
90
|
+
logger.info('Loading agents from directory', { agentsDir: targetDir });
|
|
91
|
+
const agentFiles = findAgentFiles(targetDir);
|
|
82
92
|
logger.debug('Found agent files', { count: agentFiles.length });
|
|
83
93
|
for (const filePath of agentFiles) {
|
|
84
94
|
const agent = parseAgentFile(filePath);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentic-flow",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Production-ready AI agent orchestration platform with 66 specialized agents, 111 MCP tools, and autonomous multi-agent swarms. Built by @ruvnet with Claude Agent SDK, neural networks, memory persistence, GitHub integration, and distributed consensus protocols.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -110,9 +110,6 @@
|
|
|
110
110
|
"dependencies": {
|
|
111
111
|
"@anthropic-ai/claude-agent-sdk": "^0.1.5",
|
|
112
112
|
"@anthropic-ai/sdk": "^0.65.0",
|
|
113
|
-
"@huggingface/hub": "^2.6.10",
|
|
114
|
-
"@huggingface/inference": "^4.11.0",
|
|
115
|
-
"@xenova/transformers": "^2.17.2",
|
|
116
113
|
"agentic-payments": "^0.1.3",
|
|
117
114
|
"axios": "^1.12.2",
|
|
118
115
|
"claude-flow": "^2.0.0",
|
|
@@ -120,10 +117,15 @@
|
|
|
120
117
|
"express": "^5.1.0",
|
|
121
118
|
"fastmcp": "^3.19.0",
|
|
122
119
|
"http-proxy-middleware": "^3.0.5",
|
|
123
|
-
"onnxruntime-node": "^1.23.0",
|
|
124
120
|
"tiktoken": "^1.0.22",
|
|
125
121
|
"zod": "^3.25.76"
|
|
126
122
|
},
|
|
123
|
+
"optionalDependencies": {
|
|
124
|
+
"@huggingface/hub": "^2.6.10",
|
|
125
|
+
"@huggingface/inference": "^4.11.0",
|
|
126
|
+
"@xenova/transformers": "^2.17.2",
|
|
127
|
+
"onnxruntime-node": "^1.23.0"
|
|
128
|
+
},
|
|
127
129
|
"devDependencies": {
|
|
128
130
|
"@types/express": "^5.0.3",
|
|
129
131
|
"@types/node": "^20.19.19",
|