Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions mycoder.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ export default {
pageFilter: 'none', // 'simple', 'none', or 'readability'

// Model settings
//provider: 'anthropic',
//model: 'claude-3-7-sonnet-20250219',
provider: 'anthropic',
model: 'claude-3-7-sonnet-20250219',
//provider: 'openai',
//model: 'gpt-4o',
provider: 'ollama',
model: 'medragondot/Sky-T1-32B-Preview:latest',
//provider: 'ollama',
//model: 'medragondot/Sky-T1-32B-Preview:latest',
maxTokens: 4096,
temperature: 0.7,

Expand Down
8 changes: 6 additions & 2 deletions packages/agent/src/core/toolAgent/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ import { getModel } from './config.js';

describe('createProvider', () => {
it('should return the correct model for anthropic', () => {
const model = createProvider('anthropic', 'claude-3-7-sonnet-20250219');
const model = createProvider('anthropic', 'claude-3-7-sonnet-20250219', {
apiKey: 'sk-proj-1234567890',
});
expect(model).toBeDefined();
expect(model.provider).toBe('anthropic.messages');
});

it('should return the correct model for openai', () => {
const model = createProvider('openai', 'gpt-4o-2024-05-13');
const model = createProvider('openai', 'gpt-4o-2024-05-13', {
apiKey: 'sk-proj-1234567890',
});
expect(model).toBeDefined();
expect(model.provider).toBe('openai.chat');
});
Expand Down
8 changes: 0 additions & 8 deletions packages/agent/src/core/toolAgent/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ export type ModelProvider = 'anthropic' | 'openai' | 'ollama';

export type AgentConfig = {
maxIterations: number;
provider: ModelProvider;
model: string;
maxTokens: number;
temperature: number;
getSystemPrompt: (toolContext: ToolContext) => string;
};

Expand Down Expand Up @@ -55,10 +51,6 @@ export function getModel(
*/
export const DEFAULT_CONFIG: AgentConfig = {
maxIterations: 200,
provider: 'anthropic',
model: 'claude-3-7-sonnet-20250219',
maxTokens: 4096,
temperature: 0.7,
getSystemPrompt: getDefaultSystemPrompt,
};

Expand Down
6 changes: 3 additions & 3 deletions packages/agent/src/core/toolAgent/toolAgentCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const toolAgent = async (
const systemPrompt = config.getSystemPrompt(context);

// Create the LLM provider
const provider = createProvider(config.provider, config.model);
const provider = createProvider(context.provider, context.model);

for (let i = 0; i < config.maxIterations; i++) {
logger.verbose(
Expand Down Expand Up @@ -74,8 +74,8 @@ export const toolAgent = async (
const generateOptions = {
messages: messagesWithSystem,
functions: functionDefinitions,
temperature: config.temperature,
maxTokens: config.maxTokens,
temperature: context.temperature,
maxTokens: context.maxTokens,
};

const { text, toolCalls, tokenUsage } = await generateText(
Expand Down
2 changes: 2 additions & 0 deletions packages/agent/src/core/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export type ToolContext = {
agentId?: string; // Unique identifier for the agent, used for background tool tracking
provider: ModelProvider;
model: string;
maxTokens: number;
temperature: number;
};

export type Tool<TParams = Record<string, any>, TReturn = any> = {
Expand Down
2 changes: 2 additions & 0 deletions packages/agent/src/tools/getTools.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export const getMockToolContext = (): ToolContext => ({
githubMode: true,
provider: 'anthropic',
model: 'claude-3-7-sonnet-20250219',
maxTokens: 4096,
temperature: 0.7,
});

describe('getTools', () => {
Expand Down
4 changes: 0 additions & 4 deletions packages/agent/src/tools/interaction/agentStart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,6 @@ type ReturnType = z.infer<typeof returnSchema>;
// Sub-agent specific configuration
const subAgentConfig: AgentConfig = {
maxIterations: 200,
maxTokens: 4096,
temperature: 0.7,
provider: 'anthropic',
model: 'claude-3-7-sonnet-20250219',
getSystemPrompt: (context: ToolContext) => {
return [
getDefaultSystemPrompt(context),
Expand Down
2 changes: 2 additions & 0 deletions packages/agent/src/tools/interaction/agentTools.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ const mockContext: ToolContext = {
githubMode: true,
provider: 'anthropic',
model: 'claude-3-7-sonnet-20250219',
maxTokens: 4096,
temperature: 0.7,
};

describe('Agent Tools', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/agent/src/tools/interaction/subAgent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ const mockContext: ToolContext = {
githubMode: true,
provider: 'anthropic',
model: 'claude-3-7-sonnet-20250219',
maxTokens: 4096,
temperature: 0.7,
};

describe('subAgentTool', () => {
Expand Down
8 changes: 1 addition & 7 deletions packages/agent/src/tools/interaction/subAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ type ReturnType = z.infer<typeof returnSchema>;
// Sub-agent specific configuration
const subAgentConfig: AgentConfig = {
maxIterations: 200,
provider: 'anthropic',
model: 'claude-3-7-sonnet-20250219',
maxTokens: 4096,
temperature: 0.7,
getSystemPrompt: (context: ToolContext) => {
return [
getDefaultSystemPrompt(context),
Expand Down Expand Up @@ -106,11 +102,9 @@ export const subAgentTool: Tool<Parameters, ReturnType> = {

const tools = getTools({ userPrompt: false });

// Update config if timeout is specified
// Use the subAgentConfig
const config: AgentConfig = {
...subAgentConfig,
provider: context.provider,
model: context.model,
};

try {
Expand Down
12 changes: 1 addition & 11 deletions packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,7 @@ Requirements for GitHub mode:

MyCoder is configured using a `mycoder.config.js` file in your project root, similar to ESLint and other modern JavaScript tools. This file exports a configuration object with your preferred settings.

To create a default configuration file, run:

```bash
# Create a default configuration file
mycoder init

# Force overwrite an existing configuration file
mycoder init --force
```

This will create a `mycoder.config.js` file in your current directory with default settings that you can customize.
You can create a `mycoder.config.js` file in your project root with your preferred settings.

Example configuration file:

Expand Down
8 changes: 3 additions & 5 deletions packages/cli/src/commands/$default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,9 @@ export const command: CommandModule<SharedOptions, DefaultArgs> = {
process.exit(0);
});

// Create a config with the selected model
// Create a config for the agent
const agentConfig: AgentConfig = {
...DEFAULT_CONFIG,
provider: config.provider as ModelProvider,
model: config.model,
maxTokens: config.maxTokens,
temperature: config.temperature,
};

const result = await toolAgent(prompt, tools, agentConfig, {
Expand All @@ -168,6 +164,8 @@ export const command: CommandModule<SharedOptions, DefaultArgs> = {
userPrompt: config.userPrompt,
provider: config.provider as ModelProvider,
model: config.model,
maxTokens: config.maxTokens,
temperature: config.temperature,
});

const output =
Expand Down
67 changes: 0 additions & 67 deletions packages/cli/src/commands/init.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import yargs, { ArgumentsCamelCase, CommandModule } from 'yargs';
import { hideBin } from 'yargs/helpers';

import { command as defaultCommand } from './commands/$default.js';
import { command as initCommand } from './commands/init.js';
import { command as testProfileCommand } from './commands/test-profile.js';
import { command as testSentryCommand } from './commands/test-sentry.js';
import { command as toolsCommand } from './commands/tools.js';
Expand Down Expand Up @@ -59,7 +58,6 @@ const main = async () => {
testSentryCommand,
testProfileCommand,
toolsCommand,
initCommand,
] as CommandModule[])
.strict()
.showHelpOnFail(true)
Expand Down
51 changes: 0 additions & 51 deletions packages/cli/src/settings/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import * as fs from 'fs';
import * as path from 'path';

import { cosmiconfig } from 'cosmiconfig';
import { ArgumentsCamelCase } from 'yargs';

Expand Down Expand Up @@ -107,51 +104,3 @@ export async function loadConfig(
};
return mergedConfig;
}

/**
* Create a default configuration file if it doesn't exist
* @param filePath Path to create the configuration file
* @returns true if file was created, false if it already exists
*/
export function createDefaultConfigFile(filePath?: string): boolean {
// Default to current directory if no path provided
const configPath = filePath || path.join(process.cwd(), 'mycoder.config.js');

// Check if file already exists
if (fs.existsSync(configPath)) {
return false;
}

// Create default configuration file
const configContent = `// mycoder.config.js
export default {
// GitHub integration
githubMode: true,

// Browser settings
headless: true,
userSession: false,
pageFilter: 'none', // 'simple', 'none', or 'readability'

// Model settings
provider: 'anthropic',
model: 'claude-3-7-sonnet-20250219',
maxTokens: 4096,
temperature: 0.7,

// Custom settings
customPrompt: '',
profile: false,
tokenCache: true,

// Ollama configuration
ollamaBaseUrl: 'http://localhost:11434',

// API keys (better to use environment variables for these)
// ANTHROPIC_API_KEY: 'your-api-key',
};
`;

fs.writeFileSync(configPath, configContent);
return true;
}
Loading