@developerz.ai/ui-debugger-mcp 1.9.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -44
- package/dist/adapters/android/adb.d.ts +19 -7
- package/dist/adapters/android/adb.js +50 -13
- package/dist/adapters/android/adb.js.map +1 -1
- package/dist/adapters/android/android-adapter.d.ts +42 -2
- package/dist/adapters/android/android-adapter.js +366 -36
- package/dist/adapters/android/android-adapter.js.map +1 -1
- package/dist/adapters/android/commands.js.map +1 -1
- package/dist/adapters/android/ports.js.map +1 -1
- package/dist/adapters/android/sdk.d.ts +65 -0
- package/dist/adapters/android/sdk.js +107 -0
- package/dist/adapters/android/sdk.js.map +1 -0
- package/dist/adapters/android/uiautomator.d.ts +23 -7
- package/dist/adapters/android/uiautomator.js +31 -7
- package/dist/adapters/android/uiautomator.js.map +1 -1
- package/dist/adapters/availability.d.ts +39 -0
- package/dist/adapters/availability.js +62 -0
- package/dist/adapters/availability.js.map +1 -0
- package/dist/adapters/browser/browser-adapter.d.ts +11 -22
- package/dist/adapters/browser/browser-adapter.js +98 -67
- package/dist/adapters/browser/browser-adapter.js.map +1 -1
- package/dist/adapters/browser/cdp.d.ts +15 -7
- package/dist/adapters/browser/cdp.js +25 -3
- package/dist/adapters/browser/cdp.js.map +1 -1
- package/dist/adapters/browser/filters.d.ts +1 -1
- package/dist/adapters/browser/filters.js.map +1 -1
- package/dist/adapters/browser/geometry.js.map +1 -1
- package/dist/adapters/browser/launch.d.ts +14 -5
- package/dist/adapters/browser/launch.js +14 -5
- package/dist/adapters/browser/launch.js.map +1 -1
- package/dist/adapters/browser/lifecycle.d.ts +58 -0
- package/dist/adapters/browser/lifecycle.js +98 -0
- package/dist/adapters/browser/lifecycle.js.map +1 -0
- package/dist/adapters/browser/log-filters.d.ts +2 -2
- package/dist/adapters/browser/log-filters.js.map +1 -1
- package/dist/adapters/browser/log-format.d.ts +14 -23
- package/dist/adapters/browser/log-format.js +16 -55
- package/dist/adapters/browser/log-format.js.map +1 -1
- package/dist/adapters/browser/tab-context.d.ts +30 -0
- package/dist/adapters/browser/tab-context.js +41 -0
- package/dist/adapters/browser/tab-context.js.map +1 -0
- package/dist/adapters/contract.d.ts +91 -5
- package/dist/adapters/contract.js +7 -2
- package/dist/adapters/contract.js.map +1 -1
- package/dist/adapters/desktop/atspi-busctl.d.ts +26 -0
- package/dist/adapters/desktop/atspi-busctl.js +330 -0
- package/dist/adapters/desktop/atspi-busctl.js.map +1 -0
- package/dist/adapters/desktop/atspi-parse.d.ts +39 -0
- package/dist/adapters/desktop/atspi-parse.js +155 -0
- package/dist/adapters/desktop/atspi-parse.js.map +1 -0
- package/dist/adapters/desktop/atspi.d.ts +75 -50
- package/dist/adapters/desktop/atspi.js +64 -285
- package/dist/adapters/desktop/atspi.js.map +1 -1
- package/dist/adapters/desktop/capture.d.ts +11 -20
- package/dist/adapters/desktop/capture.js +68 -37
- package/dist/adapters/desktop/capture.js.map +1 -1
- package/dist/adapters/desktop/desktop-adapter.d.ts +20 -2
- package/dist/adapters/desktop/desktop-adapter.js +91 -9
- package/dist/adapters/desktop/desktop-adapter.js.map +1 -1
- package/dist/adapters/desktop/input.d.ts +18 -4
- package/dist/adapters/desktop/input.js +15 -10
- package/dist/adapters/desktop/input.js.map +1 -1
- package/dist/adapters/desktop/proc.d.ts +32 -4
- package/dist/adapters/desktop/proc.js +33 -6
- package/dist/adapters/desktop/proc.js.map +1 -1
- package/dist/adapters/factory.d.ts +12 -5
- package/dist/adapters/factory.js +29 -3
- package/dist/adapters/factory.js.map +1 -1
- package/dist/adapters/log-format.d.ts +32 -0
- package/dist/adapters/log-format.js +39 -0
- package/dist/adapters/log-format.js.map +1 -0
- package/dist/agent/belt/act.d.ts +421 -21
- package/dist/agent/belt/act.js +4 -4
- package/dist/agent/belt/act.js.map +1 -1
- package/dist/agent/belt/look.d.ts +471 -14
- package/dist/agent/belt/look.js +74 -12
- package/dist/agent/belt/look.js.map +1 -1
- package/dist/agent/belt/observe.d.ts +663 -42
- package/dist/agent/belt/observe.js +76 -12
- package/dist/agent/belt/observe.js.map +1 -1
- package/dist/agent/belt/report.d.ts +754 -48
- package/dist/agent/belt/report.js +121 -38
- package/dist/agent/belt/report.js.map +1 -1
- package/dist/agent/belt/trail.d.ts +44 -16
- package/dist/agent/belt/trail.js +46 -11
- package/dist/agent/belt/trail.js.map +1 -1
- package/dist/agent/capabilities.js.map +1 -1
- package/dist/agent/fallback.d.ts +33 -0
- package/dist/agent/fallback.js +84 -0
- package/dist/agent/fallback.js.map +1 -0
- package/dist/agent/loop.d.ts +54 -52
- package/dist/agent/loop.js +173 -176
- package/dist/agent/loop.js.map +1 -1
- package/dist/agent/models.d.ts +10 -6
- package/dist/agent/models.js +15 -9
- package/dist/agent/models.js.map +1 -1
- package/dist/agent/prompts/compose.d.ts +1 -1
- package/dist/agent/prompts/debug-agent.js +45 -8
- package/dist/agent/prompts/debug-agent.js.map +1 -1
- package/dist/agent/prompts/web-addendum.d.ts +1 -1
- package/dist/agent/prompts/web-addendum.js +15 -3
- package/dist/agent/prompts/web-addendum.js.map +1 -1
- package/dist/agent/provider.d.ts +38 -0
- package/dist/agent/provider.js +55 -3
- package/dist/agent/provider.js.map +1 -1
- package/dist/boot.d.ts +64 -0
- package/dist/boot.js +145 -0
- package/dist/boot.js.map +1 -0
- package/dist/cli/chromium-libs.d.ts +262 -0
- package/dist/cli/chromium-libs.js +522 -0
- package/dist/cli/chromium-libs.js.map +1 -0
- package/dist/cli/control.js +51 -9
- package/dist/cli/control.js.map +1 -1
- package/dist/cli/init.d.ts +52 -3
- package/dist/cli/init.js +62 -10
- package/dist/cli/init.js.map +1 -1
- package/dist/config/load.d.ts +25 -8
- package/dist/config/load.js +40 -13
- package/dist/config/load.js.map +1 -1
- package/dist/config/schema.d.ts +18 -6
- package/dist/config/schema.js +22 -7
- package/dist/config/schema.js.map +1 -1
- package/dist/errors.d.ts +14 -0
- package/dist/errors.js +18 -0
- package/dist/errors.js.map +1 -1
- package/dist/findings/schema.d.ts +44 -6
- package/dist/findings/schema.js +39 -3
- package/dist/findings/schema.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.js +4 -82
- package/dist/main.js.map +1 -1
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools/describe.d.ts +5 -4
- package/dist/mcp/tools/describe.js +14 -10
- package/dist/mcp/tools/describe.js.map +1 -1
- package/dist/mcp/tools/end-session.d.ts +3 -1
- package/dist/mcp/tools/end-session.js +7 -3
- package/dist/mcp/tools/end-session.js.map +1 -1
- package/dist/mcp/tools/output.d.ts +5 -4
- package/dist/mcp/tools/output.js +10 -2
- package/dist/mcp/tools/output.js.map +1 -1
- package/dist/mcp/tools/result.d.ts +10 -1
- package/dist/mcp/tools/result.js +8 -6
- package/dist/mcp/tools/result.js.map +1 -1
- package/dist/mcp/tools/start-debug.js +7 -5
- package/dist/mcp/tools/start-debug.js.map +1 -1
- package/dist/redact.d.ts +28 -0
- package/dist/redact.js +51 -0
- package/dist/redact.js.map +1 -0
- package/dist/services/catalog.d.ts +28 -0
- package/dist/services/catalog.js +65 -0
- package/dist/services/catalog.js.map +1 -0
- package/dist/services/debug-api.d.ts +172 -0
- package/dist/services/debug-api.js +9 -0
- package/dist/services/debug-api.js.map +1 -0
- package/dist/services/debug-service.d.ts +25 -173
- package/dist/services/debug-service.js +108 -175
- package/dist/services/debug-service.js.map +1 -1
- package/dist/services/login.d.ts +7 -2
- package/dist/services/login.js +203 -29
- package/dist/services/login.js.map +1 -1
- package/dist/services/retained-snapshot.d.ts +36 -0
- package/dist/services/retained-snapshot.js +63 -0
- package/dist/services/retained-snapshot.js.map +1 -0
- package/dist/services/session-builder.d.ts +26 -0
- package/dist/services/session-builder.js +46 -19
- package/dist/services/session-builder.js.map +1 -1
- package/dist/services/start-guards.d.ts +32 -0
- package/dist/services/start-guards.js +50 -0
- package/dist/services/start-guards.js.map +1 -0
- package/dist/services/summarize.d.ts +12 -3
- package/dist/services/summarize.js +13 -5
- package/dist/services/summarize.js.map +1 -1
- package/dist/session/cleanup.js.map +1 -1
- package/dist/session/findings-store.d.ts +2 -1
- package/dist/session/findings-store.js +30 -2
- package/dist/session/findings-store.js.map +1 -1
- package/dist/session/live-pointer.d.ts +19 -0
- package/dist/session/live-pointer.js +41 -0
- package/dist/session/live-pointer.js.map +1 -0
- package/dist/session/manager.d.ts +11 -1
- package/dist/session/manager.js +46 -2
- package/dist/session/manager.js.map +1 -1
- package/dist/session/owner-lock.d.ts +208 -0
- package/dist/session/owner-lock.js +499 -0
- package/dist/session/owner-lock.js.map +1 -0
- package/dist/session/process-identity.js.map +1 -1
- package/dist/session/session.js +61 -7
- package/dist/session/session.js.map +1 -1
- package/dist/session/state-file.d.ts +74 -14
- package/dist/session/state-file.js +203 -21
- package/dist/session/state-file.js.map +1 -1
- package/package.json +7 -7
- package/dist/adapters/android/android-adapter.test-helpers.d.ts +0 -52
- package/dist/adapters/android/android-adapter.test-helpers.js +0 -115
- package/dist/adapters/android/android-adapter.test-helpers.js.map +0 -1
- package/dist/mcp/server.test-helpers.d.ts +0 -23
- package/dist/mcp/server.test-helpers.js +0 -49
- package/dist/mcp/server.test-helpers.js.map +0 -1
|
@@ -1,38 +1,42 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Desktop screenshots —
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* on Wayland (`idea/desktop-control.md`). So detect the session and dispatch —
|
|
6
|
-
* **grim** on wlroots/Wayland, **scrot** on X11. Both write a temp PNG we read and
|
|
7
|
-
* delete, keeping one uniform path. GNOME/KDE D-Bus + portal routes are future work.
|
|
8
|
-
*
|
|
9
|
-
* The picker + arg builders are pure and unit-tested; {@link Screenshot} is the
|
|
10
|
-
* thin runner that shells out and fails loud as an {@link AdapterError}.
|
|
2
|
+
* Desktop screenshots — try X11, then Wayland when available. Environment hints
|
|
3
|
+
* do not prove compositor protocol support: only a successful capture does.
|
|
4
|
+
* Both routes write temporary PNGs; portal/D-Bus capture remains unimplemented.
|
|
11
5
|
*/
|
|
12
6
|
import { mkdtemp, readFile, rm } from 'node:fs/promises';
|
|
13
7
|
import { tmpdir } from 'node:os';
|
|
14
8
|
import { join } from 'node:path';
|
|
15
|
-
import { AdapterError } from '../../errors.js';
|
|
9
|
+
import { AdapterError, ExecTimeoutError } from '../../errors.js';
|
|
16
10
|
import { desktopEnv, errMessage, makeExec } from './proc.js';
|
|
17
|
-
/**
|
|
18
|
-
* Capture cap — deliberately longer than `proc.ts`'s input/a11y default: a cold
|
|
19
|
-
* grim/scrot encoding a hi-dpi PNG (plus a compositor round-trip on Wayland) is
|
|
20
|
-
* legitimately slow, and one frame is worth waiting for. Still bounded: a wedged
|
|
21
|
-
* capture must not park the run until the outer session timeout.
|
|
22
|
-
*/
|
|
11
|
+
/** One shared cap: fallback must not restart the capture budget. */
|
|
23
12
|
const CAPTURE_TIMEOUT_MS = 30_000;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
* X11 (`DISPLAY`) → scrot. Throws loud when neither is set — there is nothing to capture.
|
|
27
|
-
*/
|
|
28
|
-
export function chooseCaptureTool(env) {
|
|
29
|
-
if (env.WAYLAND_DISPLAY)
|
|
30
|
-
return 'grim';
|
|
13
|
+
function captureTools(env) {
|
|
14
|
+
const tools = [];
|
|
31
15
|
if (env.DISPLAY)
|
|
32
|
-
|
|
33
|
-
|
|
16
|
+
tools.push('scrot');
|
|
17
|
+
if (env.WAYLAND_DISPLAY)
|
|
18
|
+
tools.push('grim');
|
|
19
|
+
return tools;
|
|
20
|
+
}
|
|
21
|
+
function captureFailure(env, failures) {
|
|
22
|
+
const hints = ['XDG_CURRENT_DESKTOP', 'XDG_SESSION_DESKTOP', 'DESKTOP_SESSION']
|
|
23
|
+
.filter((key) => env[key])
|
|
24
|
+
.map((key) => `${key}=${env[key]}`)
|
|
25
|
+
.join(', ');
|
|
26
|
+
return new AdapterError(`desktop: screenshot capture infrastructure unavailable (not an application defect; ${hints || 'compositor/desktop unknown'}): ${failures.join('; ')}. ` +
|
|
27
|
+
'grim requires a compositor supporting the Wayland screencopy protocol; portal/D-Bus capture is not implemented.');
|
|
34
28
|
}
|
|
35
|
-
/**
|
|
29
|
+
/** First route to try, not a claim that the display or backend is usable. */
|
|
30
|
+
export function chooseCaptureTool(env) {
|
|
31
|
+
const tool = captureTools(env)[0];
|
|
32
|
+
if (tool)
|
|
33
|
+
return tool;
|
|
34
|
+
throw captureFailure(env, [
|
|
35
|
+
'scrot unavailable: DISPLAY is not set',
|
|
36
|
+
'grim unavailable: WAYLAND_DISPLAY is not set',
|
|
37
|
+
]);
|
|
38
|
+
}
|
|
39
|
+
/** Build the capture argv that writes a PNG to `file`. */
|
|
36
40
|
export function captureArgs(tool, file) {
|
|
37
41
|
switch (tool) {
|
|
38
42
|
case 'grim':
|
|
@@ -45,26 +49,53 @@ export function captureArgs(tool, file) {
|
|
|
45
49
|
}
|
|
46
50
|
}
|
|
47
51
|
}
|
|
48
|
-
/** grim/scrot-backed
|
|
52
|
+
/** grim/scrot-backed capture with injectable execution and clock for deterministic tests. */
|
|
49
53
|
export class Screenshot {
|
|
50
54
|
#env;
|
|
51
55
|
#exec;
|
|
56
|
+
#now;
|
|
52
57
|
constructor(init = {}) {
|
|
53
58
|
this.#env = desktopEnv(init.display);
|
|
54
59
|
this.#exec = init.exec ?? makeExec(this.#env, CAPTURE_TIMEOUT_MS);
|
|
60
|
+
this.#now = init.now ?? Date.now;
|
|
55
61
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const
|
|
62
|
+
async capture(deadline) {
|
|
63
|
+
const end = Math.min(deadline ?? Infinity, this.#now() + CAPTURE_TIMEOUT_MS);
|
|
64
|
+
const checkDeadline = () => {
|
|
65
|
+
if (this.#now() >= end) {
|
|
66
|
+
throw new ExecTimeoutError(`desktop: screenshot capture at/after its deadline (${end})`);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const failures = [];
|
|
70
|
+
if (!this.#env.DISPLAY)
|
|
71
|
+
failures.push('scrot unavailable: DISPLAY is not set');
|
|
72
|
+
if (!this.#env.WAYLAND_DISPLAY)
|
|
73
|
+
failures.push('grim unavailable: WAYLAND_DISPLAY is not set');
|
|
74
|
+
const tools = captureTools(this.#env);
|
|
75
|
+
if (!tools.length)
|
|
76
|
+
throw captureFailure(this.#env, failures);
|
|
77
|
+
checkDeadline();
|
|
59
78
|
const dir = await mkdtemp(join(tmpdir(), 'uidbg-shot-'));
|
|
60
|
-
const file = join(dir, 'shot.png');
|
|
61
79
|
try {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
80
|
+
for (const tool of tools) {
|
|
81
|
+
checkDeadline();
|
|
82
|
+
// Separate files prevent a failed route's partial output becoming fallback evidence.
|
|
83
|
+
const file = join(dir, `${tool}.png`);
|
|
84
|
+
try {
|
|
85
|
+
await this.#exec(tool, captureArgs(tool, file), { deadline: end });
|
|
86
|
+
checkDeadline();
|
|
87
|
+
const buffer = await readFile(file);
|
|
88
|
+
checkDeadline();
|
|
89
|
+
return new Uint8Array(buffer);
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
if (error instanceof ExecTimeoutError)
|
|
93
|
+
throw error;
|
|
94
|
+
checkDeadline();
|
|
95
|
+
failures.push(`${tool} failed: ${errMessage(error)}`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
throw captureFailure(this.#env, failures);
|
|
68
99
|
}
|
|
69
100
|
finally {
|
|
70
101
|
await rm(dir, { recursive: true, force: true });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capture.js","sourceRoot":"","sources":["../../../src/adapters/desktop/capture.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"capture.js","sourceRoot":"","sources":["../../../src/adapters/desktop/capture.ts"],"names":[],"mappings":"AAAA;;;;GAIG;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CAAC,GAAG,IAAI,YAAY,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;gBACxD,CAAC;YACH,CAAC;YACD,MAAM,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAC5C,CAAC;gBAAS,CAAC;YACT,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;CACF"}
|
|
@@ -9,14 +9,25 @@
|
|
|
9
9
|
*
|
|
10
10
|
* **Managed only**: the desktop target has no attach handle (unlike web `cdpUrl` /
|
|
11
11
|
* android `adbSerial`), so `open` launches the configured command and `close` stops
|
|
12
|
-
* it. Reads/clicks key off AT-SPI
|
|
12
|
+
* it. Reads/clicks/type key off the AT-SPI tree — its screen extents give the
|
|
13
|
+
* click coordinates. A custom-drawn surface (a canvas, a game, a custom widget)
|
|
14
|
+
* exposes no a11y node, so it is simply absent from the tree: `find`, `click` and
|
|
15
|
+
* `type` cannot reach it. There is no automatic vision/OCR fallback: this adapter
|
|
16
|
+
* has no OCR/pixel path, so the adapter never switches to pixels — a read yields
|
|
17
|
+
* tree nodes or nothing. Only the agent-level `look` can describe a frame.
|
|
18
|
+
*
|
|
19
|
+
* **Every read is scoped to one window.** The AT-SPI tree spans every application
|
|
20
|
+
* on the desktop, so an unscoped lookup for "Save" can resolve to another app's
|
|
21
|
+
* button and the click lands in the wrong window. The scope is the configured
|
|
22
|
+
* `window` when the target has one, else the window the last `open` selected;
|
|
23
|
+
* with neither, a read fails loud rather than reading the whole desktop.
|
|
13
24
|
*
|
|
14
25
|
* Desktop apps expose no console/network channels — those methods throw loud
|
|
15
26
|
* ({@link AdapterError}), never a silent empty list. Every backend failure surfaces
|
|
16
27
|
* as an {@link AdapterError}; our own loud errors pass through un-rewrapped.
|
|
17
28
|
*/
|
|
18
29
|
import type { DesktopTarget } from '../../config/schema.js';
|
|
19
|
-
import type { Adapter, ConsoleEntry, NetworkEntry, Node, NodeRef, Query, ScrollOptions, WaitOptions } from '../contract.js';
|
|
30
|
+
import type { Adapter, ConsoleEntry, NetworkEntry, Node, NodeRef, Query, ScrollOptions, SelectorDialect, WaitOptions } from '../contract.js';
|
|
20
31
|
import { type AtspiSource } from './atspi.js';
|
|
21
32
|
import { type ScreenCapture } from './capture.js';
|
|
22
33
|
import { type PointerInput } from './input.js';
|
|
@@ -38,6 +49,13 @@ export interface DesktopAdapterInit {
|
|
|
38
49
|
*/
|
|
39
50
|
export declare class DesktopAdapter implements Adapter {
|
|
40
51
|
#private;
|
|
52
|
+
/**
|
|
53
|
+
* The native selector grammar — the AT-SPI parser this adapter's
|
|
54
|
+
* `find`/`click`/`type` accept: `role "name"` or a bare name substring, and
|
|
55
|
+
* nothing else. Declared here, not derived from the absence of `tabs`: the
|
|
56
|
+
* dialect is the grammar, and the grammar is the adapter's own.
|
|
57
|
+
*/
|
|
58
|
+
readonly selectorDialect: SelectorDialect;
|
|
41
59
|
private constructor();
|
|
42
60
|
/** Wire the adapter from config, binding each backend to the chosen X11 display. */
|
|
43
61
|
static create(init: DesktopAdapterInit): DesktopAdapter;
|
|
@@ -9,7 +9,18 @@
|
|
|
9
9
|
*
|
|
10
10
|
* **Managed only**: the desktop target has no attach handle (unlike web `cdpUrl` /
|
|
11
11
|
* android `adbSerial`), so `open` launches the configured command and `close` stops
|
|
12
|
-
* it. Reads/clicks key off AT-SPI
|
|
12
|
+
* it. Reads/clicks/type key off the AT-SPI tree — its screen extents give the
|
|
13
|
+
* click coordinates. A custom-drawn surface (a canvas, a game, a custom widget)
|
|
14
|
+
* exposes no a11y node, so it is simply absent from the tree: `find`, `click` and
|
|
15
|
+
* `type` cannot reach it. There is no automatic vision/OCR fallback: this adapter
|
|
16
|
+
* has no OCR/pixel path, so the adapter never switches to pixels — a read yields
|
|
17
|
+
* tree nodes or nothing. Only the agent-level `look` can describe a frame.
|
|
18
|
+
*
|
|
19
|
+
* **Every read is scoped to one window.** The AT-SPI tree spans every application
|
|
20
|
+
* on the desktop, so an unscoped lookup for "Save" can resolve to another app's
|
|
21
|
+
* button and the click lands in the wrong window. The scope is the configured
|
|
22
|
+
* `window` when the target has one, else the window the last `open` selected;
|
|
23
|
+
* with neither, a read fails loud rather than reading the whole desktop.
|
|
13
24
|
*
|
|
14
25
|
* Desktop apps expose no console/network channels — those methods throw loud
|
|
15
26
|
* ({@link AdapterError}), never a silent empty list. Every backend failure surfaces
|
|
@@ -18,7 +29,7 @@
|
|
|
18
29
|
import { spawn } from 'node:child_process';
|
|
19
30
|
import { AdapterError, UiDebuggerError } from '../../errors.js';
|
|
20
31
|
import { capWait } from '../budget.js';
|
|
21
|
-
import { BusctlAtspi, parseRoleNameQuery, shapeNodes } from './atspi.js';
|
|
32
|
+
import { BusctlAtspi, parseRoleNameQuery, shapeNodes, } from './atspi.js';
|
|
22
33
|
import { Screenshot } from './capture.js';
|
|
23
34
|
import { centerOf, clickPointOf, expectOnScreen, Xdotool, } from './input.js';
|
|
24
35
|
import { desktopEnv, terminateGroup } from './proc.js';
|
|
@@ -29,6 +40,13 @@ const DEFAULT_WAIT_MS = 5000;
|
|
|
29
40
|
const POLL_MS = 500;
|
|
30
41
|
/** How long `open` waits for the launched window to appear before failing loud. */
|
|
31
42
|
const WINDOW_WAIT_MS = 10_000;
|
|
43
|
+
/**
|
|
44
|
+
* Appended to the early-exit diagnosis when the launch command itself exits (code
|
|
45
|
+
* or signal) before any window appears. A possibility, never a proof: the exit
|
|
46
|
+
* code alone cannot show the command daemonized, so the hint names the likely
|
|
47
|
+
* shape and the fix, not a cause.
|
|
48
|
+
*/
|
|
49
|
+
const EARLY_EXIT_HINT = '. The command may have backgrounded or daemonized itself (e.g. a trailing &, nohup, or a wrapper that forks) — that exits before any window can appear. Use a foreground launch command that stays alive holding the window';
|
|
32
50
|
/** Wheel-step calibration: pixels-per-click, and the default page-ish distance. */
|
|
33
51
|
const SCROLL_STEP_PX = 120;
|
|
34
52
|
const DEFAULT_SCROLL_AMOUNT = 360;
|
|
@@ -42,12 +60,36 @@ export function scrollRepeat(amount) {
|
|
|
42
60
|
* contract. Construct via {@link DesktopAdapter.create}.
|
|
43
61
|
*/
|
|
44
62
|
export class DesktopAdapter {
|
|
63
|
+
/**
|
|
64
|
+
* The native selector grammar — the AT-SPI parser this adapter's
|
|
65
|
+
* `find`/`click`/`type` accept: `role "name"` or a bare name substring, and
|
|
66
|
+
* nothing else. Declared here, not derived from the absence of `tabs`: the
|
|
67
|
+
* dialect is the grammar, and the grammar is the adapter's own.
|
|
68
|
+
*/
|
|
69
|
+
selectorDialect = 'native';
|
|
45
70
|
#config;
|
|
46
71
|
#env;
|
|
47
72
|
#atspi;
|
|
48
73
|
#input;
|
|
49
74
|
#capture;
|
|
50
75
|
#child = null;
|
|
76
|
+
/**
|
|
77
|
+
* The window identity the reads are scoped to — the app/window the AT-SPI
|
|
78
|
+
* walk is restricted to.
|
|
79
|
+
*
|
|
80
|
+
* The a11y tree spans EVERY application on the desktop, so an unscoped read
|
|
81
|
+
* returns whichever application happened to answer first: two apps with the
|
|
82
|
+
* same "Save" label and the click lands in the wrong one.
|
|
83
|
+
*
|
|
84
|
+
* The scope is the CONFIGURED `window` whenever the target configures one:
|
|
85
|
+
* that is the window xdotool activates, so it is the window the reads must
|
|
86
|
+
* name — and a later `open` of another window does NOT re-scope them (the
|
|
87
|
+
* configured window still wins the match, so the scope stays put). Only a
|
|
88
|
+
* target with NO configured window takes its scope from the window `open`
|
|
89
|
+
* last selected, and there a later `open` of another window DOES re-scope
|
|
90
|
+
* the reads.
|
|
91
|
+
*/
|
|
92
|
+
#scope = null;
|
|
51
93
|
constructor(handles) {
|
|
52
94
|
this.#config = handles.config;
|
|
53
95
|
this.#env = handles.env;
|
|
@@ -83,11 +125,20 @@ export class DesktopAdapter {
|
|
|
83
125
|
}
|
|
84
126
|
const { died } = this.#launch();
|
|
85
127
|
// The window wait fits inside the run's remaining cap when that is the shorter one.
|
|
86
|
-
const
|
|
128
|
+
const waitMs = capWait(WINDOW_WAIT_MS, timeoutMs);
|
|
129
|
+
// The wait gets an ABSOLUTE deadline, not just a duration: the xdotool calls it
|
|
130
|
+
// makes are capped by the time left until then, so an in-flight search cannot
|
|
131
|
+
// outlive the budget the run has left.
|
|
132
|
+
const deadline = Date.now() + waitMs;
|
|
133
|
+
const activated = this.#input.activateWindow(match, waitMs, deadline);
|
|
87
134
|
// Pre-handle the loser: when the child dies first, the window wait keeps polling
|
|
88
135
|
// (bounded by the cap above) and its later rejection must not go unhandled.
|
|
89
136
|
activated.catch(() => { });
|
|
90
137
|
await Promise.race([activated, died]);
|
|
138
|
+
// The window that is now up is the one every later read is scoped to — the
|
|
139
|
+
// a11y tree holds every application on the desktop, so the scope is what
|
|
140
|
+
// keeps a lookup inside this one.
|
|
141
|
+
this.#scope = { title: match.title, class: match.class };
|
|
91
142
|
});
|
|
92
143
|
}
|
|
93
144
|
/**
|
|
@@ -108,14 +159,16 @@ export class DesktopAdapter {
|
|
|
108
159
|
stdio: 'ignore',
|
|
109
160
|
});
|
|
110
161
|
const died = new Promise((_resolve, reject) => {
|
|
111
|
-
const down = (reason) => {
|
|
162
|
+
const down = (reason, hint = '') => {
|
|
112
163
|
// A dead app must not pin `#child`: clear it so a later `open` relaunches
|
|
113
164
|
// and `close` never kills a recycled process group.
|
|
114
165
|
if (this.#child?.proc === proc)
|
|
115
166
|
this.#child = null;
|
|
116
|
-
reject(new AdapterError(`desktop: launch command exited (${reason}) before the window appeared: ${command}`));
|
|
167
|
+
reject(new AdapterError(`desktop: launch command exited (${reason}) before the window appeared: ${command}${hint}`));
|
|
117
168
|
};
|
|
118
|
-
|
|
169
|
+
// The daemonization hint rides the exit event only — on 'error' (spawn
|
|
170
|
+
// failed) the command never ran, so the hint would mislead there.
|
|
171
|
+
proc.once('exit', (code, signal) => down(signal ? `killed by ${signal}` : `exit code ${code ?? 'unknown'}`, EARLY_EXIT_HINT));
|
|
119
172
|
// 'error' fires async: unlistened, a missing `/bin/sh` would crash the server.
|
|
120
173
|
proc.once('error', (error) => down(`spawn failed: ${error.message}`));
|
|
121
174
|
});
|
|
@@ -134,6 +187,7 @@ export class DesktopAdapter {
|
|
|
134
187
|
}
|
|
135
188
|
async readState(opts = {}) {
|
|
136
189
|
return this.#run('readState', async () => {
|
|
190
|
+
const scope = this.#readScope();
|
|
137
191
|
const region = opts.within !== undefined ? await this.#regionBounds(opts.within) : undefined;
|
|
138
192
|
// A bounded query (role/name) + maxNodes let the AT-SPI walk skip describing
|
|
139
193
|
// (and stop once it has found) more than the caller could ever use — `find`
|
|
@@ -147,7 +201,7 @@ export class DesktopAdapter {
|
|
|
147
201
|
const query = opts.query ? parseRoleNameQuery(opts.query) : undefined;
|
|
148
202
|
const narrowed = region !== undefined || opts.filters !== undefined;
|
|
149
203
|
const maxNodes = narrowed ? DEFAULT_LIMIT : (opts.limit ?? DEFAULT_LIMIT);
|
|
150
|
-
const nodes = await this.#atspi.readTree({ query, maxNodes });
|
|
204
|
+
const nodes = await this.#atspi.readTree({ query, maxNodes, scope });
|
|
151
205
|
return shapeNodes(nodes, opts, DEFAULT_LIMIT, region);
|
|
152
206
|
});
|
|
153
207
|
}
|
|
@@ -196,8 +250,14 @@ export class DesktopAdapter {
|
|
|
196
250
|
await this.#run('waitFor', async () => {
|
|
197
251
|
const deadline = Date.now() + timeout;
|
|
198
252
|
for (;;) {
|
|
199
|
-
if (await this.#present(query, deadline))
|
|
253
|
+
if (await this.#present(query, deadline)) {
|
|
254
|
+
// A match that only landed after the deadline is not a success: the wait is
|
|
255
|
+
// over, so resolving now would report a node the caller waited too long for.
|
|
256
|
+
if (Date.now() > deadline) {
|
|
257
|
+
throw new AdapterError(`desktop: waitFor timed out after ${timeout}ms (${query}) — the query matched only after the deadline`);
|
|
258
|
+
}
|
|
200
259
|
return;
|
|
260
|
+
}
|
|
201
261
|
if (Date.now() >= deadline) {
|
|
202
262
|
throw new AdapterError(`desktop: waitFor timed out after ${timeout}ms (${query})`);
|
|
203
263
|
}
|
|
@@ -212,10 +272,12 @@ export class DesktopAdapter {
|
|
|
212
272
|
* checks the clock between polls — would overshoot its timeout by a whole walk.
|
|
213
273
|
*/
|
|
214
274
|
async #present(query, deadline) {
|
|
275
|
+
const scope = this.#readScope();
|
|
215
276
|
const nodes = await this.#atspi.readTree({
|
|
216
277
|
query: parseRoleNameQuery(query),
|
|
217
278
|
maxNodes: 1,
|
|
218
279
|
deadline,
|
|
280
|
+
scope,
|
|
219
281
|
});
|
|
220
282
|
return shapeNodes(nodes, { query, limit: 1 }, DEFAULT_LIMIT).length > 0;
|
|
221
283
|
}
|
|
@@ -257,7 +319,27 @@ export class DesktopAdapter {
|
|
|
257
319
|
return node;
|
|
258
320
|
}
|
|
259
321
|
/**
|
|
260
|
-
*
|
|
322
|
+
* The scope every read must carry — the window the target is bound to.
|
|
323
|
+
*
|
|
324
|
+
* The scope in force is the configured `window` when the target has one (a
|
|
325
|
+
* later `open` of another window does not change it — the configured window
|
|
326
|
+
* still wins the match), else the window the last `open` selected. With
|
|
327
|
+
* neither there is no window to read: an unscoped read walks EVERY
|
|
328
|
+
* application on the desktop, so a lookup for "Save" can resolve to another
|
|
329
|
+
* app's button and the click lands in the wrong window. That is the bug this
|
|
330
|
+
* scope exists to prevent, so the read fails loud instead of silently
|
|
331
|
+
* reading the whole desktop.
|
|
332
|
+
*/
|
|
333
|
+
#readScope() {
|
|
334
|
+
const scope = this.#scope ?? this.#config.window;
|
|
335
|
+
if (!scope || (!scope.title && !scope.class)) {
|
|
336
|
+
throw new AdapterError('desktop: no window selected — set `window.title` or `window.class` on the desktop ' +
|
|
337
|
+
'target, or open a window first; an unscoped read would match any application on ' +
|
|
338
|
+
'the desktop');
|
|
339
|
+
}
|
|
340
|
+
return scope;
|
|
341
|
+
}
|
|
342
|
+
/** Resolve a scope `within` (a {@link Node} or a selector) to an on-screen rectangle.
|
|
261
343
|
*
|
|
262
344
|
* A zero-size region is rejected, not scoped to: it would park the scroll cursor at
|
|
263
345
|
* the screen origin and (via `centerWithin`) read as a region nothing sits in.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"desktop-adapter.js","sourceRoot":"","sources":["../../../src/adapters/desktop/desktop-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAqB,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE9D,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAYvC,OAAO,EAAoB,WAAW,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC3F,OAAO,EAAsB,UAAU,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,cAAc,EAGd,OAAO,GACR,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEvD,oFAAoF;AACpF,MAAM,aAAa,GAAG,GAAG,CAAC;AAE1B,yFAAyF;AACzF,MAAM,eAAe,GAAG,IAAI,CAAC;AAC7B,MAAM,OAAO,GAAG,GAAG,CAAC;AAEpB,mFAAmF;AACnF,MAAM,cAAc,GAAG,MAAM,CAAC;AAE9B,mFAAmF;AACnF,MAAM,cAAc,GAAG,GAAG,CAAC;AAC3B,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAElC,MAAM,KAAK,GAAG,CAAC,EAAU,EAAiB,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAE/F,iFAAiF;AACjF,MAAM,UAAU,YAAY,CAAC,MAAe;IAC1C,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,IAAI,qBAAqB,CAAC,GAAG,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,EAAE,CAAC;QACpB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,eAAe;gBAAE,MAAM,KAAK,CAAC;YAClD,MAAM,IAAI,YAAY,CACpB,WAAW,EAAE,YAAY,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAClF,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
|
|
@@ -28,7 +28,7 @@ export declare function centerOf(bounds: Bounds): {
|
|
|
28
28
|
* The on-screen rectangle of a {@link Node}, or a loud failure when it has none.
|
|
29
29
|
*
|
|
30
30
|
* AT-SPI nodes that expose no `Component` (app roots, toolkit fillers) carry
|
|
31
|
-
* placeholder zero bounds (`atspi.ts` marks them `measured: false`), and a real
|
|
31
|
+
* placeholder zero bounds (`atspi-busctl.ts` marks them `measured: false`), and a real
|
|
32
32
|
* widget reports `0x0` until it is laid out. Either way the "center" is the screen
|
|
33
33
|
* origin — clicking it would hit the top-left of the desktop and read as success.
|
|
34
34
|
* (The android adapter applies the same rule in `tapPointOf`.)
|
|
@@ -70,7 +70,15 @@ export interface PointerInput {
|
|
|
70
70
|
typeText(text: string): Promise<void>;
|
|
71
71
|
key(chord: string): Promise<void>;
|
|
72
72
|
scroll(direction: ScrollDirection, repeat: number): Promise<void>;
|
|
73
|
-
|
|
73
|
+
/**
|
|
74
|
+
* Wait for the matching window and activate it.
|
|
75
|
+
*
|
|
76
|
+
* `timeoutMs` is how long the wait may take; `deadline` is the absolute instant
|
|
77
|
+
* (epoch ms) it must not run past — the caller hands down its own budget's
|
|
78
|
+
* deadline so an in-flight `xdotool` cannot outlive it. Omit it and the wait
|
|
79
|
+
* derives one from `timeoutMs`.
|
|
80
|
+
*/
|
|
81
|
+
activateWindow(match: WindowMatch, timeoutMs: number, deadline?: number): Promise<void>;
|
|
74
82
|
}
|
|
75
83
|
/** xdotool-backed {@link PointerInput}. Construct with a target `display` (or inject `exec` for tests). */
|
|
76
84
|
export declare class Xdotool implements PointerInput {
|
|
@@ -84,6 +92,12 @@ export declare class Xdotool implements PointerInput {
|
|
|
84
92
|
typeText(text: string): Promise<void>;
|
|
85
93
|
key(chord: string): Promise<void>;
|
|
86
94
|
scroll(direction: ScrollDirection, repeat: number): Promise<void>;
|
|
87
|
-
/**
|
|
88
|
-
|
|
95
|
+
/**
|
|
96
|
+
* Poll `search` until the window exists, then `windowactivate --sync`; throw loud on timeout.
|
|
97
|
+
*
|
|
98
|
+
* Every invocation is bounded by `deadline` (the enclosing budget's instant), so a
|
|
99
|
+
* wedged `xdotool` cannot hold the wait — and the `open` that asked for it — past
|
|
100
|
+
* the time the run has left.
|
|
101
|
+
*/
|
|
102
|
+
activateWindow(match: WindowMatch, timeoutMs: number, deadline?: number): Promise<void>;
|
|
89
103
|
}
|
|
@@ -99,7 +99,7 @@ export function centerOf(bounds) {
|
|
|
99
99
|
* The on-screen rectangle of a {@link Node}, or a loud failure when it has none.
|
|
100
100
|
*
|
|
101
101
|
* AT-SPI nodes that expose no `Component` (app roots, toolkit fillers) carry
|
|
102
|
-
* placeholder zero bounds (`atspi.ts` marks them `measured: false`), and a real
|
|
102
|
+
* placeholder zero bounds (`atspi-busctl.ts` marks them `measured: false`), and a real
|
|
103
103
|
* widget reports `0x0` until it is laid out. Either way the "center" is the screen
|
|
104
104
|
* origin — clicking it would hit the top-left of the desktop and read as success.
|
|
105
105
|
* (The android adapter applies the same rule in `tapPointOf`.)
|
|
@@ -180,15 +180,20 @@ export class Xdotool {
|
|
|
180
180
|
scroll(direction, repeat) {
|
|
181
181
|
return this.#do(scrollArgs(direction, repeat));
|
|
182
182
|
}
|
|
183
|
-
/**
|
|
184
|
-
|
|
183
|
+
/**
|
|
184
|
+
* Poll `search` until the window exists, then `windowactivate --sync`; throw loud on timeout.
|
|
185
|
+
*
|
|
186
|
+
* Every invocation is bounded by `deadline` (the enclosing budget's instant), so a
|
|
187
|
+
* wedged `xdotool` cannot hold the wait — and the `open` that asked for it — past
|
|
188
|
+
* the time the run has left.
|
|
189
|
+
*/
|
|
190
|
+
async activateWindow(match, timeoutMs, deadline = Date.now() + timeoutMs) {
|
|
185
191
|
const args = searchArgs(match);
|
|
186
|
-
const start = Date.now();
|
|
187
192
|
for (;;) {
|
|
188
193
|
// `search` exits non-zero with EMPTY stderr when nothing matches (→ rejects);
|
|
189
194
|
// that means "not up yet", so keep polling. Anything on stderr is a real
|
|
190
195
|
// failure (e.g. `Can't open display`) — fatal, loud. Missing xdotool too.
|
|
191
|
-
const out = await this.#exec(XDOTOOL, args).catch((error) => {
|
|
196
|
+
const out = await this.#exec(XDOTOOL, args, { deadline }).catch((error) => {
|
|
192
197
|
// An expired per-call cap (`proc.ts`) arrives already loud, with no stderr —
|
|
193
198
|
// never mistake a wedged xdotool for "no window yet" and keep polling.
|
|
194
199
|
if (error instanceof AdapterError)
|
|
@@ -208,19 +213,19 @@ export class Xdotool {
|
|
|
208
213
|
.map((line) => line.trim())
|
|
209
214
|
.find((line) => line.length > 0);
|
|
210
215
|
if (id) {
|
|
211
|
-
await this.#do(['windowactivate', '--sync', id]);
|
|
216
|
+
await this.#do(['windowactivate', '--sync', id], deadline);
|
|
212
217
|
return;
|
|
213
218
|
}
|
|
214
|
-
if (Date.now()
|
|
215
|
-
throw new AdapterError(`desktop: window not found within ${timeoutMs}ms (${JSON.stringify(match)})`);
|
|
219
|
+
if (Date.now() >= deadline) {
|
|
220
|
+
throw new AdapterError(`desktop: window not found within ${timeoutMs}ms (deadline ${deadline}) (${JSON.stringify(match)})`);
|
|
216
221
|
}
|
|
217
222
|
await delay(POLL_MS);
|
|
218
223
|
}
|
|
219
224
|
}
|
|
220
225
|
/** Run one xdotool invocation, re-throwing any failure as a loud {@link AdapterError}. */
|
|
221
|
-
async #do(args) {
|
|
226
|
+
async #do(args, deadline) {
|
|
222
227
|
try {
|
|
223
|
-
await this.#exec(XDOTOOL, args);
|
|
228
|
+
await this.#exec(XDOTOOL, args, deadline === undefined ? undefined : { deadline });
|
|
224
229
|
}
|
|
225
230
|
catch (error) {
|
|
226
231
|
// Already-loud failures (a per-call timeout) surface verbatim, not re-prefixed.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../../src/adapters/desktop/input.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAa,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAElF,MAAM,OAAO,GAAG,SAAS,CAAC;AAE1B,sEAAsE;AACtE,MAAM,OAAO,GAAG,GAAG,CAAC;AAEpB,iFAAiF;AACjF,MAAM,WAAW,GAA2B;IAC1C,OAAO,EAAE,MAAM;IACf,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,OAAO;IACZ,OAAO,EAAE,OAAO;IAChB,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,OAAO;IACd,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,KAAK;IACb,KAAK,EAAE,OAAO;CACf,CAAC;AAEF,uFAAuF;AACvF,MAAM,WAAW,GAA2B;IAC1C,KAAK,EAAE,QAAQ;IACf,MAAM,EAAE,QAAQ;IAChB,GAAG,EAAE,QAAQ;IACb,MAAM,EAAE,QAAQ;IAChB,GAAG,EAAE,KAAK;IACV,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,QAAQ;IAChB,GAAG,EAAE,QAAQ;IACb,KAAK,EAAE,OAAO;IACd,EAAE,EAAE,IAAI;IACR,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,IAAI;IACb,SAAS,EAAE,MAAM;IACjB,SAAS,EAAE,MAAM;IACjB,UAAU,EAAE,OAAO;IACnB,IAAI,EAAE,MAAM;I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AAE,CAAC,CAAC;QACrF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,gFAAgF;YAChF,IAAI,KAAK,YAAY,YAAY;gBAAE,MAAM,KAAK,CAAC;YAC/C,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;gBACpB,MAAM,IAAI,YAAY,CAAC,wDAAwD,CAAC,CAAC;YACnF,CAAC;YACD,MAAM,IAAI,YAAY,CAAC,WAAW,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,YAAY,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAClF,CAAC;IACH,CAAC;CACF"}
|
|
@@ -12,6 +12,12 @@
|
|
|
12
12
|
* Fails loud — a non-zero exit rejects through `execFile`, and callers re-wrap it
|
|
13
13
|
* as an {@link AdapterError}; never a silent fallback. Every invocation is also
|
|
14
14
|
* wall-clock capped, so no wedged tool can park the run (see {@link makeExec}).
|
|
15
|
+
*
|
|
16
|
+
* The cap is per-invocation, so on its own it can OUTLAST the budget the caller
|
|
17
|
+
* handed down (a run's remaining wall-clock, a `waitFor` timeout). Hence the
|
|
18
|
+
* absolute deadline ({@link ExecOptions.deadline}): the subprocess is capped by the
|
|
19
|
+
* time left until it, and a call that resolves after it rejects — an enclosing
|
|
20
|
+
* budget is never outlived by the tool's own default.
|
|
15
21
|
*/
|
|
16
22
|
/**
|
|
17
23
|
* Default per-invocation wall-clock cap. These tools do wedge in practice — `busctl`
|
|
@@ -21,13 +27,26 @@
|
|
|
21
27
|
* capture passes its own, longer cap (`capture.ts`).
|
|
22
28
|
*/
|
|
23
29
|
export declare const DEFAULT_EXEC_TIMEOUT_MS = 10000;
|
|
30
|
+
/** Per-call options for one {@link Exec} invocation. */
|
|
31
|
+
export interface ExecOptions {
|
|
32
|
+
/**
|
|
33
|
+
* Absolute wall-clock instant (epoch ms) the call must not run past. The
|
|
34
|
+
* subprocess is capped by the time left until then (never above the adapter's own
|
|
35
|
+
* default), and a call that resolves after it rejects as an
|
|
36
|
+
* {@link ExecTimeoutError} instead of counting as a success.
|
|
37
|
+
*
|
|
38
|
+
* An absolute instant, not a duration: the enclosing budget is shared by every
|
|
39
|
+
* call it covers, so each one has to be told the same instant.
|
|
40
|
+
*/
|
|
41
|
+
deadline?: number;
|
|
42
|
+
}
|
|
24
43
|
/** Run a CLI tool, resolve its stdout, reject (loud) on a non-zero exit or a missing binary. */
|
|
25
|
-
export type Exec = (cmd: string, args: string[]) => Promise<string>;
|
|
44
|
+
export type Exec = (cmd: string, args: string[], opts?: ExecOptions) => Promise<string>;
|
|
26
45
|
/**
|
|
27
46
|
* A child env with `DISPLAY` overridden when a target display is configured (else inherit).
|
|
28
47
|
* An explicit display also drops any inherited `WAYLAND_DISPLAY` — the user pointed us at
|
|
29
|
-
* an X11 display (e.g. Xvfb `:99`), so capture/input must not dispatch
|
|
30
|
-
*
|
|
48
|
+
* an X11 display (e.g. Xvfb `:99`), so capture/input must not dispatch or fall back
|
|
49
|
+
* to the live Wayland session.
|
|
31
50
|
*/
|
|
32
51
|
export declare function desktopEnv(display?: string): NodeJS.ProcessEnv;
|
|
33
52
|
/**
|
|
@@ -36,8 +55,17 @@ export declare function desktopEnv(display?: string): NodeJS.ProcessEnv;
|
|
|
36
55
|
* rejects as an {@link ExecTimeoutError} naming the cap; every other failure passes through
|
|
37
56
|
* **raw** so callers can still triage the real `execFile` error (ENOENT, exit code,
|
|
38
57
|
* stderr) — `xdotool search` exiting non-zero with empty stderr means "no window yet".
|
|
58
|
+
*
|
|
59
|
+
* With a {@link ExecOptions.deadline} the call is capped by the time left until that
|
|
60
|
+
* instant instead of by its own default, and a result that arrives after it rejects —
|
|
61
|
+
* the enclosing budget (a run's remaining time, a `waitFor` timeout) is never
|
|
62
|
+
* outlived by a tool that happens to be slow.
|
|
63
|
+
*
|
|
64
|
+
* @param now the clock, injectable for tests (defaults to `Date.now`). Shifting the
|
|
65
|
+
* global clock from a test leaks into every test file `bun test` runs alongside it;
|
|
66
|
+
* a seam keeps the deadline logic deterministic with no cross-file blast radius.
|
|
39
67
|
*/
|
|
40
|
-
export declare function makeExec(env: NodeJS.ProcessEnv, timeoutMs?: number): Exec;
|
|
68
|
+
export declare function makeExec(env: NodeJS.ProcessEnv, timeoutMs?: number, now?: () => number): Exec;
|
|
41
69
|
/**
|
|
42
70
|
* Tear a managed target down: SIGTERM its group, wait for it to actually die, escalate
|
|
43
71
|
* to SIGKILL after `graceMs`.
|