@skillful-agents/agent-computer 0.0.3
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 +458 -0
- package/bin/ac-core-darwin-arm64 +0 -0
- package/bin/ac-core-darwin-x64 +0 -0
- package/bin/ac-core-win32-arm64.exe +0 -0
- package/bin/ac-core-win32-x64.exe +0 -0
- package/dist/bin/ac.d.ts +3 -0
- package/dist/bin/ac.d.ts.map +1 -0
- package/dist/bin/ac.js +126 -0
- package/dist/bin/ac.js.map +1 -0
- package/dist/src/bridge.d.ts +69 -0
- package/dist/src/bridge.d.ts.map +1 -0
- package/dist/src/bridge.js +687 -0
- package/dist/src/bridge.js.map +1 -0
- package/dist/src/cdp/ax-tree.d.ts +19 -0
- package/dist/src/cdp/ax-tree.d.ts.map +1 -0
- package/dist/src/cdp/ax-tree.js +159 -0
- package/dist/src/cdp/ax-tree.js.map +1 -0
- package/dist/src/cdp/bounds.d.ts +25 -0
- package/dist/src/cdp/bounds.d.ts.map +1 -0
- package/dist/src/cdp/bounds.js +62 -0
- package/dist/src/cdp/bounds.js.map +1 -0
- package/dist/src/cdp/client.d.ts +115 -0
- package/dist/src/cdp/client.d.ts.map +1 -0
- package/dist/src/cdp/client.js +269 -0
- package/dist/src/cdp/client.js.map +1 -0
- package/dist/src/cdp/connection.d.ts +25 -0
- package/dist/src/cdp/connection.d.ts.map +1 -0
- package/dist/src/cdp/connection.js +249 -0
- package/dist/src/cdp/connection.js.map +1 -0
- package/dist/src/cdp/diff.d.ts +17 -0
- package/dist/src/cdp/diff.d.ts.map +1 -0
- package/dist/src/cdp/diff.js +52 -0
- package/dist/src/cdp/diff.js.map +1 -0
- package/dist/src/cdp/discovery.d.ts +8 -0
- package/dist/src/cdp/discovery.d.ts.map +1 -0
- package/dist/src/cdp/discovery.js +54 -0
- package/dist/src/cdp/discovery.js.map +1 -0
- package/dist/src/cdp/index.d.ts +12 -0
- package/dist/src/cdp/index.d.ts.map +1 -0
- package/dist/src/cdp/index.js +10 -0
- package/dist/src/cdp/index.js.map +1 -0
- package/dist/src/cdp/interactions.d.ts +47 -0
- package/dist/src/cdp/interactions.d.ts.map +1 -0
- package/dist/src/cdp/interactions.js +298 -0
- package/dist/src/cdp/interactions.js.map +1 -0
- package/dist/src/cdp/port-manager.d.ts +3 -0
- package/dist/src/cdp/port-manager.d.ts.map +1 -0
- package/dist/src/cdp/port-manager.js +33 -0
- package/dist/src/cdp/port-manager.js.map +1 -0
- package/dist/src/cdp/role-map.d.ts +8 -0
- package/dist/src/cdp/role-map.d.ts.map +1 -0
- package/dist/src/cdp/role-map.js +99 -0
- package/dist/src/cdp/role-map.js.map +1 -0
- package/dist/src/cdp/types.d.ts +53 -0
- package/dist/src/cdp/types.d.ts.map +1 -0
- package/dist/src/cdp/types.js +2 -0
- package/dist/src/cdp/types.js.map +1 -0
- package/dist/src/cli/commands/apps.d.ts +2 -0
- package/dist/src/cli/commands/apps.d.ts.map +1 -0
- package/dist/src/cli/commands/apps.js +62 -0
- package/dist/src/cli/commands/apps.js.map +1 -0
- package/dist/src/cli/commands/batch.d.ts +2 -0
- package/dist/src/cli/commands/batch.d.ts.map +1 -0
- package/dist/src/cli/commands/batch.js +36 -0
- package/dist/src/cli/commands/batch.js.map +1 -0
- package/dist/src/cli/commands/click.d.ts +2 -0
- package/dist/src/cli/commands/click.d.ts.map +1 -0
- package/dist/src/cli/commands/click.js +60 -0
- package/dist/src/cli/commands/click.js.map +1 -0
- package/dist/src/cli/commands/clipboard.d.ts +2 -0
- package/dist/src/cli/commands/clipboard.d.ts.map +1 -0
- package/dist/src/cli/commands/clipboard.js +30 -0
- package/dist/src/cli/commands/clipboard.js.map +1 -0
- package/dist/src/cli/commands/dialog.d.ts +2 -0
- package/dist/src/cli/commands/dialog.d.ts.map +1 -0
- package/dist/src/cli/commands/dialog.js +44 -0
- package/dist/src/cli/commands/dialog.js.map +1 -0
- package/dist/src/cli/commands/drag.d.ts +2 -0
- package/dist/src/cli/commands/drag.d.ts.map +1 -0
- package/dist/src/cli/commands/drag.js +25 -0
- package/dist/src/cli/commands/drag.js.map +1 -0
- package/dist/src/cli/commands/find.d.ts +2 -0
- package/dist/src/cli/commands/find.d.ts.map +1 -0
- package/dist/src/cli/commands/find.js +98 -0
- package/dist/src/cli/commands/find.js.map +1 -0
- package/dist/src/cli/commands/menu.d.ts +2 -0
- package/dist/src/cli/commands/menu.d.ts.map +1 -0
- package/dist/src/cli/commands/menu.js +35 -0
- package/dist/src/cli/commands/menu.js.map +1 -0
- package/dist/src/cli/commands/screenshot.d.ts +2 -0
- package/dist/src/cli/commands/screenshot.d.ts.map +1 -0
- package/dist/src/cli/commands/screenshot.js +26 -0
- package/dist/src/cli/commands/screenshot.js.map +1 -0
- package/dist/src/cli/commands/scroll.d.ts +2 -0
- package/dist/src/cli/commands/scroll.d.ts.map +1 -0
- package/dist/src/cli/commands/scroll.js +76 -0
- package/dist/src/cli/commands/scroll.js.map +1 -0
- package/dist/src/cli/commands/session.d.ts +2 -0
- package/dist/src/cli/commands/session.d.ts.map +1 -0
- package/dist/src/cli/commands/session.js +26 -0
- package/dist/src/cli/commands/session.js.map +1 -0
- package/dist/src/cli/commands/snapshot.d.ts +2 -0
- package/dist/src/cli/commands/snapshot.d.ts.map +1 -0
- package/dist/src/cli/commands/snapshot.js +23 -0
- package/dist/src/cli/commands/snapshot.js.map +1 -0
- package/dist/src/cli/commands/type.d.ts +2 -0
- package/dist/src/cli/commands/type.d.ts.map +1 -0
- package/dist/src/cli/commands/type.js +68 -0
- package/dist/src/cli/commands/type.js.map +1 -0
- package/dist/src/cli/commands/windowmgmt.d.ts +2 -0
- package/dist/src/cli/commands/windowmgmt.d.ts.map +1 -0
- package/dist/src/cli/commands/windowmgmt.js +61 -0
- package/dist/src/cli/commands/windowmgmt.js.map +1 -0
- package/dist/src/cli/commands/windows.d.ts +2 -0
- package/dist/src/cli/commands/windows.d.ts.map +1 -0
- package/dist/src/cli/commands/windows.js +9 -0
- package/dist/src/cli/commands/windows.js.map +1 -0
- package/dist/src/cli/commands.d.ts +13 -0
- package/dist/src/cli/commands.d.ts.map +1 -0
- package/dist/src/cli/commands.js +177 -0
- package/dist/src/cli/commands.js.map +1 -0
- package/dist/src/cli/output.d.ts +4 -0
- package/dist/src/cli/output.d.ts.map +1 -0
- package/dist/src/cli/output.js +249 -0
- package/dist/src/cli/output.js.map +1 -0
- package/dist/src/cli/parser.d.ts +19 -0
- package/dist/src/cli/parser.d.ts.map +1 -0
- package/dist/src/cli/parser.js +125 -0
- package/dist/src/cli/parser.js.map +1 -0
- package/dist/src/config.d.ts +14 -0
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/config.js +73 -0
- package/dist/src/config.js.map +1 -0
- package/dist/src/daemon.d.ts +21 -0
- package/dist/src/daemon.d.ts.map +1 -0
- package/dist/src/daemon.js +180 -0
- package/dist/src/daemon.js.map +1 -0
- package/dist/src/errors.d.ts +39 -0
- package/dist/src/errors.d.ts.map +1 -0
- package/dist/src/errors.js +103 -0
- package/dist/src/errors.js.map +1 -0
- package/dist/src/index.d.ts +8 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +8 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/platform/index.d.ts +6 -0
- package/dist/src/platform/index.d.ts.map +1 -0
- package/dist/src/platform/index.js +14 -0
- package/dist/src/platform/index.js.map +1 -0
- package/dist/src/platform/resolve.d.ts +2 -0
- package/dist/src/platform/resolve.d.ts.map +1 -0
- package/dist/src/platform/resolve.js +54 -0
- package/dist/src/platform/resolve.js.map +1 -0
- package/dist/src/refs.d.ts +12 -0
- package/dist/src/refs.d.ts.map +1 -0
- package/dist/src/refs.js +85 -0
- package/dist/src/refs.js.map +1 -0
- package/dist/src/sdk.d.ts +258 -0
- package/dist/src/sdk.d.ts.map +1 -0
- package/dist/src/sdk.js +285 -0
- package/dist/src/sdk.js.map +1 -0
- package/dist/src/types.d.ts +93 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +9 -0
- package/dist/src/types.js.map +1 -0
- package/package.json +67 -0
- package/schema/examples/click.response.example.json +9 -0
- package/schema/examples/error.response.example.json +12 -0
- package/schema/examples/ping.response.example.json +7 -0
- package/schema/examples/snapshot.response.example.json +50 -0
- package/schema/methods/click.request.json +26 -0
- package/schema/methods/click.response.json +24 -0
- package/schema/methods/error.response.json +19 -0
- package/schema/methods/ping.request.json +12 -0
- package/schema/methods/ping.response.json +17 -0
- package/schema/methods/snapshot.request.json +24 -0
- package/schema/methods/snapshot.response.json +23 -0
- package/schema/methods/status.request.json +12 -0
- package/schema/methods/status.response.json +20 -0
- package/schema/types/element.json +26 -0
- package/schema/types/normalized-role.json +13 -0
- package/schema/types/ref.json +7 -0
- package/schema/types/window-info.json +24 -0
- package/scripts/build-macos.sh +5 -0
- package/scripts/postinstall.js +35 -0
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { type BridgeOptions } from './bridge.js';
|
|
2
|
+
import type { Element, WindowInfo, DisplayInfo, StatusInfo, PermissionsInfo } from './types.js';
|
|
3
|
+
export interface SnapshotOptions {
|
|
4
|
+
app?: string;
|
|
5
|
+
interactive?: boolean;
|
|
6
|
+
compact?: boolean;
|
|
7
|
+
depth?: number;
|
|
8
|
+
subtree?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface SnapshotResult {
|
|
11
|
+
snapshot_id: string;
|
|
12
|
+
elements: Element[];
|
|
13
|
+
window?: WindowInfo;
|
|
14
|
+
}
|
|
15
|
+
export interface ClickOptions {
|
|
16
|
+
right?: boolean;
|
|
17
|
+
double?: boolean;
|
|
18
|
+
count?: number;
|
|
19
|
+
modifiers?: string[];
|
|
20
|
+
}
|
|
21
|
+
export interface TypeOptions {
|
|
22
|
+
delay?: number;
|
|
23
|
+
}
|
|
24
|
+
export interface ScrollOptions {
|
|
25
|
+
amount?: number;
|
|
26
|
+
on?: string;
|
|
27
|
+
pixels?: number;
|
|
28
|
+
smooth?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface DragOptions {
|
|
31
|
+
duration?: number;
|
|
32
|
+
steps?: number;
|
|
33
|
+
}
|
|
34
|
+
export interface ScreenshotOptions {
|
|
35
|
+
ref?: string;
|
|
36
|
+
screen?: boolean;
|
|
37
|
+
format?: 'png' | 'jpg';
|
|
38
|
+
quality?: number;
|
|
39
|
+
path?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface ScreenshotInfo {
|
|
42
|
+
ok: boolean;
|
|
43
|
+
path: string;
|
|
44
|
+
width?: number;
|
|
45
|
+
height?: number;
|
|
46
|
+
}
|
|
47
|
+
export interface FindOptions {
|
|
48
|
+
role?: string;
|
|
49
|
+
first?: boolean;
|
|
50
|
+
app?: string;
|
|
51
|
+
}
|
|
52
|
+
export interface WaitOptions {
|
|
53
|
+
timeout?: number;
|
|
54
|
+
}
|
|
55
|
+
export interface BatchCommand {
|
|
56
|
+
method: string;
|
|
57
|
+
params?: Record<string, unknown>;
|
|
58
|
+
}
|
|
59
|
+
export interface DialogDetection {
|
|
60
|
+
ok: boolean;
|
|
61
|
+
found: boolean;
|
|
62
|
+
dialog?: {
|
|
63
|
+
type: string;
|
|
64
|
+
title?: string;
|
|
65
|
+
message?: string;
|
|
66
|
+
buttons?: Array<{
|
|
67
|
+
title: string;
|
|
68
|
+
}>;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
export interface DiffResult {
|
|
72
|
+
ok: boolean;
|
|
73
|
+
changed: boolean;
|
|
74
|
+
added?: Array<Record<string, unknown>>;
|
|
75
|
+
removed?: Array<Record<string, unknown>>;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* High-level AC SDK for programmatic macOS desktop automation.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* import { AC } from '@skillful-agents/ac';
|
|
83
|
+
*
|
|
84
|
+
* const ac = new AC();
|
|
85
|
+
* await ac.launch('TextEdit');
|
|
86
|
+
* const snap = await ac.snapshot({ interactive: true });
|
|
87
|
+
* const textarea = snap.elements.find(e => e.role === 'textarea');
|
|
88
|
+
* if (textarea) {
|
|
89
|
+
* await ac.fill(textarea.ref, 'Hello from AC!');
|
|
90
|
+
* }
|
|
91
|
+
* await ac.quit('TextEdit');
|
|
92
|
+
* await ac.disconnect();
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
export declare class AC {
|
|
96
|
+
private bridge;
|
|
97
|
+
constructor(options?: BridgeOptions);
|
|
98
|
+
/** Take a snapshot of the accessibility tree */
|
|
99
|
+
snapshot(options?: SnapshotOptions): Promise<SnapshotResult>;
|
|
100
|
+
/** Find elements by text and/or role */
|
|
101
|
+
find(text: string, options?: FindOptions): Promise<{
|
|
102
|
+
elements: Element[];
|
|
103
|
+
}>;
|
|
104
|
+
/** Read an element's value */
|
|
105
|
+
read(ref: string, attr?: string): Promise<{
|
|
106
|
+
ref: string;
|
|
107
|
+
value: unknown;
|
|
108
|
+
}>;
|
|
109
|
+
/** Get element bounds */
|
|
110
|
+
box(ref: string): Promise<{
|
|
111
|
+
ref: string;
|
|
112
|
+
bounds: [number, number, number, number];
|
|
113
|
+
}>;
|
|
114
|
+
/** Check element state (visible, enabled, focused, checked) */
|
|
115
|
+
is(state: string, ref: string): Promise<{
|
|
116
|
+
state: string;
|
|
117
|
+
value: boolean;
|
|
118
|
+
}>;
|
|
119
|
+
/** Get children of an element */
|
|
120
|
+
children(ref: string): Promise<{
|
|
121
|
+
ref: string;
|
|
122
|
+
children: Element[];
|
|
123
|
+
}>;
|
|
124
|
+
/** Click an element by ref */
|
|
125
|
+
click(ref: string, options?: ClickOptions): Promise<void>;
|
|
126
|
+
/** Click at screen coordinates */
|
|
127
|
+
clickAt(x: number, y: number, options?: ClickOptions): Promise<void>;
|
|
128
|
+
/** Hover over an element */
|
|
129
|
+
hover(ref: string): Promise<void>;
|
|
130
|
+
/** Hover at coordinates */
|
|
131
|
+
hoverAt(x: number, y: number): Promise<void>;
|
|
132
|
+
/** Type text into the frontmost app */
|
|
133
|
+
type(text: string, options?: TypeOptions): Promise<void>;
|
|
134
|
+
/** Fill an element with text (focus, clear, type) */
|
|
135
|
+
fill(ref: string, text: string): Promise<void>;
|
|
136
|
+
/** Press a key combination */
|
|
137
|
+
key(combo: string, repeat?: number): Promise<void>;
|
|
138
|
+
/** Paste text via clipboard */
|
|
139
|
+
paste(text: string): Promise<void>;
|
|
140
|
+
/** Focus an element */
|
|
141
|
+
focus(ref: string): Promise<void>;
|
|
142
|
+
/** Check a checkbox */
|
|
143
|
+
check(ref: string): Promise<void>;
|
|
144
|
+
/** Uncheck a checkbox */
|
|
145
|
+
uncheck(ref: string): Promise<void>;
|
|
146
|
+
/** Select a value in a dropdown */
|
|
147
|
+
select(ref: string, value: string): Promise<void>;
|
|
148
|
+
/** Set a value on an element */
|
|
149
|
+
set(ref: string, value: string): Promise<void>;
|
|
150
|
+
/** Scroll in a direction */
|
|
151
|
+
scroll(direction: 'up' | 'down' | 'left' | 'right', options?: ScrollOptions): Promise<void>;
|
|
152
|
+
/** Drag from one element/position to another */
|
|
153
|
+
drag(from: string | {
|
|
154
|
+
x: number;
|
|
155
|
+
y: number;
|
|
156
|
+
}, to: string | {
|
|
157
|
+
x: number;
|
|
158
|
+
y: number;
|
|
159
|
+
}, options?: DragOptions): Promise<void>;
|
|
160
|
+
/** Click a menu item by path (e.g. "File > Save") */
|
|
161
|
+
menuClick(path: string, app?: string): Promise<void>;
|
|
162
|
+
/** List menu items */
|
|
163
|
+
menuList(menuName?: string, options?: {
|
|
164
|
+
all?: boolean;
|
|
165
|
+
app?: string;
|
|
166
|
+
}): Promise<{
|
|
167
|
+
items: Array<{
|
|
168
|
+
title: string;
|
|
169
|
+
}>;
|
|
170
|
+
}>;
|
|
171
|
+
/** List running applications */
|
|
172
|
+
apps(): Promise<{
|
|
173
|
+
apps: Array<Record<string, unknown>>;
|
|
174
|
+
}>;
|
|
175
|
+
/** Launch an application */
|
|
176
|
+
launch(name: string, options?: {
|
|
177
|
+
wait?: boolean;
|
|
178
|
+
background?: boolean;
|
|
179
|
+
}): Promise<void>;
|
|
180
|
+
/** Quit an application */
|
|
181
|
+
quit(name: string, options?: {
|
|
182
|
+
force?: boolean;
|
|
183
|
+
}): Promise<void>;
|
|
184
|
+
/** Relaunch an application with CDP support (quit + launch with --remote-debugging-port) */
|
|
185
|
+
relaunch(name: string, options?: {
|
|
186
|
+
wait?: boolean;
|
|
187
|
+
}): Promise<void>;
|
|
188
|
+
/** Switch to (activate) an application */
|
|
189
|
+
switch(name: string): Promise<void>;
|
|
190
|
+
/** List windows */
|
|
191
|
+
windows(app?: string): Promise<{
|
|
192
|
+
windows: WindowInfo[];
|
|
193
|
+
}>;
|
|
194
|
+
/** Grab (lock onto) a window for subsequent commands */
|
|
195
|
+
grab(refOrApp: string): Promise<void>;
|
|
196
|
+
/** Release the grabbed window */
|
|
197
|
+
ungrab(): Promise<void>;
|
|
198
|
+
minimize(ref?: string): Promise<void>;
|
|
199
|
+
maximize(ref?: string): Promise<void>;
|
|
200
|
+
fullscreen(ref?: string): Promise<void>;
|
|
201
|
+
closeWindow(ref?: string): Promise<void>;
|
|
202
|
+
raise(ref?: string): Promise<void>;
|
|
203
|
+
move(x: number, y: number, ref?: string): Promise<void>;
|
|
204
|
+
resize(width: number, height: number, ref?: string): Promise<void>;
|
|
205
|
+
bounds(preset: string, ref?: string): Promise<void>;
|
|
206
|
+
/** Take a screenshot */
|
|
207
|
+
screenshot(options?: ScreenshotOptions): Promise<ScreenshotInfo>;
|
|
208
|
+
/** List displays */
|
|
209
|
+
displays(): Promise<{
|
|
210
|
+
displays: DisplayInfo[];
|
|
211
|
+
}>;
|
|
212
|
+
/** Read clipboard contents */
|
|
213
|
+
clipboardRead(): Promise<{
|
|
214
|
+
text: string;
|
|
215
|
+
}>;
|
|
216
|
+
/** Set clipboard contents */
|
|
217
|
+
clipboardSet(text: string): Promise<void>;
|
|
218
|
+
/** Detect if a dialog/alert is visible */
|
|
219
|
+
dialog(app?: string): Promise<DialogDetection>;
|
|
220
|
+
/** Accept (click OK/Save) the current dialog */
|
|
221
|
+
dialogAccept(app?: string): Promise<void>;
|
|
222
|
+
/** Cancel/dismiss the current dialog */
|
|
223
|
+
dialogCancel(app?: string): Promise<void>;
|
|
224
|
+
/** Set the filename in a file dialog */
|
|
225
|
+
dialogFile(path: string, app?: string): Promise<void>;
|
|
226
|
+
/** Wait for a fixed duration */
|
|
227
|
+
wait(ms: number): Promise<void>;
|
|
228
|
+
/** Wait for an app to launch */
|
|
229
|
+
waitForApp(name: string, options?: WaitOptions): Promise<void>;
|
|
230
|
+
/** Wait for a window with a given title */
|
|
231
|
+
waitForWindow(title: string, options?: WaitOptions): Promise<void>;
|
|
232
|
+
/** Wait for text to appear on screen */
|
|
233
|
+
waitForText(text: string, options?: WaitOptions & {
|
|
234
|
+
gone?: boolean;
|
|
235
|
+
}): Promise<void>;
|
|
236
|
+
/** Execute a batch of commands sequentially */
|
|
237
|
+
batch(commands: Array<[string, ...unknown[]]>, stopOnError?: boolean): Promise<Record<string, unknown>>;
|
|
238
|
+
/** Check if the UI has changed since last snapshot */
|
|
239
|
+
changed(app?: string): Promise<{
|
|
240
|
+
ok: boolean;
|
|
241
|
+
changed: boolean;
|
|
242
|
+
}>;
|
|
243
|
+
/** Get a diff of what changed since last snapshot */
|
|
244
|
+
diff(app?: string): Promise<DiffResult>;
|
|
245
|
+
/** Get daemon status */
|
|
246
|
+
status(): Promise<StatusInfo>;
|
|
247
|
+
/** Check permissions */
|
|
248
|
+
permissions(): Promise<PermissionsInfo>;
|
|
249
|
+
/** Get window title */
|
|
250
|
+
title(): Promise<{
|
|
251
|
+
title: string;
|
|
252
|
+
}>;
|
|
253
|
+
/** Disconnect from the daemon */
|
|
254
|
+
disconnect(): Promise<void>;
|
|
255
|
+
/** Shut down the daemon */
|
|
256
|
+
shutdown(): Promise<void>;
|
|
257
|
+
}
|
|
258
|
+
//# sourceMappingURL=sdk.d.ts.map
|
|
@@ -0,0 +1 @@
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O,CAAA;KAAE,CAAC;IAIvE,qDAAqD;IAC/C,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAM7C,wBAAwB;IAClB,MAAM,IAAI,OAAO,CAAC,UAAU,CAAC;IAInC,wBAAwB;IAClB,WAAW,IAAI,OAAO,CAAC,eAAe,CAAC;IAI7C,uBAAuB;IACjB,KAAK,IAAI,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAMzC,iCAAiC;IAC3B,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAIjC,2BAA2B;IACrB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAGhC"}
|
package/dist/src/sdk.js
ADDED
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
// High-level SDK wrapping Bridge with typed methods
|
|
2
|
+
import { Bridge } from './bridge.js';
|
|
3
|
+
/**
|
|
4
|
+
* High-level AC SDK for programmatic macOS desktop automation.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { AC } from '@skillful-agents/ac';
|
|
9
|
+
*
|
|
10
|
+
* const ac = new AC();
|
|
11
|
+
* await ac.launch('TextEdit');
|
|
12
|
+
* const snap = await ac.snapshot({ interactive: true });
|
|
13
|
+
* const textarea = snap.elements.find(e => e.role === 'textarea');
|
|
14
|
+
* if (textarea) {
|
|
15
|
+
* await ac.fill(textarea.ref, 'Hello from AC!');
|
|
16
|
+
* }
|
|
17
|
+
* await ac.quit('TextEdit');
|
|
18
|
+
* await ac.disconnect();
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export class AC {
|
|
22
|
+
bridge;
|
|
23
|
+
constructor(options = {}) {
|
|
24
|
+
this.bridge = new Bridge(options);
|
|
25
|
+
}
|
|
26
|
+
// MARK: - Snapshot & Observation
|
|
27
|
+
/** Take a snapshot of the accessibility tree */
|
|
28
|
+
async snapshot(options = {}) {
|
|
29
|
+
return await this.bridge.send('snapshot', { ...options });
|
|
30
|
+
}
|
|
31
|
+
/** Find elements by text and/or role */
|
|
32
|
+
async find(text, options = {}) {
|
|
33
|
+
return await this.bridge.send('find', { text, ...options });
|
|
34
|
+
}
|
|
35
|
+
/** Read an element's value */
|
|
36
|
+
async read(ref, attr) {
|
|
37
|
+
return await this.bridge.send('read', { ref, ...(attr ? { attr } : {}) });
|
|
38
|
+
}
|
|
39
|
+
/** Get element bounds */
|
|
40
|
+
async box(ref) {
|
|
41
|
+
return await this.bridge.send('box', { ref });
|
|
42
|
+
}
|
|
43
|
+
/** Check element state (visible, enabled, focused, checked) */
|
|
44
|
+
async is(state, ref) {
|
|
45
|
+
return await this.bridge.send('is', { state, ref });
|
|
46
|
+
}
|
|
47
|
+
/** Get children of an element */
|
|
48
|
+
async children(ref) {
|
|
49
|
+
return await this.bridge.send('children', { ref });
|
|
50
|
+
}
|
|
51
|
+
// MARK: - Actions
|
|
52
|
+
/** Click an element by ref */
|
|
53
|
+
async click(ref, options = {}) {
|
|
54
|
+
await this.bridge.send('click', { ref, ...options });
|
|
55
|
+
}
|
|
56
|
+
/** Click at screen coordinates */
|
|
57
|
+
async clickAt(x, y, options = {}) {
|
|
58
|
+
await this.bridge.send('click', { x, y, ...options });
|
|
59
|
+
}
|
|
60
|
+
/** Hover over an element */
|
|
61
|
+
async hover(ref) {
|
|
62
|
+
await this.bridge.send('hover', { ref });
|
|
63
|
+
}
|
|
64
|
+
/** Hover at coordinates */
|
|
65
|
+
async hoverAt(x, y) {
|
|
66
|
+
await this.bridge.send('hover', { x, y });
|
|
67
|
+
}
|
|
68
|
+
/** Type text into the frontmost app */
|
|
69
|
+
async type(text, options = {}) {
|
|
70
|
+
await this.bridge.send('type', { text, ...options });
|
|
71
|
+
}
|
|
72
|
+
/** Fill an element with text (focus, clear, type) */
|
|
73
|
+
async fill(ref, text) {
|
|
74
|
+
await this.bridge.send('fill', { ref, text });
|
|
75
|
+
}
|
|
76
|
+
/** Press a key combination */
|
|
77
|
+
async key(combo, repeat) {
|
|
78
|
+
await this.bridge.send('key', { combo, ...(repeat ? { repeat } : {}) });
|
|
79
|
+
}
|
|
80
|
+
/** Paste text via clipboard */
|
|
81
|
+
async paste(text) {
|
|
82
|
+
await this.bridge.send('paste', { text });
|
|
83
|
+
}
|
|
84
|
+
/** Focus an element */
|
|
85
|
+
async focus(ref) {
|
|
86
|
+
await this.bridge.send('focus', { ref });
|
|
87
|
+
}
|
|
88
|
+
/** Check a checkbox */
|
|
89
|
+
async check(ref) {
|
|
90
|
+
await this.bridge.send('check', { ref });
|
|
91
|
+
}
|
|
92
|
+
/** Uncheck a checkbox */
|
|
93
|
+
async uncheck(ref) {
|
|
94
|
+
await this.bridge.send('uncheck', { ref });
|
|
95
|
+
}
|
|
96
|
+
/** Select a value in a dropdown */
|
|
97
|
+
async select(ref, value) {
|
|
98
|
+
await this.bridge.send('select', { ref, value });
|
|
99
|
+
}
|
|
100
|
+
/** Set a value on an element */
|
|
101
|
+
async set(ref, value) {
|
|
102
|
+
await this.bridge.send('set', { ref, value });
|
|
103
|
+
}
|
|
104
|
+
/** Scroll in a direction */
|
|
105
|
+
async scroll(direction, options = {}) {
|
|
106
|
+
await this.bridge.send('scroll', { direction, ...options });
|
|
107
|
+
}
|
|
108
|
+
/** Drag from one element/position to another */
|
|
109
|
+
async drag(from, to, options = {}) {
|
|
110
|
+
const params = { ...options };
|
|
111
|
+
if (typeof from === 'string')
|
|
112
|
+
params.from_ref = from;
|
|
113
|
+
else {
|
|
114
|
+
params.from_x = from.x;
|
|
115
|
+
params.from_y = from.y;
|
|
116
|
+
}
|
|
117
|
+
if (typeof to === 'string')
|
|
118
|
+
params.to_ref = to;
|
|
119
|
+
else {
|
|
120
|
+
params.to_x = to.x;
|
|
121
|
+
params.to_y = to.y;
|
|
122
|
+
}
|
|
123
|
+
await this.bridge.send('drag', params);
|
|
124
|
+
}
|
|
125
|
+
// MARK: - Menu
|
|
126
|
+
/** Click a menu item by path (e.g. "File > Save") */
|
|
127
|
+
async menuClick(path, app) {
|
|
128
|
+
await this.bridge.send('menu_click', { path, ...(app ? { app } : {}) });
|
|
129
|
+
}
|
|
130
|
+
/** List menu items */
|
|
131
|
+
async menuList(menuName, options = {}) {
|
|
132
|
+
return await this.bridge.send('menu_list', { ...(menuName ? { menu: menuName } : {}), ...options });
|
|
133
|
+
}
|
|
134
|
+
// MARK: - Apps & Windows
|
|
135
|
+
/** List running applications */
|
|
136
|
+
async apps() {
|
|
137
|
+
return await this.bridge.send('apps');
|
|
138
|
+
}
|
|
139
|
+
/** Launch an application */
|
|
140
|
+
async launch(name, options = {}) {
|
|
141
|
+
await this.bridge.send('launch', { name, ...options });
|
|
142
|
+
}
|
|
143
|
+
/** Quit an application */
|
|
144
|
+
async quit(name, options = {}) {
|
|
145
|
+
await this.bridge.send('quit', { name, ...options });
|
|
146
|
+
}
|
|
147
|
+
/** Relaunch an application with CDP support (quit + launch with --remote-debugging-port) */
|
|
148
|
+
async relaunch(name, options = {}) {
|
|
149
|
+
await this.bridge.send('relaunch', { name, ...options });
|
|
150
|
+
}
|
|
151
|
+
/** Switch to (activate) an application */
|
|
152
|
+
async switch(name) {
|
|
153
|
+
await this.bridge.send('switch', { name });
|
|
154
|
+
}
|
|
155
|
+
/** List windows */
|
|
156
|
+
async windows(app) {
|
|
157
|
+
return await this.bridge.send('windows', app ? { app } : {});
|
|
158
|
+
}
|
|
159
|
+
/** Grab (lock onto) a window for subsequent commands */
|
|
160
|
+
async grab(refOrApp) {
|
|
161
|
+
if (refOrApp.startsWith('@')) {
|
|
162
|
+
await this.bridge.send('grab', { ref: refOrApp });
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
await this.bridge.send('grab', { app: refOrApp });
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
/** Release the grabbed window */
|
|
169
|
+
async ungrab() {
|
|
170
|
+
await this.bridge.send('ungrab');
|
|
171
|
+
}
|
|
172
|
+
// MARK: - Window Management
|
|
173
|
+
async minimize(ref) {
|
|
174
|
+
await this.bridge.send('minimize', ref ? { ref } : {});
|
|
175
|
+
}
|
|
176
|
+
async maximize(ref) {
|
|
177
|
+
await this.bridge.send('maximize', ref ? { ref } : {});
|
|
178
|
+
}
|
|
179
|
+
async fullscreen(ref) {
|
|
180
|
+
await this.bridge.send('fullscreen', ref ? { ref } : {});
|
|
181
|
+
}
|
|
182
|
+
async closeWindow(ref) {
|
|
183
|
+
await this.bridge.send('close', ref ? { ref } : {});
|
|
184
|
+
}
|
|
185
|
+
async raise(ref) {
|
|
186
|
+
await this.bridge.send('raise', ref ? { ref } : {});
|
|
187
|
+
}
|
|
188
|
+
async move(x, y, ref) {
|
|
189
|
+
await this.bridge.send('move', { x, y, ...(ref ? { ref } : {}) });
|
|
190
|
+
}
|
|
191
|
+
async resize(width, height, ref) {
|
|
192
|
+
await this.bridge.send('resize', { width, height, ...(ref ? { ref } : {}) });
|
|
193
|
+
}
|
|
194
|
+
async bounds(preset, ref) {
|
|
195
|
+
await this.bridge.send('bounds', { preset, ...(ref ? { ref } : {}) });
|
|
196
|
+
}
|
|
197
|
+
// MARK: - Screenshot & Displays
|
|
198
|
+
/** Take a screenshot */
|
|
199
|
+
async screenshot(options = {}) {
|
|
200
|
+
return await this.bridge.send('screenshot', { ...options });
|
|
201
|
+
}
|
|
202
|
+
/** List displays */
|
|
203
|
+
async displays() {
|
|
204
|
+
return await this.bridge.send('displays');
|
|
205
|
+
}
|
|
206
|
+
// MARK: - Clipboard
|
|
207
|
+
/** Read clipboard contents */
|
|
208
|
+
async clipboardRead() {
|
|
209
|
+
return await this.bridge.send('clipboard_read');
|
|
210
|
+
}
|
|
211
|
+
/** Set clipboard contents */
|
|
212
|
+
async clipboardSet(text) {
|
|
213
|
+
await this.bridge.send('clipboard_set', { text });
|
|
214
|
+
}
|
|
215
|
+
// MARK: - Dialog
|
|
216
|
+
/** Detect if a dialog/alert is visible */
|
|
217
|
+
async dialog(app) {
|
|
218
|
+
return await this.bridge.send('dialog', app ? { app } : {});
|
|
219
|
+
}
|
|
220
|
+
/** Accept (click OK/Save) the current dialog */
|
|
221
|
+
async dialogAccept(app) {
|
|
222
|
+
await this.bridge.send('dialog_accept', app ? { app } : {});
|
|
223
|
+
}
|
|
224
|
+
/** Cancel/dismiss the current dialog */
|
|
225
|
+
async dialogCancel(app) {
|
|
226
|
+
await this.bridge.send('dialog_cancel', app ? { app } : {});
|
|
227
|
+
}
|
|
228
|
+
/** Set the filename in a file dialog */
|
|
229
|
+
async dialogFile(path, app) {
|
|
230
|
+
await this.bridge.send('dialog_file', { path, ...(app ? { app } : {}) });
|
|
231
|
+
}
|
|
232
|
+
// MARK: - Wait
|
|
233
|
+
/** Wait for a fixed duration */
|
|
234
|
+
async wait(ms) {
|
|
235
|
+
await this.bridge.send('wait', { ms });
|
|
236
|
+
}
|
|
237
|
+
/** Wait for an app to launch */
|
|
238
|
+
async waitForApp(name, options = {}) {
|
|
239
|
+
await this.bridge.send('wait', { app: name, ...options });
|
|
240
|
+
}
|
|
241
|
+
/** Wait for a window with a given title */
|
|
242
|
+
async waitForWindow(title, options = {}) {
|
|
243
|
+
await this.bridge.send('wait', { window: title, ...options });
|
|
244
|
+
}
|
|
245
|
+
/** Wait for text to appear on screen */
|
|
246
|
+
async waitForText(text, options = {}) {
|
|
247
|
+
await this.bridge.send('wait', { text, ...options });
|
|
248
|
+
}
|
|
249
|
+
// MARK: - Batch & Diff
|
|
250
|
+
/** Execute a batch of commands sequentially */
|
|
251
|
+
async batch(commands, stopOnError = true) {
|
|
252
|
+
return await this.bridge.send('batch', { commands, stop_on_error: stopOnError });
|
|
253
|
+
}
|
|
254
|
+
/** Check if the UI has changed since last snapshot */
|
|
255
|
+
async changed(app) {
|
|
256
|
+
return await this.bridge.send('changed', app ? { app } : {});
|
|
257
|
+
}
|
|
258
|
+
/** Get a diff of what changed since last snapshot */
|
|
259
|
+
async diff(app) {
|
|
260
|
+
return await this.bridge.send('diff', app ? { app } : {});
|
|
261
|
+
}
|
|
262
|
+
// MARK: - Status
|
|
263
|
+
/** Get daemon status */
|
|
264
|
+
async status() {
|
|
265
|
+
return await this.bridge.send('status');
|
|
266
|
+
}
|
|
267
|
+
/** Check permissions */
|
|
268
|
+
async permissions() {
|
|
269
|
+
return await this.bridge.send('permissions');
|
|
270
|
+
}
|
|
271
|
+
/** Get window title */
|
|
272
|
+
async title() {
|
|
273
|
+
return await this.bridge.send('title');
|
|
274
|
+
}
|
|
275
|
+
// MARK: - Lifecycle
|
|
276
|
+
/** Disconnect from the daemon */
|
|
277
|
+
async disconnect() {
|
|
278
|
+
await this.bridge.disconnect();
|
|
279
|
+
}
|
|
280
|
+
/** Shut down the daemon */
|
|
281
|
+
async shutdown() {
|
|
282
|
+
await this.bridge.shutdown();
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
//# sourceMappingURL=sdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/sdk.ts"],"names":[],"mappings":"AAAA,oDAAoD;AAEpD,OAAO,EAAE,MAAM,EAAsB,MAAM,aAAa,CAAC;AA8FzD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAO,EAAE;IACL,MAAM,CAAS;IAEvB,YAAY,UAAyB,EAAE;QACrC,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;IAED,iCAAiC;IAEjC,gDAAgD;IAChD,KAAK,CAAC,QAAQ,CAAC,UAA2B,EAAE;QAC1C,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,GAAG,OAAO,EAAE,CAAmB,CAAC;IAC9E,CAAC;IAED,wCAAwC;IACxC,KAAK,CAAC,IAAI,CAAC,IAAY,EAAE,UAAuB,EAAE;QAChD,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,GAAG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CAAC;IAC9D,CAAC;IAED,oBAAoB;IAEpB,iCAAiC;IACjC,KAAK,CAAC,UAAU;QACd,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;IACjC,CAAC;IAED,2BAA2B;IAC3B,KAAK,CAAC,QAAQ;QACZ,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC/B,CAAC;CACF"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
export type RefPrefix = 'b' | 't' | 'l' | 'm' | 'c' | 'r' | 's' | 'd' | 'i' | 'g' | 'w' | 'x' | 'o' | 'a' | 'e' | 'cb' | 'sa' | 'st' | 'sp' | 'tl' | 'pg' | 'tv' | 'wb';
|
|
2
|
+
export type Ref = `@${RefPrefix}${number}`;
|
|
3
|
+
export interface Element {
|
|
4
|
+
ref: string;
|
|
5
|
+
role: string;
|
|
6
|
+
label: string | null;
|
|
7
|
+
value: string | null;
|
|
8
|
+
enabled: boolean;
|
|
9
|
+
focused: boolean;
|
|
10
|
+
bounds: [x: number, y: number, w: number, h: number];
|
|
11
|
+
children?: Element[];
|
|
12
|
+
}
|
|
13
|
+
export interface Snapshot {
|
|
14
|
+
snapshot_id: string;
|
|
15
|
+
window: WindowInfo;
|
|
16
|
+
elements: Element[];
|
|
17
|
+
fallback: 'ocr' | null;
|
|
18
|
+
}
|
|
19
|
+
export interface WindowInfo {
|
|
20
|
+
ref: string;
|
|
21
|
+
title: string;
|
|
22
|
+
app: string;
|
|
23
|
+
bundle_id?: string;
|
|
24
|
+
process_id: number;
|
|
25
|
+
bounds: [x: number, y: number, w: number, h: number];
|
|
26
|
+
minimized: boolean;
|
|
27
|
+
hidden: boolean;
|
|
28
|
+
fullscreen: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface ScreenshotResult {
|
|
31
|
+
path: string;
|
|
32
|
+
width: number;
|
|
33
|
+
height: number;
|
|
34
|
+
annotations?: Array<{
|
|
35
|
+
ref: string;
|
|
36
|
+
label: string;
|
|
37
|
+
bounds: [number, number, number, number];
|
|
38
|
+
}>;
|
|
39
|
+
}
|
|
40
|
+
export interface RecordingStatus {
|
|
41
|
+
active: boolean;
|
|
42
|
+
path?: string;
|
|
43
|
+
duration_ms?: number;
|
|
44
|
+
}
|
|
45
|
+
export interface DialogInfo {
|
|
46
|
+
type: 'alert' | 'file-open' | 'file-save' | 'custom';
|
|
47
|
+
message?: string;
|
|
48
|
+
buttons: string[];
|
|
49
|
+
elements: Element[];
|
|
50
|
+
}
|
|
51
|
+
export interface AppInfo {
|
|
52
|
+
name: string;
|
|
53
|
+
bundle_id?: string;
|
|
54
|
+
process_id: number;
|
|
55
|
+
is_active: boolean;
|
|
56
|
+
is_hidden: boolean;
|
|
57
|
+
}
|
|
58
|
+
export interface StatusInfo {
|
|
59
|
+
grabbed_window: string | null;
|
|
60
|
+
grabbed_app: string | null;
|
|
61
|
+
grabbed_pid: number | null;
|
|
62
|
+
last_snapshot_id: string | null;
|
|
63
|
+
daemon_pid: number | null;
|
|
64
|
+
daemon_uptime_ms: number | null;
|
|
65
|
+
}
|
|
66
|
+
export interface PermissionsInfo {
|
|
67
|
+
accessibility: boolean;
|
|
68
|
+
screen_recording: boolean;
|
|
69
|
+
}
|
|
70
|
+
export interface DoctorResult {
|
|
71
|
+
version: string;
|
|
72
|
+
permissions: PermissionsInfo;
|
|
73
|
+
daemon: {
|
|
74
|
+
running: boolean;
|
|
75
|
+
pid?: number;
|
|
76
|
+
uptime_ms?: number;
|
|
77
|
+
};
|
|
78
|
+
binary_path: string;
|
|
79
|
+
platform: string;
|
|
80
|
+
arch: string;
|
|
81
|
+
}
|
|
82
|
+
export interface DisplayInfo {
|
|
83
|
+
id: number;
|
|
84
|
+
width: number;
|
|
85
|
+
height: number;
|
|
86
|
+
x: number;
|
|
87
|
+
y: number;
|
|
88
|
+
is_main: boolean;
|
|
89
|
+
scale_factor: number;
|
|
90
|
+
}
|
|
91
|
+
export declare const NORMALIZED_ROLES: readonly ["button", "textfield", "textarea", "link", "checkbox", "radio", "slider", "dropdown", "image", "group", "window", "table", "row", "cell", "tabgroup", "tab", "menubar", "menuitem", "scrollarea", "text", "toolbar", "combobox", "stepper", "splitgroup", "timeline", "progress", "treeview", "webarea", "generic"];
|
|
92
|
+
export type NormalizedRole = typeof NORMALIZED_ROLES[number];
|
|
93
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,SAAS,GACjB,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GACvF,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE1D,MAAM,MAAM,GAAG,GAAG,IAAI,SAAS,GAAG,MAAM,EAAE,CAAC;AAE3C,MAAM,WAAW,OAAO;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;IACrD,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,QAAQ;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,UAAU,CAAC;IACnB,QAAQ,EAAE,OAAO,EAAE,CAAC;I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