import assert from "node:assert/strict";
import { describe, it } from "node:test";
import { StatusReporter } from "./status-reporter.js";
describe("StatusReporter tool action mapping", () => {
    it("reports poll_message as a normal aws-mcp tool call", () => {
        const updates = [];
        const reporter = new StatusReporter({
            agentId: "agent-self",
            sendStatusUpdate: (update) => updates.push(update),
        });
        reporter.reportToolUse("poll_message", {});
        assert.equal(updates.length, 1);
        assert.equal(updates[0]?.status, "tool_using");
        assert.equal(updates[0]?.actionType, "mcp");
        assert.equal(updates[0]?.actionLabel, "Calling MCP");
        assert.equal(updates[0]?.actionDetail, "aws-mcp/poll_message");
    });
    it("redacts transient mini-term paste paths from file action details", () => {
        const updates = [];
        const reporter = new StatusReporter({
            agentId: "agent-self",
            sendStatusUpdate: (update) => updates.push(update),
        });
        reporter.reportToolUse("read", {
            path: "C:\\Users\\ZHUANG~1\\AppData\\Local\\Temp\\mini-term-clipboard\\paste-1780484619651.txt",
        });
        assert.equal(updates[0]?.actionDetail, "[temp clipboard paste file]");
    });
    it("redacts transient mini-term paste paths from command action details", () => {
        const updates = [];
        const reporter = new StatusReporter({
            agentId: "agent-self",
            sendStatusUpdate: (update) => updates.push(update),
        });
        reporter.reportToolUse("bash", {
            command: "type \"C:\\Users\\ZHUANG~1\\AppData\\Local\\Temp\\mini-term-clipboard\\paste-1780484619651.txt\"",
        });
        assert.equal(updates[0]?.actionDetail, "type \"[temp clipboard paste file]\"");
    });
    it("keeps normal project paths unchanged", () => {
        const updates = [];
        const reporter = new StatusReporter({
            agentId: "agent-self",
            sendStatusUpdate: (update) => updates.push(update),
        });
        reporter.reportToolUse("read", {
            path: "D:\\code\\AgentsWorkStudio\\README.md",
        });
        assert.equal(updates[0]?.actionDetail, "D:\\code\\AgentsWorkStudio\\README.md");
    });
    it("redacts transient mini-term paste paths from tool results", () => {
        const updates = [];
        const reporter = new StatusReporter({
            agentId: "agent-self",
            sendStatusUpdate: (update) => updates.push(update),
        });
        reporter.reportToolUse("read", { path: "D:\\code\\AgentsWorkStudio\\README.md" });
        reporter.reportToolResult({
            error: "failed: C:\\Users\\ZHUANG~1\\AppData\\Local\\Temp\\mini-term-clipboard\\paste-1780484619651.txt",
        });
        assert.match(String(updates.at(-1)?.actionResult), /\[temp clipboard paste file\]/);
        assert.doesNotMatch(String(updates.at(-1)?.actionResult), /mini-term-clipboard/);
    });
});
//# sourceMappingURL=status-reporter.test.js.map