simen-keyboard-listener 1.1.11 → 1.1.12

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.
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Type definitions for osascript context information module
3
3
  */
4
- interface IFrontmostApp {
4
+ interface IFrontmostApp$1 {
5
5
  /** Application name */
6
6
  name: string;
7
7
  /** Bundle identifier (e.g., "com.apple.finder") */
@@ -37,7 +37,7 @@ interface IFinderWindow {
37
37
  /** true if this is a special view (Recents, Search results, etc.) */
38
38
  isSpecialView: boolean;
39
39
  }
40
- interface IFileMetadata {
40
+ interface IFileMetadata$1 {
41
41
  /** File or folder name */
42
42
  name: string;
43
43
  /** Absolute POSIX path */
@@ -55,7 +55,7 @@ interface IFileMetadata {
55
55
  /** Kind description (e.g., "Folder", "PNG Image") */
56
56
  kind: string;
57
57
  }
58
- interface IClipboardContent {
58
+ interface IClipboardContent$1 {
59
59
  /** Text content if available */
60
60
  text: string | null;
61
61
  /** Whether clipboard contains file references */
@@ -65,7 +65,7 @@ interface IClipboardContent {
65
65
  /** Whether clipboard contains image data (screenshot, copied image) */
66
66
  hasImage: boolean;
67
67
  }
68
- interface IDesktopItem {
68
+ interface IDesktopItem$1 {
69
69
  /** File or folder name */
70
70
  name: string;
71
71
  /** Absolute POSIX path */
@@ -73,7 +73,7 @@ interface IDesktopItem {
73
73
  /** Whether this is a folder */
74
74
  isFolder: boolean;
75
75
  }
76
- interface IRecentFile {
76
+ interface IRecentFile$1 {
77
77
  /** File name */
78
78
  name: string;
79
79
  /** Absolute POSIX path */
@@ -81,7 +81,7 @@ interface IRecentFile {
81
81
  /** Last accessed date (ISO string) */
82
82
  accessedAt: string;
83
83
  }
84
- interface IRunningApp {
84
+ interface IRunningApp$1 {
85
85
  /** Application name */
86
86
  name: string;
87
87
  /** Bundle identifier */
@@ -91,21 +91,21 @@ interface IRunningApp {
91
91
  /** Whether this is the frontmost application */
92
92
  isFrontmost: boolean;
93
93
  }
94
- interface ISystemContext {
94
+ interface ISystemContext$1 {
95
95
  /** Frontmost application info */
96
- frontmostApp: IFrontmostApp;
96
+ frontmostApp: IFrontmostApp$1;
97
97
  /** Finder selection (null if Finder is not frontmost or no selection) */
98
98
  finderSelection: IFinderSelection | null;
99
99
  /** Current Finder folder path (null if Finder is not open) */
100
100
  finderCurrentFolder: string | null;
101
101
  /** Clipboard content */
102
- clipboard: IClipboardContent;
102
+ clipboard: IClipboardContent$1;
103
103
  }
104
- interface IExecuteOptions {
104
+ interface IExecuteOptions$1 {
105
105
  /** Timeout in milliseconds (default: 30000) */
106
106
  timeout?: number;
107
107
  }
108
- interface IExecuteResult<T = string> {
108
+ interface IExecuteResult$1<T = string> {
109
109
  /** Whether execution was successful */
110
110
  success: boolean;
111
111
  /** Result data if successful */
@@ -117,7 +117,7 @@ interface IExecuteResult<T = string> {
117
117
  }
118
118
 
119
119
  /** A file or folder item in Finder selection */
120
- interface ISelectedItem {
120
+ interface ISelectedItem$1 {
121
121
  /** Item name (e.g., "document.pdf") */
122
122
  name: string;
123
123
  /** Absolute POSIX path (e.g., "/Users/xxx/document.pdf") */
@@ -143,7 +143,7 @@ interface IFinderWindowInfo {
143
143
  /**
144
144
  * Complete Agent context - all information needed for Agent decision-making.
145
145
  */
146
- interface IAgentContext {
146
+ interface IAgentContext$1 {
147
147
  /** Frontmost (active) application */
148
148
  frontmostApp: {
149
149
  /** App name (e.g., "Finder", "Safari") */
@@ -160,7 +160,7 @@ interface IAgentContext {
160
160
  /** Number of selected items */
161
161
  count: number;
162
162
  /** Detailed item info */
163
- items: ISelectedItem[];
163
+ items: ISelectedItem$1[];
164
164
  /** Just the paths (convenience) */
165
165
  paths: string[];
166
166
  };
@@ -185,7 +185,7 @@ interface IAgentContext {
185
185
  timestamp: number;
186
186
  }
187
187
  /** Options for getAgentContext */
188
- interface IAgentContextOptions extends IExecuteOptions {
188
+ interface IAgentContextOptions$1 extends IExecuteOptions$1 {
189
189
  /** Include file metadata (size, modifiedAt) for selected items. Slower (~350ms vs ~250ms) */
190
190
  includeMetadata?: boolean;
191
191
  }
@@ -207,7 +207,7 @@ interface IAgentContextOptions extends IExecuteOptions {
207
207
  * // With file metadata (~350ms)
208
208
  * const ctx = await getAgentContext({ includeMetadata: true });
209
209
  */
210
- declare function getAgentContext(opts?: IAgentContextOptions): Promise<IAgentContext | null>;
210
+ declare function getAgentContext$1(opts?: IAgentContextOptions$1): Promise<IAgentContext$1 | null>;
211
211
 
212
212
  /**
213
213
  * Check if osascript is available (macOS only)
@@ -220,7 +220,7 @@ declare function isOsascriptAvailable(): boolean;
220
220
  * @param options - Execution options
221
221
  * @returns Execution result with stdout as data
222
222
  */
223
- declare function executeAppleScript(script: string, options?: IExecuteOptions): Promise<IExecuteResult<string>>;
223
+ declare function executeAppleScript(script: string, options?: IExecuteOptions$1): Promise<IExecuteResult$1<string>>;
224
224
  /**
225
225
  * Execute multi-line AppleScript
226
226
  *
@@ -228,7 +228,7 @@ declare function executeAppleScript(script: string, options?: IExecuteOptions):
228
228
  * @param options - Execution options
229
229
  * @returns Execution result with stdout as data
230
230
  */
231
- declare function executeAppleScriptLines(lines: string[], options?: IExecuteOptions): Promise<IExecuteResult<string>>;
231
+ declare function executeAppleScriptLines(lines: string[], options?: IExecuteOptions$1): Promise<IExecuteResult$1<string>>;
232
232
  /**
233
233
  * Execute AppleScript and parse the result
234
234
  *
@@ -237,7 +237,7 @@ declare function executeAppleScriptLines(lines: string[], options?: IExecuteOpti
237
237
  * @param options - Execution options
238
238
  * @returns Parsed result
239
239
  */
240
- declare function executeAndParse<T>(script: string, parser: (output: string) => T, options?: IExecuteOptions): Promise<IExecuteResult<T>>;
240
+ declare function executeAndParse$1<T>(script: string, parser: (output: string) => T, options?: IExecuteOptions$1): Promise<IExecuteResult$1<T>>;
241
241
  /**
242
242
  * Execute multi-line AppleScript and parse the result
243
243
  *
@@ -246,7 +246,7 @@ declare function executeAndParse<T>(script: string, parser: (output: string) =>
246
246
  * @param options - Execution options
247
247
  * @returns Parsed result
248
248
  */
249
- declare function executeMultilineAndParse<T>(lines: string[], parser: (output: string) => T, options?: IExecuteOptions): Promise<IExecuteResult<T>>;
249
+ declare function executeMultilineAndParse$1<T>(lines: string[], parser: (output: string) => T, options?: IExecuteOptions$1): Promise<IExecuteResult$1<T>>;
250
250
  /**
251
251
  * Escape a string for use in AppleScript
252
252
  * Handles quotes and backslashes
@@ -321,7 +321,7 @@ interface IFinderContext {
321
321
  * }
322
322
  * }
323
323
  */
324
- declare function getFinderContext(options?: IExecuteOptions): Promise<IFinderContext | null>;
324
+ declare function getFinderContext(options?: IExecuteOptions$1): Promise<IFinderContext | null>;
325
325
 
326
326
  /**
327
327
  * Get information about the frontmost (active) application
@@ -329,7 +329,7 @@ declare function getFinderContext(options?: IExecuteOptions): Promise<IFinderCon
329
329
  * @param options - Execution options
330
330
  * @returns Frontmost application info, or null if failed
331
331
  */
332
- declare function getFrontmostApp(options?: IExecuteOptions): Promise<IFrontmostApp | null>;
332
+ declare function getFrontmostApp$1(options?: IExecuteOptions$1): Promise<IFrontmostApp$1 | null>;
333
333
 
334
334
  /**
335
335
  * Get the current Finder selection (selected files/folders)
@@ -337,14 +337,14 @@ declare function getFrontmostApp(options?: IExecuteOptions): Promise<IFrontmostA
337
337
  * @param options - Execution options
338
338
  * @returns Finder selection info with absolute paths, or null if failed
339
339
  */
340
- declare function getFinderSelection(options?: IExecuteOptions): Promise<IFinderSelection | null>;
340
+ declare function getFinderSelection(options?: IExecuteOptions$1): Promise<IFinderSelection | null>;
341
341
  /**
342
342
  * Get the current folder displayed in Finder's front window
343
343
  *
344
344
  * @param options - Execution options
345
345
  * @returns Current folder path, or null if no Finder window or failed
346
346
  */
347
- declare function getFinderCurrentFolder(options?: IExecuteOptions): Promise<string | null>;
347
+ declare function getFinderCurrentFolder(options?: IExecuteOptions$1): Promise<string | null>;
348
348
 
349
349
  /**
350
350
  * Get information about all open Finder windows
@@ -352,7 +352,7 @@ declare function getFinderCurrentFolder(options?: IExecuteOptions): Promise<stri
352
352
  * @param options - Execution options
353
353
  * @returns Array of Finder window info, or null if failed
354
354
  */
355
- declare function getFinderWindows(options?: IExecuteOptions): Promise<IFinderWindow[] | null>;
355
+ declare function getFinderWindows(options?: IExecuteOptions$1): Promise<IFinderWindow[] | null>;
356
356
 
357
357
  /**
358
358
  * Get metadata for a file or folder
@@ -361,7 +361,7 @@ declare function getFinderWindows(options?: IExecuteOptions): Promise<IFinderWin
361
361
  * @param options - Execution options
362
362
  * @returns File metadata, or null if failed
363
363
  */
364
- declare function getFileMetadata(filePath: string, options?: IExecuteOptions): Promise<IFileMetadata | null>;
364
+ declare function getFileMetadata(filePath: string, options?: IExecuteOptions$1): Promise<IFileMetadata$1 | null>;
365
365
  /**
366
366
  * Get metadata for multiple files/folders
367
367
  *
@@ -369,7 +369,7 @@ declare function getFileMetadata(filePath: string, options?: IExecuteOptions): P
369
369
  * @param options - Execution options
370
370
  * @returns Array of file metadata (null entries for failed lookups)
371
371
  */
372
- declare function getFilesMetadata(filePaths: string[], options?: IExecuteOptions): Promise<(IFileMetadata | null)[]>;
372
+ declare function getFilesMetadata(filePaths: string[], options?: IExecuteOptions$1): Promise<(IFileMetadata$1 | null)[]>;
373
373
 
374
374
  /**
375
375
  * Get clipboard content (text and/or file references)
@@ -377,14 +377,14 @@ declare function getFilesMetadata(filePaths: string[], options?: IExecuteOptions
377
377
  * @param options - Execution options
378
378
  * @returns Clipboard content info, or null if failed
379
379
  */
380
- declare function getClipboardContent(options?: IExecuteOptions): Promise<IClipboardContent | null>;
380
+ declare function getClipboardContent$1(options?: IExecuteOptions$1): Promise<IClipboardContent$1 | null>;
381
381
  /**
382
382
  * Get clipboard text only (faster if you only need text)
383
383
  *
384
384
  * @param options - Execution options
385
385
  * @returns Clipboard text, or null if no text or failed
386
386
  */
387
- declare function getClipboardText(options?: IExecuteOptions): Promise<string | null>;
387
+ declare function getClipboardText$1(options?: IExecuteOptions$1): Promise<string | null>;
388
388
 
389
389
  /**
390
390
  * Get all items on the desktop
@@ -392,14 +392,14 @@ declare function getClipboardText(options?: IExecuteOptions): Promise<string | n
392
392
  * @param options - Execution options
393
393
  * @returns Array of desktop items, or null if failed
394
394
  */
395
- declare function getDesktopItems(options?: IExecuteOptions): Promise<IDesktopItem[] | null>;
395
+ declare function getDesktopItems(options?: IExecuteOptions$1): Promise<IDesktopItem$1[] | null>;
396
396
  /**
397
397
  * Get the desktop folder path
398
398
  *
399
399
  * @param options - Execution options
400
400
  * @returns Desktop folder path, or null if failed
401
401
  */
402
- declare function getDesktopPath(options?: IExecuteOptions): Promise<string | null>;
402
+ declare function getDesktopPath(options?: IExecuteOptions$1): Promise<string | null>;
403
403
 
404
404
  /**
405
405
  * Get recent files from Finder's Recents folder
@@ -408,7 +408,7 @@ declare function getDesktopPath(options?: IExecuteOptions): Promise<string | nul
408
408
  * @param options - Execution options
409
409
  * @returns Array of recent files, or null if failed
410
410
  */
411
- declare function getRecentFiles(limit?: number, options?: IExecuteOptions): Promise<IRecentFile[] | null>;
411
+ declare function getRecentFiles(limit?: number, options?: IExecuteOptions$1): Promise<IRecentFile$1[] | null>;
412
412
  /**
413
413
  * Get recently modified documents (using mdfind)
414
414
  * This searches for files modified in the last 7 days
@@ -416,7 +416,7 @@ declare function getRecentFiles(limit?: number, options?: IExecuteOptions): Prom
416
416
  * @param options - Execution options
417
417
  * @returns Array of recent files, or null if failed
418
418
  */
419
- declare function getRecentDocuments(options?: IExecuteOptions): Promise<IRecentFile[] | null>;
419
+ declare function getRecentDocuments(options?: IExecuteOptions$1): Promise<IRecentFile$1[] | null>;
420
420
 
421
421
  /**
422
422
  * Get all running applications
@@ -424,7 +424,7 @@ declare function getRecentDocuments(options?: IExecuteOptions): Promise<IRecentF
424
424
  * @param options - Execution options
425
425
  * @returns Array of running apps, or null if failed
426
426
  */
427
- declare function getRunningApps(options?: IExecuteOptions): Promise<IRunningApp[] | null>;
427
+ declare function getRunningApps(options?: IExecuteOptions$1): Promise<IRunningApp$1[] | null>;
428
428
  /**
429
429
  * Check if a specific application is running
430
430
  *
@@ -432,17 +432,17 @@ declare function getRunningApps(options?: IExecuteOptions): Promise<IRunningApp[
432
432
  * @param options - Execution options
433
433
  * @returns true if running, false otherwise
434
434
  */
435
- declare function isAppRunning(appName: string, options?: IExecuteOptions): Promise<boolean>;
435
+ declare function isAppRunning(appName: string, options?: IExecuteOptions$1): Promise<boolean>;
436
436
  /**
437
437
  * Get the frontmost application from the running apps list
438
438
  *
439
439
  * @param options - Execution options
440
440
  * @returns Frontmost app info, or null if failed
441
441
  */
442
- declare function getFrontmostFromRunning(options?: IExecuteOptions): Promise<IRunningApp | null>;
442
+ declare function getFrontmostFromRunning(options?: IExecuteOptions$1): Promise<IRunningApp$1 | null>;
443
443
 
444
444
  /** Result of reading file content */
445
- interface IFileContent {
445
+ interface IFileContent$1 {
446
446
  /** File path that was read */
447
447
  path: string;
448
448
  /** File content as text */
@@ -455,7 +455,7 @@ interface IFileContent {
455
455
  error?: string;
456
456
  }
457
457
  /** Options for readFileContent */
458
- interface IReadFileOptions extends IExecuteOptions {
458
+ interface IReadFileOptions$1 extends IExecuteOptions$1 {
459
459
  /** Maximum bytes to read (default: 1MB = 1048576) */
460
460
  maxBytes?: number;
461
461
  /** Encoding (default: utf8) */
@@ -478,7 +478,7 @@ interface IReadFileOptions extends IExecuteOptions {
478
478
  * // Read with size limit
479
479
  * const result = await readFileContent('/path/to/file.txt', { maxBytes: 10000 });
480
480
  */
481
- declare function readFileContent(filePath: string, opts?: IReadFileOptions): Promise<IFileContent | null>;
481
+ declare function readFileContent(filePath: string, opts?: IReadFileOptions$1): Promise<IFileContent$1 | null>;
482
482
  /**
483
483
  * Read multiple files in parallel.
484
484
  *
@@ -489,7 +489,7 @@ declare function readFileContent(filePath: string, opts?: IReadFileOptions): Pro
489
489
  * @example
490
490
  * const results = await readMultipleFiles(['/path/a.txt', '/path/b.txt']);
491
491
  */
492
- declare function readMultipleFiles(filePaths: string[], opts?: IReadFileOptions): Promise<IFileContent[]>;
492
+ declare function readMultipleFiles(filePaths: string[], opts?: IReadFileOptions$1): Promise<IFileContent$1[]>;
493
493
 
494
494
  /**
495
495
  * osascript module - macOS system context for Agent decision-making
@@ -510,11 +510,341 @@ declare function readMultipleFiles(filePaths: string[], opts?: IReadFileOptions)
510
510
  * Note: macOS only. Returns null on other platforms.
511
511
  */
512
512
 
513
+ /**
514
+ * @deprecated Use getAgentContext() instead for better performance.
515
+ */
516
+ declare function getSystemContext$1(options?: IExecuteOptions$1): Promise<ISystemContext$1 | null>;
517
+
518
+ /**
519
+ * PowerShell execution types for Windows system context
520
+ */
521
+ interface IExecuteOptions {
522
+ /** Timeout in milliseconds (default: 30000) */
523
+ timeout?: number;
524
+ }
525
+ interface IExecuteResult<T> {
526
+ success: boolean;
527
+ data?: T;
528
+ error?: string;
529
+ executionTime?: number;
530
+ }
531
+ interface IFrontmostApp {
532
+ /** Application name (e.g., "Visual Studio Code") */
533
+ name: string;
534
+ /** Process name (e.g., "Code") */
535
+ processName: string;
536
+ /** Executable path */
537
+ path: string;
538
+ /** Process ID */
539
+ processId: number;
540
+ /** Window title */
541
+ windowTitle: string;
542
+ /** Whether this is Windows Explorer */
543
+ isExplorer: boolean;
544
+ }
545
+ interface ISelectedItem {
546
+ /** Absolute path to the file or folder */
547
+ path: string;
548
+ /** Item name */
549
+ name: string;
550
+ /** Whether this is a folder */
551
+ isFolder: boolean;
552
+ }
553
+ interface IExplorerSelection {
554
+ /** Selected files/folders (up to 50 items) */
555
+ items: ISelectedItem[];
556
+ /** Number of selected items */
557
+ count: number;
558
+ }
559
+ interface IExplorerWindowInfo {
560
+ /** Window title */
561
+ title: string;
562
+ /** Current folder path */
563
+ path: string;
564
+ /** Whether this is the active window */
565
+ isActive: boolean;
566
+ }
567
+ interface IExplorerWindow {
568
+ /** All open Explorer windows */
569
+ windows: IExplorerWindowInfo[];
570
+ /** Number of windows */
571
+ count: number;
572
+ }
573
+ interface IClipboardContent {
574
+ /** Text content (null if no text) */
575
+ text: string | null;
576
+ /** Whether clipboard contains files */
577
+ hasFiles: boolean;
578
+ /** File paths if hasFiles is true */
579
+ filePaths: string[];
580
+ /** Whether clipboard contains an image */
581
+ hasImage: boolean;
582
+ }
583
+ interface IFileMetadata {
584
+ /** File path */
585
+ path: string;
586
+ /** File name */
587
+ name: string;
588
+ /** File extension */
589
+ extension: string;
590
+ /** File size in bytes */
591
+ size: number;
592
+ /** Creation time (ISO string) */
593
+ creationTime: string;
594
+ /** Last modified time (ISO string) */
595
+ lastWriteTime: string;
596
+ /** Last access time (ISO string) */
597
+ lastAccessTime: string;
598
+ /** Whether this is a directory */
599
+ isDirectory: boolean;
600
+ /** Whether this is read-only */
601
+ isReadOnly: boolean;
602
+ /** Whether this is hidden */
603
+ isHidden: boolean;
604
+ }
605
+ interface IDesktopItem {
606
+ /** Item name */
607
+ name: string;
608
+ /** Absolute path */
609
+ path: string;
610
+ /** Whether this is a folder */
611
+ isFolder: boolean;
612
+ }
613
+ interface IRecentFile {
614
+ /** File name */
615
+ name: string;
616
+ /** Absolute path */
617
+ path: string;
618
+ /** Last access time (ISO string) */
619
+ lastAccessTime: string;
620
+ }
621
+ interface IRunningApp {
622
+ /** Process name */
623
+ name: string;
624
+ /** Process ID */
625
+ processId: number;
626
+ /** Executable path */
627
+ path: string;
628
+ /** Window title (if has main window) */
629
+ windowTitle?: string;
630
+ }
631
+ interface IReadFileOptions {
632
+ /** Encoding (default: 'utf8') */
633
+ encoding?: string;
634
+ /** Maximum file size in bytes (default: 1MB) */
635
+ maxSize?: number;
636
+ }
637
+ interface IFileContent {
638
+ /** File path */
639
+ path: string;
640
+ /** File content */
641
+ content: string;
642
+ /** File size in bytes */
643
+ size: number;
644
+ /** Whether content was truncated */
645
+ truncated: boolean;
646
+ }
647
+ interface ISystemContext {
648
+ frontmostApp: IFrontmostApp;
649
+ explorerSelection: IExplorerSelection | null;
650
+ explorerCurrentFolder: string | null;
651
+ clipboard: IClipboardContent;
652
+ }
653
+ interface IAgentContextOptions extends IExecuteOptions {
654
+ /** Include clipboard content (default: true) */
655
+ includeClipboard?: boolean;
656
+ /** Include Explorer windows (default: true) */
657
+ includeExplorerWindows?: boolean;
658
+ /** Maximum number of selected items to return (default: 50) */
659
+ maxSelectedItems?: number;
660
+ }
661
+ interface IAgentContext {
662
+ /** Frontmost application */
663
+ frontmostApp: IFrontmostApp;
664
+ /** Explorer selection (null if not Explorer or no selection) */
665
+ explorerSelection: IExplorerSelection | null;
666
+ /** Current folder path (null if not Explorer) */
667
+ explorerCurrentFolder: string | null;
668
+ /** All open Explorer windows */
669
+ explorerWindows: IExplorerWindowInfo[];
670
+ /** Desktop folder path */
671
+ desktopPath: string;
672
+ /** Clipboard content */
673
+ clipboard: IClipboardContent;
674
+ /** Timestamp (ISO string) */
675
+ timestamp: string;
676
+ }
677
+
678
+ /**
679
+ * Get complete agent context in a single PowerShell call
680
+ *
681
+ * This is the RECOMMENDED way to get system context on Windows.
682
+ * Retrieves all information in one call for optimal performance.
683
+ *
684
+ * @param options - Context options
685
+ * @returns Complete agent context or null if failed
686
+ */
687
+ declare function getAgentContext(options?: IAgentContextOptions): Promise<IAgentContext | null>;
688
+
689
+ /**
690
+ * Check if PowerShell is available (Windows only)
691
+ */
692
+ declare function isPowerShellAvailable(): boolean;
693
+ /**
694
+ * Execute a single-line PowerShell command
695
+ *
696
+ * @param script - PowerShell code to execute
697
+ * @param options - Execution options
698
+ * @returns Execution result with stdout as data
699
+ */
700
+ declare function executePowerShell(script: string, options?: IExecuteOptions): Promise<IExecuteResult<string>>;
701
+ /**
702
+ * Execute multi-line PowerShell script
703
+ *
704
+ * @param lines - Array of PowerShell lines
705
+ * @param options - Execution options
706
+ * @returns Execution result with stdout as data
707
+ */
708
+ declare function executePowerShellLines(lines: string[], options?: IExecuteOptions): Promise<IExecuteResult<string>>;
709
+ /**
710
+ * Execute PowerShell and parse the result
711
+ *
712
+ * @param script - PowerShell code to execute
713
+ * @param parser - Function to parse the raw output
714
+ * @param options - Execution options
715
+ * @returns Parsed result
716
+ */
717
+ declare function executeAndParse<T>(script: string, parser: (output: string) => T, options?: IExecuteOptions): Promise<IExecuteResult<T>>;
718
+ /**
719
+ * Execute multi-line PowerShell and parse the result
720
+ *
721
+ * @param lines - Array of PowerShell lines
722
+ * @param parser - Function to parse the raw output
723
+ * @param options - Execution options
724
+ * @returns Parsed result
725
+ */
726
+ declare function executeMultilineAndParse<T>(lines: string[], parser: (output: string) => T, options?: IExecuteOptions): Promise<IExecuteResult<T>>;
727
+ /**
728
+ * Escape a string for use in PowerShell
729
+ * Handles quotes, backticks, and special characters
730
+ */
731
+ declare function escapeForPowerShell(str: string): string;
732
+
733
+ /**
734
+ * Get the frontmost (active) application
735
+ *
736
+ * Returns information about the currently focused window and its process.
737
+ *
738
+ * @param options - Execution options
739
+ * @returns Frontmost application info or null if failed
740
+ */
741
+ declare function getFrontmostApp(options?: IExecuteOptions): Promise<IFrontmostApp | null>;
742
+
743
+ /**
744
+ * Get selected items in Windows Explorer
745
+ *
746
+ * Returns the files/folders selected in the active Explorer window.
747
+ * Supports multi-select (up to 50 items).
748
+ *
749
+ * @param options - Execution options
750
+ * @returns Explorer selection or null if not Explorer or no selection
751
+ */
752
+ declare function getExplorerSelection(options?: IExecuteOptions): Promise<IExplorerSelection | null>;
753
+ /**
754
+ * Get current folder path in Windows Explorer
755
+ *
756
+ * Returns the path of the active Explorer window.
757
+ *
758
+ * @param options - Execution options
759
+ * @returns Current folder path or null if not Explorer
760
+ */
761
+ declare function getExplorerCurrentFolder(options?: IExecuteOptions): Promise<string | null>;
762
+
763
+ /**
764
+ * Get all open Explorer windows
765
+ *
766
+ * Returns information about all open Windows Explorer windows,
767
+ * including their paths and active status.
768
+ *
769
+ * @param options - Execution options
770
+ * @returns Explorer windows info or null if failed
771
+ */
772
+ declare function getExplorerWindows(options?: IExecuteOptions): Promise<IExplorerWindow | null>;
773
+
774
+ /**
775
+ * Get clipboard text content
776
+ *
777
+ * @param options - Execution options
778
+ * @returns Clipboard text or null if no text
779
+ */
780
+ declare function getClipboardText(options?: IExecuteOptions): Promise<string | null>;
781
+ /**
782
+ * Get complete clipboard content (text, files, image detection)
783
+ *
784
+ * @param options - Execution options
785
+ * @returns Clipboard content or null if failed
786
+ */
787
+ declare function getClipboardContent(options?: IExecuteOptions): Promise<IClipboardContent | null>;
788
+
789
+ /**
790
+ * PowerShell module - Windows system context for Agent decision-making
791
+ *
792
+ * RECOMMENDED: Use getAgentContext() for best performance (~300-400ms).
793
+ * It retrieves all commonly needed info in a single PowerShell call.
794
+ *
795
+ * Available information:
796
+ * - Frontmost application (name, processName, path, processId, windowTitle)
797
+ * - Explorer selection (files/folders with absolute paths, supports multi-select)
798
+ * - Explorer windows (all open windows with paths)
799
+ * - Desktop path
800
+ * - Clipboard content (text and/or file paths)
801
+ *
802
+ * Additional APIs for specific use cases:
803
+ * - Individual context queries when only specific info is needed
804
+ *
805
+ * Note: Windows only. Returns null on other platforms.
806
+ */
807
+
513
808
  /**
514
809
  * @deprecated Use getAgentContext() instead for better performance.
515
810
  */
516
811
  declare function getSystemContext(options?: IExecuteOptions): Promise<ISystemContext | null>;
517
812
 
813
+ type index_IAgentContext = IAgentContext;
814
+ type index_IAgentContextOptions = IAgentContextOptions;
815
+ type index_IClipboardContent = IClipboardContent;
816
+ type index_IDesktopItem = IDesktopItem;
817
+ type index_IExecuteOptions = IExecuteOptions;
818
+ type index_IExecuteResult<T> = IExecuteResult<T>;
819
+ type index_IExplorerSelection = IExplorerSelection;
820
+ type index_IExplorerWindow = IExplorerWindow;
821
+ type index_IExplorerWindowInfo = IExplorerWindowInfo;
822
+ type index_IFileContent = IFileContent;
823
+ type index_IFileMetadata = IFileMetadata;
824
+ type index_IFrontmostApp = IFrontmostApp;
825
+ type index_IReadFileOptions = IReadFileOptions;
826
+ type index_IRecentFile = IRecentFile;
827
+ type index_IRunningApp = IRunningApp;
828
+ type index_ISelectedItem = ISelectedItem;
829
+ type index_ISystemContext = ISystemContext;
830
+ declare const index_escapeForPowerShell: typeof escapeForPowerShell;
831
+ declare const index_executeAndParse: typeof executeAndParse;
832
+ declare const index_executeMultilineAndParse: typeof executeMultilineAndParse;
833
+ declare const index_executePowerShell: typeof executePowerShell;
834
+ declare const index_executePowerShellLines: typeof executePowerShellLines;
835
+ declare const index_getAgentContext: typeof getAgentContext;
836
+ declare const index_getClipboardContent: typeof getClipboardContent;
837
+ declare const index_getClipboardText: typeof getClipboardText;
838
+ declare const index_getExplorerCurrentFolder: typeof getExplorerCurrentFolder;
839
+ declare const index_getExplorerSelection: typeof getExplorerSelection;
840
+ declare const index_getExplorerWindows: typeof getExplorerWindows;
841
+ declare const index_getFrontmostApp: typeof getFrontmostApp;
842
+ declare const index_getSystemContext: typeof getSystemContext;
843
+ declare const index_isPowerShellAvailable: typeof isPowerShellAvailable;
844
+ declare namespace index {
845
+ export { type index_IAgentContext as IAgentContext, type index_IAgentContextOptions as IAgentContextOptions, type index_IClipboardContent as IClipboardContent, type index_IDesktopItem as IDesktopItem, type index_IExecuteOptions as IExecuteOptions, type index_IExecuteResult as IExecuteResult, type index_IExplorerSelection as IExplorerSelection, type index_IExplorerWindow as IExplorerWindow, type index_IExplorerWindowInfo as IExplorerWindowInfo, type index_IFileContent as IFileContent, type index_IFileMetadata as IFileMetadata, type index_IFrontmostApp as IFrontmostApp, type index_IReadFileOptions as IReadFileOptions, type index_IRecentFile as IRecentFile, type index_IRunningApp as IRunningApp, type index_ISelectedItem as ISelectedItem, type index_ISystemContext as ISystemContext, index_escapeForPowerShell as escapeForPowerShell, index_executeAndParse as executeAndParse, index_executeMultilineAndParse as executeMultilineAndParse, index_executePowerShell as executePowerShell, index_executePowerShellLines as executePowerShellLines, index_getAgentContext as getAgentContext, index_getClipboardContent as getClipboardContent, index_getClipboardText as getClipboardText, index_getExplorerCurrentFolder as getExplorerCurrentFolder, index_getExplorerSelection as getExplorerSelection, index_getExplorerWindows as getExplorerWindows, index_getFrontmostApp as getFrontmostApp, index_getSystemContext as getSystemContext, index_isPowerShellAvailable as isPowerShellAvailable };
846
+ }
847
+
518
848
  type IGlobalKeyState = 'DOWN' | 'UP' | 'PERMISSION_LOST';
519
849
  interface IGlobalKeyEvent {
520
850
  readonly name: string;
@@ -582,4 +912,4 @@ declare function getSelectedTextSmart(): string | null;
582
912
  */
583
913
  declare function setBlockSystemHotkeys(block: boolean): void;
584
914
 
585
- export { type IAgentContext, type IAgentContextOptions, type IClipboardContent, type IDesktopItem, type IExecuteOptions, type IExecuteResult, type IFileContent, type IFileMetadata, type IFinderContext, type IFinderItem, type IFinderSelection, type IFinderWindow, type IFinderWindowInfo, type IFinderWindowItem, type IFrontmostApp, type IGlobalKeyDownMap, type IGlobalKeyEvent, type IGlobalKeyListener, type IGlobalKeyState, type IGlobalKeyboardListener, type IPermissionLostListener, type IReadFileOptions, type IRecentFile, type IRunningApp, type ISelectedItem, type ISystemContext, checkKeyboardPermission, createGlobalKeyboardListener, escapeForAppleScript, executeAndParse, executeAppleScript, executeAppleScriptLines, executeMultilineAndParse, getAgentContext, getClipboardContent, getClipboardText, getContextJSON, getDesktopItems, getDesktopPath, getFileMetadata, getFilesMetadata, getFinderContext, getFinderCurrentFolder, getFinderSelection, getFinderWindows, getFocusedInputSelectedText, getFocusedInputValue, getFrontmostApp, getFrontmostFromRunning, getGlobalKeyboardListener, getRecentDocuments, getRecentFiles, getRunningApps, getSelectedTextSmart, getSystemContext, isAppRunning, isOsascriptAvailable, readFileContent, readMultipleFiles, setBlockSystemHotkeys };
915
+ export { type IAgentContext$1 as IAgentContext, type IAgentContextOptions$1 as IAgentContextOptions, type IClipboardContent$1 as IClipboardContent, type IDesktopItem$1 as IDesktopItem, type IExecuteOptions$1 as IExecuteOptions, type IExecuteResult$1 as IExecuteResult, type IFileContent$1 as IFileContent, type IFileMetadata$1 as IFileMetadata, type IFinderContext, type IFinderItem, type IFinderSelection, type IFinderWindow, type IFinderWindowInfo, type IFinderWindowItem, type IFrontmostApp$1 as IFrontmostApp, type IGlobalKeyDownMap, type IGlobalKeyEvent, type IGlobalKeyListener, type IGlobalKeyState, type IGlobalKeyboardListener, type IPermissionLostListener, type IReadFileOptions$1 as IReadFileOptions, type IRecentFile$1 as IRecentFile, type IRunningApp$1 as IRunningApp, type ISelectedItem$1 as ISelectedItem, type ISystemContext$1 as ISystemContext, checkKeyboardPermission, createGlobalKeyboardListener, escapeForAppleScript, executeAndParse$1 as executeAndParse, executeAppleScript, executeAppleScriptLines, executeMultilineAndParse$1 as executeMultilineAndParse, getAgentContext$1 as getAgentContext, getClipboardContent$1 as getClipboardContent, getClipboardText$1 as getClipboardText, getContextJSON, getDesktopItems, getDesktopPath, getFileMetadata, getFilesMetadata, getFinderContext, getFinderCurrentFolder, getFinderSelection, getFinderWindows, getFocusedInputSelectedText, getFocusedInputValue, getFrontmostApp$1 as getFrontmostApp, getFrontmostFromRunning, getGlobalKeyboardListener, getRecentDocuments, getRecentFiles, getRunningApps, getSelectedTextSmart, getSystemContext$1 as getSystemContext, isAppRunning, isOsascriptAvailable, index as powershell, readFileContent, readMultipleFiles, setBlockSystemHotkeys };