| |
| |
| |
|
|
| export type AgentType = 'orchestrator' | 'explore' | 'task' | 'plan' | 'setup' | 'interview'; |
|
|
| interface AgentConfig { |
| type: AgentType; |
| tools: string[]; |
| maxIterations: number; |
| isReadOnly?: boolean; |
| writeScope?: string; |
| } |
|
|
| |
| |
| |
| export class Agent { |
| public readonly type: AgentType; |
| public readonly tools: string[]; |
| public readonly maxIterations: number; |
| public readonly isReadOnly: boolean; |
| public readonly writeScope?: string; |
|
|
| constructor(config: AgentConfig) { |
| this.type = config.type; |
| this.tools = config.tools; |
| this.maxIterations = config.maxIterations; |
| this.isReadOnly = config.isReadOnly ?? false; |
| this.writeScope = config.writeScope; |
| } |
|
|
| |
| |
| |
| hasTool(toolId: string): boolean { |
| return this.tools.includes(toolId); |
| } |
| } |
|
|
| |
| |
| |
| export class AgentRegistry { |
| private agents: Map<AgentType, Agent> = new Map(); |
|
|
| constructor() { |
| this.registerBuiltInAgents(); |
| } |
|
|
| |
| |
| |
| private registerBuiltInAgents(): void { |
| this.register(new Agent({ |
| type: 'orchestrator', |
| tools: ['bash'], |
| maxIterations: 100 |
| })); |
|
|
| this.register(new Agent({ |
| type: 'explore', |
| tools: ['bash'], |
| maxIterations: 5, |
| isReadOnly: true |
| })); |
|
|
| this.register(new Agent({ |
| type: 'task', |
| tools: ['bash'], |
| maxIterations: 30 |
| })); |
|
|
| this.register(new Agent({ |
| type: 'plan', |
| tools: ['bash'], |
| maxIterations: 10, |
| isReadOnly: true |
| })); |
|
|
| this.register(new Agent({ |
| type: 'setup', |
| tools: ['bash'], |
| maxIterations: 20 |
| })); |
|
|
| |
| |
| this.register(new Agent({ |
| type: 'interview', |
| tools: ['bash'], |
| maxIterations: 30, |
| writeScope: '/.interviews/', |
| })); |
| } |
|
|
| private register(agent: Agent): void { |
| this.agents.set(agent.type, agent); |
| } |
|
|
| get(type: AgentType): Agent | undefined { |
| return this.agents.get(type); |
| } |
| } |
|
|
| |
| export const agentRegistry = new AgentRegistry(); |
|
|