import { llmProviderRegistry } from "@open-mercato/shared/lib/ai/llm-provider-registry";
import { createAnthropicAdapter } from "./llm-adapters/anthropic.js";
import { createGoogleAdapter } from "./llm-adapters/google.js";
import { createOpenAICompatibleProvider } from "./llm-adapters/openai.js";
import { OPENAI_COMPATIBLE_PRESETS } from "./openai-compatible-presets.js";
let bootstrapped = false;
function registerBuiltInLlmProviders() {
  if (bootstrapped && llmProviderRegistry.list().length > 0) {
    return;
  }
  try {
    llmProviderRegistry.register(createAnthropicAdapter());
  } catch (error) {
    console.warn(
      "[LlmBootstrap] Failed to register Anthropic adapter:",
      error instanceof Error ? error.message : error
    );
  }
  try {
    llmProviderRegistry.register(createGoogleAdapter());
  } catch (error) {
    console.warn(
      "[LlmBootstrap] Failed to register Google adapter:",
      error instanceof Error ? error.message : error
    );
  }
  for (const preset of OPENAI_COMPATIBLE_PRESETS) {
    try {
      llmProviderRegistry.register(createOpenAICompatibleProvider(preset));
    } catch (error) {
      console.warn(
        `[LlmBootstrap] Failed to register OpenAI-compatible preset "${preset.id}":`,
        error instanceof Error ? error.message : error
      );
    }
  }
  bootstrapped = true;
}
function resetLlmBootstrapState() {
  bootstrapped = false;
}
registerBuiltInLlmProviders();
export {
  registerBuiltInLlmProviders,
  resetLlmBootstrapState
};
//# sourceMappingURL=llm-bootstrap.js.map
