groove-dev 0.25.14 → 0.25.16

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.
@@ -4,7 +4,7 @@
4
4
  import { readFileSync, writeFileSync, existsSync, mkdirSync, statSync } from 'fs';
5
5
  import { resolve } from 'path';
6
6
  import { execFile } from 'child_process';
7
- import { getProvider } from './providers/index.js';
7
+ import { getProvider, getInstalledProviders } from './providers/index.js';
8
8
 
9
9
  const DEFAULT_INTERVAL = 120_000; // 2 minutes
10
10
  const MAX_LOG_CHARS = 40_000; // ~10k tokens budget for synthesis input
@@ -309,13 +309,23 @@ export class Journalist {
309
309
  }
310
310
 
311
311
  async callHeadless(prompt) {
312
- const provider = getProvider('claude-code');
313
- if (!provider || !provider.constructor.isInstalled()) {
312
+ // Find the best available provider for headless synthesis
313
+ // Priority: claude-code (cheapest via Haiku) > gemini > codex > ollama
314
+ const priority = ['claude-code', 'gemini', 'codex', 'ollama'];
315
+ const installed = getInstalledProviders();
316
+ const providerId = priority.find((p) => installed.some((i) => i.id === p));
317
+ if (!providerId) {
314
318
  throw new Error('No provider available for synthesis');
315
319
  }
320
+ const provider = getProvider(providerId);
316
321
 
317
- // Use headless mode with Haiku — cheapest model, good enough for synthesis
318
- const { command, args, env } = provider.buildHeadlessCommand(prompt, 'claude-haiku-4-5-20251001');
322
+ // Pick the lightest model for synthesis (cheapest/fastest)
323
+ const lightModel = provider.constructor.models?.find((m) => m.tier === 'light')
324
+ || provider.constructor.models?.find((m) => m.tier === 'medium')
325
+ || provider.constructor.models?.[0];
326
+ const modelId = lightModel?.id || null;
327
+
328
+ const { command, args, env } = provider.buildHeadlessCommand(prompt, modelId);
319
329
 
320
330
  return new Promise((resolve, reject) => {
321
331
  const proc = execFile(command, args, {