import { listFiles as apiListFiles, getFileTree as apiGetFileTree, readFile as apiReadFile, getSessionFiles as apiGetSessionFiles, } from '@ottocode/api';
import { extractErrorMessage } from './utils';
export const filesMixin = {
    async listFiles() {
        const response = await apiListFiles();
        if (response.error)
            throw new Error(extractErrorMessage(response.error));
        return response.data;
    },
    async getFileTree(dirPath = '.') {
        const response = await apiGetFileTree({
            query: { path: dirPath },
        });
        if (response.error)
            throw new Error(extractErrorMessage(response.error));
        // biome-ignore lint/suspicious/noExplicitAny: API response structure
        return response.data;
    },
    async readFileContent(filePath) {
        const response = await apiReadFile({
            query: { path: filePath },
        });
        if (response.error)
            throw new Error(extractErrorMessage(response.error));
        // biome-ignore lint/suspicious/noExplicitAny: API response structure
        return response.data;
    },
    async getSessionFiles(sessionId) {
        const response = await apiGetSessionFiles({ path: { sessionId } });
        if (response.error)
            throw new Error(extractErrorMessage(response.error));
        return response.data;
    },
};
//# sourceMappingURL=files.js.map