195 lines
6.2 KiB
Markdown
195 lines
6.2 KiB
Markdown
# v1.1.10 - Validation Complete ✅
|
|
|
|
## Summary
|
|
|
|
**v1.1.10 fixes all proxy URL issues from v1.1.8 and v1.1.9.**
|
|
|
|
### Fixed Issues
|
|
- ✅ Gemini proxy URL mismatch (was hardcoded to port 3001, now uses 3000 from CLI)
|
|
- ✅ claudeAgent now respects `ANTHROPIC_BASE_URL` set by CLI
|
|
- ✅ All providers automatically use correct proxy URL
|
|
- ✅ No more hanging with Gemini provider
|
|
|
|
## Local Validation Results
|
|
|
|
### Test 1: Anthropic Provider (Direct API)
|
|
```bash
|
|
node dist/cli-proxy.js --agent coder --task "Create add function" --provider anthropic --max-tokens 100
|
|
```
|
|
**Result**: ✅ **WORKING** - Function created successfully
|
|
|
|
### Test 2: Gemini Provider (Via Proxy)
|
|
```bash
|
|
export GOOGLE_GEMINI_API_KEY="..."
|
|
node dist/cli-proxy.js --agent coder --task "Create add function" --provider gemini --max-tokens 100
|
|
```
|
|
**Result**: ✅ **WORKING**
|
|
- Proxy started on port 3000
|
|
- Gemini API call successful
|
|
- Function created: `add.py`
|
|
|
|
### Test 3: OpenRouter Provider (Via Proxy)
|
|
```bash
|
|
export OPENROUTER_API_KEY="..."
|
|
node dist/cli-proxy.js --agent coder --task "Create multiply function" --provider openrouter --model "openai/gpt-4o-mini" --max-tokens 100
|
|
```
|
|
**Result**: ✅ **WORKING**
|
|
- Proxy started on port 3000
|
|
- OpenRouter API call successful
|
|
- Function created successfully
|
|
|
|
### Test 4: Claude Agent SDK Write Tool
|
|
```bash
|
|
node dist/cli-proxy.js --agent coder --task "Write a hello world function to a file called hello.js using the Write tool" --provider anthropic --max-tokens 200
|
|
```
|
|
**Result**: ✅ **WORKING**
|
|
- File created at `/tmp/hello.js`
|
|
- SDK Write tool functioning correctly
|
|
|
|
### Test 5: MCP Integration (claude-flow-sdk)
|
|
```bash
|
|
export ENABLE_CLAUDE_FLOW_SDK=true
|
|
node dist/cli-proxy.js --agent coder --task "Use the claude-flow-sdk MCP to store 'test-validation'='all systems working' in memory, then retrieve it" --provider anthropic --max-tokens 250
|
|
```
|
|
**Result**: ✅ **WORKING**
|
|
- Memory stored: `test-validation=all systems working` (19 bytes)
|
|
- Memory retrieved successfully
|
|
- MCP memory system operational
|
|
|
|
## Code Changes (v1.1.9 → v1.1.10)
|
|
|
|
### File: `src/agents/claudeAgent.ts`
|
|
|
|
**Before (v1.1.9)**:
|
|
```typescript
|
|
if (provider === 'gemini' && process.env.GOOGLE_GEMINI_API_KEY) {
|
|
envOverrides.ANTHROPIC_API_KEY = 'proxy-key';
|
|
envOverrides.ANTHROPIC_BASE_URL = process.env.GEMINI_PROXY_URL || 'http://localhost:3001'; // ❌ Wrong port
|
|
}
|
|
```
|
|
|
|
**After (v1.1.10)**:
|
|
```typescript
|
|
if (provider === 'gemini' && process.env.GOOGLE_GEMINI_API_KEY) {
|
|
// Use ANTHROPIC_BASE_URL if already set by CLI
|
|
envOverrides.ANTHROPIC_API_KEY = process.env.ANTHROPIC_API_KEY || 'proxy-key';
|
|
envOverrides.ANTHROPIC_BASE_URL = process.env.ANTHROPIC_BASE_URL || process.env.GEMINI_PROXY_URL || 'http://localhost:3000'; // ✅ Correct
|
|
}
|
|
```
|
|
|
|
### File: `src/cli-proxy.ts`
|
|
|
|
**Lines 136-156**: Added proper Gemini proxy startup
|
|
```typescript
|
|
// Start proxy if needed (OpenRouter or Gemini)
|
|
if (useOpenRouter) {
|
|
console.log('🚀 Initializing OpenRouter proxy...');
|
|
await this.startOpenRouterProxy(options.model);
|
|
} else if (useGemini) {
|
|
console.log('🚀 Initializing Gemini proxy...');
|
|
await this.startGeminiProxy(options.model); // ✅ New method
|
|
} else {
|
|
console.log('🚀 Using direct Anthropic API...\n');
|
|
}
|
|
```
|
|
|
|
**Lines 254-295**: New `startGeminiProxy()` method
|
|
```typescript
|
|
private async startGeminiProxy(modelOverride?: string): Promise<void> {
|
|
const geminiKey = process.env.GOOGLE_GEMINI_API_KEY;
|
|
|
|
if (!geminiKey) {
|
|
console.error('❌ Error: GOOGLE_GEMINI_API_KEY required for Gemini models');
|
|
process.exit(1);
|
|
}
|
|
|
|
const defaultModel = modelOverride || process.env.COMPLETION_MODEL || 'gemini-2.0-flash-exp';
|
|
|
|
const { AnthropicToGeminiProxy } = await import('./proxy/anthropic-to-gemini.js');
|
|
const proxy = new AnthropicToGeminiProxy({
|
|
geminiApiKey: geminiKey,
|
|
defaultModel
|
|
});
|
|
|
|
proxy.start(this.proxyPort);
|
|
this.proxyServer = proxy;
|
|
|
|
// Set ANTHROPIC_BASE_URL so claudeAgent uses it
|
|
process.env.ANTHROPIC_BASE_URL = `http://localhost:${this.proxyPort}`;
|
|
|
|
if (!process.env.ANTHROPIC_API_KEY) {
|
|
process.env.ANTHROPIC_API_KEY = 'sk-ant-proxy-dummy-key';
|
|
}
|
|
|
|
console.log(`🔗 Proxy Mode: Google Gemini`);
|
|
console.log(`🔧 Proxy URL: http://localhost:${this.proxyPort}`);
|
|
console.log(`🤖 Default Model: ${defaultModel}\n`);
|
|
|
|
await new Promise(resolve => setTimeout(resolve, 1500));
|
|
}
|
|
```
|
|
|
|
## Version Comparison
|
|
|
|
| Version | Gemini Provider | OpenRouter | Anthropic | MCP | SDK Tools |
|
|
|---------|----------------|------------|-----------|-----|-----------|
|
|
| v1.1.8 | ❌ Hangs indefinitely | ✅ Works | ✅ Works | ✅ Works | ✅ Works |
|
|
| v1.1.9 | ❌ Hangs (proxy not started) | ✅ Works | ✅ Works | ✅ Works | ✅ Works |
|
|
| v1.1.10 | ✅ **FIXED** | ✅ Works | ✅ Works | ✅ Works | ✅ Works |
|
|
|
|
## Installation
|
|
|
|
```bash
|
|
npm install -g agentic-flow@1.1.10
|
|
# or
|
|
npx agentic-flow@1.1.10 --agent coder --task "..."
|
|
```
|
|
|
|
## Usage Examples
|
|
|
|
### Gemini (Fixed in v1.1.10)
|
|
```bash
|
|
export GOOGLE_GEMINI_API_KEY="your-key-here"
|
|
npx agentic-flow@1.1.10 --agent coder --task "Create a REST API" --provider gemini
|
|
```
|
|
|
|
### OpenRouter
|
|
```bash
|
|
export OPENROUTER_API_KEY="sk-or-v1-..."
|
|
npx agentic-flow@1.1.10 --agent coder --task "Write tests" --provider openrouter --model "openai/gpt-4o-mini"
|
|
```
|
|
|
|
### Anthropic (Direct)
|
|
```bash
|
|
export ANTHROPIC_API_KEY="sk-ant-..."
|
|
npx agentic-flow@1.1.10 --agent coder --task "Refactor code"
|
|
```
|
|
|
|
### With MCP Memory
|
|
```bash
|
|
export ENABLE_CLAUDE_FLOW_SDK=true
|
|
export ANTHROPIC_API_KEY="sk-ant-..."
|
|
npx agentic-flow@1.1.10 --agent coder --task "Store config in MCP memory"
|
|
```
|
|
|
|
## Key Improvements
|
|
|
|
1. **Automatic Proxy Detection**: CLI automatically starts the correct proxy based on provider
|
|
2. **URL Consistency**: `claudeAgent.ts` now uses `ANTHROPIC_BASE_URL` set by CLI
|
|
3. **Better Error Messages**: Clear errors instead of hanging
|
|
4. **Debug Mode**: Use `--verbose` to see provider selection logic
|
|
5. **All Providers Validated**: Anthropic, Gemini, OpenRouter, MCP, SDK tools all working
|
|
|
|
## Recommended Version
|
|
|
|
**Use v1.1.10** - All provider issues fixed, full validation complete.
|
|
|
|
Avoid: v1.1.8 (hangs), v1.1.9 (Gemini proxy not started)
|
|
|
|
## Package Info
|
|
|
|
- **NPM**: https://www.npmjs.com/package/agentic-flow/v/1.1.10
|
|
- **Size**: 264 files, 66 agents, 111 MCP tools
|
|
- **Published**: 2025-10-05
|
|
- **Status**: ✅ Production Ready
|