export type SuccessResponse = {
    /**
     * Status code for successful operations
     */
    status: 0;
    /**
     * Result payload for the operation
     */
    result: {
        [key: string]: unknown;
    };
};
export type ErrorResponse = {
    /**
     * Status code for error operations
     */
    status: 1;
    error: ({
        code?: 'DefaultError';
    } & DefaultError) | ({
        code?: 'RawFsError';
    } & RawFsError);
};
export type DefaultError = {
    code: PitcherErrorCode;
    /**
     * Additional error details
     */
    data?: {
        [key: string]: unknown;
    } | null;
    /**
     * Human-readable error message that can be displayed to users
     */
    publicMessage?: string | null;
};
export type RawFsError = {
    /**
     * RAWFS_ERROR code
     */
    code: 102;
    data: {
        /**
         * File system error number, or null if not available
         */
        errno: unknown;
    };
    /**
     * Human-readable error message that can be displayed to users
     */
    publicMessage?: string | null;
};
/**
 * Enumeration of error codes
 */
export type PitcherErrorCode = 0 | 1 | 2 | 3 | 100 | 101 | 102 | 200 | 201 | 204 | 300 | 400 | 404 | 410 | 420 | 430 | 440 | 450 | 460 | 470 | 500 | 600 | 601 | 602 | 704 | 800 | 801 | 802 | 803 | 814;
export type WriteFileRequest = {
    /**
     * File path to write to
     */
    path: string;
    /**
     * File content as binary data (Uint8Array)
     */
    content: Blob | File;
    /**
     * Whether to create the file if it doesn't exist
     */
    create?: boolean;
    /**
     * Whether to overwrite the file if it exists
     */
    overwrite?: boolean;
};
export type FsReadResult = {
    treeNodes: Array<{
        [key: string]: unknown;
    }>;
    /**
     * Current clock value for the file system
     */
    clock: number;
};
export type FsOperationRequest = {
    operation: FsOperation;
};
export type FsOperation = ({
    type?: 'FSCreateOperation';
} & FsCreateOperation) | ({
    type?: 'FSDeleteOperation';
} & FsDeleteOperation) | ({
    type?: 'FSMoveOperation';
} & FsMoveOperation);
export type FsCreateOperation = {
    type: 'create';
    /**
     * ID of the parent directory
     */
    parentId: string;
    newEntry: {
        /**
         * ID of the new entry
         */
        id: string;
        /**
         * Type of the node
         */
        type: 'directory' | 'file';
        /**
         * Name of the new entry
         */
        name: string;
    };
};
export type FsDeleteOperation = {
    type: 'delete';
    /**
     * ID of the entry to delete
     */
    id: string;
};
export type FsMoveOperation = {
    type: 'move';
    /**
     * ID of the entry to move
     */
    id: string;
    /**
     * ID of the new parent directory
     */
    parentId?: string | null;
    /**
     * New name for the entry
     */
    name?: string | null;
};
export type FsOperationResult = {
    /**
     * Success code
     */
    code: 0;
    /**
     * Current clock value
     */
    clock: number;
} | {
    /**
     * Ignored code
     */
    code: 1;
};
export type FsSearchParams = {
    /**
     * Text to search for
     */
    text: string;
    /**
     * Glob pattern to filter files
     */
    glob?: string | null;
    /**
     * Whether to treat the search text as a regular expression
     */
    isRegex?: boolean | null;
    /**
     * Case sensitivity setting for the search
     */
    caseSensitivity?: 'smart' | 'enabled' | 'disabled';
};
export type SearchResult = {
    /**
     * ID of the file containing the match
     */
    fileId: string;
    lines: {
        /**
         * Text of the line containing the match
         */
        text: string;
    };
    /**
     * Line number of the match
     */
    lineNumber: number;
    /**
     * Absolute offset of the match in the file
     */
    absoluteOffset: number;
    submatches: Array<SearchSubMatch>;
};
export type SearchSubMatch = {
    match: {
        /**
         * Matched text
         */
        text: string;
    };
    /**
     * Start position of the match
     */
    start: number;
    /**
     * End position of the match
     */
    end: number;
};
export type FsStreamingSearchParams = {
    /**
     * ID for the search operation
     */
    searchId: string;
    /**
     * Text to search for
     */
    text: string;
    /**
     * Glob pattern to filter files
     */
    glob?: string | null;
    /**
     * Whether to treat the search text as a regular expression
     */
    isRegex?: boolean | null;
    /**
     * Case sensitivity setting for the search
     */
    caseSensitivity?: 'smart' | 'enabled' | 'disabled';
    /**
     * Maximum number of results to return (default: 10,000)
     */
    maxResults?: number | null;
};
export type PathSearchParams = {
    /**
     * Text to search for in file paths
     */
    text: string;
};
export type PathSearchResult = {
    matches: Array<PathSearchMatch>;
};
export type PathSearchMatch = {
    /**
     * Path that matched the search
     */
    path: string;
    submatches: Array<SearchSubMatch>;
};
export type InvalidIdError = {
    /**
     * INVALID_ID error code
     */
    code: 100;
};
export type FsReadFileParams = {
    /**
     * Path to the file to read
     */
    path: string;
};
export type FsReadFileResult = {
    /**
     * File content as binary data
     */
    content: Blob | File;
};
export type FsReadDirParams = {
    /**
     * Path to the directory to read
     */
    path: string;
};
export type FsReadDirResult = {
    entries: Array<{
        /**
         * Name of the entry
         */
        name: string;
        /**
         * Type of the entry
         */
        type: 'directory' | 'file';
        /**
         * Whether the entry is a symlink
         */
        isSymlink: boolean;
    }>;
};
export type FsStatParams = {
    /**
     * Path to the file or directory to stat
     */
    path: string;
};
export type FsStatResult = {
    /**
     * Type of the entry
     */
    type: 'directory' | 'file';
    /**
     * Whether the entry is a symlink
     */
    isSymlink: boolean;
    /**
     * Size of the file in bytes
     */
    size: number;
    /**
     * Last modified time
     */
    mtime: number;
    /**
     * Creation time
     */
    ctime: number;
    /**
     * Last accessed time
     */
    atime: number;
};
export type FsCopyParams = {
    /**
     * Path to copy from
     */
    from: string;
    /**
     * Path to copy to
     */
    to: string;
    /**
     * Whether to copy directories recursively
     */
    recursive?: boolean | null;
    /**
     * Whether to overwrite existing files
     */
    overwrite?: boolean | null;
};
export type FsRenameParams = {
    /**
     * Path to rename from
     */
    from: string;
    /**
     * Path to rename to
     */
    to: string;
    /**
     * Whether to overwrite existing files
     */
    overwrite?: boolean | null;
};
export type FsRemoveParams = {
    /**
     * Path to remove
     */
    path: string;
    /**
     * Whether to remove directories recursively
     */
    recursive?: boolean | null;
};
export type FsMkdirParams = {
    /**
     * Path to create directory at
     */
    path: string;
    /**
     * Whether to create parent directories if they don't exist
     */
    recursive?: boolean | null;
};
export type FsWatchParams = {
    /**
     * Path to watch
     */
    path: string;
    /**
     * Whether to watch directories recursively
     */
    recursive?: boolean | null;
    /**
     * Glob patterns to exclude from watching
     */
    excludes?: Array<string> | null;
};
export type FsWatchResult = {
    /**
     * ID of the watch
     */
    watchId: string;
};
export type FsUnwatchParams = {
    /**
     * ID of the watch to stop
     */
    watchId: string;
};
export type WriteFileData = {
    body: WriteFileRequest;
    path?: never;
    query?: never;
    url: '/fs/writeFile';
};
export type WriteFileErrors = {
    /**
     * Error writing file
     */
    400: ErrorResponse & {
        error?: ({
            code?: 'DefaultError';
        } & DefaultError) | ({
            code?: 'RawFsError';
        } & RawFsError);
    };
};
export type WriteFileError = WriteFileErrors[keyof WriteFileErrors];
export type WriteFileResponses = {
    /**
     * Successful operation
     */
    200: SuccessResponse & {
        result?: {
            [key: string]: unknown;
        };
    };
};
export type WriteFileResponse = WriteFileResponses[keyof WriteFileResponses];
export type FsReadData = {
    body?: never;
    path?: never;
    query?: never;
    url: '/fs/read';
};
export type FsReadErrors = {
    /**
     * Error reading file system
     */
    400: ErrorResponse & {
        error?: DefaultError;
    };
};
export type FsReadError = FsReadErrors[keyof FsReadErrors];
export type FsReadResponses = {
    /**
     * Successful operation
     */
    200: SuccessResponse & {
        result?: FsReadResult;
    };
};
export type FsReadResponse = FsReadResponses[keyof FsReadResponses];
export type FsOperationData = {
    body: FsOperationRequest;
    path?: never;
    query?: never;
    url: '/fs/operation';
};
export type FsOperationErrors = {
    /**
     * Error performing operation
     */
    400: ErrorResponse & {
        error?: DefaultError;
    };
};
export type FsOperationError = FsOperationErrors[keyof FsOperationErrors];
export type FsOperationResponses = {
    /**
     * Successful operation
     */
    200: SuccessResponse & {
        result?: FsOperationResult;
    };
};
export type FsOperationResponse = FsOperationResponses[keyof FsOperationResponses];
export type FsSearchData = {
    body: FsSearchParams;
    path?: never;
    query?: never;
    url: '/fs/search';
};
export type FsSearchErrors = {
    /**
     * Error searching files
     */
    400: ErrorResponse & {
        error?: DefaultError;
    };
};
export type FsSearchError = FsSearchErrors[keyof FsSearchErrors];
export type FsSearchResponses = {
    /**
     * Successful operation
     */
    200: SuccessResponse & {
        result?: Array<SearchResult>;
    };
};
export type FsSearchResponse = FsSearchResponses[keyof FsSearchResponses];
export type FsStreamingSearchData = {
    body: FsStreamingSearchParams;
    path?: never;
    query?: never;
    url: '/fs/streamingSearch';
};
export type FsStreamingSearchErrors = {
    /**
     * Error starting streaming search
     */
    400: ErrorResponse & {
        error?: DefaultError;
    };
};
export type FsStreamingSearchError = FsStreamingSearchErrors[keyof FsStreamingSearchErrors];
export type FsStreamingSearchResponses = {
    /**
     * Successful operation
     */
    200: SuccessResponse & {
        result?: {
            /**
             * ID of the search operation
             */
            searchId?: string;
        };
    };
};
export type FsStreamingSearchResponse = FsStreamingSearchResponses[keyof FsStreamingSearchResponses];
export type FsCancelStreamingSearchData = {
    body: {
        /**
         * ID of the search to cancel
         */
        searchId: string;
    };
    path?: never;
    query?: never;
    url: '/fs/cancelStreamingSearch';
};
export type FsCancelStreamingSearchErrors = {
    /**
     * Error cancelling search
     */
    400: ErrorResponse & {
        error?: DefaultError;
    };
};
export type FsCancelStreamingSearchError = FsCancelStreamingSearchErrors[keyof FsCancelStreamingSearchErrors];
export type FsCancelStreamingSearchResponses = {
    /**
     * Successful operation
     */
    200: SuccessResponse & {
        result?: {
            /**
             * ID of the cancelled search
             */
            searchId?: string;
        };
    };
};
export type FsCancelStreamingSearchResponse = FsCancelStreamingSearchResponses[keyof FsCancelStreamingSearchResponses];
export type FsPathSearchData = {
    body: PathSearchParams;
    path?: never;
    query?: never;
    url: '/fs/pathSearch';
};
export type FsPathSearchErrors = {
    /**
     * Error searching paths
     */
    400: ErrorResponse & {
        error?: DefaultError;
    };
};
export type FsPathSearchError = FsPathSearchErrors[keyof FsPathSearchErrors];
export type FsPathSearchResponses = {
    /**
     * Successful operation
     */
    200: SuccessResponse & {
        result?: PathSearchResult;
    };
};
export type FsPathSearchResponse = FsPathSearchResponses[keyof FsPathSearchResponses];
export type FsUploadData = {
    body: {
        /**
         * ID of the parent directory
         */
        parentId: string;
        /**
         * Name of the file to create
         */
        filename: string;
        /**
         * File content as binary data
         */
        content: Blob | File;
    };
    path?: never;
    query?: never;
    url: '/fs/upload';
};
export type FsUploadErrors = {
    /**
     * Error uploading file
     */
    400: ErrorResponse & {
        error?: ({
            code?: 'DefaultError';
        } & DefaultError) | ({
            code?: 'InvalidIdError';
        } & InvalidIdError);
    };
};
export type FsUploadError = FsUploadErrors[keyof FsUploadErrors];
export type FsUploadResponses = {
    /**
     * Successful operation
     */
    200: SuccessResponse & {
        result?: {
            /**
             * ID of the created file
             */
            fileId?: string;
        };
    };
};
export type FsUploadResponse = FsUploadResponses[keyof FsUploadResponses];
export type FsDownloadData = {
    body: {
        /**
         * Path to download
         */
        path: string;
        /**
         * Glob patterns of files/folders to exclude from the download
         */
        excludes?: Array<string>;
    };
    path?: never;
    query?: never;
    url: '/fs/download';
};
export type FsDownloadErrors = {
    /**
     * Error creating download
     */
    400: ErrorResponse & {
        error?: DefaultError;
    };
};
export type FsDownloadError = FsDownloadErrors[keyof FsDownloadErrors];
export type FsDownloadResponses = {
    /**
     * Successful operation
     */
    200: SuccessResponse & {
        result?: {
            /**
             * URL to download the files from
             */
            downloadUrl?: string;
        };
    };
};
export type FsDownloadResponse = FsDownloadResponses[keyof FsDownloadResponses];
export type FsReadFileData = {
    body: FsReadFileParams;
    path?: never;
    query?: never;
    url: '/fs/readFile';
};
export type FsReadFileErrors = {
    /**
     * Error reading file
     */
    400: ErrorResponse & {
        error?: ({
            code?: 'DefaultError';
        } & DefaultError) | ({
            code?: 'RawFsError';
        } & RawFsError);
    };
};
export type FsReadFileError = FsReadFileErrors[keyof FsReadFileErrors];
export type FsReadFileResponses = {
    /**
     * Successful operation
     */
    200: SuccessResponse & {
        result?: FsReadFileResult;
    };
};
export type FsReadFileResponse = FsReadFileResponses[keyof FsReadFileResponses];
export type FsReadDirData = {
    body: FsReadDirParams;
    path?: never;
    query?: never;
    url: '/fs/readdir';
};
export type FsReadDirErrors = {
    /**
     * Error reading directory
     */
    400: ErrorResponse & {
        error?: ({
            code?: 'DefaultError';
        } & DefaultError) | ({
            code?: 'RawFsError';
        } & RawFsError);
    };
};
export type FsReadDirError = FsReadDirErrors[keyof FsReadDirErrors];
export type FsReadDirResponses = {
    /**
     * Successful operation
     */
    200: SuccessResponse & {
        result?: FsReadDirResult;
    };
};
export type FsReadDirResponse = FsReadDirResponses[keyof FsReadDirResponses];
export type FsStatData = {
    body: FsStatParams;
    path?: never;
    query?: never;
    url: '/fs/stat';
};
export type FsStatErrors = {
    /**
     * Error getting stats
     */
    400: ErrorResponse & {
        error?: ({
            code?: 'DefaultError';
        } & DefaultError) | ({
            code?: 'RawFsError';
        } & RawFsError);
    };
};
export type FsStatError = FsStatErrors[keyof FsStatErrors];
export type FsStatResponses = {
    /**
     * Successful operation
     */
    200: SuccessResponse & {
        result?: FsStatResult;
    };
};
export type FsStatResponse = FsStatResponses[keyof FsStatResponses];
export type FsCopyData = {
    body: FsCopyParams;
    path?: never;
    query?: never;
    url: '/fs/copy';
};
export type FsCopyErrors = {
    /**
     * Error copying file/directory
     */
    400: ErrorResponse & {
        error?: ({
            code?: 'DefaultError';
        } & DefaultError) | ({
            code?: 'RawFsError';
        } & RawFsError);
    };
};
export type FsCopyError = FsCopyErrors[keyof FsCopyErrors];
export type FsCopyResponses = {
    /**
     * Successful operation
     */
    200: SuccessResponse & {
        result?: {
            [key: string]: unknown;
        };
    };
};
export type FsCopyResponse = FsCopyResponses[keyof FsCopyResponses];
export type FsRenameData = {
    body: FsRenameParams;
    path?: never;
    query?: never;
    url: '/fs/rename';
};
export type FsRenameErrors = {
    /**
     * Error renaming file/directory
     */
    400: ErrorResponse & {
        error?: ({
            code?: 'DefaultError';
        } & DefaultError) | ({
            code?: 'RawFsError';
        } & RawFsError);
    };
};
export type FsRenameError = FsRenameErrors[keyof FsRenameErrors];
export type FsRenameResponses = {
    /**
     * Successful operation
     */
    200: SuccessResponse & {
        result?: {
            [key: string]: unknown;
        };
    };
};
export type FsRenameResponse = FsRenameResponses[keyof FsRenameResponses];
export type FsRemoveData = {
    body: FsRemoveParams;
    path?: never;
    query?: never;
    url: '/fs/remove';
};
export type FsRemoveErrors = {
    /**
     * Error removing file/directory
     */
    400: ErrorResponse & {
        error?: ({
            code?: 'DefaultError';
        } & DefaultError) | ({
            code?: 'RawFsError';
        } & RawFsError);
    };
};
export type FsRemoveError = FsRemoveErrors[keyof FsRemoveErrors];
export type FsRemoveResponses = {
    /**
     * Successful operation
     */
    200: SuccessResponse & {
        result?: {
            [key: string]: unknown;
        };
    };
};
export type FsRemoveResponse = FsRemoveResponses[keyof FsRemoveResponses];
export type FsMkdirData = {
    body: FsMkdirParams;
    path?: never;
    query?: never;
    url: '/fs/mkdir';
};
export type FsMkdirErrors = {
    /**
     * Error creating directory
     */
    400: ErrorResponse & {
        error?: ({
            code?: 'DefaultError';
        } & DefaultError) | ({
            code?: 'RawFsError';
        } & RawFsError);
    };
};
export type FsMkdirError = FsMkdirErrors[keyof FsMkdirErrors];
export type FsMkdirResponses = {
    /**
     * Successful operation
     */
    200: SuccessResponse & {
        result?: {
            [key: string]: unknown;
        };
    };
};
export type FsMkdirResponse = FsMkdirResponses[keyof FsMkdirResponses];
export type FsWatchData = {
    body: FsWatchParams;
    path?: never;
    query?: never;
    url: '/fs/watch';
};
export type FsWatchErrors = {
    /**
     * Error watching file/directory
     */
    400: ErrorResponse & {
        error?: ({
            code?: 'DefaultError';
        } & DefaultError) | ({
            code?: 'RawFsError';
        } & RawFsError);
    };
};
export type FsWatchError = FsWatchErrors[keyof FsWatchErrors];
export type FsWatchResponses = {
    /**
     * Successful operation
     */
    200: SuccessResponse & {
        result?: FsWatchResult;
    };
};
export type FsWatchResponse = FsWatchResponses[keyof FsWatchResponses];
export type FsUnwatchData = {
    body: FsUnwatchParams;
    path?: never;
    query?: never;
    url: '/fs/unwatch';
};
export type FsUnwatchErrors = {
    /**
     * Error unwatching file/directory
     */
    400: ErrorResponse & {
        error?: ({
            code?: 'DefaultError';
        } & DefaultError) | ({
            code?: 'RawFsError';
        } & RawFsError);
    };
};
export type FsUnwatchError = FsUnwatchErrors[keyof FsUnwatchErrors];
export type FsUnwatchResponses = {
    /**
     * Successful operation
     */
    200: SuccessResponse & {
        result?: {
            [key: string]: unknown;
        };
    };
};
export type FsUnwatchResponse = FsUnwatchResponses[keyof FsUnwatchResponses];
