(config = {})
| 23 | |
| 24 | class SmallCode extends EventEmitter { |
| 25 | constructor(config = {}) { |
| 26 | super(); |
| 27 | this.config = { |
| 28 | model: config.model || process.env.SMALLCODE_MODEL || '', |
| 29 | baseUrl: config.baseUrl || process.env.SMALLCODE_BASE_URL || 'http://localhost:1234/v1', |
| 30 | provider: config.provider || process.env.SMALLCODE_PROVIDER || 'openai', |
| 31 | apiKey: config.apiKey || process.env.OPENAI_API_KEY || null, |
| 32 | contextWindow: config.contextWindow || 0, |
| 33 | maxToolCalls: config.maxToolCalls || 50, |
| 34 | timeout: config.timeout || 120000, |
| 35 | cwd: config.cwd || process.cwd(), |
| 36 | tools: config.tools || null, // null = all tools |
| 37 | verbose: config.verbose || false, |
| 38 | }; |
| 39 | |
| 40 | this.earlyStop = new EarlyStopDetector(); |
| 41 | this.profile = getProfile(this.config.model, this.config.contextWindow); |
| 42 | this._history = []; |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * Run a single prompt through the agent loop. |
nothing calls this directly
no test coverage detected