agentic-flow 1.0.3 → 1.0.5
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/agents/directApiAgent.js +20 -4
- package/dist/cli-proxy.js +3 -3
- package/dist/mcp/standalone-stdio.js +18 -12
- package/package.json +1 -1
|
@@ -3,9 +3,24 @@ import Anthropic from '@anthropic-ai/sdk';
|
|
|
3
3
|
import { logger } from '../utils/logger.js';
|
|
4
4
|
import { withRetry } from '../utils/retry.js';
|
|
5
5
|
import { execSync } from 'child_process';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
// Lazy initialize Anthropic client to allow runtime API key validation
|
|
7
|
+
let anthropic = null;
|
|
8
|
+
function getAnthropicClient() {
|
|
9
|
+
if (!anthropic) {
|
|
10
|
+
const apiKey = process.env.ANTHROPIC_API_KEY;
|
|
11
|
+
// Validate API key format
|
|
12
|
+
if (!apiKey) {
|
|
13
|
+
throw new Error('ANTHROPIC_API_KEY is required but not set');
|
|
14
|
+
}
|
|
15
|
+
if (!apiKey.startsWith('sk-ant-')) {
|
|
16
|
+
throw new Error(`Invalid ANTHROPIC_API_KEY format. Expected format: sk-ant-...\n` +
|
|
17
|
+
`Got: ${apiKey.substring(0, 10)}...\n\n` +
|
|
18
|
+
`Please check your API key at: https://console.anthropic.com/settings/keys`);
|
|
19
|
+
}
|
|
20
|
+
anthropic = new Anthropic({ apiKey });
|
|
21
|
+
}
|
|
22
|
+
return anthropic;
|
|
23
|
+
}
|
|
9
24
|
// Define claude-flow tools as native Anthropic tool definitions
|
|
10
25
|
const claudeFlowTools = [
|
|
11
26
|
{
|
|
@@ -179,7 +194,8 @@ export async function directApiAgent(agent, input, onStream) {
|
|
|
179
194
|
// Agentic loop: keep calling API until no more tool uses
|
|
180
195
|
while (toolUseCount < maxToolUses) {
|
|
181
196
|
logger.debug('API call iteration', { toolUseCount, messagesLength: messages.length });
|
|
182
|
-
const
|
|
197
|
+
const client = getAnthropicClient();
|
|
198
|
+
const response = await client.messages.create({
|
|
183
199
|
model: 'claude-sonnet-4-5-20250929',
|
|
184
200
|
max_tokens: 8192,
|
|
185
201
|
system: agent.systemPrompt || 'You are a helpful AI assistant.',
|
package/dist/cli-proxy.js
CHANGED
|
@@ -8,7 +8,7 @@ import { AnthropicToOpenRouterProxy } from "./proxy/anthropic-to-openrouter.js";
|
|
|
8
8
|
import { logger } from "./utils/logger.js";
|
|
9
9
|
import { parseArgs } from "./utils/cli.js";
|
|
10
10
|
import { getAgent, listAgents } from "./utils/agentLoader.js";
|
|
11
|
-
import {
|
|
11
|
+
import { directApiAgent } from "./agents/directApiAgent.js";
|
|
12
12
|
import { readFileSync } from 'fs';
|
|
13
13
|
import { resolve, dirname } from 'path';
|
|
14
14
|
import { fileURLToPath } from 'url';
|
|
@@ -181,8 +181,8 @@ class AgenticFlowCLI {
|
|
|
181
181
|
}
|
|
182
182
|
console.log('⏳ Running...\n');
|
|
183
183
|
const streamHandler = options.stream ? (chunk) => process.stdout.write(chunk) : undefined;
|
|
184
|
-
|
|
185
|
-
const result = await
|
|
184
|
+
// Use directApiAgent (works without Claude Code installed) instead of claudeAgent (requires Claude Code)
|
|
185
|
+
const result = await directApiAgent(agent, task, streamHandler);
|
|
186
186
|
if (!options.stream) {
|
|
187
187
|
console.log('\n✅ Completed!\n');
|
|
188
188
|
console.log('═══════════════════════════════════════\n');
|
|
@@ -5,18 +5,26 @@ import { z } from 'zod';
|
|
|
5
5
|
import { execSync } from 'child_process';
|
|
6
6
|
import { resolve, dirname } from 'path';
|
|
7
7
|
import { fileURLToPath } from 'url';
|
|
8
|
-
|
|
9
8
|
const __filename = fileURLToPath(import.meta.url);
|
|
10
9
|
const __dirname = dirname(__filename);
|
|
11
|
-
|
|
10
|
+
// Suppress FastMCP internal warnings for cleaner output
|
|
11
|
+
const originalConsoleWarn = console.warn;
|
|
12
|
+
console.warn = (...args) => {
|
|
13
|
+
const message = args.join(' ');
|
|
14
|
+
// Filter out FastMCP client capability warnings
|
|
15
|
+
if (message.includes('could not infer client capabilities')) {
|
|
16
|
+
// Replace with friendly status message
|
|
17
|
+
console.error('⏳ Waiting for MCP client connection...');
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
originalConsoleWarn.apply(console, args);
|
|
21
|
+
};
|
|
12
22
|
console.error('🚀 Starting Agentic-Flow MCP Server (stdio)...');
|
|
13
23
|
console.error('📦 Local agentic-flow tools available');
|
|
14
|
-
|
|
15
24
|
const server = new FastMCP({
|
|
16
25
|
name: 'agentic-flow',
|
|
17
|
-
version: '1.0.
|
|
26
|
+
version: '1.0.3'
|
|
18
27
|
});
|
|
19
|
-
|
|
20
28
|
// Tool: Run agentic-flow agent
|
|
21
29
|
server.addTool({
|
|
22
30
|
name: 'agentic_flow_agent',
|
|
@@ -35,19 +43,18 @@ server.addTool({
|
|
|
35
43
|
maxBuffer: 10 * 1024 * 1024,
|
|
36
44
|
cwd: resolve(__dirname, '../..')
|
|
37
45
|
});
|
|
38
|
-
|
|
39
46
|
return JSON.stringify({
|
|
40
47
|
success: true,
|
|
41
48
|
agent,
|
|
42
49
|
task,
|
|
43
50
|
output: result.trim()
|
|
44
51
|
}, null, 2);
|
|
45
|
-
}
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
46
54
|
throw new Error(`Failed to execute agent: ${error.message}`);
|
|
47
55
|
}
|
|
48
56
|
}
|
|
49
57
|
});
|
|
50
|
-
|
|
51
58
|
// Tool: List available agents
|
|
52
59
|
server.addTool({
|
|
53
60
|
name: 'agentic_flow_list_agents',
|
|
@@ -61,22 +68,21 @@ server.addTool({
|
|
|
61
68
|
encoding: 'utf-8',
|
|
62
69
|
cwd: resolve(__dirname, '../..')
|
|
63
70
|
});
|
|
64
|
-
|
|
65
71
|
return JSON.stringify({
|
|
66
72
|
success: true,
|
|
67
73
|
agents: result.trim()
|
|
68
74
|
}, null, 2);
|
|
69
|
-
}
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
70
77
|
throw new Error(`Failed to list agents: ${error.message}`);
|
|
71
78
|
}
|
|
72
79
|
}
|
|
73
80
|
});
|
|
74
|
-
|
|
75
81
|
console.error('✅ Registered 2 tools: agentic_flow_agent, agentic_flow_list_agents');
|
|
76
82
|
console.error('🔌 Starting stdio transport...');
|
|
77
|
-
|
|
78
83
|
server.start({ transportType: 'stdio' }).then(() => {
|
|
79
84
|
console.error('✅ Agentic-Flow MCP server running on stdio');
|
|
85
|
+
console.error('💡 Ready for MCP client connections (e.g., Claude Desktop)');
|
|
80
86
|
}).catch((error) => {
|
|
81
87
|
console.error('❌ Failed to start server:', error);
|
|
82
88
|
process.exit(1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentic-flow",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
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",
|