import assert from "node:assert/strict";
import test from "node:test";
import { describeProviderChatBackend } from "../src/llm/provider-adapters.js";

test("provider backend registry selects chat protocol and managed-tool mode", () => {
  assert.deepEqual(describeProviderChatBackend("openai", []), {
    provider: "openai",
    protocol: "chat-completions",
    managedTools: false,
    enabledTools: [],
  });
  assert.deepEqual(describeProviderChatBackend("openai", ["web_search"]), {
    provider: "openai",
    protocol: "responses",
    managedTools: true,
    enabledTools: ["web_search"],
  });
  assert.deepEqual(describeProviderChatBackend("anthropic", ["web_search"]), {
    provider: "anthropic",
    protocol: "messages",
    managedTools: true,
    enabledTools: ["web_search"],
  });
  assert.deepEqual(describeProviderChatBackend("xai", ["web_search"]), {
    provider: "xai",
    protocol: "chat-completions",
    managedTools: true,
    enabledTools: ["web_search"],
  });
  assert.deepEqual(describeProviderChatBackend("gemini", ["web_search"]), {
    provider: "gemini",
    protocol: "gemini",
    managedTools: true,
    enabledTools: ["web_search"],
  });
  assert.deepEqual(describeProviderChatBackend("hermes-agent", ["web_search"]), {
    provider: "hermes-agent",
    protocol: "chat-completions",
    managedTools: false,
    enabledTools: [],
  });
});
