onin-sdk 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,213 @@
1
+ /**
2
+ * Command handler function type - defines the signature for handling incoming commands
3
+ * @param command - The command name to handle
4
+ * @param args - Arguments passed with the command
5
+ * @returns The result of the command execution (can be synchronous or asynchronous)
6
+ * @since 0.1.0
7
+ * @group Types
8
+ */
9
+ export type CommandHandler = (command: string, args: any) => any | Promise<any>;
10
+ /**
11
+ * Command keyword definition
12
+ * @interface CommandKeyword
13
+ * @since 0.2.0
14
+ */
15
+ export interface CommandKeyword {
16
+ /** Keyword name */
17
+ name: string;
18
+ /** Keyword type: "prefix" | "fuzzy" | "exact" */
19
+ type?: string;
20
+ }
21
+ /**
22
+ * Command match definition for content-based matching
23
+ * @interface CommandMatchDefinition
24
+ * @since 0.2.0
25
+ */
26
+ export interface CommandMatchDefinition {
27
+ /** Match type: "text" | "image" | "file" | "folder" */
28
+ type: 'text' | 'image' | 'file' | 'folder';
29
+ /** Match name */
30
+ name: string;
31
+ /** Match description */
32
+ description?: string;
33
+ /** Regular expression for text matching */
34
+ regexp?: string;
35
+ /** Minimum count */
36
+ min?: number;
37
+ /** Maximum count */
38
+ max?: number;
39
+ /** File extensions filter */
40
+ extensions?: string[];
41
+ }
42
+ /**
43
+ * Command definition for dynamic registration
44
+ * @interface CommandDefinition
45
+ * @since 0.2.0
46
+ */
47
+ export interface CommandDefinition {
48
+ /** Unique command code */
49
+ code: string;
50
+ /** Display name */
51
+ name: string;
52
+ /** Command description */
53
+ description?: string;
54
+ /** Trigger keywords */
55
+ keywords?: CommandKeyword[];
56
+ /** Content match rules */
57
+ matches?: CommandMatchDefinition[];
58
+ }
59
+ /**
60
+ * For testing purposes - reset the registration state
61
+ * @internal
62
+ */
63
+ export declare function _resetRegistrationState(): void;
64
+ /**
65
+ * Registers a command handler to respond to command calls from the main application.
66
+ * Each plugin instance should call this function only once.
67
+ *
68
+ * The registered handler will receive all commands directed to this plugin and should
69
+ * implement appropriate routing and response logic. Commands are executed asynchronously
70
+ * and results are automatically sent back to the caller.
71
+ *
72
+ * @param handler - A function to handle received commands. It receives `command` and `args` as parameters.
73
+ * @returns Promise that resolves when the handler is successfully registered.
74
+ * @throws {Error} When handler registration fails or when called multiple times
75
+ * @example
76
+ * ```typescript
77
+ * import { command } from 'onin-plugin-sdk';
78
+ *
79
+ * // Define command handler with routing
80
+ * await command.handle(async (code, args) => {
81
+ * console.log(`Received command: ${code}`, args);
82
+ *
83
+ * switch (code) {
84
+ * case 'greet':
85
+ * return `Hello, ${args.name || 'World'}!`;
86
+ *
87
+ * case 'calculate':
88
+ * const { operation, a, b } = args;
89
+ * switch (operation) {
90
+ * case 'add': return a + b;
91
+ * case 'multiply': return a * b;
92
+ * default: throw new Error(`Unknown operation: ${operation}`);
93
+ * }
94
+ *
95
+ * default:
96
+ * throw new Error(`Unknown command: ${code}`);
97
+ * }
98
+ * });
99
+ * ```
100
+ * @since 0.1.0
101
+ * @group API
102
+ */
103
+ export declare function handleCommand(handler: CommandHandler): Promise<void>;
104
+ /**
105
+ * Dynamically register a command for the current plugin.
106
+ *
107
+ * This allows plugins to create commands at runtime based on user data,
108
+ * external APIs, or other dynamic sources. Registered commands are persisted
109
+ * and will appear in the command list.
110
+ *
111
+ * @param definition - The command definition including code, name, keywords, and matches
112
+ * @returns Promise that resolves when the command is successfully registered
113
+ * @throws {Error} When command registration fails
114
+ * @example
115
+ * ```typescript
116
+ * import { command } from 'onin-plugin-sdk';
117
+ *
118
+ * // Register a dynamic command
119
+ * await command.register({
120
+ * code: 'open-bookmark-1',
121
+ * name: 'My Favorite Site',
122
+ * keywords: [{ name: 'bookmark' }, { name: 'favorite' }],
123
+ * });
124
+ *
125
+ * // Handle all commands
126
+ * await command.handle((code, args) => {
127
+ * if (code.startsWith('open-bookmark-')) {
128
+ * // Open the bookmark
129
+ * }
130
+ * });
131
+ * ```
132
+ * @since 0.2.0
133
+ * @group API
134
+ */
135
+ export declare function registerCommand(definition: CommandDefinition): Promise<void>;
136
+ /**
137
+ * Remove a dynamically registered command.
138
+ *
139
+ * @param code - The unique command code to remove
140
+ * @returns Promise that resolves when the command is successfully removed
141
+ * @throws {Error} When command removal fails or command doesn't exist
142
+ * @example
143
+ * ```typescript
144
+ * import { command } from 'onin-plugin-sdk';
145
+ *
146
+ * // Remove a previously registered command
147
+ * await command.remove('open-bookmark-1');
148
+ * ```
149
+ * @since 0.2.0
150
+ * @group API
151
+ */
152
+ export declare function removeCommand(code: string): Promise<void>;
153
+ /**
154
+ * Simplified method name alias for handleCommand
155
+ * @see {@link handleCommand} - For detailed documentation
156
+ * @since 0.2.0
157
+ * @group API
158
+ */
159
+ export declare const handle: typeof handleCommand;
160
+ /**
161
+ * Simplified method name alias for registerCommand
162
+ * @see {@link registerCommand} - For detailed documentation
163
+ * @since 0.2.0
164
+ * @group API
165
+ */
166
+ export declare const register: typeof registerCommand;
167
+ /**
168
+ * Simplified method name alias for removeCommand
169
+ * @see {@link removeCommand} - For detailed documentation
170
+ * @since 0.2.0
171
+ * @group API
172
+ */
173
+ export declare const remove: typeof removeCommand;
174
+ /**
175
+ * Command API namespace - provides command handling functionality for plugins
176
+ *
177
+ * Allows plugins to:
178
+ * - **register**: Dynamically register commands at runtime
179
+ * - **handle**: Register a handler to process command executions
180
+ * - **remove**: Remove dynamically registered commands
181
+ *
182
+ * @namespace command
183
+ * @version 0.2.0
184
+ * @since 0.1.0
185
+ * @group API
186
+ * @example
187
+ * ```typescript
188
+ * import { command } from 'onin-plugin-sdk';
189
+ *
190
+ * // Register dynamic commands
191
+ * await command.register({
192
+ * code: 'search-google',
193
+ * name: 'Search Google',
194
+ * keywords: [{ name: 'google' }],
195
+ * matches: [{ type: 'text', name: 'Search text', min: 1 }]
196
+ * });
197
+ *
198
+ * // Handle command execution
199
+ * await command.handle(async (code, args) => {
200
+ * if (code === 'search-google') {
201
+ * window.open(`https://google.com/search?q=${encodeURIComponent(args.text)}`);
202
+ * }
203
+ * });
204
+ *
205
+ * // Remove a command when no longer needed
206
+ * await command.remove('search-google');
207
+ * ```
208
+ */
209
+ export declare const command: {
210
+ register: typeof registerCommand;
211
+ handle: typeof handleCommand;
212
+ remove: typeof removeCommand;
213
+ };
@@ -0,0 +1,285 @@
1
+ import { parseDialogError } from '../utils/error-parser';
2
+ /**
3
+ * Message dialog options
4
+ * @interface MessageDialogOptions
5
+ * @since 0.1.0
6
+ * @group Types
7
+ */
8
+ export interface MessageDialogOptions {
9
+ /** Dialog title */
10
+ title?: string;
11
+ /** Main message to display */
12
+ message: string;
13
+ /** Dialog type, affects the displayed icon */
14
+ kind?: 'info' | 'warning' | 'error';
15
+ /** Custom label for the "OK" button */
16
+ okLabel?: string;
17
+ }
18
+ /**
19
+ * Confirmation dialog options
20
+ * @interface ConfirmDialogOptions
21
+ * @since 0.1.0
22
+ * @group Types
23
+ */
24
+ export interface ConfirmDialogOptions {
25
+ /** Dialog title */
26
+ title?: string;
27
+ /** Main message to display */
28
+ message: string;
29
+ /** Dialog type */
30
+ kind?: 'info' | 'warning' | 'error';
31
+ /** Custom label for the "OK" button */
32
+ okLabel?: string;
33
+ /** Custom label for the "Cancel" button */
34
+ cancelLabel?: string;
35
+ }
36
+ /**
37
+ * File type filter for file dialogs
38
+ * @interface DialogFilter
39
+ * @since 0.1.0
40
+ * @group Types
41
+ */
42
+ export interface DialogFilter {
43
+ /** Filter name (e.g., "Image Files") */
44
+ name: string;
45
+ /** Array of file extensions associated with this filter (e.g., ['png', 'jpg']) */
46
+ extensions: string[];
47
+ }
48
+ /**
49
+ * Open file dialog options
50
+ * @interface OpenDialogOptions
51
+ * @since 0.1.0
52
+ * @group Types
53
+ */
54
+ export interface OpenDialogOptions {
55
+ /** Dialog title */
56
+ title?: string;
57
+ /** Default path that should be displayed when the dialog opens */
58
+ defaultPath?: string;
59
+ /** Array of file type filters to apply to file selection */
60
+ filters?: DialogFilter[];
61
+ /** Whether to allow selecting multiple files */
62
+ multiple?: boolean;
63
+ /** Whether to open a directory selector instead of a file selector */
64
+ directory?: boolean;
65
+ }
66
+ /**
67
+ * Save file dialog options
68
+ * @interface SaveDialogOptions
69
+ * @since 0.1.0
70
+ * @group Types
71
+ */
72
+ export interface SaveDialogOptions {
73
+ /** Dialog title */
74
+ title?: string;
75
+ /** Default suggested file path or name in the dialog */
76
+ defaultPath?: string;
77
+ /** Array of file type filters to apply to file saving */
78
+ filters?: DialogFilter[];
79
+ }
80
+ /**
81
+ * Shows a standard message dialog.
82
+ * @param options - Dialog configuration options
83
+ * @returns Promise that resolves when the dialog is closed
84
+ * @throws {PluginError} With code `DIALOG_UNAVAILABLE` when dialog system is not available
85
+ * @throws {PluginError} With code `DIALOG_INVALID_OPTIONS` when options are malformed
86
+ * @throws {PluginError} With code `PERMISSION_DENIED` when dialog permission is denied
87
+ * @example
88
+ * ```typescript
89
+ * // Simple info message
90
+ * await dialog.showMessage({
91
+ * title: 'Info',
92
+ * message: 'This is an informational message.'
93
+ * });
94
+ *
95
+ * // Warning message with custom styling
96
+ * await dialog.showMessage({
97
+ * title: 'Warning',
98
+ * message: 'This action cannot be undone.',
99
+ * kind: 'warning',
100
+ * okLabel: 'I Understand'
101
+ * });
102
+ *
103
+ * // Error message
104
+ * await dialog.showMessage({
105
+ * title: 'Error',
106
+ * message: 'An unexpected error occurred.',
107
+ * kind: 'error'
108
+ * });
109
+ * ```
110
+ * @since 0.1.0
111
+ * @group API
112
+ */
113
+ export declare function showMessage(options: MessageDialogOptions): Promise<void>;
114
+ /**
115
+ * Shows a confirmation dialog with "OK" and "Cancel" buttons.
116
+ * @param options - Dialog configuration options
117
+ * @returns Promise that resolves to true if user clicks "OK", false otherwise
118
+ * @example
119
+ * const confirmed = await dialog.showConfirm({
120
+ * title: 'Confirm Action',
121
+ * message: 'Are you sure you want to proceed?'
122
+ * });
123
+ * if (confirmed) {
124
+ * console.log('User confirmed.');
125
+ * }
126
+ */
127
+ export declare function showConfirm(options: ConfirmDialogOptions): Promise<boolean>;
128
+ /**
129
+ * Shows an open dialog for selecting files or directories.
130
+ * @param options - Dialog configuration options
131
+ * @returns Promise that resolves to the selected file/directory path(s), or null if user cancels
132
+ * @example
133
+ * // Select single file
134
+ * const filePath = await dialog.showOpen({
135
+ * filters: [{ name: 'Text Files', extensions: ['txt'] }]
136
+ * });
137
+ * if (filePath) {
138
+ * console.log('Selected file:', filePath);
139
+ * }
140
+ *
141
+ * // Select multiple files
142
+ * const filePaths = await dialog.showOpen({ multiple: true });
143
+ * if (filePaths) {
144
+ * console.log('Selected files:', filePaths);
145
+ * }
146
+ */
147
+ export declare function showOpen(options?: OpenDialogOptions): Promise<string | string[] | null>;
148
+ /**
149
+ * Shows a save dialog for selecting a file save path.
150
+ * @param options - Dialog configuration options
151
+ * @returns Promise that resolves to the user-selected save path, or null if user cancels
152
+ * @example
153
+ * const savePath = await dialog.showSave({
154
+ * defaultPath: 'new-file.txt',
155
+ * filters: [{ name: 'Text Files', extensions: ['txt'] }]
156
+ * });
157
+ * if (savePath) {
158
+ * console.log('File will be saved to:', savePath);
159
+ * }
160
+ */
161
+ export declare function showSave(options?: SaveDialogOptions): Promise<string | null>;
162
+ /**
163
+ * Shows an info message
164
+ * @param message - Message content
165
+ * @param title - Title (optional)
166
+ */
167
+ export declare function info(message: string, title?: string): Promise<void>;
168
+ /**
169
+ * Shows a warning message
170
+ * @param message - Message content
171
+ * @param title - Title (optional)
172
+ */
173
+ export declare function warning(message: string, title?: string): Promise<void>;
174
+ /**
175
+ * Shows an error message
176
+ * @param message - Message content
177
+ * @param title - Title (optional)
178
+ */
179
+ export declare function error(message: string, title?: string): Promise<void>;
180
+ /**
181
+ * Shows a confirmation dialog (simplified version)
182
+ * @param message - Message content
183
+ * @param title - Title (optional)
184
+ * @returns Whether the user clicked the confirm button
185
+ */
186
+ export declare function confirm(message: string, title?: string): Promise<boolean>;
187
+ /**
188
+ * Selects a single file
189
+ * @param filters - File filters (optional)
190
+ * @param defaultPath - Default path (optional)
191
+ * @returns Selected file path, or null if cancelled
192
+ */
193
+ export declare function selectFile(filters?: DialogFilter[], defaultPath?: string): Promise<string | null>;
194
+ /**
195
+ * Selects multiple files
196
+ * @param filters - File filters (optional)
197
+ * @param defaultPath - Default path (optional)
198
+ * @returns Array of selected file paths, or null if cancelled
199
+ */
200
+ export declare function selectFiles(filters?: DialogFilter[], defaultPath?: string): Promise<string[] | null>;
201
+ /**
202
+ * Selects a folder
203
+ * @param defaultPath - Default path (optional)
204
+ * @returns Selected folder path, or null if cancelled
205
+ */
206
+ export declare function selectFolder(defaultPath?: string): Promise<string | null>;
207
+ /**
208
+ * Save file dialog (simplified version)
209
+ * @param defaultName - Default file name (optional)
210
+ * @param filters - File filters (optional)
211
+ * @returns Selected save path, or null if cancelled
212
+ */
213
+ export declare function saveFile(defaultName?: string, filters?: DialogFilter[]): Promise<string | null>;
214
+ /**
215
+ * Dialog API namespace - provides native system dialog functionality
216
+ *
217
+ * Supports various types of system dialogs including message boxes, file pickers,
218
+ * and confirmation dialogs. All dialogs are native system dialogs that respect
219
+ * the user's operating system theme and accessibility settings.
220
+ *
221
+ * **Cross-Platform Support**: All dialog functions work consistently across
222
+ * Windows, macOS, and Linux with platform-appropriate styling.
223
+ *
224
+ * **Accessibility**: Native dialogs automatically support screen readers and
225
+ * keyboard navigation according to system accessibility settings.
226
+ *
227
+ * **User Experience**: Dialogs are modal and will block plugin execution until
228
+ * the user responds, ensuring proper user interaction flow.
229
+ *
230
+ * @namespace dialog
231
+ * @version 0.1.0
232
+ * @since 0.1.0
233
+ * @group API
234
+ * @see {@link parseDialogError} - For dialog error handling utilities
235
+ * @example
236
+ * ```typescript
237
+ * import { dialog } from 'onin-plugin-sdk';
238
+ *
239
+ * // Show information message
240
+ * await dialog.info('Operation completed successfully!');
241
+ *
242
+ * // Get user confirmation
243
+ * const confirmed = await dialog.confirm(
244
+ * 'Are you sure you want to delete this item?'
245
+ * );
246
+ * if (confirmed) {
247
+ * // Proceed with deletion
248
+ * }
249
+ *
250
+ * // File selection
251
+ * const filePath = await dialog.selectFile([
252
+ * { name: 'Text Files', extensions: ['txt', 'md'] },
253
+ * { name: 'All Files', extensions: ['*'] }
254
+ * ]);
255
+ * if (filePath) {
256
+ * console.log('Selected file:', filePath);
257
+ * }
258
+ *
259
+ * // Save file dialog
260
+ * const savePath = await dialog.saveFile('document.txt', [
261
+ * { name: 'Text Files', extensions: ['txt'] }
262
+ * ]);
263
+ * if (savePath) {
264
+ * // Save file to the selected path
265
+ * }
266
+ * ```
267
+ */
268
+ export declare const dialog: {
269
+ /** Core methods */
270
+ showMessage: typeof showMessage;
271
+ showConfirm: typeof showConfirm;
272
+ showOpen: typeof showOpen;
273
+ showSave: typeof showSave;
274
+ /** Convenience methods */
275
+ info: typeof info;
276
+ warning: typeof warning;
277
+ error: typeof error;
278
+ confirm: typeof confirm;
279
+ selectFile: typeof selectFile;
280
+ selectFiles: typeof selectFiles;
281
+ selectFolder: typeof selectFolder;
282
+ saveFile: typeof saveFile;
283
+ /** Error handling tools */
284
+ parseDialogError: typeof parseDialogError;
285
+ };
@@ -0,0 +1,198 @@
1
+ /**
2
+ * File or directory metadata
3
+ * @interface FileInfo
4
+ * @since 0.1.0
5
+ * @group Types
6
+ */
7
+ export interface FileInfo {
8
+ /** File or directory name */
9
+ name: string;
10
+ /** Complete path of the file or directory */
11
+ path: string;
12
+ /** True if it's a file */
13
+ isFile: boolean;
14
+ /** True if it's a directory */
15
+ isDirectory: boolean;
16
+ /** File size in bytes */
17
+ size: number;
18
+ /** Last modified time (Unix timestamp) */
19
+ modifiedTime: number;
20
+ /** Creation time (Unix timestamp) */
21
+ createdTime: number;
22
+ }
23
+ /**
24
+ * Reads the text file content at the specified path with UTF-8 encoding.
25
+ * @param path - File path relative to the plugin data directory.
26
+ * @returns Promise that resolves to the file's text content.
27
+ * @throws {PluginError} With code `FS_FILE_NOT_FOUND` when the file doesn't exist
28
+ * @throws {PluginError} With code `FS_FILE_ACCESS_DENIED` when permission is denied
29
+ * @throws {PluginError} With code `FS_INVALID_PATH` when the path is malformed
30
+ * @throws {PluginError} With code `PERMISSION_DENIED` for general file system permission issues
31
+ * @example
32
+ * ```typescript
33
+ * // Read configuration file
34
+ * try {
35
+ * const content = await fs.readFile('config.json');
36
+ * const config = JSON.parse(content);
37
+ * console.log('Configuration loaded:', config);
38
+ * } catch (error) {
39
+ * if (errorUtils.isErrorCode(error, 'FS_FILE_NOT_FOUND')) {
40
+ * console.log('Config file not found, using defaults');
41
+ * } else {
42
+ * console.error('Failed to read config:', error.message);
43
+ * }
44
+ * }
45
+ *
46
+ * // Read log file
47
+ * const logContent = await fs.readFile('logs/app.log');
48
+ * console.log('Recent logs:', logContent.split('\n').slice(-10));
49
+ * ```
50
+ * @since 0.1.0
51
+ * @group API
52
+ */
53
+ export declare function readFile(path: string): Promise<string>;
54
+ /**
55
+ * Writes text content to a file at the specified path. Creates the file if it doesn't exist, or overwrites it if it does.
56
+ * @param path - File path relative to the plugin data directory.
57
+ * @param content - Text content to write to the file.
58
+ * @returns Promise that resolves when the file write operation is complete.
59
+ * @example
60
+ * await fs.writeFile('log.txt', 'This is a log entry.');
61
+ */
62
+ export declare function writeFile(path: string, content: string): Promise<void>;
63
+ /**
64
+ * Checks if a file or directory exists at the specified path.
65
+ * @param path - Path relative to the plugin data directory.
66
+ * @returns Promise that resolves to true if the path exists, false otherwise.
67
+ * @example
68
+ * if (await fs.exists('config.json')) {
69
+ * console.log('Config file exists.');
70
+ * }
71
+ */
72
+ export declare function exists(path: string): Promise<boolean>;
73
+ /**
74
+ * Creates a new directory.
75
+ * @param path - Directory path relative to the plugin data directory.
76
+ * @param recursive - Whether to recursively create all non-existing parent directories.
77
+ * @returns Promise that resolves when the directory creation operation is complete.
78
+ * @example
79
+ * await fs.createDir('data/logs', true);
80
+ */
81
+ export declare function createDir(path: string, recursive?: boolean): Promise<void>;
82
+ /**
83
+ * Lists all files and subdirectories in the specified directory.
84
+ * @param path - Directory path relative to the plugin data directory.
85
+ * @returns Promise that resolves to an array of FileInfo objects containing the directory contents.
86
+ * @example
87
+ * const items = await fs.listDir('.');
88
+ * for (const item of items) {
89
+ * console.log(item.name, item.isDirectory ? '(dir)' : '(file)');
90
+ * }
91
+ */
92
+ export declare function listDir(path: string): Promise<FileInfo[]>;
93
+ /**
94
+ * Deletes the file at the specified path.
95
+ * @param path - File path relative to the plugin data directory.
96
+ * @returns Promise that resolves when the file deletion operation is complete.
97
+ * @example
98
+ * await fs.deleteFile('temp.txt');
99
+ */
100
+ export declare function deleteFile(path: string): Promise<void>;
101
+ /**
102
+ * Deletes the directory at the specified path.
103
+ * @param path - Directory path relative to the plugin data directory.
104
+ * @param recursive - Whether to recursively delete all contents in the directory. If false and the directory is not empty, the operation will fail.
105
+ * @returns Promise that resolves when the directory deletion operation is complete.
106
+ * @example
107
+ * await fs.deleteDir('old_data', true);
108
+ */
109
+ export declare function deleteDir(path: string, recursive?: boolean): Promise<void>;
110
+ /**
111
+ * Gets metadata for the file or directory at the specified path.
112
+ * @param path - File path relative to the plugin data directory.
113
+ * @returns Promise that resolves to a FileInfo object for the file or directory.
114
+ * @example
115
+ * const info = await fs.getFileInfo('data.txt');
116
+ * console.log(`Size: ${info.size} bytes`);
117
+ */
118
+ export declare function getFileInfo(path: string): Promise<FileInfo>;
119
+ /**
120
+ * Copies a file from source path to destination path.
121
+ * @param sourcePath - Source file path relative to the plugin data directory.
122
+ * @param destPath - Destination file path relative to the plugin data directory.
123
+ * @returns Promise that resolves when the file copy operation is complete.
124
+ * @example
125
+ * await fs.copyFile('source.txt', 'destination.txt');
126
+ */
127
+ export declare function copyFile(sourcePath: string, destPath: string): Promise<void>;
128
+ /**
129
+ * Moves or renames a file/directory.
130
+ * @param sourcePath - Source path relative to the plugin data directory.
131
+ * @param destPath - Destination path relative to the plugin data directory.
132
+ * @returns Promise that resolves when the move/rename operation is complete.
133
+ * @example
134
+ * await fs.moveFile('old-name.txt', 'new-name.txt');
135
+ */
136
+ export declare function moveFile(sourcePath: string, destPath: string): Promise<void>;
137
+ /**
138
+ * File system API namespace - provides sandboxed file operations for plugins
139
+ *
140
+ * All file operations are restricted to the plugin's data directory for security.
141
+ * Paths are relative to the plugin's isolated storage space, ensuring data
142
+ * separation between plugins and preventing access to system files.
143
+ *
144
+ * **Security**: All file operations are sandboxed within the plugin's data directory.
145
+ * Attempts to access files outside this directory will result in errors.
146
+ *
147
+ * **Path Handling**: All paths are relative to the plugin data directory.
148
+ * Use forward slashes (/) for cross-platform compatibility.
149
+ *
150
+ * **Encoding**: Text files are read/written using UTF-8 encoding by default.
151
+ *
152
+ * **Performance**: For better performance with multiple operations, consider
153
+ * using batch operations when available.
154
+ *
155
+ * @namespace fs
156
+ * @version 0.1.0
157
+ * @since 0.1.0
158
+ * @group API
159
+ * @see {@link parseFsError} - For file system error handling utilities
160
+ * @example
161
+ * ```typescript
162
+ * import { fs } from 'onin-plugin-sdk';
163
+ *
164
+ * // Basic file operations
165
+ * await fs.writeFile('data.txt', 'Hello World');
166
+ * const content = await fs.readFile('data.txt');
167
+ * console.log(content); // 'Hello World'
168
+ *
169
+ * // Directory operations
170
+ * await fs.createDir('backups', true);
171
+ * const files = await fs.listDir('.');
172
+ * console.log('Files in plugin directory:', files);
173
+ *
174
+ * // File management
175
+ * await fs.copyFile('data.txt', 'backups/data-backup.txt');
176
+ * await fs.moveFile('old-name.txt', 'new-name.txt');
177
+ *
178
+ * // Check file existence
179
+ * if (await fs.exists('config.json')) {
180
+ * const config = JSON.parse(await fs.readFile('config.json'));
181
+ * } else {
182
+ * console.log('Config file not found, creating default...');
183
+ * await fs.writeFile('config.json', JSON.stringify({ version: 1 }));
184
+ * }
185
+ * ```
186
+ */
187
+ export declare const fs: {
188
+ readFile: typeof readFile;
189
+ writeFile: typeof writeFile;
190
+ exists: typeof exists;
191
+ createDir: typeof createDir;
192
+ listDir: typeof listDir;
193
+ deleteFile: typeof deleteFile;
194
+ deleteDir: typeof deleteDir;
195
+ getFileInfo: typeof getFileInfo;
196
+ copyFile: typeof copyFile;
197
+ moveFile: typeof moveFile;
198
+ };