Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

799 B
Raw Blame
import type { ConfigFile } from '../types.js';
import { createClaudeCodeAdapter } from './claude-code.js';
import type { AgentAdapter } from './types.js';

/**
 * Build an AgentAdapter from config. Shared between `update` and `refresh` so
 * adapter wiring stays in one place.
 */
export function makeAdapter(config: ConfigFile): AgentAdapter {
  switch (config.agent) {
    case 'claude-code':
      return createClaudeCodeAdapter({
        model: config.agent_options?.model,
        timeoutSeconds: config.agent_options?.timeout,
        refreshTimeoutSeconds: config.agent_options?.refreshTimeout,
        command: config.agent_options?.command,
      });
    case 'codex':
    case 'custom':
      throw new Error(`agent "${config.agent}" is not implemented in MVP. Use "claude-code".`);
  }
}