@developerz.ai/ui-debugger-mcp 1.1.0 → 1.2.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 +22 -10
- package/dist/adapters/android/adb.d.ts +34 -5
- package/dist/adapters/android/adb.js +74 -20
- package/dist/adapters/android/adb.js.map +1 -1
- package/dist/adapters/android/android-adapter.d.ts +23 -7
- package/dist/adapters/android/android-adapter.js +106 -36
- package/dist/adapters/android/android-adapter.js.map +1 -1
- package/dist/adapters/android/android-adapter.test-helpers.d.ts +52 -0
- package/dist/adapters/android/android-adapter.test-helpers.js +115 -0
- package/dist/adapters/android/android-adapter.test-helpers.js.map +1 -0
- package/dist/adapters/android/commands.d.ts +27 -4
- package/dist/adapters/android/commands.js +66 -4
- package/dist/adapters/android/commands.js.map +1 -1
- package/dist/adapters/android/ports.d.ts +32 -0
- package/dist/adapters/android/ports.js +47 -0
- package/dist/adapters/android/ports.js.map +1 -0
- package/dist/adapters/android/uiautomator.d.ts +10 -2
- package/dist/adapters/android/uiautomator.js +36 -4
- package/dist/adapters/android/uiautomator.js.map +1 -1
- package/dist/adapters/browser/browser-adapter.d.ts +14 -13
- package/dist/adapters/browser/browser-adapter.js +69 -306
- package/dist/adapters/browser/browser-adapter.js.map +1 -1
- package/dist/adapters/browser/cdp.js +18 -11
- package/dist/adapters/browser/cdp.js.map +1 -1
- package/dist/adapters/browser/extractor.d.ts +49 -0
- package/dist/adapters/browser/extractor.js +208 -0
- package/dist/adapters/browser/extractor.js.map +1 -0
- package/dist/adapters/browser/filters.d.ts +15 -0
- package/dist/adapters/browser/filters.js +93 -0
- package/dist/adapters/browser/filters.js.map +1 -0
- package/dist/adapters/browser/launch.d.ts +41 -0
- package/dist/adapters/browser/launch.js +61 -0
- package/dist/adapters/browser/launch.js.map +1 -0
- package/dist/adapters/budget.d.ts +16 -0
- package/dist/adapters/budget.js +25 -0
- package/dist/adapters/budget.js.map +1 -0
- package/dist/adapters/contract.d.ts +13 -6
- package/dist/adapters/desktop/atspi.d.ts +15 -0
- package/dist/adapters/desktop/atspi.js +37 -17
- package/dist/adapters/desktop/atspi.js.map +1 -1
- package/dist/adapters/desktop/capture.js +8 -1
- package/dist/adapters/desktop/capture.js.map +1 -1
- package/dist/adapters/desktop/desktop-adapter.d.ts +9 -2
- package/dist/adapters/desktop/desktop-adapter.js +84 -32
- package/dist/adapters/desktop/desktop-adapter.js.map +1 -1
- package/dist/adapters/desktop/input.d.ts +16 -1
- package/dist/adapters/desktop/input.js +30 -0
- package/dist/adapters/desktop/input.js.map +1 -1
- package/dist/adapters/desktop/proc.d.ts +18 -3
- package/dist/adapters/desktop/proc.js +48 -5
- package/dist/adapters/desktop/proc.js.map +1 -1
- package/dist/adapters/factory.d.ts +3 -1
- package/dist/adapters/factory.js +6 -2
- package/dist/adapters/factory.js.map +1 -1
- package/dist/adapters/limit.d.ts +10 -0
- package/dist/adapters/limit.js +19 -0
- package/dist/adapters/limit.js.map +1 -0
- package/dist/agent/belt/act.d.ts +27 -5
- package/dist/agent/belt/act.js +75 -17
- package/dist/agent/belt/act.js.map +1 -1
- package/dist/agent/belt/observe.d.ts +29 -15
- package/dist/agent/belt/observe.js +74 -19
- package/dist/agent/belt/observe.js.map +1 -1
- package/dist/agent/belt/report.d.ts +29 -9
- package/dist/agent/belt/report.js +77 -10
- package/dist/agent/belt/report.js.map +1 -1
- package/dist/agent/belt/trail.d.ts +34 -0
- package/dist/agent/belt/trail.js +64 -0
- package/dist/agent/belt/trail.js.map +1 -0
- package/dist/agent/capabilities.d.ts +4 -4
- package/dist/agent/capabilities.js +38 -13
- package/dist/agent/capabilities.js.map +1 -1
- package/dist/agent/loop.d.ts +58 -19
- package/dist/agent/loop.js +134 -46
- package/dist/agent/loop.js.map +1 -1
- package/dist/agent/prompts/compose.d.ts +9 -1
- package/dist/agent/prompts/compose.js +5 -4
- package/dist/agent/prompts/compose.js.map +1 -1
- package/dist/agent/prompts/debug-agent.d.ts +13 -1
- package/dist/agent/prompts/debug-agent.js +45 -11
- package/dist/agent/prompts/debug-agent.js.map +1 -1
- package/dist/agent/prompts/desktop-addendum.d.ts +1 -1
- package/dist/agent/prompts/desktop-addendum.js +1 -1
- package/dist/agent/prompts/web-addendum.d.ts +1 -1
- package/dist/agent/prompts/web-addendum.js +16 -18
- package/dist/agent/prompts/web-addendum.js.map +1 -1
- package/dist/cli/control.d.ts +3 -1
- package/dist/cli/control.js +26 -40
- package/dist/cli/control.js.map +1 -1
- package/dist/cli/help.d.ts +3 -1
- package/dist/cli/help.js +6 -2
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/init.d.ts +3 -6
- package/dist/cli/init.js +64 -16
- package/dist/cli/init.js.map +1 -1
- package/dist/config/load.js +8 -1
- package/dist/config/load.js.map +1 -1
- package/dist/config/schema.d.ts +12 -5
- package/dist/config/schema.js +17 -7
- package/dist/config/schema.js.map +1 -1
- package/dist/errors.d.ts +14 -2
- package/dist/errors.js +24 -4
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/main.js +22 -8
- package/dist/main.js.map +1 -1
- package/dist/mcp/server.d.ts +16 -1
- package/dist/mcp/server.js +23 -2
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/server.test-helpers.d.ts +23 -0
- package/dist/mcp/server.test-helpers.js +49 -0
- package/dist/mcp/server.test-helpers.js.map +1 -0
- package/dist/mcp/tools/describe.js +5 -0
- package/dist/mcp/tools/describe.js.map +1 -1
- package/dist/mcp/tools/end-session.js +5 -0
- package/dist/mcp/tools/end-session.js.map +1 -1
- package/dist/mcp/tools/get-findings.js +23 -3
- package/dist/mcp/tools/get-findings.js.map +1 -1
- package/dist/mcp/tools/output.d.ts +50 -0
- package/dist/mcp/tools/output.js +55 -0
- package/dist/mcp/tools/output.js.map +1 -0
- package/dist/mcp/tools/result.d.ts +24 -1
- package/dist/mcp/tools/result.js +106 -5
- package/dist/mcp/tools/result.js.map +1 -1
- package/dist/mcp/tools/send-message.js +5 -0
- package/dist/mcp/tools/send-message.js.map +1 -1
- package/dist/mcp/tools/start-debug.js +7 -1
- package/dist/mcp/tools/start-debug.js.map +1 -1
- package/dist/services/debug-service.d.ts +38 -6
- package/dist/services/debug-service.js +122 -13
- package/dist/services/debug-service.js.map +1 -1
- package/dist/services/session-builder.d.ts +20 -3
- package/dist/services/session-builder.js +43 -13
- package/dist/services/session-builder.js.map +1 -1
- package/dist/session/atomic-write.d.ts +24 -0
- package/dist/session/atomic-write.js +39 -0
- package/dist/session/atomic-write.js.map +1 -0
- package/dist/session/findings-store.js +3 -4
- package/dist/session/findings-store.js.map +1 -1
- package/dist/session/process-identity.d.ts +16 -0
- package/dist/session/process-identity.js +29 -0
- package/dist/session/process-identity.js.map +1 -1
- package/dist/session/session.js +10 -2
- package/dist/session/session.js.map +1 -1
- package/dist/session/state-file.d.ts +51 -5
- package/dist/session/state-file.js +60 -8
- package/dist/session/state-file.js.map +1 -1
- package/dist/session/workspace.d.ts +11 -0
- package/dist/session/workspace.js +14 -1
- package/dist/session/workspace.js.map +1 -1
- package/package.json +4 -1
|
@@ -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,G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C,GAAG,CAAC,IAAc;QACtB,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAClC,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"}
|
|
@@ -9,8 +9,17 @@
|
|
|
9
9
|
* the pure orchestration without spawning anything.
|
|
10
10
|
*
|
|
11
11
|
* Fails loud — a non-zero exit rejects through `execFile`, and callers re-wrap it
|
|
12
|
-
* as an {@link AdapterError}; never a silent fallback.
|
|
12
|
+
* as an {@link AdapterError}; never a silent fallback. Every invocation is also
|
|
13
|
+
* wall-clock capped, so no wedged tool can park the run (see {@link makeExec}).
|
|
13
14
|
*/
|
|
15
|
+
/**
|
|
16
|
+
* Default per-invocation wall-clock cap. These tools do wedge in practice — `busctl`
|
|
17
|
+
* against an unresponsive AT-SPI peer, `xdotool --sync` waiting on a window that never
|
|
18
|
+
* settles — and an unbounded `execFile` parks the whole operation behind that one call
|
|
19
|
+
* until the outer session timeout. 10 s is far above any healthy input/a11y round-trip;
|
|
20
|
+
* capture passes its own, longer cap (`capture.ts`).
|
|
21
|
+
*/
|
|
22
|
+
export declare const DEFAULT_EXEC_TIMEOUT_MS = 10000;
|
|
14
23
|
/** Run a CLI tool, resolve its stdout, reject (loud) on a non-zero exit or a missing binary. */
|
|
15
24
|
export type Exec = (cmd: string, args: string[]) => Promise<string>;
|
|
16
25
|
/**
|
|
@@ -20,8 +29,14 @@ export type Exec = (cmd: string, args: string[]) => Promise<string>;
|
|
|
20
29
|
* Wayland session ({@link chooseCaptureTool} checks `WAYLAND_DISPLAY` first).
|
|
21
30
|
*/
|
|
22
31
|
export declare function desktopEnv(display?: string): NodeJS.ProcessEnv;
|
|
23
|
-
/**
|
|
24
|
-
|
|
32
|
+
/**
|
|
33
|
+
* The real {@link Exec}: `execFile` bound to a fixed child env and a wall-clock cap
|
|
34
|
+
* (`timeoutMs`, default {@link DEFAULT_EXEC_TIMEOUT_MS}). Expiry kills the child and
|
|
35
|
+
* rejects as an {@link ExecTimeoutError} naming the cap; every other failure passes through
|
|
36
|
+
* **raw** so callers can still triage the real `execFile` error (ENOENT, exit code,
|
|
37
|
+
* stderr) — `xdotool search` exiting non-zero with empty stderr means "no window yet".
|
|
38
|
+
*/
|
|
39
|
+
export declare function makeExec(env: NodeJS.ProcessEnv, timeoutMs?: number): Exec;
|
|
25
40
|
/** True when an error is a "binary not found on PATH" (`ENOENT`) — for a clear, loud message. */
|
|
26
41
|
export declare function isEnoent(error: unknown): boolean;
|
|
27
42
|
/** Compact message extractor for wrapping a thrown subprocess error. */
|
|
@@ -9,13 +9,29 @@
|
|
|
9
9
|
* the pure orchestration without spawning anything.
|
|
10
10
|
*
|
|
11
11
|
* Fails loud — a non-zero exit rejects through `execFile`, and callers re-wrap it
|
|
12
|
-
* as an {@link AdapterError}; never a silent fallback.
|
|
12
|
+
* as an {@link AdapterError}; never a silent fallback. Every invocation is also
|
|
13
|
+
* wall-clock capped, so no wedged tool can park the run (see {@link makeExec}).
|
|
13
14
|
*/
|
|
14
15
|
import { execFile } from 'node:child_process';
|
|
15
16
|
import { promisify } from 'node:util';
|
|
17
|
+
import { ExecTimeoutError } from '../../errors.js';
|
|
16
18
|
const pExecFile = promisify(execFile);
|
|
17
19
|
/** 16 MiB stdout cap — busctl JSON is small; the screenshots route through a file. */
|
|
18
20
|
const MAX_BUFFER = 16 * 1024 * 1024;
|
|
21
|
+
/**
|
|
22
|
+
* Default per-invocation wall-clock cap. These tools do wedge in practice — `busctl`
|
|
23
|
+
* against an unresponsive AT-SPI peer, `xdotool --sync` waiting on a window that never
|
|
24
|
+
* settles — and an unbounded `execFile` parks the whole operation behind that one call
|
|
25
|
+
* until the outer session timeout. 10 s is far above any healthy input/a11y round-trip;
|
|
26
|
+
* capture passes its own, longer cap (`capture.ts`).
|
|
27
|
+
*/
|
|
28
|
+
export const DEFAULT_EXEC_TIMEOUT_MS = 10_000;
|
|
29
|
+
/**
|
|
30
|
+
* Kill signal on expiry. SIGKILL, not SIGTERM: a tool blocked on a hung X11/D-Bus
|
|
31
|
+
* round-trip is exactly the process that ignores a polite signal, and Node only
|
|
32
|
+
* rejects once the child is actually gone.
|
|
33
|
+
*/
|
|
34
|
+
const KILL_SIGNAL = 'SIGKILL';
|
|
19
35
|
/**
|
|
20
36
|
* A child env with `DISPLAY` overridden when a target display is configured (else inherit).
|
|
21
37
|
* An explicit display also drops any inherited `WAYLAND_DISPLAY` — the user pointed us at
|
|
@@ -30,13 +46,40 @@ export function desktopEnv(display) {
|
|
|
30
46
|
}
|
|
31
47
|
return env;
|
|
32
48
|
}
|
|
33
|
-
/**
|
|
34
|
-
|
|
49
|
+
/**
|
|
50
|
+
* The real {@link Exec}: `execFile` bound to a fixed child env and a wall-clock cap
|
|
51
|
+
* (`timeoutMs`, default {@link DEFAULT_EXEC_TIMEOUT_MS}). Expiry kills the child and
|
|
52
|
+
* rejects as an {@link ExecTimeoutError} naming the cap; every other failure passes through
|
|
53
|
+
* **raw** so callers can still triage the real `execFile` error (ENOENT, exit code,
|
|
54
|
+
* stderr) — `xdotool search` exiting non-zero with empty stderr means "no window yet".
|
|
55
|
+
*/
|
|
56
|
+
export function makeExec(env, timeoutMs = DEFAULT_EXEC_TIMEOUT_MS) {
|
|
35
57
|
return async (cmd, args) => {
|
|
36
|
-
|
|
37
|
-
|
|
58
|
+
try {
|
|
59
|
+
const { stdout } = await pExecFile(cmd, args, {
|
|
60
|
+
env,
|
|
61
|
+
maxBuffer: MAX_BUFFER,
|
|
62
|
+
timeout: timeoutMs,
|
|
63
|
+
killSignal: KILL_SIGNAL,
|
|
64
|
+
});
|
|
65
|
+
return stdout;
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
if (!killedByTimeout(error))
|
|
69
|
+
throw error;
|
|
70
|
+
throw new ExecTimeoutError(`desktop: \`${cmd}\` timed out after ${timeoutMs}ms (${KILL_SIGNAL}ed — the tool or its display/bus is wedged)`, { cause: error });
|
|
71
|
+
}
|
|
38
72
|
};
|
|
39
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* True when `execFile` killed the child on `timeout` expiry. `killed` alone is not
|
|
76
|
+
* enough: a `maxBuffer` overflow also kills, and that is a different (still loud) bug.
|
|
77
|
+
*/
|
|
78
|
+
function killedByTimeout(error) {
|
|
79
|
+
if (!(error instanceof Error) || error.killed !== true)
|
|
80
|
+
return false;
|
|
81
|
+
return error.code !== 'ERR_CHILD_PROCESS_STDIO_MAXBUFFER';
|
|
82
|
+
}
|
|
40
83
|
/** True when an error is a "binary not found on PATH" (`ENOENT`) — for a clear, loud message. */
|
|
41
84
|
export function isEnoent(error) {
|
|
42
85
|
return error instanceof Error && error.code === 'ENOENT';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proc.js","sourceRoot":"","sources":["../../../src/adapters/desktop/proc.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"proc.js","sourceRoot":"","sources":["../../../src/adapters/desktop/proc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,MAAM,SAAS,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAEtC,sFAAsF;AACtF,MAAM,UAAU,GAA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OAAQ,KAA+B,CAAC,IAAI,KAAK,mCAAmC,CAAC;AACvF,CAAC;AAED,iGAAiG;AACjG,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,OAAO,KAAK,YAAY,KAAK,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ,CAAC;AACtF,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC"}
|
|
@@ -16,8 +16,10 @@ import type { Adapter } from './contract.js';
|
|
|
16
16
|
* @param config — the resolved `.ui-debugger-mcp.json` config
|
|
17
17
|
* @param profileDir — absolute path to persistent profile dir (for managed browser adapter)
|
|
18
18
|
* @param onLog — optional sink for streaming console/network logs to findings store
|
|
19
|
+
* @param timeoutMs — the run's remaining wall-clock budget for getting the target up;
|
|
20
|
+
* only the browser launches/connects here, so only it shortens its wait by it
|
|
19
21
|
* @returns the wired Adapter instance
|
|
20
22
|
* @throws TargetNotFoundError if targetName doesn't exist in config.targets
|
|
21
23
|
* @throws AdapterError if the adapter type is not yet implemented
|
|
22
24
|
*/
|
|
23
|
-
export declare function createAdapter(targetName: string, config: Config, profileDir: string, onLog?: BrowserAdapterInit['onLog']): Promise<Adapter>;
|
|
25
|
+
export declare function createAdapter(targetName: string, config: Config, profileDir: string, onLog?: BrowserAdapterInit['onLog'], timeoutMs?: number): Promise<Adapter>;
|
package/dist/adapters/factory.js
CHANGED
|
@@ -17,24 +17,28 @@ import { DesktopAdapter } from './desktop/desktop-adapter.js';
|
|
|
17
17
|
* @param config — the resolved `.ui-debugger-mcp.json` config
|
|
18
18
|
* @param profileDir — absolute path to persistent profile dir (for managed browser adapter)
|
|
19
19
|
* @param onLog — optional sink for streaming console/network logs to findings store
|
|
20
|
+
* @param timeoutMs — the run's remaining wall-clock budget for getting the target up;
|
|
21
|
+
* only the browser launches/connects here, so only it shortens its wait by it
|
|
20
22
|
* @returns the wired Adapter instance
|
|
21
23
|
* @throws TargetNotFoundError if targetName doesn't exist in config.targets
|
|
22
24
|
* @throws AdapterError if the adapter type is not yet implemented
|
|
23
25
|
*/
|
|
24
|
-
export async function createAdapter(targetName, config, profileDir, onLog) {
|
|
26
|
+
export async function createAdapter(targetName, config, profileDir, onLog, timeoutMs) {
|
|
25
27
|
const target = config.targets[targetName];
|
|
26
28
|
if (!target) {
|
|
27
29
|
throw new TargetNotFoundError(`target "${targetName}" not found in config.targets`);
|
|
28
30
|
}
|
|
29
31
|
switch (target.adapter) {
|
|
30
32
|
case 'browser':
|
|
31
|
-
return BrowserAdapter.create({ config: target, profileDir, onLog });
|
|
33
|
+
return BrowserAdapter.create({ config: target, profileDir, onLog, timeoutMs });
|
|
32
34
|
case 'desktop':
|
|
33
35
|
// Desktop is managed-only (no attach handle), so `profileDir`/`onLog` don't apply.
|
|
36
|
+
// Nothing launches here either — `open` spawns the app, and caps itself there.
|
|
34
37
|
return DesktopAdapter.create({ config: target });
|
|
35
38
|
case 'android':
|
|
36
39
|
// Managed (boot `emulator @avd`) unless `adbSerial` attaches — `create` reads that
|
|
37
40
|
// off the config. No page profile or CDP log sink applies, so neither is threaded.
|
|
41
|
+
// The emulator boots in `open`, which is where the run budget caps it.
|
|
38
42
|
return AndroidAdapter.create({ config: target });
|
|
39
43
|
default: {
|
|
40
44
|
const unreachable = target;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../../src/adapters/factory.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAA2B,MAAM,8BAA8B,CAAC;AAEvF,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA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ACH,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared `limit` guard for adapter reads.
|
|
3
|
+
*
|
|
4
|
+
* `limit` reaches adapters straight from agent input, and `Array.slice` misreads
|
|
5
|
+
* bad values SILENTLY: `-1` drops only the last row, `NaN` yields `[]`, `1.5`
|
|
6
|
+
* rounds. A blind driver would then reason over a quietly truncated tree, so
|
|
7
|
+
* every read cap goes through here and fails loud instead.
|
|
8
|
+
*/
|
|
9
|
+
/** Cap `items` at `limit` (`undefined` = uncapped). Throws on a negative/non-integer limit. */
|
|
10
|
+
export declare function capToLimit<T>(items: T[], limit?: number): T[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared `limit` guard for adapter reads.
|
|
3
|
+
*
|
|
4
|
+
* `limit` reaches adapters straight from agent input, and `Array.slice` misreads
|
|
5
|
+
* bad values SILENTLY: `-1` drops only the last row, `NaN` yields `[]`, `1.5`
|
|
6
|
+
* rounds. A blind driver would then reason over a quietly truncated tree, so
|
|
7
|
+
* every read cap goes through here and fails loud instead.
|
|
8
|
+
*/
|
|
9
|
+
import { AdapterError } from '../errors.js';
|
|
10
|
+
/** Cap `items` at `limit` (`undefined` = uncapped). Throws on a negative/non-integer limit. */
|
|
11
|
+
export function capToLimit(items, limit) {
|
|
12
|
+
if (limit === undefined)
|
|
13
|
+
return items;
|
|
14
|
+
if (!Number.isInteger(limit) || limit < 0) {
|
|
15
|
+
throw new AdapterError('`limit` must be a non-negative integer');
|
|
16
|
+
}
|
|
17
|
+
return items.slice(0, limit);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=limit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limit.js","sourceRoot":"","sources":["../../src/adapters/limit.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,+FAA+F;AAC/F,MAAM,UAAU,UAAU,CAAI,KAAU,EAAE,KAAc;IACtD,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACtC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QAC1C,MAAM,IAAI,YAAY,CAAC,wCAAwC,CAAC,CAAC;IACnE,CAAC;IACD,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;AAC/B,CAAC"}
|
package/dist/agent/belt/act.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* - `click` → `find` + `click` (resolve the node, then click it)
|
|
11
11
|
* - `type` → `find` + `type` (resolve the field, then type into it)
|
|
12
12
|
* - `navigate` → `open` (go to a URL / window / activity)
|
|
13
|
-
* - `wait` → `waitFor` (block on a node / network idle
|
|
13
|
+
* - `wait` → `waitFor` (block on a node and/or network idle, capped by timeout)
|
|
14
14
|
* - `key` → `pressKey` (press a key / chord on the focused element)
|
|
15
15
|
* - `scroll` → `scroll` (wheel the viewport, or a `target`-scoped region)
|
|
16
16
|
*
|
|
@@ -21,11 +21,15 @@
|
|
|
21
21
|
*
|
|
22
22
|
* After the action it records one step: a line to `logs/agent.log` plus an ordered
|
|
23
23
|
* post-action frame to `screenshots/` (the replay video). Recording is not
|
|
24
|
-
* best-effort — a failed capture surfaces, never a silent fallback.
|
|
24
|
+
* best-effort — a failed capture surfaces, never a silent fallback. Every finished
|
|
25
|
+
* step lands on the run's {@link ActTrail} at act time, `ok: true` with its frame
|
|
26
|
+
* or `ok: false` with the error (then rethrown, so the driver still sees it) — the
|
|
27
|
+
* trail tells the truth about what worked AND what did not.
|
|
25
28
|
*/
|
|
26
29
|
import { z } from 'zod';
|
|
27
30
|
import type { Adapter } from '../../adapters/contract.js';
|
|
28
31
|
import type { LogChannel } from '../../session/findings-store.js';
|
|
32
|
+
import type { ActTrail } from './trail.js';
|
|
29
33
|
/** The six action verbs `act` routes to the shared contract. */
|
|
30
34
|
export declare const ACT_ACTIONS: readonly ["click", "type", "key", "scroll", "navigate", "wait"];
|
|
31
35
|
/**
|
|
@@ -69,6 +73,12 @@ export interface ActResult {
|
|
|
69
73
|
action: ActInput['action'];
|
|
70
74
|
/** Target-derived step label, e.g. `click button "Save"`. */
|
|
71
75
|
label: string;
|
|
76
|
+
/**
|
|
77
|
+
* Whether the step worked — always `true` here, since a failed act throws (and
|
|
78
|
+
* reaches the trail as `ok: false`). Told to the driver so it never has to
|
|
79
|
+
* guess whether an act landed.
|
|
80
|
+
*/
|
|
81
|
+
ok: true;
|
|
72
82
|
/** Path to the post-action screenshot saved as evidence. */
|
|
73
83
|
screenshot: string;
|
|
74
84
|
}
|
|
@@ -85,10 +95,22 @@ export interface StepRecorder {
|
|
|
85
95
|
/**
|
|
86
96
|
* Route one `act` call through the {@link Adapter}, then record the step. Pure
|
|
87
97
|
* over the contract + {@link StepRecorder} seams, so it unit-tests against fakes.
|
|
98
|
+
*
|
|
99
|
+
* The step lands on `trail` the moment it finishes — announced through
|
|
100
|
+
* {@link ActTrail.begin} first, so a `report` racing in the SAME step waits for it
|
|
101
|
+
* instead of writing a verdict that never mentions this act. Anything that throws
|
|
102
|
+
* — a missing operand, an unresolved target, a dead adapter, a failed capture — is
|
|
103
|
+
* recorded as an `ok: false` entry and then RETHROWN: the driver still sees the
|
|
104
|
+
* error (and can retry), while the evidence trail keeps the step that did not work
|
|
105
|
+
* instead of silently dropping it.
|
|
106
|
+
*/
|
|
107
|
+
export declare function runAct(adapter: Adapter, recorder: StepRecorder, input: ActInput, trail?: ActTrail): Promise<ActResult>;
|
|
108
|
+
/**
|
|
109
|
+
* Build the `act` tool bound to one adapter + recorder, for the debug agent's belt.
|
|
110
|
+
* `trail` (when wired by the loop) is the run's shared step trail, so every act —
|
|
111
|
+
* the ones that worked and the ones that threw — lands in the persisted findings.
|
|
88
112
|
*/
|
|
89
|
-
export declare function
|
|
90
|
-
/** Build the `act` tool bound to one adapter + recorder, for the debug agent's belt. */
|
|
91
|
-
export declare function createActTool(adapter: Adapter, recorder: StepRecorder): import("ai").Tool<{
|
|
113
|
+
export declare function createActTool(adapter: Adapter, recorder: StepRecorder, trail?: ActTrail): import("ai").Tool<{
|
|
92
114
|
action: "type" | "key" | "click" | "scroll" | "navigate" | "wait";
|
|
93
115
|
target?: string | undefined;
|
|
94
116
|
text?: string | undefined;
|
package/dist/agent/belt/act.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* - `click` → `find` + `click` (resolve the node, then click it)
|
|
11
11
|
* - `type` → `find` + `type` (resolve the field, then type into it)
|
|
12
12
|
* - `navigate` → `open` (go to a URL / window / activity)
|
|
13
|
-
* - `wait` → `waitFor` (block on a node / network idle
|
|
13
|
+
* - `wait` → `waitFor` (block on a node and/or network idle, capped by timeout)
|
|
14
14
|
* - `key` → `pressKey` (press a key / chord on the focused element)
|
|
15
15
|
* - `scroll` → `scroll` (wheel the viewport, or a `target`-scoped region)
|
|
16
16
|
*
|
|
@@ -21,7 +21,10 @@
|
|
|
21
21
|
*
|
|
22
22
|
* After the action it records one step: a line to `logs/agent.log` plus an ordered
|
|
23
23
|
* post-action frame to `screenshots/` (the replay video). Recording is not
|
|
24
|
-
* best-effort — a failed capture surfaces, never a silent fallback.
|
|
24
|
+
* best-effort — a failed capture surfaces, never a silent fallback. Every finished
|
|
25
|
+
* step lands on the run's {@link ActTrail} at act time, `ok: true` with its frame
|
|
26
|
+
* or `ok: false` with the error (then rethrown, so the driver still sees it) — the
|
|
27
|
+
* trail tells the truth about what worked AND what did not.
|
|
25
28
|
*/
|
|
26
29
|
import { tool } from 'ai';
|
|
27
30
|
import { z } from 'zod';
|
|
@@ -45,7 +48,7 @@ export const ActInputSchema = z.object({
|
|
|
45
48
|
target: z
|
|
46
49
|
.string()
|
|
47
50
|
.optional()
|
|
48
|
-
.describe('what to act on — CSS, role+name (button "Save"), or visible text (web); navigate: URL/window/activity; wait: selector to await; scroll: region to scroll within (optional)'),
|
|
51
|
+
.describe('what to act on — CSS, role+name (button "Save"), or visible text (web); navigate: URL/window/activity; wait: selector to await (required unless networkIdle); scroll: region to scroll within (optional)'),
|
|
49
52
|
text: z.string().optional().describe('text to type (action=type)'),
|
|
50
53
|
key: z
|
|
51
54
|
.string()
|
|
@@ -59,7 +62,7 @@ export const ActInputSchema = z.object({
|
|
|
59
62
|
networkIdle: z
|
|
60
63
|
.boolean()
|
|
61
64
|
.optional()
|
|
62
|
-
.describe('wait until in-flight requests settle (action=wait, web)'),
|
|
65
|
+
.describe('wait until in-flight requests settle (action=wait, web); needed if no target'),
|
|
63
66
|
timeout: z
|
|
64
67
|
.number()
|
|
65
68
|
.int()
|
|
@@ -80,14 +83,18 @@ function describeNode(node) {
|
|
|
80
83
|
const name = node.name.trim();
|
|
81
84
|
return name ? `${node.role} ${JSON.stringify(name)}` : node.role;
|
|
82
85
|
}
|
|
83
|
-
/**
|
|
86
|
+
/**
|
|
87
|
+
* Describe what a `wait` is blocking on, for the step label. Never empty — the belt
|
|
88
|
+
* rejects a `wait` with no condition before it gets here.
|
|
89
|
+
*/
|
|
84
90
|
function describeWait(query, networkIdle, timeout) {
|
|
85
|
-
|
|
91
|
+
return [
|
|
86
92
|
query ? JSON.stringify(query) : undefined,
|
|
87
93
|
networkIdle ? 'network idle' : undefined,
|
|
88
94
|
timeout ? `${timeout}ms` : undefined,
|
|
89
|
-
]
|
|
90
|
-
|
|
95
|
+
]
|
|
96
|
+
.filter((part) => part !== undefined)
|
|
97
|
+
.join(' + ');
|
|
91
98
|
}
|
|
92
99
|
/**
|
|
93
100
|
* Require an operand the flat schema can't enforce per-action; fail loud when
|
|
@@ -100,6 +107,19 @@ function required(value, field, action) {
|
|
|
100
107
|
}
|
|
101
108
|
return value;
|
|
102
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* Label an act from its INPUT — the fallback for a step that threw before a
|
|
112
|
+
* target-derived label existed. Never echoes `text` (typed secrets stay out of
|
|
113
|
+
* the trail, as they do out of the success label).
|
|
114
|
+
*/
|
|
115
|
+
function describeAttempt(input) {
|
|
116
|
+
const operand = input.action === 'key' ? input.key : input.action === 'scroll' ? input.direction : input.target;
|
|
117
|
+
return operand ? `${input.action} ${operand}` : input.action;
|
|
118
|
+
}
|
|
119
|
+
/** One-line error text for a failed step's `note`. */
|
|
120
|
+
function failureNote(error) {
|
|
121
|
+
return error instanceof Error ? `${error.name}: ${error.message}` : String(error);
|
|
122
|
+
}
|
|
103
123
|
/** Perform one action against the contract and return its target-derived step label. */
|
|
104
124
|
async function performAct(adapter, input) {
|
|
105
125
|
switch (input.action) {
|
|
@@ -122,6 +142,14 @@ async function performAct(adapter, input) {
|
|
|
122
142
|
return `navigate to ${target}`;
|
|
123
143
|
}
|
|
124
144
|
case 'wait': {
|
|
145
|
+
// Every adapter needs something to block on — a bare `wait` can only throw
|
|
146
|
+
// (`waitFor requires query and/or networkIdle`). Reject it HERE so the driver
|
|
147
|
+
// gets a steering message from its own tool, and the dead step lands on the
|
|
148
|
+
// trail, instead of an adapter error it has to decode. A `timeout` alone is a
|
|
149
|
+
// sleep, which the loop has no use for.
|
|
150
|
+
if (!input.target && input.networkIdle !== true) {
|
|
151
|
+
throw new AgentError("act 'wait' requires 'target' (a selector to wait for) and/or 'networkIdle': true");
|
|
152
|
+
}
|
|
125
153
|
await adapter.waitFor({
|
|
126
154
|
query: input.target,
|
|
127
155
|
networkIdle: input.networkIdle,
|
|
@@ -148,20 +176,50 @@ async function performAct(adapter, input) {
|
|
|
148
176
|
/**
|
|
149
177
|
* Route one `act` call through the {@link Adapter}, then record the step. Pure
|
|
150
178
|
* over the contract + {@link StepRecorder} seams, so it unit-tests against fakes.
|
|
179
|
+
*
|
|
180
|
+
* The step lands on `trail` the moment it finishes — announced through
|
|
181
|
+
* {@link ActTrail.begin} first, so a `report` racing in the SAME step waits for it
|
|
182
|
+
* instead of writing a verdict that never mentions this act. Anything that throws
|
|
183
|
+
* — a missing operand, an unresolved target, a dead adapter, a failed capture — is
|
|
184
|
+
* recorded as an `ok: false` entry and then RETHROWN: the driver still sees the
|
|
185
|
+
* error (and can retry), while the evidence trail keeps the step that did not work
|
|
186
|
+
* instead of silently dropping it.
|
|
151
187
|
*/
|
|
152
|
-
export async function runAct(adapter, recorder, input) {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
|
|
188
|
+
export async function runAct(adapter, recorder, input, trail) {
|
|
189
|
+
// Enter the gate BEFORE the first await, so a same-step terminal read sees this
|
|
190
|
+
// act in flight rather than an empty trail.
|
|
191
|
+
const settle = trail?.begin();
|
|
192
|
+
// Label the attempt from the input up front: a throw inside `performAct` yields
|
|
193
|
+
// no target-derived label, and an unlabelled failed step is not evidence.
|
|
194
|
+
let label = describeAttempt(input);
|
|
195
|
+
try {
|
|
196
|
+
label = await performAct(adapter, input);
|
|
197
|
+
const png = await adapter.screenshot();
|
|
198
|
+
const screenshot = await recorder.saveScreenshot(label, png);
|
|
199
|
+
await recorder.appendLog('agent', `act ${label} → ${screenshot}`);
|
|
200
|
+
trail?.record({ step: label, ok: true, screenshot });
|
|
201
|
+
return { action: input.action, label, ok: true, screenshot };
|
|
202
|
+
}
|
|
203
|
+
catch (error) {
|
|
204
|
+
trail?.record({ step: label, ok: false, note: failureNote(error) });
|
|
205
|
+
throw error;
|
|
206
|
+
}
|
|
207
|
+
finally {
|
|
208
|
+
// After the record on BOTH paths — a waiter released early would read a trail
|
|
209
|
+
// that is missing the very step it waited for.
|
|
210
|
+
settle?.();
|
|
211
|
+
}
|
|
158
212
|
}
|
|
159
|
-
/**
|
|
160
|
-
|
|
213
|
+
/**
|
|
214
|
+
* Build the `act` tool bound to one adapter + recorder, for the debug agent's belt.
|
|
215
|
+
* `trail` (when wired by the loop) is the run's shared step trail, so every act —
|
|
216
|
+
* the ones that worked and the ones that threw — lands in the persisted findings.
|
|
217
|
+
*/
|
|
218
|
+
export function createActTool(adapter, recorder, trail) {
|
|
161
219
|
return tool({
|
|
162
220
|
description: 'Drive the target with one action, chosen by action: click | type | key | scroll | navigate | wait. Resolves target via find, then routes to the adapter (click/type/open/waitFor) and records a step to agent.log plus a post-action screenshot. Use observe to read state before and after.',
|
|
163
221
|
inputSchema: ActInputSchema,
|
|
164
|
-
execute: (input) => runAct(adapter, recorder, input),
|
|
222
|
+
execute: (input) => runAct(adapter, recorder, input, trail),
|
|
165
223
|
});
|
|
166
224
|
}
|
|
167
225
|
//# sourceMappingURL=act.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"act.js","sourceRoot":"","sources":["../../../src/agent/belt/act.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"act.js","sourceRoot":"","sources":["../../../src/agent/belt/act.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAI7C,gEAAgE;AAChE,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,CAAU,CAAC;AAE3F;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,2DAA2D,CAAC;IACjG,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,0MAA0M,CAC3M;IACH,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,4BAA4B,CAAC;IAClE,GAAG,EAAE,CAAC;SACH,MAAM,EAAE;SACR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,OAAO,IAAI,CAAC;QACV,WAAW,EACT,8RAA8R;QAChS,WAAW,EAAE,cAAc;QAC3B,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC;KAC5D,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -24,8 +24,19 @@
|
|
|
24
24
|
* swallow it or silently fall back.
|
|
25
25
|
*/
|
|
26
26
|
import { z } from 'zod';
|
|
27
|
-
import type { Adapter, ConsoleEntry, NetworkEntry, Node } from '../../adapters/contract.js';
|
|
27
|
+
import type { Adapter, ConsoleEntry, NetworkEntry, Node, NodeRef } from '../../adapters/contract.js';
|
|
28
28
|
import type { EvidenceRecorder } from './look.js';
|
|
29
|
+
/**
|
|
30
|
+
* The four observable channels `kind` selects (each routes to one contract method).
|
|
31
|
+
* Exported so the prompt-vs-schema drift guard (`prompts/schema-drift.test.ts`) can
|
|
32
|
+
* assert every `kind:"…"` example the prompts teach is one the belt actually accepts.
|
|
33
|
+
*/
|
|
34
|
+
export declare const OBSERVE_KINDS: readonly ["tree", "screenshot", "console", "network"];
|
|
35
|
+
/**
|
|
36
|
+
* Selectable {@link Node} columns — the `fields` projection whitelist (contract-level).
|
|
37
|
+
* Exported for the same drift guard as {@link OBSERVE_KINDS}.
|
|
38
|
+
*/
|
|
39
|
+
export declare const NODE_FIELDS: readonly ["role", "name", "bounds", "enabled", "testid", "style"];
|
|
29
40
|
/** `observe` input — flat + SQL-like; `kind` picks the table, the rest compose the read. */
|
|
30
41
|
export declare const ObserveInputSchema: z.ZodObject<{
|
|
31
42
|
kind: z.ZodEnum<{
|
|
@@ -37,9 +48,9 @@ export declare const ObserveInputSchema: z.ZodObject<{
|
|
|
37
48
|
query: z.ZodOptional<z.ZodString>;
|
|
38
49
|
fields: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
39
50
|
name: "name";
|
|
40
|
-
role: "role";
|
|
41
51
|
bounds: "bounds";
|
|
42
52
|
enabled: "enabled";
|
|
53
|
+
role: "role";
|
|
43
54
|
testid: "testid";
|
|
44
55
|
style: "style";
|
|
45
56
|
}>>>;
|
|
@@ -48,13 +59,13 @@ export declare const ObserveInputSchema: z.ZodObject<{
|
|
|
48
59
|
within: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
49
60
|
role: z.ZodString;
|
|
50
61
|
name: z.ZodString;
|
|
51
|
-
bounds: z.ZodObject<{
|
|
62
|
+
bounds: z.ZodOptional<z.ZodObject<{
|
|
52
63
|
x: z.ZodNumber;
|
|
53
64
|
y: z.ZodNumber;
|
|
54
65
|
width: z.ZodNumber;
|
|
55
66
|
height: z.ZodNumber;
|
|
56
|
-
}, z.core.$strip
|
|
57
|
-
enabled: z.ZodBoolean
|
|
67
|
+
}, z.core.$strip>>;
|
|
68
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
58
69
|
testid: z.ZodOptional<z.ZodString>;
|
|
59
70
|
}, z.core.$strip>]>>;
|
|
60
71
|
}, z.core.$strip>;
|
|
@@ -82,13 +93,16 @@ export type ObserveResult = {
|
|
|
82
93
|
entries: NetworkEntry[];
|
|
83
94
|
};
|
|
84
95
|
/**
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
96
|
+
* Resolve `within` to something the {@link Adapter} contract takes — a selector string
|
|
97
|
+
* or a {@link Node}. Two coercions, each fixing a shape drivers actually produce:
|
|
98
|
+
*
|
|
99
|
+
* - a JSON-*stringified* node (`within: "{\"role\": …}"`). Before this it fell through
|
|
100
|
+
* as a selector, normalized to `text={"role"…}`, matched nothing, and returned an
|
|
101
|
+
* empty tree with no clue why — the single biggest step-waster observed.
|
|
102
|
+
* Garbage-that-looks-like-JSON fails loud instead of reading the whole page.
|
|
103
|
+
* - a node projected without `bounds` (`fields:["role","name"]`) → {@link scopeOf}.
|
|
90
104
|
*/
|
|
91
|
-
export declare function coerceWithin(within: ObserveInput['within']):
|
|
105
|
+
export declare function coerceWithin(within: ObserveInput['within']): NodeRef | undefined;
|
|
92
106
|
/**
|
|
93
107
|
* Route one `observe` call to the adapter and shape the result. Pure over the
|
|
94
108
|
* {@link Adapter} + {@link EvidenceRecorder} seams (no `tool()` wrapper), so it
|
|
@@ -99,19 +113,19 @@ export declare function runObserve(adapter: Adapter, recorder: EvidenceRecorder,
|
|
|
99
113
|
export declare function createObserveTool(adapter: Adapter, recorder: EvidenceRecorder): import("ai").Tool<{
|
|
100
114
|
kind: "screenshot" | "console" | "network" | "tree";
|
|
101
115
|
query?: string | undefined;
|
|
102
|
-
fields?: ("name" | "
|
|
116
|
+
fields?: ("name" | "bounds" | "enabled" | "role" | "testid" | "style")[] | undefined;
|
|
103
117
|
filters?: Record<string, string | number | boolean | string[]> | undefined;
|
|
104
118
|
limit?: number | undefined;
|
|
105
119
|
within?: string | {
|
|
106
120
|
role: string;
|
|
107
121
|
name: string;
|
|
108
|
-
bounds
|
|
122
|
+
bounds?: {
|
|
109
123
|
x: number;
|
|
110
124
|
y: number;
|
|
111
125
|
width: number;
|
|
112
126
|
height: number;
|
|
113
|
-
};
|
|
114
|
-
enabled
|
|
127
|
+
} | undefined;
|
|
128
|
+
enabled?: boolean | undefined;
|
|
115
129
|
testid?: string | undefined;
|
|
116
130
|
} | undefined;
|
|
117
131
|
}, ObserveResult>;
|