import { describe, expect, it } from 'vitest';
import { getToolActionInfo, isTransientClipboardPasteFilePath, redactTransientClipboardPastePaths, redactTransientClipboardPastePathsInValue, } from './types.js';
describe('getToolActionInfo', () => {
    it('reports poll_message as an idle MCP listening tool call', () => {
        expect(getToolActionInfo('poll_message')).toEqual({
            actionType: 'idle',
            actionLabel: '监听消息',
            actionDetail: 'aws-mcp/poll_message',
        });
    });
    it('reports prefixed poll_message as a canonical idle MCP listening tool call', () => {
        expect(getToolActionInfo('aws-mcp__poll_message')).toEqual({
            actionType: 'idle',
            actionLabel: '监听消息',
            actionDetail: 'aws-mcp/poll_message',
        });
    });
    it('redacts transient mini-term paste paths from file action details', () => {
        const info = getToolActionInfo('read', {
            path: 'C:\\Users\\ZHUANG~1\\AppData\\Local\\Temp\\mini-term-clipboard\\paste-1780484619651.txt',
        });
        expect(info).toEqual({
            actionType: 'read_file',
            actionLabel: '读取文件',
            actionDetail: '[temp clipboard paste file]',
        });
    });
    it('redacts transient mini-term paste paths inside displayed tool input values', () => {
        expect(redactTransientClipboardPastePathsInValue({
            command: 'type "C:\\Users\\ZHUANG~1\\AppData\\Local\\Temp\\mini-term-clipboard\\paste-1780484619651.txt"',
        })).toEqual({
            command: 'type "[temp clipboard paste file]"',
        });
    });
    it('keeps normal project paths unchanged', () => {
        const info = getToolActionInfo('read', {
            path: 'D:\\code\\AgentsWorkStudio\\README.md',
        });
        expect(info.actionDetail).toBe('D:\\code\\AgentsWorkStudio\\README.md');
    });
    it('detects only standalone transient mini-term paste file paths', () => {
        expect(isTransientClipboardPasteFilePath('"C:\\Users\\ZHUANG~1\\AppData\\Local\\Temp\\mini-term-clipboard\\paste-1780484619651.txt"')).toBe(true);
        expect(isTransientClipboardPasteFilePath('type "C:\\Users\\ZHUANG~1\\AppData\\Local\\Temp\\mini-term-clipboard\\paste-1780484619651.txt"')).toBe(false);
        expect(isTransientClipboardPasteFilePath('D:\\code\\AgentsWorkStudio\\README.md')).toBe(false);
    });
    it('redacts transient mini-term paste paths before terminal display/status output', () => {
        expect(redactTransientClipboardPastePaths('C:\\Users\\ZHUANG~1\\AppData\\Local\\Temp\\mini-term-clipboard\\paste-1780484619651.txt')).toBe('[temp clipboard paste file]');
        expect(redactTransientClipboardPastePaths('type "C:\\Users\\ZHUANG~1\\AppData\\Local\\Temp\\mini-term-clipboard\\paste-1780484619651.txt"')).toBe('type "[temp clipboard paste file]"');
    });
});
