@ebowwa/osascript 1.1.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.
- package/README.md +123 -0
- package/dist/index.js +574 -0
- package/dist/mcp/index.js +866 -0
- package/dist/mcp/stdio.js +1704 -0
- package/package.json +79 -0
- package/src/index.ts +844 -0
- package/src/mcp/events.ts +468 -0
- package/src/mcp/index.ts +565 -0
- package/src/mcp/stdio.ts +1284 -0
- package/src/types.ts +189 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Type definitions for osascript MCP
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Result from executing osascript
|
|
7
|
+
*/
|
|
8
|
+
export interface OsascriptResult {
|
|
9
|
+
success: boolean;
|
|
10
|
+
stdout: string;
|
|
11
|
+
stderr: string;
|
|
12
|
+
exitCode: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Script language type
|
|
17
|
+
*/
|
|
18
|
+
export type ScriptLanguage = "applescript" | "javascript";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Options for executing scripts
|
|
22
|
+
*/
|
|
23
|
+
export interface ExecuteOptions {
|
|
24
|
+
/** Script language (default: applescript) */
|
|
25
|
+
language?: ScriptLanguage;
|
|
26
|
+
/** Timeout in milliseconds (default: 30000) */
|
|
27
|
+
timeout?: number;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Dialog button configuration
|
|
32
|
+
*/
|
|
33
|
+
export interface DialogButton {
|
|
34
|
+
/** Button label */
|
|
35
|
+
label: string;
|
|
36
|
+
/** Button action (default button) */
|
|
37
|
+
default?: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Dialog options
|
|
42
|
+
*/
|
|
43
|
+
export interface DialogOptions {
|
|
44
|
+
/** Dialog title */
|
|
45
|
+
title?: string;
|
|
46
|
+
/** Dialog message */
|
|
47
|
+
message: string;
|
|
48
|
+
/** Buttons to display */
|
|
49
|
+
buttons?: string[];
|
|
50
|
+
/** Default button index (1-based) */
|
|
51
|
+
defaultButton?: number;
|
|
52
|
+
/** Icon type: note, caution, stop */
|
|
53
|
+
icon?: "note" | "caution" | "stop";
|
|
54
|
+
/** Give up after seconds */
|
|
55
|
+
givingUpAfter?: number;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Dialog result
|
|
60
|
+
*/
|
|
61
|
+
export interface DialogResult {
|
|
62
|
+
/** Button that was clicked */
|
|
63
|
+
buttonReturned: string;
|
|
64
|
+
/** Text entered if text fields present */
|
|
65
|
+
textReturned?: string;
|
|
66
|
+
/** Whether dialog timed out */
|
|
67
|
+
gaveUp?: boolean;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Notification options
|
|
72
|
+
*/
|
|
73
|
+
export interface NotificationOptions {
|
|
74
|
+
/** Notification title */
|
|
75
|
+
title?: string;
|
|
76
|
+
/** Notification subtitle */
|
|
77
|
+
subtitle?: string;
|
|
78
|
+
/** Notification body text */
|
|
79
|
+
message: string;
|
|
80
|
+
/** Sound name */
|
|
81
|
+
soundName?: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Window information
|
|
86
|
+
*/
|
|
87
|
+
export interface WindowInfo {
|
|
88
|
+
/** Window name/title */
|
|
89
|
+
name: string | null;
|
|
90
|
+
/** Window ID */
|
|
91
|
+
id: number;
|
|
92
|
+
/** Window index (z-order) */
|
|
93
|
+
index: number;
|
|
94
|
+
/** Whether window is visible */
|
|
95
|
+
visible?: boolean;
|
|
96
|
+
/** Window bounds {x, y, width, height} */
|
|
97
|
+
bounds?: {
|
|
98
|
+
x: number;
|
|
99
|
+
y: number;
|
|
100
|
+
width: number;
|
|
101
|
+
height: number;
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Application information
|
|
107
|
+
*/
|
|
108
|
+
export interface ApplicationInfo {
|
|
109
|
+
/** Application name */
|
|
110
|
+
name: string;
|
|
111
|
+
/** Display name */
|
|
112
|
+
displayName?: string;
|
|
113
|
+
/** Application path */
|
|
114
|
+
path?: string;
|
|
115
|
+
/** Whether app is running */
|
|
116
|
+
running: boolean;
|
|
117
|
+
/** Window count */
|
|
118
|
+
windowCount?: number;
|
|
119
|
+
/** Process ID */
|
|
120
|
+
processId?: number;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Keystroke options
|
|
125
|
+
*/
|
|
126
|
+
export interface KeystrokeOptions {
|
|
127
|
+
/** Key to press */
|
|
128
|
+
key: string;
|
|
129
|
+
/** Modifiers: command, shift, option, control */
|
|
130
|
+
modifiers?: ("command" | "shift" | "option" | "control")[];
|
|
131
|
+
/** Delay between keystrokes in seconds */
|
|
132
|
+
delay?: number;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Key code options (for special keys)
|
|
137
|
+
*/
|
|
138
|
+
export interface KeyCodeOptions {
|
|
139
|
+
/** Key code number */
|
|
140
|
+
keyCode: number;
|
|
141
|
+
/** Modifiers */
|
|
142
|
+
modifiers?: ("command" | "shift" | "option" | "control")[];
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Volume info
|
|
147
|
+
*/
|
|
148
|
+
export interface VolumeInfo {
|
|
149
|
+
/** Volume level 0-100 */
|
|
150
|
+
volume: number;
|
|
151
|
+
/** Whether muted */
|
|
152
|
+
muted: boolean;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Display info
|
|
157
|
+
*/
|
|
158
|
+
export interface DisplayInfo {
|
|
159
|
+
/** Display name/ID */
|
|
160
|
+
id: number;
|
|
161
|
+
/** Width in pixels */
|
|
162
|
+
width: number;
|
|
163
|
+
/** Height in pixels */
|
|
164
|
+
height: number;
|
|
165
|
+
/** Color depth */
|
|
166
|
+
depth?: number;
|
|
167
|
+
/** Whether this is the main display */
|
|
168
|
+
main?: boolean;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* File/folder item from Finder
|
|
173
|
+
*/
|
|
174
|
+
export interface FinderItem {
|
|
175
|
+
/** Item name */
|
|
176
|
+
name: string;
|
|
177
|
+
/** Full path */
|
|
178
|
+
path: string;
|
|
179
|
+
/** Type: file, folder, application, etc. */
|
|
180
|
+
type: "file" | "folder" | "application" | "disk" | "alias" | "unknown";
|
|
181
|
+
/** Size in bytes (files only) */
|
|
182
|
+
size?: number;
|
|
183
|
+
/** Creation date */
|
|
184
|
+
created?: string;
|
|
185
|
+
/** Modification date */
|
|
186
|
+
modified?: string;
|
|
187
|
+
/** Whether item exists */
|
|
188
|
+
exists: boolean;
|
|
189
|
+
}
|