import * as fs from 'node:fs/promises'; import { type ToolDefinition } from '@opencode-ai/plugin/tool'; import { MAX_FILE_SIZE, MAX_DIRECTORY_DEPTH } from '../config/constants'; import { type PluginConfig } from '../config/schema'; /** * Sleep for a given number of milliseconds */ export declare function sleep(ms: number): Promise; /** * Calculate retry delay with exponential backoff and ±20% jitter */ export declare function calculateRetryDelay(attempt: number, baseDelay?: number): number; /** * Check if an error is retryable */ export declare function isRetryableError(error: unknown): boolean; /** * Execute a write operation with retry logic * The writeFn parameter allows for dependency injection during testing */ export declare function writeFileWithRetry(filePath: string, content: string, options: { encoding: BufferEncoding; }, writeFn?: typeof fs.writeFile, retryEnabled?: boolean, maxRetries?: number): Promise; /** * Create a tool to read a file from the .writer/ directory. */ export declare function createReadWriterFile(directory: string): ToolDefinition; /** * Create a tool to write content to a file in the .writer/ directory. Overwrites if exists. */ export declare function createWriteWriterFile(directory: string, config?: PluginConfig): ToolDefinition; /** * Create a tool to list all files in the .writer/ directory recursively. */ export declare function createListWriterFiles(directory: string): ToolDefinition; export { MAX_FILE_SIZE, MAX_DIRECTORY_DEPTH };