@compilr-dev/agents 0.1.0 → 0.2.1

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.
@@ -34,9 +34,7 @@ export class GeminiProvider extends OpenAICompatibleProvider {
34
34
  name = 'gemini';
35
35
  apiKey;
36
36
  constructor(config = {}) {
37
- const apiKey = config.apiKey ??
38
- process.env.GOOGLE_AI_API_KEY ??
39
- process.env.GEMINI_API_KEY;
37
+ const apiKey = config.apiKey ?? process.env.GOOGLE_AI_API_KEY ?? process.env.GEMINI_API_KEY;
40
38
  if (!apiKey) {
41
39
  throw new ProviderError('Gemini API key not found. Set GOOGLE_AI_API_KEY or GEMINI_API_KEY environment variable, or pass apiKey in config.', 'gemini');
42
40
  }
@@ -185,6 +185,14 @@ export class MockProvider {
185
185
  if (block.type === 'text') {
186
186
  charCount += block.text.length;
187
187
  }
188
+ else if (block.type === 'tool_result') {
189
+ // Count tool result content (always a string per our type definition)
190
+ charCount += block.content.length;
191
+ }
192
+ else if (block.type === 'tool_use') {
193
+ // Count tool use input
194
+ charCount += JSON.stringify(block.input).length;
195
+ }
188
196
  }
189
197
  }
190
198
  }
@@ -198,9 +198,7 @@ export class OpenAICompatibleProvider {
198
198
  });
199
199
  }
200
200
  else if (block.type === 'tool_result') {
201
- const content = typeof block.content === 'string'
202
- ? block.content
203
- : JSON.stringify(block.content);
201
+ const content = typeof block.content === 'string' ? block.content : JSON.stringify(block.content);
204
202
  toolResults.push({
205
203
  id: block.toolUseId,
206
204
  content,