@lingxia/types 0.10.0 → 0.12.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/dist/automation/index.d.ts +1228 -0
- package/dist/automation/index.d.ts.map +1 -0
- package/dist/automation/index.js +13 -0
- package/dist/automation/index.js.map +1 -0
- package/dist/automation-test-globals.d.ts +14 -0
- package/dist/error.d.ts +13 -0
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +47 -1
- package/dist/error.js.map +1 -1
- package/dist/generated/i18n.d.ts +1 -1
- package/dist/generated/i18n.d.ts.map +1 -1
- package/dist/generated/i18n.js +37 -0
- package/dist/generated/i18n.js.map +1 -1
- package/dist/generated/logic-web.d.ts +305 -0
- package/dist/generated/logic.d.ts +2502 -0
- package/dist/generated/logic.d.ts.map +1 -0
- package/dist/generated/logic.js +5 -0
- package/dist/generated/logic.js.map +1 -0
- package/dist/index.d.ts +25 -313
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -16
- package/dist/index.js.map +1 -1
- package/dist/logic-globals.d.ts +1 -0
- package/dist/process.d.ts +117 -0
- package/dist/process.d.ts.map +1 -0
- package/dist/process.js +10 -0
- package/dist/process.js.map +1 -0
- package/dist/testing/public-api.d.ts +429 -0
- package/dist/testing/public-api.d.ts.map +1 -0
- package/dist/testing/public-api.js +588 -0
- package/dist/testing/public-api.js.map +1 -0
- package/dist/testing/public-api.mjs +584 -0
- package/package.json +83 -48
- package/src/automation/index.ts +1370 -0
- package/src/error.ts +47 -1
- package/src/generated/i18n.ts +37 -0
- package/src/generated/logic-web.d.ts +305 -0
- package/src/generated/logic.ts +2753 -0
- package/src/index.ts +34 -459
- package/src/logic-globals.d.ts +1 -0
- package/src/process.ts +135 -0
- package/src/testing/public-api.ts +716 -0
- package/dist/app/index.d.ts +0 -328
- package/dist/app/index.d.ts.map +0 -1
- package/dist/app/index.js +0 -6
- package/dist/app/index.js.map +0 -1
- package/dist/device/actions.d.ts +0 -7
- package/dist/device/actions.d.ts.map +0 -1
- package/dist/device/actions.js +0 -6
- package/dist/device/actions.js.map +0 -1
- package/dist/device/index.d.ts +0 -5
- package/dist/device/index.d.ts.map +0 -1
- package/dist/device/index.js +0 -21
- package/dist/device/index.js.map +0 -1
- package/dist/device/info.d.ts +0 -16
- package/dist/device/info.d.ts.map +0 -1
- package/dist/device/info.js +0 -6
- package/dist/device/info.js.map +0 -1
- package/dist/device/network.d.ts +0 -12
- package/dist/device/network.d.ts.map +0 -1
- package/dist/device/network.js +0 -6
- package/dist/device/network.js.map +0 -1
- package/dist/device/wifi.d.ts +0 -20
- package/dist/device/wifi.d.ts.map +0 -1
- package/dist/device/wifi.js +0 -6
- package/dist/device/wifi.js.map +0 -1
- package/dist/display/index.d.ts +0 -8
- package/dist/display/index.d.ts.map +0 -1
- package/dist/display/index.js +0 -6
- package/dist/display/index.js.map +0 -1
- package/dist/env/index.d.ts +0 -8
- package/dist/env/index.d.ts.map +0 -1
- package/dist/env/index.js +0 -6
- package/dist/env/index.js.map +0 -1
- package/dist/file/index.d.ts +0 -146
- package/dist/file/index.d.ts.map +0 -1
- package/dist/file/index.js +0 -6
- package/dist/file/index.js.map +0 -1
- package/dist/input/index.d.ts +0 -18
- package/dist/input/index.d.ts.map +0 -1
- package/dist/input/index.js +0 -8
- package/dist/input/index.js.map +0 -1
- package/dist/location/index.d.ts +0 -19
- package/dist/location/index.d.ts.map +0 -1
- package/dist/location/index.js +0 -6
- package/dist/location/index.js.map +0 -1
- package/dist/lxapp/index.d.ts +0 -11
- package/dist/lxapp/index.d.ts.map +0 -1
- package/dist/lxapp/index.js +0 -6
- package/dist/lxapp/index.js.map +0 -1
- package/dist/media/index.d.ts +0 -372
- package/dist/media/index.d.ts.map +0 -1
- package/dist/media/index.js +0 -6
- package/dist/media/index.js.map +0 -1
- package/dist/navigator/index.d.ts +0 -14
- package/dist/navigator/index.d.ts.map +0 -1
- package/dist/navigator/index.js +0 -6
- package/dist/navigator/index.js.map +0 -1
- package/dist/share/index.d.ts +0 -90
- package/dist/share/index.d.ts.map +0 -1
- package/dist/share/index.js +0 -6
- package/dist/share/index.js.map +0 -1
- package/dist/storage/index.d.ts +0 -13
- package/dist/storage/index.d.ts.map +0 -1
- package/dist/storage/index.js +0 -6
- package/dist/storage/index.js.map +0 -1
- package/dist/system/index.d.ts +0 -9
- package/dist/system/index.d.ts.map +0 -1
- package/dist/system/index.js +0 -6
- package/dist/system/index.js.map +0 -1
- package/dist/transfer/index.d.ts +0 -166
- package/dist/transfer/index.d.ts.map +0 -1
- package/dist/transfer/index.js +0 -6
- package/dist/transfer/index.js.map +0 -1
- package/dist/ui/index.d.ts +0 -134
- package/dist/ui/index.d.ts.map +0 -1
- package/dist/ui/index.js +0 -6
- package/dist/ui/index.js.map +0 -1
- package/dist/update/index.d.ts +0 -17
- package/dist/update/index.d.ts.map +0 -1
- package/dist/update/index.js +0 -6
- package/dist/update/index.js.map +0 -1
- package/src/app/index.ts +0 -378
- package/src/device/actions.ts +0 -7
- package/src/device/index.ts +0 -4
- package/src/device/info.ts +0 -17
- package/src/device/network.ts +0 -23
- package/src/device/wifi.ts +0 -23
- package/src/display/index.ts +0 -9
- package/src/env/index.ts +0 -8
- package/src/file/index.ts +0 -171
- package/src/input/index.ts +0 -19
- package/src/location/index.ts +0 -20
- package/src/lxapp/index.ts +0 -12
- package/src/media/index.ts +0 -411
- package/src/navigator/index.ts +0 -16
- package/src/share/index.ts +0 -97
- package/src/storage/index.ts +0 -13
- package/src/system/index.ts +0 -9
- package/src/transfer/index.ts +0 -194
- package/src/ui/index.ts +0 -165
- package/src/update/index.ts +0 -19
|
@@ -0,0 +1,1228 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* In-process UI/runtime automation — `lx.automation()`.
|
|
3
|
+
*
|
|
4
|
+
* Returns a stable selector root. Selecting the calling lxapp requires the
|
|
5
|
+
* `automation` security privilege; cross-lxapp and host surfaces require
|
|
6
|
+
* `host`. `lingxia dev` sessions and the Runner grant both implicitly.
|
|
7
|
+
*
|
|
8
|
+
* This mirrors the devtool (`lxdev`) automation surface as a privilege-scoped,
|
|
9
|
+
* product-side API.
|
|
10
|
+
*/
|
|
11
|
+
import type { TerminalSettingsValue } from '../generated/logic.js';
|
|
12
|
+
/** Stable automation root; it grants no capability until one is selected. */
|
|
13
|
+
export interface Automation {
|
|
14
|
+
/** Drive the calling/current lxapp. Requires `automation` outside dev. */
|
|
15
|
+
lxapp(): LxAppDriver;
|
|
16
|
+
/** Drive a specific running lxapp. Requires `host` outside dev. */
|
|
17
|
+
lxapp(appid: string): LxAppDriver;
|
|
18
|
+
/** Cross-lxapp lifecycle and host-window capture. */
|
|
19
|
+
readonly lxapps: LxAppManager;
|
|
20
|
+
/** The host app's browser tabs. */
|
|
21
|
+
readonly browser: BrowserDriver;
|
|
22
|
+
/** Persisted host-shell shortcuts for deterministic test setup/assertion. */
|
|
23
|
+
readonly shell: ShellDriver;
|
|
24
|
+
/** Simulated-device selection in a host runner. */
|
|
25
|
+
readonly device: DeviceDriver;
|
|
26
|
+
/**
|
|
27
|
+
* Session-less local-OS desktop automation (`lxdev desktop`). Beyond the
|
|
28
|
+
* app sandbox, so restricted to dev/test hosts (`lingxia dev` or the
|
|
29
|
+
* Runner) on top of the `host` privilege. Windows/macOS only.
|
|
30
|
+
*/
|
|
31
|
+
readonly desktop: DesktopDriver;
|
|
32
|
+
/** Native terminal workspace state and pane actions in trusted dev/test hosts. */
|
|
33
|
+
readonly terminal: TerminalDriver;
|
|
34
|
+
}
|
|
35
|
+
export type TerminalSplitDirection = 'left' | 'right' | 'up' | 'down';
|
|
36
|
+
export interface TerminalSurfaceRef {
|
|
37
|
+
/** Stable id returned by `lx.shell.openDeclared('terminal', { key })`. */
|
|
38
|
+
surface: string;
|
|
39
|
+
}
|
|
40
|
+
export interface TerminalPaneSnapshot {
|
|
41
|
+
paneId: string;
|
|
42
|
+
active: boolean;
|
|
43
|
+
visible: boolean;
|
|
44
|
+
frame: {
|
|
45
|
+
x: number;
|
|
46
|
+
y: number;
|
|
47
|
+
width: number;
|
|
48
|
+
height: number;
|
|
49
|
+
};
|
|
50
|
+
grid: {
|
|
51
|
+
cols: number;
|
|
52
|
+
rows: number;
|
|
53
|
+
generation: number;
|
|
54
|
+
imageGeneration: number;
|
|
55
|
+
imageCount: number;
|
|
56
|
+
imagePlacementCount: number;
|
|
57
|
+
defaultForeground: number;
|
|
58
|
+
defaultBackground: number;
|
|
59
|
+
cursorRow: number;
|
|
60
|
+
cursorCol: number;
|
|
61
|
+
cursorVisible: boolean;
|
|
62
|
+
cursorStyle: 'block' | 'bar' | 'underline' | 'block-hollow';
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export type TerminalPaneTree = {
|
|
66
|
+
kind: 'leaf';
|
|
67
|
+
pane: TerminalPaneSnapshot;
|
|
68
|
+
} | {
|
|
69
|
+
kind: 'split';
|
|
70
|
+
/** `horizontal` places children left/right; `vertical` stacks them. */
|
|
71
|
+
axis: 'horizontal' | 'vertical';
|
|
72
|
+
children: TerminalPaneTree[];
|
|
73
|
+
};
|
|
74
|
+
export interface TerminalTabSnapshot {
|
|
75
|
+
id: string;
|
|
76
|
+
active: boolean;
|
|
77
|
+
activePaneId?: string;
|
|
78
|
+
paneCount: number;
|
|
79
|
+
tree?: TerminalPaneTree;
|
|
80
|
+
}
|
|
81
|
+
/** Semantic state published by the native terminal host after layout. */
|
|
82
|
+
export interface TerminalWorkspaceSnapshot {
|
|
83
|
+
surfaceId: string;
|
|
84
|
+
presentation: 'main' | 'aside';
|
|
85
|
+
visible: boolean;
|
|
86
|
+
/** Expanded to the full content area rather than its docked size. */
|
|
87
|
+
maximized: boolean;
|
|
88
|
+
activeTabId?: string;
|
|
89
|
+
tabCount: number;
|
|
90
|
+
paneCount: number;
|
|
91
|
+
configGeneration: number;
|
|
92
|
+
visualGeneration: number;
|
|
93
|
+
config: TerminalSettingsValue;
|
|
94
|
+
chrome: {
|
|
95
|
+
surface: string;
|
|
96
|
+
header: string;
|
|
97
|
+
separator: string;
|
|
98
|
+
text: string;
|
|
99
|
+
textMuted: string;
|
|
100
|
+
cursor: string;
|
|
101
|
+
selectionBackground: string;
|
|
102
|
+
selectionForeground: string;
|
|
103
|
+
};
|
|
104
|
+
tabs: TerminalTabSnapshot[];
|
|
105
|
+
}
|
|
106
|
+
export interface TerminalSplitOptions extends TerminalSurfaceRef {
|
|
107
|
+
direction: TerminalSplitDirection;
|
|
108
|
+
}
|
|
109
|
+
/** Native terminal automation; available only to trusted dev/test hosts. */
|
|
110
|
+
export interface TerminalDriver {
|
|
111
|
+
snapshot(options: TerminalSurfaceRef): Promise<TerminalWorkspaceSnapshot>;
|
|
112
|
+
/** Send text to the focused pane, as if typed into its PTY. */
|
|
113
|
+
input(options: TerminalInputOptions): Promise<TerminalWorkspaceSnapshot>;
|
|
114
|
+
split(options: TerminalSplitOptions): Promise<TerminalWorkspaceSnapshot>;
|
|
115
|
+
/** Open a tab and activate it. Resolves with the snapshot that follows. */
|
|
116
|
+
newTab(options: TerminalSurfaceRef): Promise<TerminalWorkspaceSnapshot>;
|
|
117
|
+
/** Expand to the full content area, or return to the docked size. */
|
|
118
|
+
setMaximized(options: TerminalMaximizeOptions): Promise<TerminalWorkspaceSnapshot>;
|
|
119
|
+
}
|
|
120
|
+
export interface TerminalInputOptions extends TerminalSurfaceRef {
|
|
121
|
+
text: string;
|
|
122
|
+
}
|
|
123
|
+
export interface TerminalMaximizeOptions extends TerminalSurfaceRef {
|
|
124
|
+
maximized: boolean;
|
|
125
|
+
}
|
|
126
|
+
/** One ordered shortcut in the host shell's persisted Pin collection. */
|
|
127
|
+
export type AutomationShellPin = {
|
|
128
|
+
/** A host workspace shortcut; activation opens/focuses the app as main. */
|
|
129
|
+
kind: 'lxapp';
|
|
130
|
+
/** Installed lxapp id. This is not a page name or route. */
|
|
131
|
+
key: string;
|
|
132
|
+
} | {
|
|
133
|
+
/** A website shortcut opened/focused as a main browser tab. */
|
|
134
|
+
kind: 'bookmark';
|
|
135
|
+
/** Persisted bookmark id. */
|
|
136
|
+
key: string;
|
|
137
|
+
};
|
|
138
|
+
export type SetAutomationShellPinOptions = AutomationShellPin & {
|
|
139
|
+
pinned: boolean;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Host-shell state for test setup and end-to-end assertions. This does not
|
|
143
|
+
* customize an lxapp's production shell; use `lx.shell` for app behavior.
|
|
144
|
+
*/
|
|
145
|
+
export interface ShellDriver {
|
|
146
|
+
/** Ordered shortcuts exactly as projected into the host sidebar. */
|
|
147
|
+
pins(): Promise<AutomationShellPin[]>;
|
|
148
|
+
/**
|
|
149
|
+
* Idempotently persist or remove one shortcut. New Pins append to the
|
|
150
|
+
* existing order; adding beyond the host limit rejects without mutation.
|
|
151
|
+
* Returns the resulting complete order.
|
|
152
|
+
*/
|
|
153
|
+
setPin(options: SetAutomationShellPinOptions): Promise<AutomationShellPin[]>;
|
|
154
|
+
}
|
|
155
|
+
/** Fields common to every page action; `page` defaults to the current page. */
|
|
156
|
+
export interface PageTarget {
|
|
157
|
+
/** Configured page name (from lxapp.json); defaults to the current page. */
|
|
158
|
+
page?: string;
|
|
159
|
+
}
|
|
160
|
+
export interface PageEvalOptions extends PageTarget {
|
|
161
|
+
/** JavaScript expression or function body evaluated in the page WebView. */
|
|
162
|
+
script: string;
|
|
163
|
+
timeoutMs?: number;
|
|
164
|
+
}
|
|
165
|
+
export interface PageQueryOptions extends PageTarget {
|
|
166
|
+
/** CSS selector. */
|
|
167
|
+
css: string;
|
|
168
|
+
/** Target the nth match (single-element mode). */
|
|
169
|
+
index?: number;
|
|
170
|
+
/** Return every match as `{ count, items }` instead of a single element. */
|
|
171
|
+
all?: boolean;
|
|
172
|
+
/** Cap text/value length (default 4096). */
|
|
173
|
+
maxText?: number;
|
|
174
|
+
/** Return untruncated text/value (ignores `maxText`). */
|
|
175
|
+
full?: boolean;
|
|
176
|
+
}
|
|
177
|
+
export interface PageSelectorOptions extends PageTarget {
|
|
178
|
+
css: string;
|
|
179
|
+
/** Target the nth match. */
|
|
180
|
+
index?: number;
|
|
181
|
+
}
|
|
182
|
+
export interface PageTypeOptions extends PageSelectorOptions {
|
|
183
|
+
text: string;
|
|
184
|
+
}
|
|
185
|
+
export interface PagePressOptions extends PageTarget {
|
|
186
|
+
/** Key name, e.g. `Enter`, `Escape`, `Tab`. */
|
|
187
|
+
key: string;
|
|
188
|
+
/** Focus this CSS selector before pressing; otherwise use the current focus. */
|
|
189
|
+
css?: string;
|
|
190
|
+
/** Target the nth selector match. Requires `css`. */
|
|
191
|
+
index?: number;
|
|
192
|
+
}
|
|
193
|
+
export interface PageScrollOptions extends PageTarget {
|
|
194
|
+
/** Horizontal delta in CSS pixels. */
|
|
195
|
+
dx?: number;
|
|
196
|
+
/** Vertical delta in CSS pixels (positive scrolls down). */
|
|
197
|
+
dy?: number;
|
|
198
|
+
}
|
|
199
|
+
export interface PageScrollToOptions extends PageTarget {
|
|
200
|
+
/** CSS selector of the element to reveal (first match). */
|
|
201
|
+
css: string;
|
|
202
|
+
}
|
|
203
|
+
export type PageWaitState = 'attached' | 'detached' | 'visible' | 'hidden' | 'enabled' | 'editable'
|
|
204
|
+
/** @deprecated Use `attached`. */
|
|
205
|
+
| 'exists'
|
|
206
|
+
/** @deprecated Use `detached`. */
|
|
207
|
+
| 'gone';
|
|
208
|
+
export interface PageWaitForOptions extends PageTarget {
|
|
209
|
+
css: string;
|
|
210
|
+
/** Condition to await (default `visible`). */
|
|
211
|
+
state?: PageWaitState;
|
|
212
|
+
/** Timeout in ms (default 10000, capped at 60000). */
|
|
213
|
+
timeoutMs?: number;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* An element's viewport rectangle (viewport-relative CSS pixels).
|
|
217
|
+
* Windows LingXia WebViews use a 1:1 CSS-to-child-window rasterization scale,
|
|
218
|
+
* so combine this with that WebView's desktop bounds without multiplying by
|
|
219
|
+
* `DesktopWindowInfo.scale`.
|
|
220
|
+
*/
|
|
221
|
+
export interface ElementRect {
|
|
222
|
+
left: number;
|
|
223
|
+
top: number;
|
|
224
|
+
width: number;
|
|
225
|
+
height: number;
|
|
226
|
+
right: number;
|
|
227
|
+
bottom: number;
|
|
228
|
+
center_x: number;
|
|
229
|
+
center_y: number;
|
|
230
|
+
viewport_width: number;
|
|
231
|
+
viewport_height: number;
|
|
232
|
+
}
|
|
233
|
+
/** A matched element. Keys are the raw automation payload (snake_case). */
|
|
234
|
+
export interface PageElement {
|
|
235
|
+
exists: true;
|
|
236
|
+
index: number;
|
|
237
|
+
/** Total number of matches for the selector. */
|
|
238
|
+
count: number;
|
|
239
|
+
tag: string;
|
|
240
|
+
/** `<input>` type, else null. */
|
|
241
|
+
type: string | null;
|
|
242
|
+
id: string | null;
|
|
243
|
+
name: string | null;
|
|
244
|
+
role: string | null;
|
|
245
|
+
aria_label: string | null;
|
|
246
|
+
placeholder: string | null;
|
|
247
|
+
/** Viewport-aware visibility (size, style, and in-viewport). */
|
|
248
|
+
visible: boolean;
|
|
249
|
+
enabled: boolean;
|
|
250
|
+
editable: boolean;
|
|
251
|
+
text: string;
|
|
252
|
+
text_truncated: boolean;
|
|
253
|
+
value: string | null;
|
|
254
|
+
value_truncated: boolean;
|
|
255
|
+
rect: ElementRect;
|
|
256
|
+
}
|
|
257
|
+
/** Returned when no element matches (single-element mode). */
|
|
258
|
+
export interface PageElementMiss {
|
|
259
|
+
exists: false;
|
|
260
|
+
index: number;
|
|
261
|
+
count: number;
|
|
262
|
+
visible: false;
|
|
263
|
+
enabled: false;
|
|
264
|
+
editable: false;
|
|
265
|
+
}
|
|
266
|
+
export type PageQueryResult = PageElement | PageElementMiss;
|
|
267
|
+
/** Returned by `query` when `all: true`. */
|
|
268
|
+
export interface PageQueryAll {
|
|
269
|
+
count: number;
|
|
270
|
+
items: PageElement[];
|
|
271
|
+
}
|
|
272
|
+
export interface Screenshot {
|
|
273
|
+
format: 'png';
|
|
274
|
+
/** Base64-encoded PNG bytes. */
|
|
275
|
+
base64: string;
|
|
276
|
+
width: number;
|
|
277
|
+
height: number;
|
|
278
|
+
}
|
|
279
|
+
/** Element-level automation of the selected lxapp's page WebViews. */
|
|
280
|
+
export interface PageDriver {
|
|
281
|
+
/** Evaluate JavaScript in the page WebView; resolves to the returned value. */
|
|
282
|
+
eval(options: PageEvalOptions): Promise<unknown>;
|
|
283
|
+
/** Query one element's info. */
|
|
284
|
+
query(options: PageQueryOptions & {
|
|
285
|
+
all?: false;
|
|
286
|
+
}): Promise<PageQueryResult>;
|
|
287
|
+
/** Query every matching element. */
|
|
288
|
+
query(options: PageQueryOptions & {
|
|
289
|
+
all: true;
|
|
290
|
+
}): Promise<PageQueryAll>;
|
|
291
|
+
click(options: PageSelectorOptions): Promise<void>;
|
|
292
|
+
/** Type text into an element without clearing existing content. */
|
|
293
|
+
type(options: PageTypeOptions): Promise<void>;
|
|
294
|
+
/** Replace an element's current value. */
|
|
295
|
+
fill(options: PageTypeOptions): Promise<void>;
|
|
296
|
+
press(options: PagePressOptions): Promise<void>;
|
|
297
|
+
/** Scroll the first matching element into view. */
|
|
298
|
+
scrollTo(options: PageScrollToOptions): Promise<void>;
|
|
299
|
+
/** Scroll the page DOM by a pixel delta (nearest scrollable container). */
|
|
300
|
+
scroll(options?: PageScrollOptions): Promise<void>;
|
|
301
|
+
/** Poll until the selector reaches `state`, else reject on timeout. */
|
|
302
|
+
waitFor(options: PageWaitForOptions): Promise<void>;
|
|
303
|
+
screenshot(options?: PageTarget): Promise<Screenshot>;
|
|
304
|
+
/** App-window pointer input at page coordinates (`lxdev lxapp page pointer`). */
|
|
305
|
+
readonly pointer: PagePointer;
|
|
306
|
+
/** App-window keyboard input (`lxdev lxapp page key`). */
|
|
307
|
+
readonly key: PageKey;
|
|
308
|
+
}
|
|
309
|
+
export interface NavOptions {
|
|
310
|
+
/** Configured page name (from lxapp.json). */
|
|
311
|
+
page: string;
|
|
312
|
+
/** Query forwarded to the destination page. */
|
|
313
|
+
query?: Record<string, unknown>;
|
|
314
|
+
}
|
|
315
|
+
export interface NavBackOptions {
|
|
316
|
+
/** Number of pages to pop (default 1). */
|
|
317
|
+
delta?: number;
|
|
318
|
+
}
|
|
319
|
+
/** A page's runtime position. */
|
|
320
|
+
export interface PageInfo {
|
|
321
|
+
path: string;
|
|
322
|
+
/** Configured page name, if the path maps to one. */
|
|
323
|
+
name: string | null;
|
|
324
|
+
current: boolean;
|
|
325
|
+
inStack: boolean;
|
|
326
|
+
/** Whether the page has an attached WebView. */
|
|
327
|
+
ready: boolean;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Page-stack navigation for the selected lxapp. Action verbs take a configured
|
|
331
|
+
* page name (`redirect` rejects a tab-bar page); `back` pops; `current`/`stack`
|
|
332
|
+
* read. Unlike the JS `lx.navigateTo` family this returns the landed page, but
|
|
333
|
+
* like it does not wait for the destination WebView (awaiting in-process would
|
|
334
|
+
* deadlock the logic thread).
|
|
335
|
+
*/
|
|
336
|
+
export interface NavDriver {
|
|
337
|
+
/** Push a page onto the stack. */
|
|
338
|
+
to(options: NavOptions): Promise<PageInfo>;
|
|
339
|
+
/** Replace the current page (rejects tab-bar targets). */
|
|
340
|
+
redirect(options: NavOptions): Promise<PageInfo>;
|
|
341
|
+
/** Switch to a configured tab page. */
|
|
342
|
+
switchTab(options: NavOptions): Promise<PageInfo>;
|
|
343
|
+
/** Clear the stack and relaunch at a page. */
|
|
344
|
+
relaunch(options: NavOptions): Promise<PageInfo>;
|
|
345
|
+
back(options?: NavBackOptions): Promise<PageInfo>;
|
|
346
|
+
current(): Promise<PageInfo>;
|
|
347
|
+
/** Status of a configured page by name; omit `page` for the current page. */
|
|
348
|
+
info(options?: PageTarget): Promise<PageInfo>;
|
|
349
|
+
stack(): Promise<PageInfo[]>;
|
|
350
|
+
}
|
|
351
|
+
export interface LxAppSummary {
|
|
352
|
+
appid: string;
|
|
353
|
+
currentPage: string | null;
|
|
354
|
+
}
|
|
355
|
+
export interface LxAppPageConfig {
|
|
356
|
+
name: string;
|
|
357
|
+
path: string;
|
|
358
|
+
}
|
|
359
|
+
export interface LxAppEvalOptions {
|
|
360
|
+
/** JavaScript expression or function body run in the selected Logic runtime. */
|
|
361
|
+
script: string;
|
|
362
|
+
timeoutMs?: number;
|
|
363
|
+
}
|
|
364
|
+
export type SurfaceLayoutSizeClass = 'compact' | 'medium' | 'expanded';
|
|
365
|
+
export type SurfaceLayoutSwitcherForm = 'none' | 'sidebar' | 'rail';
|
|
366
|
+
export type SurfaceLayoutSplitForm = 'none' | 'split' | 'collapsible' | 'fullScreen';
|
|
367
|
+
export type SurfaceLayoutEdge = 'left' | 'right' | 'top' | 'bottom';
|
|
368
|
+
export type SurfaceLayoutIcon = {
|
|
369
|
+
source: 'builtIn';
|
|
370
|
+
name: string;
|
|
371
|
+
} | {
|
|
372
|
+
source: 'resource';
|
|
373
|
+
uri: string;
|
|
374
|
+
} | {
|
|
375
|
+
source: 'providerAsset';
|
|
376
|
+
provider: string;
|
|
377
|
+
key: string;
|
|
378
|
+
};
|
|
379
|
+
/** Resolved content identity carried by one host switcher item. */
|
|
380
|
+
export type SurfaceSwitcherContent = {
|
|
381
|
+
kind: 'lxapp';
|
|
382
|
+
appId: string;
|
|
383
|
+
} | {
|
|
384
|
+
kind: 'page';
|
|
385
|
+
appId: string;
|
|
386
|
+
} | {
|
|
387
|
+
kind: 'browser';
|
|
388
|
+
} | {
|
|
389
|
+
kind: 'native';
|
|
390
|
+
capability: string;
|
|
391
|
+
};
|
|
392
|
+
export interface SurfaceSwitcherItem {
|
|
393
|
+
surfaceId: string;
|
|
394
|
+
content: SurfaceSwitcherContent;
|
|
395
|
+
title?: string;
|
|
396
|
+
icon?: SurfaceLayoutIcon;
|
|
397
|
+
active: boolean;
|
|
398
|
+
root: boolean;
|
|
399
|
+
closable: boolean;
|
|
400
|
+
renameable: boolean;
|
|
401
|
+
titleOverridden: boolean;
|
|
402
|
+
}
|
|
403
|
+
/** Ordered semantic model behind the host's main-surface switcher. */
|
|
404
|
+
export interface SurfaceSwitcherSnapshot {
|
|
405
|
+
/** Monotonically changes when the host surface model changes. */
|
|
406
|
+
revision: number;
|
|
407
|
+
rootSurfaceId?: string;
|
|
408
|
+
activeSurfaceId?: string;
|
|
409
|
+
items: SurfaceSwitcherItem[];
|
|
410
|
+
}
|
|
411
|
+
export interface SurfaceLayoutAside {
|
|
412
|
+
id: string;
|
|
413
|
+
edge?: SurfaceLayoutEdge;
|
|
414
|
+
preferredSize?: number;
|
|
415
|
+
}
|
|
416
|
+
export interface SurfaceLayoutAsideSlot {
|
|
417
|
+
kind: 'lxapp' | 'browser' | 'native';
|
|
418
|
+
edge?: SurfaceLayoutEdge;
|
|
419
|
+
/** Stable tab order within this content-kind region. */
|
|
420
|
+
children: string[];
|
|
421
|
+
activeChild?: string;
|
|
422
|
+
visible: boolean;
|
|
423
|
+
overlay: boolean;
|
|
424
|
+
}
|
|
425
|
+
export type SurfaceLayoutFloatAnchor = {
|
|
426
|
+
to: 'screen';
|
|
427
|
+
} | {
|
|
428
|
+
to: 'surface';
|
|
429
|
+
surfaceId: string;
|
|
430
|
+
};
|
|
431
|
+
export interface SurfaceLayoutFloat {
|
|
432
|
+
id: string;
|
|
433
|
+
anchor: SurfaceLayoutFloatAnchor;
|
|
434
|
+
dismiss: 'tapOutside' | 'manual';
|
|
435
|
+
modal: boolean;
|
|
436
|
+
closeButton: boolean;
|
|
437
|
+
}
|
|
438
|
+
/** Id-only surface tree emitted by the shared layout core. */
|
|
439
|
+
export type SurfaceLayoutTree = {
|
|
440
|
+
kind: 'leaf';
|
|
441
|
+
surfaceId: string;
|
|
442
|
+
} | {
|
|
443
|
+
kind: 'split';
|
|
444
|
+
axis: 'horizontal' | 'vertical';
|
|
445
|
+
children: SurfaceLayoutTree[];
|
|
446
|
+
weights: number[];
|
|
447
|
+
} | {
|
|
448
|
+
kind: 'tabs';
|
|
449
|
+
activeId: string;
|
|
450
|
+
children: string[];
|
|
451
|
+
} | {
|
|
452
|
+
kind: 'freeform';
|
|
453
|
+
surfaceId: string;
|
|
454
|
+
};
|
|
455
|
+
/**
|
|
456
|
+
* Read-only automation snapshot of the exact render plan consumed by the host
|
|
457
|
+
* skin. Use this for end-to-end assertions; production lxapp behavior should
|
|
458
|
+
* depend on `SurfaceHandle`, not host layout internals.
|
|
459
|
+
*/
|
|
460
|
+
export interface SurfaceLayoutSnapshot {
|
|
461
|
+
sizeClass: SurfaceLayoutSizeClass;
|
|
462
|
+
bottomOwner: 'app';
|
|
463
|
+
switcherForm: SurfaceLayoutSwitcherForm;
|
|
464
|
+
splitForm: SurfaceLayoutSplitForm;
|
|
465
|
+
mains: string[];
|
|
466
|
+
activeMainId?: string;
|
|
467
|
+
mainSwitcher: SurfaceSwitcherSnapshot;
|
|
468
|
+
asides: SurfaceLayoutAside[];
|
|
469
|
+
asideSlots: SurfaceLayoutAsideSlot[];
|
|
470
|
+
floats: SurfaceLayoutFloat[];
|
|
471
|
+
tree?: SurfaceLayoutTree;
|
|
472
|
+
}
|
|
473
|
+
/** Capability for one selected running lxapp. */
|
|
474
|
+
export interface LxAppDriver {
|
|
475
|
+
readonly page: PageDriver;
|
|
476
|
+
readonly nav: NavDriver;
|
|
477
|
+
/** Complete runtime snapshot of the selected lxapp. */
|
|
478
|
+
info(): Promise<LxAppRuntimeInfo>;
|
|
479
|
+
/** Configured pages of the selected lxapp. */
|
|
480
|
+
pages(): Promise<LxAppPageConfig[]>;
|
|
481
|
+
/** Authoritative host surface render plan, for end-to-end assertions. */
|
|
482
|
+
surfaceLayout(): Promise<SurfaceLayoutSnapshot>;
|
|
483
|
+
/** Logic-runtime eval; self-eval from that Logic runtime is rejected. */
|
|
484
|
+
eval(options: LxAppEvalOptions): Promise<unknown>;
|
|
485
|
+
}
|
|
486
|
+
/** One configured page in a runtime info payload. */
|
|
487
|
+
export interface LxAppPageEntry {
|
|
488
|
+
name: string;
|
|
489
|
+
path: string;
|
|
490
|
+
}
|
|
491
|
+
/** Runtime snapshot of a running lxapp (raw payload, snake_case keys). */
|
|
492
|
+
export interface LxAppRuntimeInfo {
|
|
493
|
+
appid: string;
|
|
494
|
+
app_name: string;
|
|
495
|
+
version: string;
|
|
496
|
+
release_type: string;
|
|
497
|
+
session_id: number;
|
|
498
|
+
status: string;
|
|
499
|
+
is_home: boolean;
|
|
500
|
+
current_page: string | null;
|
|
501
|
+
initial_route: string;
|
|
502
|
+
pages_count: number;
|
|
503
|
+
page_entries: LxAppPageEntry[];
|
|
504
|
+
page_stack: string[];
|
|
505
|
+
tab_bar: LxAppRuntimeTabBarInfo | null;
|
|
506
|
+
navigation_bar: LxAppRuntimeNavigationBarInfo | null;
|
|
507
|
+
lxapp_dir: string;
|
|
508
|
+
data_dir: string;
|
|
509
|
+
cache_dir: string;
|
|
510
|
+
}
|
|
511
|
+
/** Runtime NavigationBar state exposed for deterministic host-level assertions. */
|
|
512
|
+
export interface LxAppRuntimeNavigationBarInfo {
|
|
513
|
+
title: string;
|
|
514
|
+
home_button: 'auto' | 'hidden';
|
|
515
|
+
home_button_visible: boolean;
|
|
516
|
+
runtime_style: {
|
|
517
|
+
background_color: string | null;
|
|
518
|
+
foreground_color: string | null;
|
|
519
|
+
divider_color: string | null;
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
/** Runtime TabBar state exposed for deterministic host-level assertions. */
|
|
523
|
+
export interface LxAppRuntimeTabBarInfo {
|
|
524
|
+
presentation: 'standard' | 'immersive';
|
|
525
|
+
visibility: 'auto' | 'visible' | 'hidden';
|
|
526
|
+
route_visible: boolean;
|
|
527
|
+
effective_visible: boolean;
|
|
528
|
+
selected_index: number;
|
|
529
|
+
runtime_style: {
|
|
530
|
+
foreground_color: string | null;
|
|
531
|
+
selected_foreground_color: string | null;
|
|
532
|
+
};
|
|
533
|
+
items: Array<{
|
|
534
|
+
index: number;
|
|
535
|
+
text: string | null;
|
|
536
|
+
icon_path: string | null;
|
|
537
|
+
selected_icon_path: string | null;
|
|
538
|
+
badge: string | null;
|
|
539
|
+
red_dot: boolean;
|
|
540
|
+
}>;
|
|
541
|
+
}
|
|
542
|
+
/** Selects a running lxapp by id; defaults to the current app. */
|
|
543
|
+
export interface LxAppRef {
|
|
544
|
+
/** LxApp id, or `"current"` (default). */
|
|
545
|
+
app?: string;
|
|
546
|
+
}
|
|
547
|
+
export interface LxAppOpenOptions {
|
|
548
|
+
appid: string;
|
|
549
|
+
/** Initial page/path. */
|
|
550
|
+
path?: string;
|
|
551
|
+
releaseType?: 'release' | 'preview' | 'developer';
|
|
552
|
+
}
|
|
553
|
+
export interface LxAppOpenResult {
|
|
554
|
+
appid: string;
|
|
555
|
+
path: string;
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* Cross-lxapp lifecycle and host-window access. Requires `host` outside dev.
|
|
559
|
+
*
|
|
560
|
+
* `close`, `restart`, and `uninstall` reject when they target the calling app
|
|
561
|
+
* itself. Use `lx.app.exit()` to self-exit.
|
|
562
|
+
*/
|
|
563
|
+
export interface LxAppManager {
|
|
564
|
+
list(): Promise<LxAppRuntimeInfo[]>;
|
|
565
|
+
current(): Promise<LxAppSummary>;
|
|
566
|
+
open(options: LxAppOpenOptions): Promise<LxAppOpenResult>;
|
|
567
|
+
close(options?: LxAppRef): Promise<void>;
|
|
568
|
+
restart(options?: LxAppRef): Promise<void>;
|
|
569
|
+
uninstall(options?: LxAppRef): Promise<void>;
|
|
570
|
+
/** Enumerate the host app's top-level windows (`lxdev lxapp windows`). */
|
|
571
|
+
windows(): Promise<AppWindowInfo[]>;
|
|
572
|
+
/** PNG of a host app window (`lxdev lxapp screenshot`); defaults to the
|
|
573
|
+
* session's focused/main window. */
|
|
574
|
+
screenshot(options?: WindowRef): Promise<Screenshot>;
|
|
575
|
+
}
|
|
576
|
+
/** A device preset the runner can simulate (raw payload, snake_case-free). */
|
|
577
|
+
export interface DeviceEntry {
|
|
578
|
+
id: string;
|
|
579
|
+
name: string;
|
|
580
|
+
/** Form-factor group: `phone` | `tablet` | `desktop`. */
|
|
581
|
+
group: string;
|
|
582
|
+
/** Logical width in points. */
|
|
583
|
+
width: number;
|
|
584
|
+
/** Logical height in points. */
|
|
585
|
+
height: number;
|
|
586
|
+
/** True for the currently selected device. */
|
|
587
|
+
current: boolean;
|
|
588
|
+
}
|
|
589
|
+
/** The active device selection. */
|
|
590
|
+
export interface DeviceState {
|
|
591
|
+
id: string;
|
|
592
|
+
name: string;
|
|
593
|
+
group: string;
|
|
594
|
+
/** Logical width in points (accounts for orientation). */
|
|
595
|
+
width: number;
|
|
596
|
+
height: number;
|
|
597
|
+
/** True when rotated to landscape. */
|
|
598
|
+
landscape: boolean;
|
|
599
|
+
}
|
|
600
|
+
export interface DeviceSetOptions {
|
|
601
|
+
/** Device preset id (see `list()`). */
|
|
602
|
+
id: string;
|
|
603
|
+
/** Force landscape (`true`) or portrait (`false`); omit to use the
|
|
604
|
+
* runner's normal device-selection behavior. */
|
|
605
|
+
landscape?: boolean;
|
|
606
|
+
}
|
|
607
|
+
/**
|
|
608
|
+
* Simulated-device control (`lxdev runner`). Only functional in a host
|
|
609
|
+
* runner that registered a device controller; otherwise every call rejects.
|
|
610
|
+
*/
|
|
611
|
+
export interface DeviceDriver {
|
|
612
|
+
list(): Promise<DeviceEntry[]>;
|
|
613
|
+
get(): Promise<DeviceState>;
|
|
614
|
+
set(options: DeviceSetOptions): Promise<DeviceState>;
|
|
615
|
+
}
|
|
616
|
+
/** Selects a browser tab by id; defaults to the current tab. */
|
|
617
|
+
export interface BrowserTabRef {
|
|
618
|
+
/** Tab id, or `"current"` (default). */
|
|
619
|
+
tab?: string;
|
|
620
|
+
}
|
|
621
|
+
export interface BrowserOpenOptions {
|
|
622
|
+
url: string;
|
|
623
|
+
/** Reuse an existing tab id instead of opening a new one. */
|
|
624
|
+
tab?: string;
|
|
625
|
+
}
|
|
626
|
+
export interface BrowserEvalOptions extends BrowserTabRef {
|
|
627
|
+
js: string;
|
|
628
|
+
/** After the eval, wait for a navigation it triggers. */
|
|
629
|
+
waitNavigation?: boolean;
|
|
630
|
+
/** With `waitNavigation`: wait until the load completes. */
|
|
631
|
+
complete?: boolean;
|
|
632
|
+
timeoutMs?: number;
|
|
633
|
+
}
|
|
634
|
+
export interface BrowserQueryOptions extends BrowserTabRef {
|
|
635
|
+
css: string;
|
|
636
|
+
maxText?: number;
|
|
637
|
+
/** Return untruncated text/value (ignores `maxText`). */
|
|
638
|
+
full?: boolean;
|
|
639
|
+
}
|
|
640
|
+
export interface BrowserSelectorOptions extends BrowserTabRef {
|
|
641
|
+
css: string;
|
|
642
|
+
}
|
|
643
|
+
/** `click` / `press` also carry the navigation-sync flags. */
|
|
644
|
+
export interface BrowserClickOptions extends BrowserTabRef {
|
|
645
|
+
css: string;
|
|
646
|
+
/** After the click, wait for a navigation it triggers. */
|
|
647
|
+
waitNavigation?: boolean;
|
|
648
|
+
complete?: boolean;
|
|
649
|
+
timeoutMs?: number;
|
|
650
|
+
}
|
|
651
|
+
export interface BrowserTypeOptions extends BrowserSelectorOptions {
|
|
652
|
+
text: string;
|
|
653
|
+
}
|
|
654
|
+
export interface BrowserPressOptions extends BrowserTabRef {
|
|
655
|
+
key: string;
|
|
656
|
+
/** After the press, wait for a navigation it triggers. */
|
|
657
|
+
waitNavigation?: boolean;
|
|
658
|
+
complete?: boolean;
|
|
659
|
+
timeoutMs?: number;
|
|
660
|
+
}
|
|
661
|
+
export interface BrowserScrollOptions extends BrowserTabRef {
|
|
662
|
+
dx?: number;
|
|
663
|
+
dy?: number;
|
|
664
|
+
}
|
|
665
|
+
/**
|
|
666
|
+
* A browser wait condition — pass **exactly one** of the condition fields.
|
|
667
|
+
* `navigation` may add `complete` to wait for load completion.
|
|
668
|
+
*/
|
|
669
|
+
export interface BrowserWaitOptions extends BrowserTabRef {
|
|
670
|
+
/** Wait for page load. */
|
|
671
|
+
loaded?: boolean;
|
|
672
|
+
/** Wait for a selector to exist. */
|
|
673
|
+
exists?: string;
|
|
674
|
+
/** Wait for a selector to be visible. */
|
|
675
|
+
visible?: string;
|
|
676
|
+
/** Wait for a selector to be hidden. */
|
|
677
|
+
hidden?: string;
|
|
678
|
+
/** Wait for a selector to be editable. */
|
|
679
|
+
editable?: string;
|
|
680
|
+
/** Wait until a JS expression is truthy. */
|
|
681
|
+
js?: string;
|
|
682
|
+
/** Wait for the URL to equal this. */
|
|
683
|
+
url?: string;
|
|
684
|
+
/** Wait for the URL to contain this. */
|
|
685
|
+
urlContains?: string;
|
|
686
|
+
/** Wait for a navigation. */
|
|
687
|
+
navigation?: boolean;
|
|
688
|
+
/** With `navigation`: baseline URL to detect a change from (default: any
|
|
689
|
+
* navigation satisfies it). */
|
|
690
|
+
fromUrl?: string;
|
|
691
|
+
/** With `navigation`: wait until the load completes. */
|
|
692
|
+
complete?: boolean;
|
|
693
|
+
/** Timeout in ms (default 10000, capped at 60000). */
|
|
694
|
+
timeoutMs?: number;
|
|
695
|
+
}
|
|
696
|
+
export interface BrowserTab {
|
|
697
|
+
tab_id: string;
|
|
698
|
+
path: string;
|
|
699
|
+
session_id: number;
|
|
700
|
+
current_url?: string;
|
|
701
|
+
title?: string;
|
|
702
|
+
can_go_back: boolean;
|
|
703
|
+
can_go_forward: boolean;
|
|
704
|
+
}
|
|
705
|
+
export interface BrowserOpenResult {
|
|
706
|
+
tab: string;
|
|
707
|
+
}
|
|
708
|
+
export type CookieSameSite = 'Lax' | 'Strict' | 'None';
|
|
709
|
+
export interface CookieSetOptions extends BrowserTabRef {
|
|
710
|
+
name: string;
|
|
711
|
+
value: string;
|
|
712
|
+
url?: string;
|
|
713
|
+
domain?: string;
|
|
714
|
+
/** Cookie path (default `/`). */
|
|
715
|
+
path?: string;
|
|
716
|
+
secure?: boolean;
|
|
717
|
+
httpOnly?: boolean;
|
|
718
|
+
expiresUnixMs?: number;
|
|
719
|
+
sameSite?: CookieSameSite;
|
|
720
|
+
}
|
|
721
|
+
export interface CookieDeleteOptions extends BrowserTabRef {
|
|
722
|
+
name: string;
|
|
723
|
+
domain: string;
|
|
724
|
+
/** Cookie path (default `/`). */
|
|
725
|
+
path?: string;
|
|
726
|
+
}
|
|
727
|
+
export interface CookieListOptions extends BrowserTabRef {
|
|
728
|
+
/** List cookies for every domain, not just the tab's URL. */
|
|
729
|
+
all?: boolean;
|
|
730
|
+
}
|
|
731
|
+
/** A cookie from the WebView store (raw payload, snake_case keys). */
|
|
732
|
+
export interface BrowserCookie {
|
|
733
|
+
name: string;
|
|
734
|
+
value: string;
|
|
735
|
+
domain: string;
|
|
736
|
+
path: string;
|
|
737
|
+
host_only?: boolean;
|
|
738
|
+
secure: boolean;
|
|
739
|
+
http_only: boolean;
|
|
740
|
+
session: boolean;
|
|
741
|
+
expires_unix_ms?: number;
|
|
742
|
+
same_site?: CookieSameSite;
|
|
743
|
+
}
|
|
744
|
+
export interface BrowserCookies {
|
|
745
|
+
list(options?: CookieListOptions): Promise<BrowserCookie[]>;
|
|
746
|
+
set(options: CookieSetOptions): Promise<void>;
|
|
747
|
+
delete(options: CookieDeleteOptions): Promise<void>;
|
|
748
|
+
clear(options?: BrowserTabRef): Promise<void>;
|
|
749
|
+
}
|
|
750
|
+
/** The host app's browser tabs (Playwright-like WebView automation). */
|
|
751
|
+
export interface BrowserDriver {
|
|
752
|
+
open(options: BrowserOpenOptions): Promise<BrowserOpenResult>;
|
|
753
|
+
tabs(): Promise<BrowserTab[]>;
|
|
754
|
+
current(): Promise<BrowserTab | null>;
|
|
755
|
+
activate(options?: BrowserTabRef): Promise<BrowserTab>;
|
|
756
|
+
close(options?: BrowserTabRef): Promise<void>;
|
|
757
|
+
reload(options?: BrowserTabRef): Promise<void>;
|
|
758
|
+
back(options?: BrowserTabRef): Promise<void>;
|
|
759
|
+
forward(options?: BrowserTabRef): Promise<void>;
|
|
760
|
+
/** Evaluate JS; with `waitNavigation` resolves to `{ value, navigation }`. */
|
|
761
|
+
eval(options: BrowserEvalOptions): Promise<unknown>;
|
|
762
|
+
query(options: BrowserQueryOptions): Promise<PageElement | PageElementMiss>;
|
|
763
|
+
/** Wait for a condition (pass exactly one condition field). */
|
|
764
|
+
wait(options: BrowserWaitOptions): Promise<unknown>;
|
|
765
|
+
/** Click; with `waitNavigation` resolves to the navigation payload else `null`. */
|
|
766
|
+
click(options: BrowserClickOptions): Promise<unknown>;
|
|
767
|
+
type(options: BrowserTypeOptions): Promise<void>;
|
|
768
|
+
fill(options: BrowserTypeOptions): Promise<void>;
|
|
769
|
+
/** Press; with `waitNavigation` resolves to the navigation payload else `null`. */
|
|
770
|
+
press(options: BrowserPressOptions): Promise<unknown>;
|
|
771
|
+
scroll(options: BrowserScrollOptions): Promise<void>;
|
|
772
|
+
scrollTo(options: BrowserSelectorOptions): Promise<void>;
|
|
773
|
+
screenshot(options?: BrowserTabRef): Promise<Screenshot>;
|
|
774
|
+
readonly cookies: BrowserCookies;
|
|
775
|
+
}
|
|
776
|
+
/** Targets a host window; defaults to the session's focused/main window. */
|
|
777
|
+
export interface WindowRef {
|
|
778
|
+
/** Window id from `lxapp.windows()`. */
|
|
779
|
+
window?: string;
|
|
780
|
+
}
|
|
781
|
+
export interface AppWindowInfo {
|
|
782
|
+
id: string;
|
|
783
|
+
title?: string;
|
|
784
|
+
width?: number;
|
|
785
|
+
height?: number;
|
|
786
|
+
focused?: boolean;
|
|
787
|
+
main?: boolean;
|
|
788
|
+
visible?: boolean;
|
|
789
|
+
}
|
|
790
|
+
/** Result of a dispatched input action. */
|
|
791
|
+
export interface InputResult {
|
|
792
|
+
window_id: string;
|
|
793
|
+
/** The action kind that was dispatched. */
|
|
794
|
+
action: string;
|
|
795
|
+
}
|
|
796
|
+
export type MouseButton = 'left' | 'right' | 'middle';
|
|
797
|
+
/** A coordinate as `[x, y]` (the `--at X,Y` flag form). */
|
|
798
|
+
export type Point = [number, number];
|
|
799
|
+
export interface PointerAtOptions extends WindowRef {
|
|
800
|
+
/** Target coordinate in page (CSS) pixels. */
|
|
801
|
+
at: Point;
|
|
802
|
+
}
|
|
803
|
+
export interface PointerButtonOptions extends PointerAtOptions {
|
|
804
|
+
button?: MouseButton;
|
|
805
|
+
}
|
|
806
|
+
export interface PointerClickOptions extends PointerButtonOptions {
|
|
807
|
+
/** Number of clicks to report in the event (default 1). */
|
|
808
|
+
count?: number;
|
|
809
|
+
}
|
|
810
|
+
export interface PointerDragOptions extends WindowRef {
|
|
811
|
+
from: Point;
|
|
812
|
+
to: Point;
|
|
813
|
+
button?: MouseButton;
|
|
814
|
+
}
|
|
815
|
+
export interface PointerScrollOptions extends PointerAtOptions {
|
|
816
|
+
/** Horizontal scroll delta in page pixels. */
|
|
817
|
+
dx?: number;
|
|
818
|
+
/** Vertical scroll delta in page pixels. */
|
|
819
|
+
dy?: number;
|
|
820
|
+
}
|
|
821
|
+
/** App-window pointer input at page coordinates (`lxdev lxapp page pointer`). */
|
|
822
|
+
export interface PagePointer {
|
|
823
|
+
move(options: PointerAtOptions): Promise<InputResult>;
|
|
824
|
+
down(options: PointerButtonOptions): Promise<InputResult>;
|
|
825
|
+
up(options: PointerButtonOptions): Promise<InputResult>;
|
|
826
|
+
click(options: PointerClickOptions): Promise<InputResult>;
|
|
827
|
+
drag(options: PointerDragOptions): Promise<InputResult>;
|
|
828
|
+
scroll(options: PointerScrollOptions): Promise<InputResult>;
|
|
829
|
+
}
|
|
830
|
+
/** Canonical cross-platform modifier vocabulary; `meta` maps to the platform
|
|
831
|
+
* meta key (Command on macOS, Windows key on Windows). */
|
|
832
|
+
export type KeyModifier = 'ctrl' | 'shift' | 'alt' | 'meta';
|
|
833
|
+
export interface KeyTypeOptions extends WindowRef {
|
|
834
|
+
text: string;
|
|
835
|
+
}
|
|
836
|
+
export interface KeyPressOptions extends WindowRef {
|
|
837
|
+
/** Key name: `return`, `tab`, `escape`, `delete`, `space`, arrows. */
|
|
838
|
+
key: string;
|
|
839
|
+
modifiers?: KeyModifier[];
|
|
840
|
+
}
|
|
841
|
+
/** App-window keyboard input to the focused control (`lxdev lxapp page key`). */
|
|
842
|
+
export interface PageKey {
|
|
843
|
+
type(options: KeyTypeOptions): Promise<InputResult>;
|
|
844
|
+
press(options: KeyPressOptions): Promise<InputResult>;
|
|
845
|
+
}
|
|
846
|
+
/** A rectangle in backend-native global desktop coordinates. */
|
|
847
|
+
export interface DesktopRect {
|
|
848
|
+
x: number;
|
|
849
|
+
y: number;
|
|
850
|
+
w: number;
|
|
851
|
+
h: number;
|
|
852
|
+
}
|
|
853
|
+
/** A monitor/display (raw contract payload, snake_case keys). */
|
|
854
|
+
export interface DesktopDisplay {
|
|
855
|
+
id: string;
|
|
856
|
+
primary: boolean;
|
|
857
|
+
bounds: DesktopRect;
|
|
858
|
+
work_area: DesktopRect;
|
|
859
|
+
scale: number;
|
|
860
|
+
dpi: number;
|
|
861
|
+
}
|
|
862
|
+
/** A top-level OS window (raw contract payload, snake_case keys). */
|
|
863
|
+
export interface DesktopWindowInfo {
|
|
864
|
+
id: string;
|
|
865
|
+
title: string;
|
|
866
|
+
process: string;
|
|
867
|
+
pid: number;
|
|
868
|
+
bounds: DesktopRect;
|
|
869
|
+
display_id: string;
|
|
870
|
+
/**
|
|
871
|
+
* Display DIP-to-physical scale. `bounds` are already backend-native; do not
|
|
872
|
+
* multiply them by this value.
|
|
873
|
+
*/
|
|
874
|
+
scale: number;
|
|
875
|
+
dpi: number;
|
|
876
|
+
visible: boolean;
|
|
877
|
+
focused: boolean;
|
|
878
|
+
minimized: boolean;
|
|
879
|
+
maximized: boolean;
|
|
880
|
+
always_on_top: boolean;
|
|
881
|
+
/** Front-to-back z index (0 = frontmost). */
|
|
882
|
+
z: number;
|
|
883
|
+
}
|
|
884
|
+
/** Generic acknowledgement for input/mutation commands. */
|
|
885
|
+
export interface DesktopAck {
|
|
886
|
+
ok: boolean;
|
|
887
|
+
action: string;
|
|
888
|
+
}
|
|
889
|
+
export interface DesktopPermissions {
|
|
890
|
+
accessibility: boolean;
|
|
891
|
+
screen_recording: boolean;
|
|
892
|
+
input: boolean;
|
|
893
|
+
}
|
|
894
|
+
export interface DesktopCapabilities {
|
|
895
|
+
displays: boolean;
|
|
896
|
+
windows: boolean;
|
|
897
|
+
screenshot: boolean;
|
|
898
|
+
window_screenshot_occlusion_independent: boolean;
|
|
899
|
+
pixel: boolean;
|
|
900
|
+
pointer: boolean;
|
|
901
|
+
key: boolean;
|
|
902
|
+
window_management: boolean;
|
|
903
|
+
clipboard: boolean;
|
|
904
|
+
ax_tree: boolean;
|
|
905
|
+
ocr: boolean;
|
|
906
|
+
image_match: boolean;
|
|
907
|
+
}
|
|
908
|
+
export interface DesktopDoctor {
|
|
909
|
+
backend: string;
|
|
910
|
+
os: string;
|
|
911
|
+
os_version: string;
|
|
912
|
+
capabilities: DesktopCapabilities;
|
|
913
|
+
permissions: DesktopPermissions;
|
|
914
|
+
}
|
|
915
|
+
export interface DesktopPixel {
|
|
916
|
+
x: number;
|
|
917
|
+
y: number;
|
|
918
|
+
hex: string;
|
|
919
|
+
r: number;
|
|
920
|
+
g: number;
|
|
921
|
+
b: number;
|
|
922
|
+
}
|
|
923
|
+
export interface DesktopCapture extends Screenshot {
|
|
924
|
+
/** True when the capture ignored occlusion (window PrintWindow path). */
|
|
925
|
+
occlusionIndependent: boolean;
|
|
926
|
+
backend: string;
|
|
927
|
+
}
|
|
928
|
+
export interface DesktopClipboardContent {
|
|
929
|
+
available_formats: string[];
|
|
930
|
+
text: string | null;
|
|
931
|
+
}
|
|
932
|
+
/** A node in the native accessibility tree. */
|
|
933
|
+
export interface DesktopAxNode {
|
|
934
|
+
id: string;
|
|
935
|
+
role: string;
|
|
936
|
+
name: string;
|
|
937
|
+
value?: string;
|
|
938
|
+
enabled: boolean;
|
|
939
|
+
focused: boolean;
|
|
940
|
+
rect: DesktopRect;
|
|
941
|
+
children?: DesktopAxNode[];
|
|
942
|
+
}
|
|
943
|
+
export interface DesktopProcessInfo {
|
|
944
|
+
pid: number;
|
|
945
|
+
name: string;
|
|
946
|
+
}
|
|
947
|
+
export interface DesktopSnapshotOptions {
|
|
948
|
+
/** Window id from `windows()`. */
|
|
949
|
+
window: string;
|
|
950
|
+
/** Skip the accessibility tree. */
|
|
951
|
+
noAx?: boolean;
|
|
952
|
+
/** Limit ax tree depth. */
|
|
953
|
+
depth?: number;
|
|
954
|
+
}
|
|
955
|
+
export interface DesktopSnapshot {
|
|
956
|
+
window: DesktopWindowInfo;
|
|
957
|
+
/** PNG capture, or `null` when unavailable. */
|
|
958
|
+
screenshot: (Screenshot & {
|
|
959
|
+
occlusionIndependent: boolean;
|
|
960
|
+
}) | null;
|
|
961
|
+
/** AX tree, `null` when `noAx` or unavailable. */
|
|
962
|
+
ax: DesktopAxNode | null;
|
|
963
|
+
}
|
|
964
|
+
export interface DesktopLaunchResult {
|
|
965
|
+
/** Durable target pid — prefer this for follow-up quit/kill. */
|
|
966
|
+
pid: number;
|
|
967
|
+
launcher_pid: number;
|
|
968
|
+
window?: DesktopWindowInfo;
|
|
969
|
+
}
|
|
970
|
+
/**
|
|
971
|
+
* Selects a desktop window: exactly one of `window` (id from `windows()`) or
|
|
972
|
+
* `match` (query `text | title: | class: | process: | pid:`, must resolve to
|
|
973
|
+
* exactly one window).
|
|
974
|
+
*/
|
|
975
|
+
export interface DesktopWindowSel {
|
|
976
|
+
window?: string;
|
|
977
|
+
match?: string;
|
|
978
|
+
}
|
|
979
|
+
export interface DesktopWindowsOptions {
|
|
980
|
+
/** Match query (`text | title: | class: | process: | pid:`). */
|
|
981
|
+
match?: string;
|
|
982
|
+
}
|
|
983
|
+
/** Capture target — at most one of `display` / `window` / `region`;
|
|
984
|
+
* omit all to capture the whole virtual screen. */
|
|
985
|
+
export interface DesktopScreenshotOptions {
|
|
986
|
+
/** Monitor by 1-based index (as listed by `displays()`). */
|
|
987
|
+
display?: number;
|
|
988
|
+
/** Window by id (occlusion-independent capture). */
|
|
989
|
+
window?: string;
|
|
990
|
+
/** Region as `[x, y, w, h]` in desktop coordinates. */
|
|
991
|
+
region?: [number, number, number, number];
|
|
992
|
+
}
|
|
993
|
+
export interface DesktopAtOptions {
|
|
994
|
+
/** Coordinate in backend-native desktop pixels. */
|
|
995
|
+
at: Point;
|
|
996
|
+
}
|
|
997
|
+
/** Optional background-input target: a `window` id (resolved to its owning
|
|
998
|
+
* process) or an explicit `pid`. Omit both for foreground input. */
|
|
999
|
+
export interface DesktopInputTarget {
|
|
1000
|
+
window?: string;
|
|
1001
|
+
pid?: number;
|
|
1002
|
+
}
|
|
1003
|
+
export interface DesktopPointerAtOptions extends DesktopInputTarget {
|
|
1004
|
+
at: Point;
|
|
1005
|
+
}
|
|
1006
|
+
export interface DesktopPointerButtonOptions extends DesktopPointerAtOptions {
|
|
1007
|
+
button?: MouseButton;
|
|
1008
|
+
}
|
|
1009
|
+
export interface DesktopPointerClickOptions extends DesktopPointerButtonOptions {
|
|
1010
|
+
count?: number;
|
|
1011
|
+
}
|
|
1012
|
+
export interface DesktopPointerDragOptions extends DesktopInputTarget {
|
|
1013
|
+
from: Point;
|
|
1014
|
+
to: Point;
|
|
1015
|
+
button?: MouseButton;
|
|
1016
|
+
}
|
|
1017
|
+
export interface DesktopPointerScrollOptions extends DesktopPointerAtOptions {
|
|
1018
|
+
/** Horizontal scroll delta in notches. */
|
|
1019
|
+
dx?: number;
|
|
1020
|
+
/** Vertical scroll delta in notches. */
|
|
1021
|
+
dy?: number;
|
|
1022
|
+
}
|
|
1023
|
+
/** Synthetic physical mouse input at desktop coordinates. */
|
|
1024
|
+
export interface DesktopPointer {
|
|
1025
|
+
move(options: DesktopPointerAtOptions): Promise<DesktopAck>;
|
|
1026
|
+
down(options: DesktopPointerButtonOptions): Promise<DesktopAck>;
|
|
1027
|
+
up(options: DesktopPointerButtonOptions): Promise<DesktopAck>;
|
|
1028
|
+
click(options: DesktopPointerClickOptions): Promise<DesktopAck>;
|
|
1029
|
+
drag(options: DesktopPointerDragOptions): Promise<DesktopAck>;
|
|
1030
|
+
scroll(options: DesktopPointerScrollOptions): Promise<DesktopAck>;
|
|
1031
|
+
}
|
|
1032
|
+
export interface DesktopKeyTypeOptions extends DesktopInputTarget {
|
|
1033
|
+
text: string;
|
|
1034
|
+
}
|
|
1035
|
+
export interface DesktopKeyPressOptions extends DesktopInputTarget {
|
|
1036
|
+
/** Case-insensitive named key (`Enter`, `ArrowDown`, `Down`, etc.) or one
|
|
1037
|
+
* printable character. */
|
|
1038
|
+
key: string;
|
|
1039
|
+
modifiers?: KeyModifier[];
|
|
1040
|
+
}
|
|
1041
|
+
export interface DesktopKeyNameOptions extends DesktopInputTarget {
|
|
1042
|
+
/** Case-insensitive named key (`Enter`, `ArrowDown`, `Down`, etc.) or one
|
|
1043
|
+
* printable character. */
|
|
1044
|
+
key: string;
|
|
1045
|
+
}
|
|
1046
|
+
/** Synthetic physical keyboard input. */
|
|
1047
|
+
export interface DesktopKey {
|
|
1048
|
+
/** Type literal text into the focused control. */
|
|
1049
|
+
type(options: DesktopKeyTypeOptions): Promise<DesktopAck>;
|
|
1050
|
+
press(options: DesktopKeyPressOptions): Promise<DesktopAck>;
|
|
1051
|
+
down(options: DesktopKeyNameOptions): Promise<DesktopAck>;
|
|
1052
|
+
up(options: DesktopKeyNameOptions): Promise<DesktopAck>;
|
|
1053
|
+
}
|
|
1054
|
+
export interface DesktopWindowMoveOptions extends DesktopWindowSel {
|
|
1055
|
+
/** Target position as `[x, y]` in desktop coordinates. */
|
|
1056
|
+
to: Point;
|
|
1057
|
+
}
|
|
1058
|
+
export interface DesktopWindowResizeOptions extends DesktopWindowSel {
|
|
1059
|
+
width: number;
|
|
1060
|
+
height: number;
|
|
1061
|
+
}
|
|
1062
|
+
export interface DesktopWindowMoveDisplayOptions extends DesktopWindowSel {
|
|
1063
|
+
/** Display id from `displays()`. */
|
|
1064
|
+
display: string;
|
|
1065
|
+
}
|
|
1066
|
+
export interface DesktopWindowAlwaysOnTopOptions extends DesktopWindowSel {
|
|
1067
|
+
on: boolean;
|
|
1068
|
+
}
|
|
1069
|
+
/** Window management; every verb resolves to the resulting window state. */
|
|
1070
|
+
export interface DesktopWindowDriver {
|
|
1071
|
+
status(options: DesktopWindowSel): Promise<DesktopWindowInfo>;
|
|
1072
|
+
focus(options: DesktopWindowSel): Promise<DesktopWindowInfo>;
|
|
1073
|
+
activate(options: DesktopWindowSel): Promise<DesktopWindowInfo>;
|
|
1074
|
+
raise(options: DesktopWindowSel): Promise<DesktopWindowInfo>;
|
|
1075
|
+
minimize(options: DesktopWindowSel): Promise<DesktopWindowInfo>;
|
|
1076
|
+
maximize(options: DesktopWindowSel): Promise<DesktopWindowInfo>;
|
|
1077
|
+
restore(options: DesktopWindowSel): Promise<DesktopWindowInfo>;
|
|
1078
|
+
/** Close a window. Destructive. */
|
|
1079
|
+
close(options: DesktopWindowSel): Promise<DesktopWindowInfo>;
|
|
1080
|
+
moveTo(options: DesktopWindowMoveOptions): Promise<DesktopWindowInfo>;
|
|
1081
|
+
moveToDisplay(options: DesktopWindowMoveDisplayOptions): Promise<DesktopWindowInfo>;
|
|
1082
|
+
resize(options: DesktopWindowResizeOptions): Promise<DesktopWindowInfo>;
|
|
1083
|
+
setAlwaysOnTop(options: DesktopWindowAlwaysOnTopOptions): Promise<DesktopWindowInfo>;
|
|
1084
|
+
}
|
|
1085
|
+
export interface DesktopClipboardSetOptions {
|
|
1086
|
+
text: string;
|
|
1087
|
+
}
|
|
1088
|
+
/** System clipboard access (Unicode text). */
|
|
1089
|
+
export interface DesktopClipboard {
|
|
1090
|
+
get(): Promise<DesktopClipboardContent>;
|
|
1091
|
+
set(options: DesktopClipboardSetOptions): Promise<DesktopAck>;
|
|
1092
|
+
clear(): Promise<DesktopAck>;
|
|
1093
|
+
/** Paste into the focused control (Ctrl/Cmd+V). */
|
|
1094
|
+
paste(): Promise<DesktopAck>;
|
|
1095
|
+
}
|
|
1096
|
+
export interface DesktopAxTreeOptions {
|
|
1097
|
+
/** Window id from `windows()`. */
|
|
1098
|
+
window: string;
|
|
1099
|
+
/** Limit tree depth. */
|
|
1100
|
+
depth?: number;
|
|
1101
|
+
/** Cap the number of nodes. */
|
|
1102
|
+
maxNodes?: number;
|
|
1103
|
+
}
|
|
1104
|
+
/** Node match query: `text | name: | role: | value: | id:`. */
|
|
1105
|
+
export interface DesktopAxSel {
|
|
1106
|
+
window: string;
|
|
1107
|
+
match: string;
|
|
1108
|
+
}
|
|
1109
|
+
export interface DesktopAxQueryOptions extends DesktopAxSel {
|
|
1110
|
+
/** Return every match instead of exactly one. */
|
|
1111
|
+
all?: boolean;
|
|
1112
|
+
/** Target the nth match. */
|
|
1113
|
+
index?: number;
|
|
1114
|
+
}
|
|
1115
|
+
export interface DesktopAxSetValueOptions extends DesktopAxSel {
|
|
1116
|
+
value: string;
|
|
1117
|
+
}
|
|
1118
|
+
/** Native accessibility tree inspection and atomic actions — never falls back
|
|
1119
|
+
* to physical input silently. */
|
|
1120
|
+
export interface DesktopAx {
|
|
1121
|
+
tree(options: DesktopAxTreeOptions): Promise<DesktopAxNode>;
|
|
1122
|
+
query(options: DesktopAxQueryOptions): Promise<DesktopAxNode[]>;
|
|
1123
|
+
/** Atomically match exactly one node and invoke it. */
|
|
1124
|
+
invoke(options: DesktopAxSel): Promise<DesktopAck>;
|
|
1125
|
+
focus(options: DesktopAxSel): Promise<DesktopAck>;
|
|
1126
|
+
setValue(options: DesktopAxSetValueOptions): Promise<DesktopAck>;
|
|
1127
|
+
select(options: DesktopAxSel): Promise<DesktopAck>;
|
|
1128
|
+
expand(options: DesktopAxSel): Promise<DesktopAck>;
|
|
1129
|
+
collapse(options: DesktopAxSel): Promise<DesktopAck>;
|
|
1130
|
+
scrollIntoView(options: DesktopAxSel): Promise<DesktopAck>;
|
|
1131
|
+
/** The accessible element at a screen point. */
|
|
1132
|
+
hitTest(options: DesktopAtOptions): Promise<DesktopAxNode>;
|
|
1133
|
+
}
|
|
1134
|
+
export interface DesktopWaitWindowOptions {
|
|
1135
|
+
match: string;
|
|
1136
|
+
/** `visible` (default) | `hidden`. */
|
|
1137
|
+
state?: 'visible' | 'hidden';
|
|
1138
|
+
/** Timeout in ms (default 5000). */
|
|
1139
|
+
timeoutMs?: number;
|
|
1140
|
+
}
|
|
1141
|
+
export interface DesktopWaitAxOptions extends DesktopAxSel {
|
|
1142
|
+
/** `exists` (default) | `gone` | `enabled` | `focused`. */
|
|
1143
|
+
state?: 'exists' | 'gone' | 'enabled' | 'focused';
|
|
1144
|
+
timeoutMs?: number;
|
|
1145
|
+
}
|
|
1146
|
+
export interface DesktopWaitPixelOptions extends DesktopAtOptions {
|
|
1147
|
+
/** Expected color as `#rrggbb`. */
|
|
1148
|
+
color: string;
|
|
1149
|
+
/** Per-channel tolerance (default 0). */
|
|
1150
|
+
tolerance?: number;
|
|
1151
|
+
timeoutMs?: number;
|
|
1152
|
+
}
|
|
1153
|
+
/** Wait for a condition; rejects with `E_DESKTOP_TIMEOUT` when it never holds. */
|
|
1154
|
+
export interface DesktopWait {
|
|
1155
|
+
window(options: DesktopWaitWindowOptions): Promise<DesktopWindowInfo>;
|
|
1156
|
+
ax(options: DesktopWaitAxOptions): Promise<DesktopAck>;
|
|
1157
|
+
pixel(options: DesktopWaitPixelOptions): Promise<DesktopPixel>;
|
|
1158
|
+
}
|
|
1159
|
+
export interface DesktopAppLaunchOptions {
|
|
1160
|
+
/** Path or PATH-resolved command. */
|
|
1161
|
+
app: string;
|
|
1162
|
+
args?: string[];
|
|
1163
|
+
/** Wait for a window matching this query before resolving. */
|
|
1164
|
+
waitWindow?: string;
|
|
1165
|
+
timeoutMs?: number;
|
|
1166
|
+
}
|
|
1167
|
+
/** Quit target — exactly one of `match` / `pid` / `window`. */
|
|
1168
|
+
export interface DesktopAppQuitOptions {
|
|
1169
|
+
match?: string;
|
|
1170
|
+
pid?: number;
|
|
1171
|
+
window?: string;
|
|
1172
|
+
/** Terminate instead of a graceful close. */
|
|
1173
|
+
force?: boolean;
|
|
1174
|
+
}
|
|
1175
|
+
/** App lifecycle. */
|
|
1176
|
+
export interface DesktopApp {
|
|
1177
|
+
launch(options: DesktopAppLaunchOptions): Promise<DesktopLaunchResult>;
|
|
1178
|
+
/** Quit an app. Destructive. */
|
|
1179
|
+
quit(options: DesktopAppQuitOptions): Promise<DesktopAck>;
|
|
1180
|
+
}
|
|
1181
|
+
export interface DesktopProcessListOptions {
|
|
1182
|
+
/** Case-insensitive name substring filter. */
|
|
1183
|
+
filter?: string;
|
|
1184
|
+
}
|
|
1185
|
+
export interface DesktopProcessKillOptions {
|
|
1186
|
+
pid: number;
|
|
1187
|
+
force?: boolean;
|
|
1188
|
+
}
|
|
1189
|
+
/** Process inspection/control. */
|
|
1190
|
+
export interface DesktopProcess {
|
|
1191
|
+
list(options?: DesktopProcessListOptions): Promise<DesktopProcessInfo[]>;
|
|
1192
|
+
/** Terminate a process. Destructive. */
|
|
1193
|
+
kill(options: DesktopProcessKillOptions): Promise<DesktopAck>;
|
|
1194
|
+
}
|
|
1195
|
+
/**
|
|
1196
|
+
* Session-less local-OS desktop automation — the in-process mapping of
|
|
1197
|
+
* `lxdev desktop` over the same backend, DTOs, and error taxonomy
|
|
1198
|
+
* (errors carry stable `E_DESKTOP_<CODE>` codes). Windows and macOS;
|
|
1199
|
+
* other platforms reject with `E_DESKTOP_UNSUPPORTED`.
|
|
1200
|
+
*
|
|
1201
|
+
* Coordinates are backend-native global desktop coordinates: physical pixels
|
|
1202
|
+
* on Windows, display points (top-left origin) on macOS.
|
|
1203
|
+
*/
|
|
1204
|
+
export interface DesktopDriver {
|
|
1205
|
+
/** Backend, capability, and permission report. */
|
|
1206
|
+
doctor(): Promise<DesktopDoctor>;
|
|
1207
|
+
/** OS-permission grants; `{ request: true }` triggers the OS prompts. */
|
|
1208
|
+
permissions(options?: {
|
|
1209
|
+
request?: boolean;
|
|
1210
|
+
}): Promise<DesktopPermissions>;
|
|
1211
|
+
displays(): Promise<DesktopDisplay[]>;
|
|
1212
|
+
windows(options?: DesktopWindowsOptions): Promise<DesktopWindowInfo[]>;
|
|
1213
|
+
/** Capture the screen (default), a display, a window, or a region. */
|
|
1214
|
+
screenshot(options?: DesktopScreenshotOptions): Promise<DesktopCapture>;
|
|
1215
|
+
/** Read one pixel's color. */
|
|
1216
|
+
pixel(options: DesktopAtOptions): Promise<DesktopPixel>;
|
|
1217
|
+
/** One-shot window info + screenshot + ax tree. */
|
|
1218
|
+
snapshot(options: DesktopSnapshotOptions): Promise<DesktopSnapshot>;
|
|
1219
|
+
readonly window: DesktopWindowDriver;
|
|
1220
|
+
readonly pointer: DesktopPointer;
|
|
1221
|
+
readonly key: DesktopKey;
|
|
1222
|
+
readonly clipboard: DesktopClipboard;
|
|
1223
|
+
readonly ax: DesktopAx;
|
|
1224
|
+
readonly wait: DesktopWait;
|
|
1225
|
+
readonly app: DesktopApp;
|
|
1226
|
+
readonly process: DesktopProcess;
|
|
1227
|
+
}
|
|
1228
|
+
//# sourceMappingURL=index.d.ts.map
|