import { describe, expect, it } from "vitest";
import { getSemanticToolName, isMessagePollingIdleCommand, isPollMessageToolDescriptor, } from "./acode-tool-names.js";
describe("ACode tool name helpers", () => {
    it("extracts semantic tool names from MCP prefixes", () => {
        expect(getSemanticToolName("aws-mcp__poll_message")).toBe("poll_message");
        expect(getSemanticToolName("aws-mcp.poll_message")).toBe("poll_message");
        expect(getSemanticToolName("mcp/aws-mcp/get_message")).toBe("get_message");
    });
    it("recognizes only exact poll_message tool descriptors as listeners", () => {
        expect(isPollMessageToolDescriptor({
            name: "aws-mcp__poll_message",
            source: "aws-mcp.poll_message",
        })).toBe(true);
        expect(isPollMessageToolDescriptor({
            name: "other-mcp__not_poll_message",
            source: "other-mcp.not_poll_message",
        })).toBe(false);
        expect(isPollMessageToolDescriptor({
            name: "poll_message_backup",
            source: "other-mcp.poll_message_backup",
        })).toBe(false);
    });
    it("detects configured idle commands that ask the agent to poll messages", () => {
        expect(isMessagePollingIdleCommand("poll_message")).toBe(true);
        expect(isMessagePollingIdleCommand("system: call get_message now")).toBe(true);
        expect(isMessagePollingIdleCommand("continue the current task")).toBe(false);
    });
});
